diff options
Diffstat (limited to 'meta-networking/recipes-protocols/quagga/files')
18 files changed, 620 insertions, 0 deletions
diff --git a/meta-networking/recipes-protocols/quagga/files/Zebra-sync-zebra-routing-table-with-the-kernel-one.patch b/meta-networking/recipes-protocols/quagga/files/Zebra-sync-zebra-routing-table-with-the-kernel-one.patch new file mode 100644 index 000000000..35f4637d8 --- /dev/null +++ b/meta-networking/recipes-protocols/quagga/files/Zebra-sync-zebra-routing-table-with-the-kernel-one.patch | |||
@@ -0,0 +1,48 @@ | |||
1 | sync zebra routing table with the kernel one when interface is down | ||
2 | |||
3 | Add router to kernel main router table with "ip", then you can see | ||
4 | a router item in kernel main router table. Also can see this router | ||
5 | item in zebra router table. If down the interface, this router item | ||
6 | will be deleted from kernel main router table, but it will not be | ||
7 | deleted from zebra router table, just set as inactive. | ||
8 | |||
9 | This patch is adopted from [1]. | ||
10 | [1] http://www.gossamer-threads.com/lists/quagga/dev/22609 | ||
11 | |||
12 | Upstream-Status: Pending | ||
13 | |||
14 | Signed-of-by: Aws Ismail <aws.ismail@windriver.com> | ||
15 | Signed-of-by: Roy.Li <rongqing.li@windriver.com> | ||
16 | |||
17 | --- | ||
18 | zebra/zebra_rib.c | 7 +++++++ | ||
19 | 1 files changed, 7 insertions(+), 0 deletions(-) | ||
20 | |||
21 | diff --git a/zebra/zebra_rib.c b/zebra/zebra_rib.c | ||
22 | index 154e8d5..63434d0 100644 | ||
23 | --- a/zebra/zebra_rib.c | ||
24 | +++ b/zebra/zebra_rib.c | ||
25 | @@ -765,6 +765,9 @@ rib_match_ipv6 (struct in6_addr *addr) | ||
26 | #define RIB_SYSTEM_ROUTE(R) \ | ||
27 | ((R)->type == ZEBRA_ROUTE_KERNEL || (R)->type == ZEBRA_ROUTE_CONNECT) | ||
28 | |||
29 | +#define RIB_KERNEL_ROUTE(R) \ | ||
30 | + ((R)->type == ZEBRA_ROUTE_KERNEL) | ||
31 | + | ||
32 | /* This function verifies reachability of one given nexthop, which can be | ||
33 | * numbered or unnumbered, IPv4 or IPv6. The result is unconditionally stored | ||
34 | * in nexthop->flags field. If the 4th parameter, 'set', is non-zero, | ||
35 | @@ -1135,6 +1138,10 @@ rib_process (struct route_node *rn) | ||
36 | redistribute_delete (&rn->p, fib); | ||
37 | if (! RIB_SYSTEM_ROUTE (fib)) | ||
38 | rib_uninstall_kernel (rn, fib); | ||
39 | +#ifdef GNU_LINUX | ||
40 | + else if(RIB_KERNEL_ROUTE (fib) && !if_is_up(if_lookup_by_index(fib->nexthop->ifindex))) | ||
41 | + del=fib; | ||
42 | +#endif | ||
43 | UNSET_FLAG (fib->flags, ZEBRA_FLAG_SELECTED); | ||
44 | |||
45 | /* Set real nexthop. */ | ||
46 | -- | ||
47 | 1.7.4.1 | ||
48 | |||
diff --git a/meta-networking/recipes-protocols/quagga/files/babel-close-the-stdout-stderr-as-in-other-daemons.patch b/meta-networking/recipes-protocols/quagga/files/babel-close-the-stdout-stderr-as-in-other-daemons.patch new file mode 100644 index 000000000..c2757a2fb --- /dev/null +++ b/meta-networking/recipes-protocols/quagga/files/babel-close-the-stdout-stderr-as-in-other-daemons.patch | |||
@@ -0,0 +1,50 @@ | |||
1 | From ba71f768e6dbb1f2ac72ed3bd880bff75a48d345 Mon Sep 17 00:00:00 2001 | ||
2 | From: Roy Li <rongqing.li@windriver.com> | ||
3 | Date: Wed, 19 Feb 2014 14:13:40 +0800 | ||
4 | Subject: [PATCH] babeld: close stdout once the background daemon is created | ||
5 | |||
6 | Upstream-Status: pending | ||
7 | |||
8 | Once babald becomes a background daemon, it should not output information to | ||
9 | stdout, so need to close stdout. | ||
10 | |||
11 | In fact, other daemons close their stdout when they run into background, like | ||
12 | ospfd, isisd and bgpd, by calling daemon() which is in lib/daemon.c | ||
13 | |||
14 | Closing the stdout can fix a tee hang issue { #/usr/sbin/babeld -d |tee tmp } | ||
15 | |||
16 | Signed-off-by: Roy Li <rongqing.li@windriver.com> | ||
17 | --- | ||
18 | babeld/util.c | 10 +++++++++- | ||
19 | 1 file changed, 9 insertions(+), 1 deletion(-) | ||
20 | |||
21 | diff --git a/babeld/util.c b/babeld/util.c | ||
22 | index 011f382..76203bc 100644 | ||
23 | --- a/babeld/util.c | ||
24 | +++ b/babeld/util.c | ||
25 | @@ -425,7 +425,7 @@ uchar_to_in6addr(struct in6_addr *dest, const unsigned char *src) | ||
26 | int | ||
27 | daemonise() | ||
28 | { | ||
29 | - int rc; | ||
30 | + int rc, fd; | ||
31 | |||
32 | fflush(stdout); | ||
33 | fflush(stderr); | ||
34 | @@ -441,5 +441,13 @@ daemonise() | ||
35 | if(rc < 0) | ||
36 | return -1; | ||
37 | |||
38 | + fd = open("/dev/null", O_RDWR, 0); | ||
39 | + if (fd != -1) | ||
40 | + { | ||
41 | + dup2(fd, STDOUT_FILENO); | ||
42 | + if (fd > 2) | ||
43 | + close(fd); | ||
44 | + } | ||
45 | + | ||
46 | return 1; | ||
47 | } | ||
48 | -- | ||
49 | 1.7.10.4 | ||
50 | |||
diff --git a/meta-networking/recipes-protocols/quagga/files/babeld.service b/meta-networking/recipes-protocols/quagga/files/babeld.service new file mode 100644 index 000000000..dd344b0b3 --- /dev/null +++ b/meta-networking/recipes-protocols/quagga/files/babeld.service | |||
@@ -0,0 +1,14 @@ | |||
1 | [Unit] | ||
2 | Description=Babel routing daemon | ||
3 | BindTo=zebra.service | ||
4 | After=zebra.service | ||
5 | ConditionPathExists=@SYSCONFDIR@/quagga/babeld.conf | ||
6 | |||
7 | [Service] | ||
8 | Type=forking | ||
9 | EnvironmentFile=-@SYSCONFDIR@/default/quagga | ||
10 | ExecStart=@SBINDIR@/babeld -d $babeld_options -f /etc/quagga/babeld.conf | ||
11 | Restart=on-abort | ||
12 | |||
13 | [Install] | ||
14 | WantedBy=multi-user.target | ||
diff --git a/meta-networking/recipes-protocols/quagga/files/bgpd.service b/meta-networking/recipes-protocols/quagga/files/bgpd.service new file mode 100644 index 000000000..164c81724 --- /dev/null +++ b/meta-networking/recipes-protocols/quagga/files/bgpd.service | |||
@@ -0,0 +1,14 @@ | |||
1 | [Unit] | ||
2 | Description=BGP routing daemon | ||
3 | BindTo=zebra.service | ||
4 | After=zebra.service | ||
5 | ConditionPathExists=@SYSCONFDIR@/quagga/bgpd.conf | ||
6 | |||
7 | [Service] | ||
8 | Type=forking | ||
9 | EnvironmentFile=-@SYSCONFDIR@/default/quagga | ||
10 | ExecStart=@SBINDIR@/bgpd -d $bgpd_options -f /etc/quagga/bgpd.conf | ||
11 | Restart=on-abort | ||
12 | |||
13 | [Install] | ||
14 | WantedBy=multi-user.target | ||
diff --git a/meta-networking/recipes-protocols/quagga/files/isisd.service b/meta-networking/recipes-protocols/quagga/files/isisd.service new file mode 100644 index 000000000..9bfe7b65e --- /dev/null +++ b/meta-networking/recipes-protocols/quagga/files/isisd.service | |||
@@ -0,0 +1,14 @@ | |||
1 | [Unit] | ||
2 | Description=IS-IS routing daemon | ||
3 | BindTo=zebra.service | ||
4 | After=zebra.service | ||
5 | ConditionPathExists=@SYSCONFDIR@/quagga/isisd.conf | ||
6 | |||
7 | [Service] | ||
8 | Type=forking | ||
9 | EnvironmentFile=-@SYSCONFDIR@/default/quagga | ||
10 | ExecStart=@SBINDIR@/isisd -d $isisd_options -f /etc/quagga/isisd.conf | ||
11 | Restart=on-abort | ||
12 | |||
13 | [Install] | ||
14 | WantedBy=multi-user.target | ||
diff --git a/meta-networking/recipes-protocols/quagga/files/ospf6d.service b/meta-networking/recipes-protocols/quagga/files/ospf6d.service new file mode 100644 index 000000000..4b8ebf802 --- /dev/null +++ b/meta-networking/recipes-protocols/quagga/files/ospf6d.service | |||
@@ -0,0 +1,14 @@ | |||
1 | [Unit] | ||
2 | Description=OSPF routing daemon for IPv6 | ||
3 | BindTo=zebra.service | ||
4 | After=zebra.service | ||
5 | ConditionPathExists=@SYSCONFDIR@/quagga/ospf6d.conf | ||
6 | |||
7 | [Service] | ||
8 | Type=forking | ||
9 | EnvironmentFile=-@SYSCONFDIR@/default/quagga | ||
10 | ExecStart=@SBINDIR@/ospf6d -d $ospf6d_options -f /etc/quagga/ospf6d.conf | ||
11 | Restart=on-abort | ||
12 | |||
13 | [Install] | ||
14 | WantedBy=multi-user.target | ||
diff --git a/meta-networking/recipes-protocols/quagga/files/ospfd.service b/meta-networking/recipes-protocols/quagga/files/ospfd.service new file mode 100644 index 000000000..f9f5031b4 --- /dev/null +++ b/meta-networking/recipes-protocols/quagga/files/ospfd.service | |||
@@ -0,0 +1,14 @@ | |||
1 | [Unit] | ||
2 | Description=OSPF routing daemon | ||
3 | BindTo=zebra.service | ||
4 | After=zebra.service | ||
5 | ConditionPathExists=@SYSCONFDIR@/quagga/ospfd.conf | ||
6 | |||
7 | [Service] | ||
8 | Type=forking | ||
9 | EnvironmentFile=-@SYSCONFDIR@/default/quagga | ||
10 | ExecStart=@SBINDIR@/ospfd -d $ospfd_options -f /etc/quagga/ospfd.conf | ||
11 | Restart=on-abort | ||
12 | |||
13 | [Install] | ||
14 | WantedBy=multi-user.target | ||
diff --git a/meta-networking/recipes-protocols/quagga/files/quagga-Avoid-duplicate-connected-address.patch b/meta-networking/recipes-protocols/quagga/files/quagga-Avoid-duplicate-connected-address.patch new file mode 100644 index 000000000..a07e33f9f --- /dev/null +++ b/meta-networking/recipes-protocols/quagga/files/quagga-Avoid-duplicate-connected-address.patch | |||
@@ -0,0 +1,54 @@ | |||
1 | quagga: Avoid duplicate connected address adding to the list | ||
2 | |||
3 | commit 27ba970b9("quagga/ripd: Fix two bugs after received SIGHUP signal") | ||
4 | introduces an regression: ifp->connected list is cleaned up when ripd is | ||
5 | restarting, however, for interface addresses which are not specified in | ||
6 | ripd configuration file, they are never to be added into ifp->connected | ||
7 | again, this will lead to some abnormal behavior for route advertising. | ||
8 | |||
9 | Instead of cleaning up the ifp->connected list to avoid duplicated | ||
10 | connected address being added into this list, we can check this | ||
11 | condition during interface address adding process and return early | ||
12 | when an identical address has already been added. | ||
13 | |||
14 | Upstream-Status: Pending | ||
15 | |||
16 | Signed-off-by: Hu Yadi <Yadi.hu@windriver.com> | ||
17 | Signed-off-by: Xufeng Zhang <xufeng.zhang@windriver.com> | ||
18 | Signed-off-by: Joe MacDonald <joe@deserted.net> | ||
19 | --- | ||
20 | --- a/lib/if.c | ||
21 | +++ b/lib/if.c | ||
22 | @@ -738,6 +738,16 @@ connected_add_by_prefix (struct interfac | ||
23 | struct prefix *destination) | ||
24 | { | ||
25 | struct connected *ifc; | ||
26 | + struct listnode *cnode; | ||
27 | + struct connected *c; | ||
28 | + int ret = 0; | ||
29 | + | ||
30 | + for (ALL_LIST_ELEMENTS_RO (ifp->connected, cnode, c)) | ||
31 | + { | ||
32 | + ret = connected_same_prefix (p, (c->address)); | ||
33 | + if(ret == 1) | ||
34 | + return NULL; | ||
35 | + } | ||
36 | |||
37 | /* Allocate new connected address. */ | ||
38 | ifc = connected_new (); | ||
39 | --- a/ripd/rip_interface.c | ||
40 | +++ b/ripd/rip_interface.c | ||
41 | @@ -516,13 +516,6 @@ rip_interface_clean (void) | ||
42 | thread_cancel (ri->t_wakeup); | ||
43 | ri->t_wakeup = NULL; | ||
44 | } | ||
45 | - | ||
46 | - for (conn_node = listhead (ifp->connected); conn_node; conn_node = next) | ||
47 | - { | ||
48 | - ifc = listgetdata (conn_node); | ||
49 | - next = conn_node->next; | ||
50 | - listnode_delete (ifp->connected, ifc); | ||
51 | - } | ||
52 | } | ||
53 | } | ||
54 | |||
diff --git a/meta-networking/recipes-protocols/quagga/files/quagga.default b/meta-networking/recipes-protocols/quagga/files/quagga.default new file mode 100644 index 000000000..0c1ce6c04 --- /dev/null +++ b/meta-networking/recipes-protocols/quagga/files/quagga.default | |||
@@ -0,0 +1,13 @@ | |||
1 | # If this option is set the /etc/init.d/quagga script automatically loads | ||
2 | # the config via "vtysh -b" when the servers are started. | ||
3 | vtysh_enable=yes | ||
4 | |||
5 | # Bind all daemons to loopback only by default | ||
6 | zebra_options=" --daemon -A 127.0.0.1" | ||
7 | babeld_options="--daemon -A 127.0.0.1" | ||
8 | bgpd_options=" --daemon -A 127.0.0.1" | ||
9 | ospfd_options=" --daemon -A 127.0.0.1" | ||
10 | ospf6d_options="--daemon -A ::1" | ||
11 | ripd_options=" --daemon -A 127.0.0.1" | ||
12 | ripngd_options="--daemon -A ::1" | ||
13 | isisd_options=" --daemon -A 127.0.0.1" | ||
diff --git a/meta-networking/recipes-protocols/quagga/files/quagga.init b/meta-networking/recipes-protocols/quagga/files/quagga.init new file mode 100644 index 000000000..60b5ab01a --- /dev/null +++ b/meta-networking/recipes-protocols/quagga/files/quagga.init | |||
@@ -0,0 +1,200 @@ | |||
1 | #!/bin/sh | ||
2 | # | ||
3 | # /etc/init.d/quagga -- start/stop the Quagga routing daemons | ||
4 | # | ||
5 | # Based on debian version by Endre Hirling <endre@mail.elte.hu> and | ||
6 | # Christian Hammers <ch@debian.org>. | ||
7 | # | ||
8 | |||
9 | ### BEGIN INIT INFO | ||
10 | # Provides: quagga | ||
11 | # Required-Start: $local_fs $network $remote_fs $syslog | ||
12 | # Required-Stop: $local_fs $network $remote_fs $syslog | ||
13 | # Default-Start: 2 3 4 5 | ||
14 | # Default-Stop: 0 1 6 | ||
15 | # Short-Description: start and stop the Quagga routing suite | ||
16 | # Description: Quagga is a routing suite for IP routing protocols like | ||
17 | # BGP, OSPF, RIP and others. This script contols the main | ||
18 | # daemon "quagga" as well as the individual protocol daemons. | ||
19 | ### END INIT INFO | ||
20 | |||
21 | # NOTE: sbin must be before bin so we get the iproute2 ip and not the | ||
22 | # busybox ip command. The busybox one flushes all routes instead of just | ||
23 | # the dynamic routes | ||
24 | PATH=/sbin:/usr/sbin:/bin:/usr/bin:/sbin | ||
25 | D_PATH=/usr/sbin | ||
26 | C_PATH=/etc/quagga | ||
27 | |||
28 | # Keep zebra first and do not list watchquagga! | ||
29 | DAEMONS="zebra bgpd ripd ripngd ospfd ospf6d isisd babeld" | ||
30 | |||
31 | # Print the name of the pidfile. | ||
32 | pidfile() | ||
33 | { | ||
34 | echo "/var/run/quagga/$1.pid" | ||
35 | } | ||
36 | |||
37 | # Check if daemon is started by using the pidfile. | ||
38 | started() | ||
39 | { | ||
40 | [ -e `pidfile $1` ] && kill -0 `cat \`pidfile $1\`` 2> /dev/null && return 0 | ||
41 | return 1 | ||
42 | } | ||
43 | |||
44 | # Loads the config via vtysh -b if configured to do so. | ||
45 | vtysh_b () | ||
46 | { | ||
47 | # Rember, that all variables have been incremented by 1 in convert_daemon_prios() | ||
48 | if [ "$vtysh_enable" = 2 -a -f $C_PATH/Quagga.conf ]; then | ||
49 | /usr/bin/vtysh -b | ||
50 | fi | ||
51 | } | ||
52 | |||
53 | # Check if the daemon is activated and if its executable and config files | ||
54 | # are in place. | ||
55 | # params: daemon name | ||
56 | # returns: 0=ok, 1=error | ||
57 | check_daemon() | ||
58 | { | ||
59 | # If the integrated config file is used the others are not checked. | ||
60 | if [ -r "$C_PATH/Quagga.conf" ]; then | ||
61 | return 0 | ||
62 | fi | ||
63 | |||
64 | # check for config file | ||
65 | if [ ! -r "$C_PATH/$1.conf" ]; then | ||
66 | return 1 | ||
67 | fi | ||
68 | return 0 | ||
69 | } | ||
70 | |||
71 | # Starts the server if it's not alrady running according to the pid file. | ||
72 | # The Quagga daemons creates the pidfile when starting. | ||
73 | start() | ||
74 | { | ||
75 | if ! check_daemon $1; then echo -n " (!$1)"; return; fi | ||
76 | echo -n " $1" | ||
77 | start-stop-daemon \ | ||
78 | --start \ | ||
79 | --pidfile=`pidfile $1` \ | ||
80 | --exec "$D_PATH/$1" \ | ||
81 | -- \ | ||
82 | `eval echo "$""$1""_options"` | ||
83 | |||
84 | } | ||
85 | |||
86 | # Stop the daemon given in the parameter, printing its name to the terminal. | ||
87 | stop() | ||
88 | { | ||
89 | if ! started "$1" ; then | ||
90 | echo -n " (!$1)" | ||
91 | return 0 | ||
92 | else | ||
93 | PIDFILE=`pidfile $1` | ||
94 | PID=`cat $PIDFILE 2>/dev/null` | ||
95 | start-stop-daemon --stop --quiet --exec "$D_PATH/$1" | ||
96 | # | ||
97 | # Now we have to wait until $DAEMON has _really_ stopped. | ||
98 | # | ||
99 | if test -n "$PID" && kill -0 $PID 2>/dev/null; then | ||
100 | echo -n " (waiting) ." | ||
101 | cnt=0 | ||
102 | while kill -0 $PID 2>/dev/null; do | ||
103 | cnt=`expr $cnt + 1` | ||
104 | if [ $cnt -gt 60 ]; then | ||
105 | # Waited 120 secs now, fail. | ||
106 | echo -n "Failed.. " | ||
107 | break | ||
108 | fi | ||
109 | sleep 2 | ||
110 | echo -n "." | ||
111 | done | ||
112 | fi | ||
113 | echo -n " $1" | ||
114 | rm -f `pidfile $1` | ||
115 | fi | ||
116 | } | ||
117 | |||
118 | stop_all() | ||
119 | { | ||
120 | local daemon_list | ||
121 | daemon_list=${1:-$DAEMONS} | ||
122 | |||
123 | echo -n "Stopping Quagga daemons:" | ||
124 | for daemon_name in $daemon_list; do | ||
125 | stop "$daemon_name" | ||
126 | done | ||
127 | echo "." | ||
128 | } | ||
129 | |||
130 | start_all() | ||
131 | { | ||
132 | local daemon_list | ||
133 | daemon_list=${1:-$DAEMONS} | ||
134 | |||
135 | echo -n "Starting Quagga daemons:" | ||
136 | for daemon_name in $daemon_list; do | ||
137 | start "$daemon_name" | ||
138 | done | ||
139 | echo "." | ||
140 | } | ||
141 | |||
142 | status_all() | ||
143 | { | ||
144 | local daemon_list | ||
145 | daemon_list=${1:-$DAEMONS} | ||
146 | res=1 | ||
147 | |||
148 | echo -n "quagga: " | ||
149 | for daemon_name in $daemon_list; do | ||
150 | if started "$daemon_name" ; then | ||
151 | id=`cat \`pidfile $daemon_name\`` | ||
152 | echo -n "$daemon_name (pid $id) " | ||
153 | res=0 | ||
154 | fi | ||
155 | done | ||
156 | if [ $res -eq 0 ]; then | ||
157 | echo "is running..." | ||
158 | else | ||
159 | echo "is stopped..." | ||
160 | fi | ||
161 | exit $res | ||
162 | } | ||
163 | |||
164 | ######################################################### | ||
165 | # Main program # | ||
166 | ######################################################### | ||
167 | |||
168 | # Load configuration | ||
169 | test -f /etc/default/quagga && . /etc/default/quagga | ||
170 | |||
171 | case "$1" in | ||
172 | start) | ||
173 | cd $C_PATH/ | ||
174 | start_all $2 | ||
175 | vtysh_b | ||
176 | ;; | ||
177 | |||
178 | stop) | ||
179 | stop_all $2 | ||
180 | echo "Removing all routes made by zebra." | ||
181 | ip route flush proto zebra | ||
182 | ;; | ||
183 | |||
184 | status) | ||
185 | status_all $2 | ||
186 | ;; | ||
187 | |||
188 | restart|force-reload) | ||
189 | $0 stop $2 | ||
190 | sleep 1 | ||
191 | $0 start $2 | ||
192 | ;; | ||
193 | |||
194 | *) | ||
195 | echo "Usage: /etc/init.d/quagga {start|stop|restart|status|force-reload} [daemon]" | ||
196 | exit 1 | ||
197 | ;; | ||
198 | esac | ||
199 | |||
200 | exit 0 | ||
diff --git a/meta-networking/recipes-protocols/quagga/files/quagga.pam b/meta-networking/recipes-protocols/quagga/files/quagga.pam new file mode 100644 index 000000000..3541a975a --- /dev/null +++ b/meta-networking/recipes-protocols/quagga/files/quagga.pam | |||
@@ -0,0 +1,13 @@ | |||
1 | # | ||
2 | # The PAM configuration file for the quagga `vtysh' service | ||
3 | # | ||
4 | |||
5 | # This allows root to change user infomation without being | ||
6 | # prompted for a password | ||
7 | auth sufficient pam_rootok.so | ||
8 | |||
9 | # The standard Unix authentication modules, used with | ||
10 | # NIS (man nsswitch) as well as normal /etc/passwd and | ||
11 | # /etc/shadow entries. | ||
12 | auth include common-auth | ||
13 | |||
diff --git a/meta-networking/recipes-protocols/quagga/files/ripd-fix-two-bugs-after-received-SIGHUP.patch b/meta-networking/recipes-protocols/quagga/files/ripd-fix-two-bugs-after-received-SIGHUP.patch new file mode 100644 index 000000000..4b8c9a929 --- /dev/null +++ b/meta-networking/recipes-protocols/quagga/files/ripd-fix-two-bugs-after-received-SIGHUP.patch | |||
@@ -0,0 +1,50 @@ | |||
1 | ripd: Fix two bugs after received SIGHUP signal | ||
2 | |||
3 | There are two problems for ripd implementation after received | ||
4 | SIGHUP signal: | ||
5 | 1). ripd didn't clean up ifp->connected list before reload | ||
6 | configuration file. | ||
7 | 2). ripd reset ri->split_horizon flag to RIP_NO_SPLIT_HORIZON | ||
8 | which lead to the unnecessary route to be advertised. | ||
9 | |||
10 | Upstream-Status: Submitted [http://patchwork.diac24.net/patch/604/] | ||
11 | |||
12 | Signed-off-by: Xufeng Zhang <xufeng.zhang@windriver.com> | ||
13 | Signed-off-by: Joe MacDonald <joe@deserted.net> | ||
14 | --- | ||
15 | --- a/ripd/rip_interface.c | ||
16 | +++ b/ripd/rip_interface.c | ||
17 | @@ -500,6 +500,8 @@ | ||
18 | struct listnode *node; | ||
19 | struct interface *ifp; | ||
20 | struct rip_interface *ri; | ||
21 | + struct connected *ifc; | ||
22 | + struct listnode *conn_node, *next; | ||
23 | |||
24 | for (ALL_LIST_ELEMENTS_RO (iflist, node, ifp)) | ||
25 | { | ||
26 | @@ -514,6 +516,13 @@ | ||
27 | thread_cancel (ri->t_wakeup); | ||
28 | ri->t_wakeup = NULL; | ||
29 | } | ||
30 | + | ||
31 | + for (conn_node = listhead (ifp->connected); conn_node; conn_node = next) | ||
32 | + { | ||
33 | + ifc = listgetdata (conn_node); | ||
34 | + next = conn_node->next; | ||
35 | + listnode_delete (ifp->connected, ifc); | ||
36 | + } | ||
37 | } | ||
38 | } | ||
39 | |||
40 | @@ -548,8 +557,8 @@ | ||
41 | ri->key_chain = NULL; | ||
42 | } | ||
43 | |||
44 | - ri->split_horizon = RIP_NO_SPLIT_HORIZON; | ||
45 | - ri->split_horizon_default = RIP_NO_SPLIT_HORIZON; | ||
46 | + ri->split_horizon = RIP_SPLIT_HORIZON; | ||
47 | + ri->split_horizon_default = RIP_SPLIT_HORIZON; | ||
48 | |||
49 | ri->list[RIP_FILTER_IN] = NULL; | ||
50 | ri->list[RIP_FILTER_OUT] = NULL; | ||
diff --git a/meta-networking/recipes-protocols/quagga/files/ripd.service b/meta-networking/recipes-protocols/quagga/files/ripd.service new file mode 100644 index 000000000..5dfd28b3a --- /dev/null +++ b/meta-networking/recipes-protocols/quagga/files/ripd.service | |||
@@ -0,0 +1,14 @@ | |||
1 | [Unit] | ||
2 | Description=RIP routing daemon | ||
3 | BindTo=zebra.service | ||
4 | After=zebra.service | ||
5 | ConditionPathExists=@SYSCONFDIR@/quagga/ripd.conf | ||
6 | |||
7 | [Service] | ||
8 | Type=forking | ||
9 | EnvironmentFile=-@SYSCONFDIR@/default/quagga | ||
10 | ExecStart=@SBINDIR@/ripd -d $ripd_options -f /etc/quagga/ripd.conf | ||
11 | Restart=on-abort | ||
12 | |||
13 | [Install] | ||
14 | WantedBy=multi-user.target | ||
diff --git a/meta-networking/recipes-protocols/quagga/files/ripngd.service b/meta-networking/recipes-protocols/quagga/files/ripngd.service new file mode 100644 index 000000000..936b81fb9 --- /dev/null +++ b/meta-networking/recipes-protocols/quagga/files/ripngd.service | |||
@@ -0,0 +1,14 @@ | |||
1 | i[Unit] | ||
2 | Description=RIP routing daemon for IPv6 | ||
3 | BindTo=zebra.service | ||
4 | After=zebra.service | ||
5 | ConditionPathExists=@SYSCONFDIR@/quagga/ripngd.conf | ||
6 | |||
7 | [Service] | ||
8 | Type=forking | ||
9 | EnvironmentFile=-@SYSCONFDIR@/default/quagga | ||
10 | ExecStart=@SBINDIR@/ripngd -d $ripngd_options -f /etc/quagga/ripngd.conf | ||
11 | Restart=on-abort | ||
12 | |||
13 | [Install] | ||
14 | WantedBy=multi-user.target | ||
diff --git a/meta-networking/recipes-protocols/quagga/files/volatiles.03_quagga b/meta-networking/recipes-protocols/quagga/files/volatiles.03_quagga new file mode 100644 index 000000000..1f28c0b24 --- /dev/null +++ b/meta-networking/recipes-protocols/quagga/files/volatiles.03_quagga | |||
@@ -0,0 +1,3 @@ | |||
1 | # <type> <owner> <group> <mode> <path> <linksource> | ||
2 | d quagga quagga 0755 /var/run/quagga none | ||
3 | d quagga quagga 0755 /var/log/quagga none | ||
diff --git a/meta-networking/recipes-protocols/quagga/files/watchquagga.default b/meta-networking/recipes-protocols/quagga/files/watchquagga.default new file mode 100644 index 000000000..2d601ec97 --- /dev/null +++ b/meta-networking/recipes-protocols/quagga/files/watchquagga.default | |||
@@ -0,0 +1,12 @@ | |||
1 | # Watchquagga configuration | ||
2 | #watch_daemons="zebra bgpd ospfd ospf6d ripd ripngd" | ||
3 | watch_daemons="zebra" | ||
4 | |||
5 | # To enable restarts when multiple daemons are being used, uncomment this line (but first be sure to edit | ||
6 | # the WATCH_DAEMONS line to reflect the daemons you are actually using): | ||
7 | #watch_options="-Az -b_ -r/etc/init.d/quagga_restart_%s -s/etc/init.d/quagga_start_%s -k/etc/init.d/quagga_stop_%s" | ||
8 | |||
9 | # Since we are using one quagga daemon for now, use the following line. If using | ||
10 | # multiple daemons, comment the line below and uncoment the line mentioned | ||
11 | # above. | ||
12 | watch_options="-z -b_ -r/etc/init.d/quagga_restart_%s" | ||
diff --git a/meta-networking/recipes-protocols/quagga/files/watchquagga.init b/meta-networking/recipes-protocols/quagga/files/watchquagga.init new file mode 100644 index 000000000..5ddd94a3d --- /dev/null +++ b/meta-networking/recipes-protocols/quagga/files/watchquagga.init | |||
@@ -0,0 +1,64 @@ | |||
1 | #!/bin/sh | ||
2 | # | ||
3 | ### BEGIN INIT INFO | ||
4 | # Provides: watchquagga | ||
5 | # Required-Start: $local_fs $network $remote_fs $syslog | ||
6 | # Required-Stop: $local_fs $network $remote_fs $syslog | ||
7 | # Default-Start: 2 3 4 5 | ||
8 | # Default-Stop: 0 1 6 | ||
9 | # Short-Description: start and stop the Quagga watchdog | ||
10 | ### END INIT INFO | ||
11 | |||
12 | PATH=/bin:/usr/bin:/sbin:/usr/sbin | ||
13 | |||
14 | # Load configuration | ||
15 | test -f /etc/default/watchquagga && . /etc/default/watchquagga | ||
16 | |||
17 | # Check that there are daemons to be monitored. | ||
18 | [ -z "$watch_daemons" ] && exit 0 | ||
19 | |||
20 | pidfile="/var/run/quagga/watchquagga.pid" | ||
21 | |||
22 | case "$1" in | ||
23 | start) | ||
24 | echo -n "Starting quagga watchdog daemon: watchquagga" | ||
25 | start-stop-daemon --start \ | ||
26 | --pidfile $pidfile \ | ||
27 | --exec /usr/sbin/watchquagga \ | ||
28 | -- -d $watch_options $watch_daemons | ||
29 | echo "." | ||
30 | ;; | ||
31 | |||
32 | stop) | ||
33 | echo -n "Stopping quagga watchdog daemon: watchquagga" | ||
34 | start-stop-daemon --stop --quiet \ | ||
35 | --pidfile $pidfile | ||
36 | echo "." | ||
37 | ;; | ||
38 | |||
39 | status) | ||
40 | echo -n "watchquagga " | ||
41 | res=1 | ||
42 | [ -e $pidfile ] && kill -0 `cat $pidfile` 2> /dev/null | ||
43 | if [ $? -eq 0 ]; then | ||
44 | echo "(pid `cat $pidfile`) is running..." | ||
45 | res=0 | ||
46 | else | ||
47 | echo "is stopped..." | ||
48 | fi | ||
49 | exit $res | ||
50 | ;; | ||
51 | |||
52 | restart|force-reload) | ||
53 | $0 stop $2 | ||
54 | sleep 1 | ||
55 | $0 start $2 | ||
56 | ;; | ||
57 | |||
58 | *) | ||
59 | echo "Usage: /etc/init.d/watchquagga {start|stop|restart|force-reload}" | ||
60 | exit 1 | ||
61 | ;; | ||
62 | esac | ||
63 | |||
64 | exit 0 | ||
diff --git a/meta-networking/recipes-protocols/quagga/files/zebra.service b/meta-networking/recipes-protocols/quagga/files/zebra.service new file mode 100644 index 000000000..afdd9e52d --- /dev/null +++ b/meta-networking/recipes-protocols/quagga/files/zebra.service | |||
@@ -0,0 +1,15 @@ | |||
1 | [Unit] | ||
2 | Description=GNU Zebra routing manager | ||
3 | Wants=network.target | ||
4 | Before=network.target | ||
5 | ConditionPathExists=@SYSCONFDIR@/quagga/zebra.conf | ||
6 | |||
7 | [Service] | ||
8 | Type=forking | ||
9 | EnvironmentFile=-@SYSCONFDIR@/default/quagga | ||
10 | ExecStartPre=@BASE_SBINDIR@/ip route flush proto zebra | ||
11 | ExecStart=@SBINDIR@/zebra -d $zebra_options -f /etc/quagga/zebra.conf | ||
12 | Restart=on-abort | ||
13 | |||
14 | [Install] | ||
15 | WantedBy=multi-user.target | ||