summaryrefslogtreecommitdiffstats
path: root/meta-networking/recipes-protocols/quagga
diff options
context:
space:
mode:
Diffstat (limited to 'meta-networking/recipes-protocols/quagga')
-rw-r--r--meta-networking/recipes-protocols/quagga/files/Zebra-sync-zebra-routing-table-with-the-kernel-one.patch48
-rw-r--r--meta-networking/recipes-protocols/quagga/files/babel-close-the-stdout-stderr-as-in-other-daemons.patch50
-rw-r--r--meta-networking/recipes-protocols/quagga/files/babeld.service14
-rw-r--r--meta-networking/recipes-protocols/quagga/files/bgpd.service14
-rw-r--r--meta-networking/recipes-protocols/quagga/files/isisd.service14
-rw-r--r--meta-networking/recipes-protocols/quagga/files/ospf6d.service14
-rw-r--r--meta-networking/recipes-protocols/quagga/files/ospfd.service14
-rw-r--r--meta-networking/recipes-protocols/quagga/files/quagga-Avoid-duplicate-connected-address.patch54
-rw-r--r--meta-networking/recipes-protocols/quagga/files/quagga.default13
-rw-r--r--meta-networking/recipes-protocols/quagga/files/quagga.init200
-rw-r--r--meta-networking/recipes-protocols/quagga/files/quagga.pam13
-rw-r--r--meta-networking/recipes-protocols/quagga/files/ripd-fix-two-bugs-after-received-SIGHUP.patch50
-rw-r--r--meta-networking/recipes-protocols/quagga/files/ripd.service14
-rw-r--r--meta-networking/recipes-protocols/quagga/files/ripngd.service14
-rw-r--r--meta-networking/recipes-protocols/quagga/files/volatiles.03_quagga3
-rw-r--r--meta-networking/recipes-protocols/quagga/files/watchquagga.default12
-rw-r--r--meta-networking/recipes-protocols/quagga/files/watchquagga.init64
-rw-r--r--meta-networking/recipes-protocols/quagga/files/zebra.service15
-rw-r--r--meta-networking/recipes-protocols/quagga/quagga.inc250
-rw-r--r--meta-networking/recipes-protocols/quagga/quagga_0.99.23.bb9
20 files changed, 879 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 @@
1sync zebra routing table with the kernel one when interface is down
2
3Add router to kernel main router table with "ip", then you can see
4a router item in kernel main router table. Also can see this router
5item in zebra router table. If down the interface, this router item
6will be deleted from kernel main router table, but it will not be
7deleted from zebra router table, just set as inactive.
8
9This patch is adopted from [1].
10[1] http://www.gossamer-threads.com/lists/quagga/dev/22609
11
12Upstream-Status: Pending
13
14Signed-of-by: Aws Ismail <aws.ismail@windriver.com>
15Signed-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
21diff --git a/zebra/zebra_rib.c b/zebra/zebra_rib.c
22index 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--
471.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 @@
1From ba71f768e6dbb1f2ac72ed3bd880bff75a48d345 Mon Sep 17 00:00:00 2001
2From: Roy Li <rongqing.li@windriver.com>
3Date: Wed, 19 Feb 2014 14:13:40 +0800
4Subject: [PATCH] babeld: close stdout once the background daemon is created
5
6Upstream-Status: pending
7
8Once babald becomes a background daemon, it should not output information to
9stdout, so need to close stdout.
10
11In fact, other daemons close their stdout when they run into background, like
12ospfd, isisd and bgpd, by calling daemon() which is in lib/daemon.c
13
14Closing the stdout can fix a tee hang issue { #/usr/sbin/babeld -d |tee tmp }
15
16Signed-off-by: Roy Li <rongqing.li@windriver.com>
17---
18 babeld/util.c | 10 +++++++++-
19 1 file changed, 9 insertions(+), 1 deletion(-)
20
21diff --git a/babeld/util.c b/babeld/util.c
22index 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--
491.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]
2Description=Babel routing daemon
3BindTo=zebra.service
4After=zebra.service
5ConditionPathExists=@SYSCONFDIR@/quagga/babeld.conf
6
7[Service]
8Type=forking
9EnvironmentFile=-@SYSCONFDIR@/default/quagga
10ExecStart=@SBINDIR@/babeld -d $babeld_options -f /etc/quagga/babeld.conf
11Restart=on-abort
12
13[Install]
14WantedBy=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]
2Description=BGP routing daemon
3BindTo=zebra.service
4After=zebra.service
5ConditionPathExists=@SYSCONFDIR@/quagga/bgpd.conf
6
7[Service]
8Type=forking
9EnvironmentFile=-@SYSCONFDIR@/default/quagga
10ExecStart=@SBINDIR@/bgpd -d $bgpd_options -f /etc/quagga/bgpd.conf
11Restart=on-abort
12
13[Install]
14WantedBy=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]
2Description=IS-IS routing daemon
3BindTo=zebra.service
4After=zebra.service
5ConditionPathExists=@SYSCONFDIR@/quagga/isisd.conf
6
7[Service]
8Type=forking
9EnvironmentFile=-@SYSCONFDIR@/default/quagga
10ExecStart=@SBINDIR@/isisd -d $isisd_options -f /etc/quagga/isisd.conf
11Restart=on-abort
12
13[Install]
14WantedBy=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]
2Description=OSPF routing daemon for IPv6
3BindTo=zebra.service
4After=zebra.service
5ConditionPathExists=@SYSCONFDIR@/quagga/ospf6d.conf
6
7[Service]
8Type=forking
9EnvironmentFile=-@SYSCONFDIR@/default/quagga
10ExecStart=@SBINDIR@/ospf6d -d $ospf6d_options -f /etc/quagga/ospf6d.conf
11Restart=on-abort
12
13[Install]
14WantedBy=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]
2Description=OSPF routing daemon
3BindTo=zebra.service
4After=zebra.service
5ConditionPathExists=@SYSCONFDIR@/quagga/ospfd.conf
6
7[Service]
8Type=forking
9EnvironmentFile=-@SYSCONFDIR@/default/quagga
10ExecStart=@SBINDIR@/ospfd -d $ospfd_options -f /etc/quagga/ospfd.conf
11Restart=on-abort
12
13[Install]
14WantedBy=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 @@
1quagga: Avoid duplicate connected address adding to the list
2
3commit 27ba970b9("quagga/ripd: Fix two bugs after received SIGHUP signal")
4introduces an regression: ifp->connected list is cleaned up when ripd is
5restarting, however, for interface addresses which are not specified in
6ripd configuration file, they are never to be added into ifp->connected
7again, this will lead to some abnormal behavior for route advertising.
8
9Instead of cleaning up the ifp->connected list to avoid duplicated
10connected address being added into this list, we can check this
11condition during interface address adding process and return early
12when an identical address has already been added.
13
14Upstream-Status: Pending
15
16Signed-off-by: Hu Yadi <Yadi.hu@windriver.com>
17Signed-off-by: Xufeng Zhang <xufeng.zhang@windriver.com>
18Signed-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.
3vtysh_enable=yes
4
5# Bind all daemons to loopback only by default
6zebra_options=" --daemon -A 127.0.0.1"
7babeld_options="--daemon -A 127.0.0.1"
8bgpd_options=" --daemon -A 127.0.0.1"
9ospfd_options=" --daemon -A 127.0.0.1"
10ospf6d_options="--daemon -A ::1"
11ripd_options=" --daemon -A 127.0.0.1"
12ripngd_options="--daemon -A ::1"
13isisd_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
24PATH=/sbin:/usr/sbin:/bin:/usr/bin:/sbin
25D_PATH=/usr/sbin
26C_PATH=/etc/quagga
27
28# Keep zebra first and do not list watchquagga!
29DAEMONS="zebra bgpd ripd ripngd ospfd ospf6d isisd babeld"
30
31# Print the name of the pidfile.
32pidfile()
33{
34 echo "/var/run/quagga/$1.pid"
35}
36
37# Check if daemon is started by using the pidfile.
38started()
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.
45vtysh_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
57check_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.
73start()
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.
87stop()
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
118stop_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
130start_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
142status_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
169test -f /etc/default/quagga && . /etc/default/quagga
170
171case "$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 ;;
198esac
199
200exit 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
7auth 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.
12auth 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 @@
1ripd: Fix two bugs after received SIGHUP signal
2
3There are two problems for ripd implementation after received
4SIGHUP signal:
51). ripd didn't clean up ifp->connected list before reload
6 configuration file.
72). ripd reset ri->split_horizon flag to RIP_NO_SPLIT_HORIZON
8 which lead to the unnecessary route to be advertised.
9
10Upstream-Status: Submitted [http://patchwork.diac24.net/patch/604/]
11
12Signed-off-by: Xufeng Zhang <xufeng.zhang@windriver.com>
13Signed-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]
2Description=RIP routing daemon
3BindTo=zebra.service
4After=zebra.service
5ConditionPathExists=@SYSCONFDIR@/quagga/ripd.conf
6
7[Service]
8Type=forking
9EnvironmentFile=-@SYSCONFDIR@/default/quagga
10ExecStart=@SBINDIR@/ripd -d $ripd_options -f /etc/quagga/ripd.conf
11Restart=on-abort
12
13[Install]
14WantedBy=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 @@
1i[Unit]
2Description=RIP routing daemon for IPv6
3BindTo=zebra.service
4After=zebra.service
5ConditionPathExists=@SYSCONFDIR@/quagga/ripngd.conf
6
7[Service]
8Type=forking
9EnvironmentFile=-@SYSCONFDIR@/default/quagga
10ExecStart=@SBINDIR@/ripngd -d $ripngd_options -f /etc/quagga/ripngd.conf
11Restart=on-abort
12
13[Install]
14WantedBy=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>
2d quagga quagga 0755 /var/run/quagga none
3d 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"
3watch_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.
12watch_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
12PATH=/bin:/usr/bin:/sbin:/usr/sbin
13
14# Load configuration
15test -f /etc/default/watchquagga && . /etc/default/watchquagga
16
17# Check that there are daemons to be monitored.
18[ -z "$watch_daemons" ] && exit 0
19
20pidfile="/var/run/quagga/watchquagga.pid"
21
22case "$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 ;;
62esac
63
64exit 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]
2Description=GNU Zebra routing manager
3Wants=network.target
4Before=network.target
5ConditionPathExists=@SYSCONFDIR@/quagga/zebra.conf
6
7[Service]
8Type=forking
9EnvironmentFile=-@SYSCONFDIR@/default/quagga
10ExecStartPre=@BASE_SBINDIR@/ip route flush proto zebra
11ExecStart=@SBINDIR@/zebra -d $zebra_options -f /etc/quagga/zebra.conf
12Restart=on-abort
13
14[Install]
15WantedBy=multi-user.target
diff --git a/meta-networking/recipes-protocols/quagga/quagga.inc b/meta-networking/recipes-protocols/quagga/quagga.inc
new file mode 100644
index 000000000..2c0817b83
--- /dev/null
+++ b/meta-networking/recipes-protocols/quagga/quagga.inc
@@ -0,0 +1,250 @@
1SUMMARY = "BGP/OSPF/RIP routing daemon"
2DESCRIPTION = "Quagga is a routing software suite, providing \
3implementations of OSPFv2, OSPFv3, RIP v1 and v2, RIPv3 and BGPv4 for \
4Unix platforms, particularly FreeBSD, Linux, Solaris and NetBSD. \
5Quagga is a fork of GNU Zebra which was developed by Kunihiro \
6Ishiguro. The Quagga tree aims to build a more involved community \
7around Quagga than the current centralised model of GNU Zebra."
8HOMEPAGE = "http://www.nongnu.org/quagga/"
9SECTION = "network"
10LICENSE = "GPL-2.0 & LGPL-2.0"
11DEPENDS = "readline ncurses perl-native"
12DEPENDS += "${@base_contains('DISTRO_FEATURES', 'snmp', 'net-snmp', '', d)}"
13SNMP_CONF="${@base_contains('DISTRO_FEATURES', 'snmp', '--enable-snmp', '', d)}"
14
15LIC_FILES_CHKSUM = "file://COPYING;md5=81bcece21748c91ba9992349a91ec11d \
16 file://COPYING.LIB;md5=01ef24401ded36cd8e5d18bfe947240c"
17
18# the "ip" command from busybox is not sufficient (flush by protocol flushes all routes)
19RDEPENDS_${PN} += "iproute2"
20
21QUAGGASUBDIR = ""
22# ${QUAGGASUBDIR} is deal with old versions. Set to "/attic" for old
23# versions and leave it empty for recent versions.
24SRC_URI = "${SAVANNAH_GNU_MIRROR}/quagga${QUAGGASUBDIR}/quagga-${PV}.tar.gz; \
25 file://Zebra-sync-zebra-routing-table-with-the-kernel-one.patch \
26 file://quagga.init \
27 file://quagga.default \
28 file://watchquagga.init \
29 file://watchquagga.default \
30 file://volatiles.03_quagga \
31 file://quagga.pam \
32 file://ripd-fix-two-bugs-after-received-SIGHUP.patch \
33 file://quagga-Avoid-duplicate-connected-address.patch \
34 file://babeld.service \
35 file://bgpd.service \
36 file://isisd.service \
37 file://ospf6d.service \
38 file://ospfd.service \
39 file://ripd.service \
40 file://ripngd.service \
41 file://zebra.service \
42"
43
44PACKAGECONFIG ??= "${@base_contains('DISTRO_FEATURES', 'pam', 'pam', '', d)}"
45PACKAGECONFIG[cap] = "--enable-capabilities,--disable-capabilities,libcap"
46PACKAGECONFIG[pam] = "--with-libpam, --without-libpam, libpam"
47
48inherit autotools update-rc.d useradd systemd
49
50SYSTEMD_PACKAGES = "${PN} ${PN}-babeld ${PN}-bgpd ${PN}-isisd ${PN}-ospf6d ${PN}-ospfd ${PN}-ripd ${PN}-ripngd"
51SYSTEMD_SERVICE_${PN}-babeld = "babeld.service"
52SYSTEMD_SERVICE_${PN}-bgpd = "bgpd.service"
53SYSTEMD_SERVICE_${PN}-isisd = "isisd.service"
54SYSTEMD_SERVICE_${PN}-ospf6d = "ospf6d.service"
55SYSTEMD_SERVICE_${PN}-ospfd = "ospfd.service"
56SYSTEMD_SERVICE_${PN}-ripd = "ripd.service"
57SYSTEMD_SERVICE_${PN}-ripngd = "ripngd.service"
58SYSTEMD_SERVICE_${PN} = "zebra.service"
59
60EXTRA_OECONF = "--sysconfdir=${sysconfdir}/quagga \
61 --localstatedir=${localstatedir}/run/quagga \
62 --enable-exampledir=${docdir}/quagga/examples/ \
63 --enable-vtysh \
64 --enable-isisd \
65 ${@base_contains('DISTRO_FEATURES', 'sysvinit', '--enable-watchquagga', '--disable-watchquagga', d)} \
66 --enable-ospf-te \
67 --enable-opaque-lsa \
68 --enable-ipv6 \
69 --enable-ospfclient=yes \
70 --enable-multipath=64 \
71 --enable-user=quagga \
72 --enable-group=quagga \
73 --enable-vty-group=quaggavty \
74 --enable-configfile-mask=0640 \
75 --enable-logfile-mask=0640 \
76 --enable-rtadv \
77 --enable-linux24-tcp-md5 \
78 ap_cv_cc_pie=no \
79 ${SNMP_CONF}"
80
81do_install () {
82 # Install init script and default settings
83 install -m 0755 -d ${D}${sysconfdir}/default ${D}${sysconfdir}/init.d \
84 ${D}${sysconfdir}/quagga ${D}${sysconfdir}/default/volatiles
85 install -m 0644 ${WORKDIR}/quagga.default ${D}${sysconfdir}/default/quagga
86 install -m 0644 ${WORKDIR}/watchquagga.default ${D}${sysconfdir}/default/watchquagga
87 install -m 0755 ${WORKDIR}/quagga.init ${D}${sysconfdir}/init.d/quagga
88 install -m 0755 ${WORKDIR}/watchquagga.init ${D}${sysconfdir}/init.d/watchquagga
89 install -m 0644 ${WORKDIR}/volatiles.03_quagga ${D}${sysconfdir}/default/volatiles/volatiles.03_quagga
90
91 # Install sample configurations for the daemons
92 for f in bgpd vtysh babeld isisd ospfd ripngd zebra ripd ospf6d; do
93 install -m 0640 ${S}/$f/$f.conf.sample ${D}${sysconfdir}/quagga/$f.conf.sample
94 done
95
96 for f in bgpd vtysh babeld isisd ospfd ripngd zebra ripd ospf6d; do
97 touch ${D}${sysconfdir}/quagga/$f.conf
98 done
99 chown quagga:quaggavty ${D}${sysconfdir}/quagga
100 chown quagga:quagga ${D}${sysconfdir}/quagga/*.conf
101 chmod 750 ${D}${sysconfdir}/quagga
102 chmod 640 ${D}${sysconfdir}/quagga/*.conf
103
104 # Install quagga
105 oe_runmake install DESTDIR=${D} prefix=${prefix} \
106 sbindir=${sbindir} \
107 sysconfdir=${sysconfdir}/quagga \
108 localstatedir=${localstatedir}/run/quagga
109
110 # Fix hardcoded paths
111 sed -i 's!/usr/sbin/!${sbindir}/!g' ${D}${sysconfdir}/init.d/*
112 sed -i 's!/usr/bin/!${bindir}/!g' ${D}${sysconfdir}/init.d/quagga
113 sed -i 's!/etc/!${sysconfdir}/!g' ${D}${sysconfdir}/init.d/* ${D}${sysconfdir}/default/watchquagga
114 sed -i 's!/var/!${localstatedir}/!g' ${D}${sysconfdir}/init.d/* ${D}${sysconfdir}/default/volatiles/volatiles.03_quagga
115 sed -i 's!^PATH=.*!PATH=${base_sbindir}:${sbindir}:${base_bindir}:${bindir}!' ${D}${sysconfdir}/init.d/*
116
117 # Remove generated info dir file, it doesn't belong in the generated
118 # package.
119 rm -f ${D}${infodir}/dir
120
121 # For PAM
122 for feature in ${DISTRO_FEATURES}; do
123 if [ "$feature" = "pam" ]; then
124 install -D -m 644 ${WORKDIR}/quagga.pam ${D}/${sysconfdir}/pam.d/quagga
125 break
126 fi
127 done
128
129 if ${@base_contains('DISTRO_FEATURES', 'systemd', 'true', 'false', d)}; then
130 install -d ${D}${sysconfdir}/tmpfiles.d
131 echo "d /var/run/quagga 0755 quagga quagga -" \
132 > ${D}${sysconfdir}/tmpfiles.d/${BPN}.conf
133 fi
134
135 # Remove sysinit script if sysvinit is not in DISTRO_FEATURES
136 if ${@bb.utils.contains('DISTRO_FEATURES', 'sysvinit', 'false', 'true', d)}; then
137 rm -rf ${D}${sysconfdir}/init.d/
138 rm -f ${D}${sysconfdir}/default/watchquagga
139 fi
140
141 install -d ${D}${systemd_unitdir}/system
142 for i in babeld bgpd isisd ospf6d ospfd ripd ripngd zebra; do
143 install -m 0644 ${WORKDIR}/$i.service ${D}${systemd_unitdir}/system
144 done
145 sed -e 's,@BASE_SBINDIR@,${base_sbindir},g' \
146 -e 's,@SYSCONFDIR@,${sysconfdir},g' \
147 -e 's,@SBINDIR@,${sbindir},g' \
148 -i ${D}${systemd_unitdir}/system/*.service
149}
150
151DEPENDS_append = " ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'systemd-systemctl-native', '', d)}"
152pkg_postinst_${PN} () {
153 if ${@bb.utils.contains('DISTRO_FEATURES', 'systemd sysvinit', 'true', 'false', d)}; then
154 if [ -n "$D" ]; then
155 OPTS="--root=$D"
156 fi
157 systemctl $OPTS mask quagga.service
158 fi
159}
160
161# Split into a main package and separate per-protocol packages
162PACKAGE_BEFORE_PN = "${PN}-ospfd ${PN}-ospf6d ${PN}-babeld ${PN}-bgpd \
163 ${PN}-ripd ${PN}-ripngd ${PN}-isisd \
164 ${PN}-ospfclient ${@base_contains('DISTRO_FEATURES', 'sysvinit', '${PN}-watchquagga', '', d)}"
165
166RDEPENDS_${PN} += "${PN}-babeld ${PN}-bgpd ${PN}-isisd ${PN}-ospf6d ${PN}-ospfd ${PN}-ripd ${PN}-ripngd"
167
168FILES_${PN}-ospfd = "${sbindir}/ospfd ${libdir}/libospf.so.*"
169FILES_${PN}-ospf6d = "${sbindir}/ospf6d"
170FILES_${PN}-babeld = "${sbindir}/babeld"
171FILES_${PN}-bgpd = "${sbindir}/bgpd"
172FILES_${PN}-ripd = "${sbindir}/ripd"
173FILES_${PN}-ripngd = "${sbindir}/ripngd"
174FILES_${PN}-isisd = "${sbindir}/isisd"
175FILES_${PN}-ospfclient = "${sbindir}/ospfclient ${libdir}/libospfapiclient.so.*"
176FILES_${PN}-watchquagga = "${sbindir}/watchquagga ${sysconfdir}/default/watchquagga \
177 ${sysconfdir}/init.d/watchquagga"
178
179# Indicate that the default files are configuration files
180CONFFILES_${PN} = "${sysconfdir}/default/quagga \
181 ${sysconfdir}/quagga/bgpd.conf \
182 ${sysconfdir}/quagga/vtysh.conf \
183 ${sysconfdir}/quagga/babeld.conf \
184 ${sysconfdir}/quagga/isisd.conf \
185 ${sysconfdir}/quagga/ospfd.conf \
186 ${sysconfdir}/quagga/ripngd.conf \
187 ${sysconfdir}/quagga/zebra.conf \
188 ${sysconfdir}/quagga/ripd.conf \
189 ${sysconfdir}/quagga/ospf6d.conf \
190 "
191CONFFILES_${PN}-watchquagga = "${sysconfdir}/default/watchquagga"
192
193# Stop the names being rewritten due to the internal shared libraries
194DEBIAN_NOAUTONAME_${PN}-ospfd = "1"
195DEBIAN_NOAUTONAME_${PN}-ospfclient = "1"
196
197# the "ip" command from busybox is not sufficient (flush by protocol flushes all routes)
198RDEPENDS_${PN} += "iproute2"
199
200# Main init script starts all deamons
201# Seperate init script for watchquagga
202INITSCRIPT_PACKAGES = "${PN} ${PN}-watchquagga"
203INITSCRIPT_NAME_${PN} = "quagga"
204INITSCRIPT_PARAMS_${PN} = "defaults 15 85"
205INITSCRIPT_NAME_${PN}-watchquagga = "watchquagga"
206INITSCRIPT_PARAMS_${PN}-watchquagga = "defaults 90 10"
207
208# Add quagga's user and group
209USERADD_PACKAGES = "${PN}"
210GROUPADD_PARAM_${PN} = "--system quagga ; --system quaggavty"
211USERADD_PARAM_${PN} = "--system --home ${localstatedir}/run/quagga/ -M -g quagga --shell /bin/false quagga"
212
213pkg_postinst_${PN} () {
214 if [ -z "$D" ] && [ -e /etc/init.d/populate-volatile.sh ] ; then
215 ${sysconfdir}/init.d/populate-volatile.sh update
216 fi
217}
218
219# Stop apps before uninstall
220pkg_prerm_${PN} () {
221 ${sysconfdir}/init.d/quagga stop
222}
223
224pkg_prerm_${PN}-ospfd () {
225 ${sysconfdir}/init.d/quagga stop ospfd
226}
227
228pkg_prerm_${PN}-ospf6d () {
229 ${sysconfdir}/init.d/quagga stop ospf6d
230}
231
232pkg_prerm_${PN}-babeld () {
233 ${sysconfdir}/init.d/quagga stop babeld
234}
235
236pkg_prerm_${PN}-bgpd () {
237 ${sysconfdir}/init.d/quagga stop bgpd
238}
239
240pkg_prerm_${PN}-ripd () {
241 ${sysconfdir}/init.d/quagga stop ripd
242}
243
244pkg_prerm_${PN}-ripngd () {
245 ${sysconfdir}/init.d/quagga stop ripngd
246}
247
248pkg_prerm_${PN}-isisd () {
249 ${sysconfdir}/init.d/quagga stop isisd
250}
diff --git a/meta-networking/recipes-protocols/quagga/quagga_0.99.23.bb b/meta-networking/recipes-protocols/quagga/quagga_0.99.23.bb
new file mode 100644
index 000000000..a56767e51
--- /dev/null
+++ b/meta-networking/recipes-protocols/quagga/quagga_0.99.23.bb
@@ -0,0 +1,9 @@
1require quagga.inc
2
3SRC_URI += "file://babel-close-the-stdout-stderr-as-in-other-daemons.patch \
4"
5
6SRC_URI[md5sum] = "d17145e62b6ea14f0f13bb63f59e5166"
7SRC_URI[sha256sum] = "2c7798204f35dc7acea9f206647e8aa3957cae3b21733cdff413b506481a101c"
8
9QUAGGASUBDIR = ""