Commit 70a0197e authored by Natanael Copa's avatar Natanael Copa

extra/quagga: new aport

A free routing daemon replacing Zebra supporting RIP, OSPF and BGP
http://quagga.net/
parent ce6f3d73
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=quagga
pkgver=0.99.11
pkgrel=4
pkgdesc="A free routing daemon replacing Zebra supporting RIP, OSPF and BGP."
url="http://quagga.net/"
license="GPL-2"
depends="uclibc readline ncurses"
makedepends="readline-dev ncurses-dev
autoconf automake libtool"
install=quagga.install
subpackages="$pkgname-dev $pkgname-doc"
source="http://www.quagga.net/download/$pkgname-$pkgver.tar.gz
$pkgname-0.99.11-link-libcap.patch
$pkgname-0.99.11-ipv6.patch
$pkgname-0.99.11-checksum.patch
$pkgname-0.99.11-ipv6-only.patch
$pkgname-0.99.11-del-routes.patch
$pkgname-0.99.11-zombie.patch
bgpd.initd
ospf6d.initd
ospfd.initd
ripd.initd
ripngd.initd
zebra.initd
zebra.confd
$install
"
build() {
cd "$srcdir"/$pkgname-$pkgver
for i in ../*.patch; do
msg "Applying $i..."
patch -p1 < $i || return 1
done
msg "Running autotools..."
aclocal || return 1
autoconf || return 1
automake || return 1
libtoolize || return 1
./configure --prefix=/usr \
--disable-static \
--enable-ipv6 \
--enable-ospf6d \
--enable-rtadv \
--enable-user=quagga \
--enable-group=quagga \
--enable-vty-group=quagga \
--enable-vtysh \
--sysconfdir=/etc/quagga \
--enable-exampledir=/usr/share/doc/quagga/ \
--localstatedir=/var/run/quagga \
|| return 1
# --with-cflags="${CFLAGS}" \
make || return 1
make DESTDIR="$pkgdir" install
install -d "$pkgdir"/var/run/quagga
for i in zebra ripd ospfd bgpd ripngd ospf6d; do
install -Dm755 "$srcdir"/$i.initd "$pkgdir"/etc/init.d/$i
done
install -Dm644 "$srcdir/zebra.confd" "$pkgdir"/etc/conf.d/zebra
}
md5sums="903e40c744730ad4d62bee872eeb813b quagga-0.99.11.tar.gz
8f99d41a8ed79e51704e8f655d255f29 quagga-0.99.11-link-libcap.patch
d73000d128eaf20a17ffb15b5ca1805a quagga-0.99.11-ipv6.patch
7e1c0152d4733b713613e10df207e3a9 quagga-0.99.11-checksum.patch
44c517e988273e0e5076d24f3959a125 quagga-0.99.11-ipv6-only.patch
1cbcf60a637b2577dee4d6df711e1247 quagga-0.99.11-del-routes.patch
ce345725f2e7240cebe0fd5ac2b2fc48 quagga-0.99.11-zombie.patch
cc109a746273bc0d6aee9d758e7524ab bgpd.initd
44547b687343ebfed7524cebc5626067 ospf6d.initd
89b0cf4e70172bfcd195b2869cae28da ospfd.initd
39b8cb21b55de53af38c94c2f5d85917 ripd.initd
120ab1b53975ec86e78266f31e935ab6 ripngd.initd
6d51e9fca8d206a6d9d1d9fde793b48f zebra.initd
c38e884372406e9e59616e436cd26388 zebra.confd
6d2ca71d32ed9d9517f7779986db91da quagga.install"
#!/sbin/runscript
# Copyright 1999-2003 DataCore GmbH, Amir Guindehi
# Distributed under the terms of the GNU General Public License, v2 or later
# $Header: /var/cvsroot/gentoo-x86/net-misc/quagga/files/bgpd.init,v 1.1 2005/09/14 11:11:08 mrness Exp $
depend() {
need net zebra
}
checkconfig() {
if [ ! -e /etc/quagga/bgpd.conf ] ; then
eerror "You need to create /etc/quagga/bgpd.conf first."
eerror "An example can be found in /etc/quagga/samples/bgpd.conf.sample"
return 1
fi
}
start() {
checkconfig || return 1
ebegin "Starting bgpd"
start-stop-daemon --start --quiet --exec /usr/sbin/bgpd \
-- -d -f /etc/quagga/bgpd.conf \
--pid_file /var/run/quagga/bgpd.pid
result=$?
eend $result
}
stop() {
ebegin "Stopping bgpd"
start-stop-daemon --stop --quiet --pidfile /var/run/quagga/bgpd.pid
result=$?
eend $result
}
#!/sbin/runscript
# Copyright 1999-2003 DataCore GmbH, Amir Guindehi
# Distributed under the terms of the GNU General Public License, v2 or later
# $Header: /var/cvsroot/gentoo-x86/net-misc/quagga/files/ospf6d.init,v 1.1 2005/09/14 11:11:08 mrness Exp $
depend() {
need net zebra
}
checkconfig() {
if [ ! -e /etc/quagga/ospf6d.conf ] ; then
eerror "You need to create /etc/quagga/ospf6d.conf first."
eerror "An example can be found in /etc/quagga/samples/ospf6d.conf.sample"
return 1
fi
}
start() {
checkconfig || return 1
ebegin "Starting ospf6d"
start-stop-daemon --start --quiet --exec /usr/sbin/ospf6d \
-- -d -f /etc/quagga/ospf6d.conf \
--pid_file /var/run/quagga/ospf6d.pid
result=$?
eend $result
}
stop() {
ebegin "Stopping ospf6d"
start-stop-daemon --stop --quiet --pidfile /var/run/quagga/ospf6d.pid
result=$?
eend $result
}
#!/sbin/runscript
# Copyright 1999-2003 DataCore GmbH, Amir Guindehi
# Distributed under the terms of the GNU General Public License, v2 or later
# $Header: /var/cvsroot/gentoo-x86/net-misc/quagga/files/ospfd.init,v 1.1 2005/09/14 11:11:08 mrness Exp $
depend() {
need net zebra
}
checkconfig() {
if [ ! -e /etc/quagga/ospfd.conf ] ; then
eerror "You need to create /etc/quagga/ospfd.conf first."
eerror "An example can be found in /etc/quagga/samples/ospfd.conf.sample"
return 1
fi
}
start() {
checkconfig || return 1
ebegin "Starting ospfd"
start-stop-daemon --start --quiet --exec /usr/sbin/ospfd \
-- -d -f /etc/quagga/ospfd.conf \
--pid_file /var/run/quagga/ospfd.pid
result=$?
eend $result
}
stop() {
ebegin "Stopping ospfd"
start-stop-daemon --stop --quiet --pidfile /var/run/quagga/ospfd.pid
result=$?
eend $result
}
This diff is collapsed.
From http://lists.quagga.net/pipermail/quagga-dev/2009-January/006362.html
If there are two paralell PtP links to the same router:
C * 192.168.101.112/32 is directly connected, p1-4-19-4-20
C>* 192.168.101.112/32 is directly connected, p1-4-17-4-18
and the cable is to one of the ppp links is pulled, Zebra
deletes both routes instead of just the one that got yanked.
This fixes it to only delete the route to the interface that
got yanked.
---
This fix was suggested by lsorense at csclub.uwaterloo.ca (Lennart Sorensen)
who had a similar problem. See [quagga-dev 6355]
zebra/zebra_rib.c | 9 ++++++++-
1 files changed, 8 insertions(+), 1 deletions(-)
diff --git a/zebra/zebra_rib.c b/zebra/zebra_rib.c
index 90db932..7a37387 100644
--- a/zebra/zebra_rib.c
+++ b/zebra/zebra_rib.c
@@ -1896,6 +1896,13 @@ rib_delete_ipv4 (int type, int flags, struct prefix_ipv4 *p,
inet_ntoa (*gate),
ifindex);
+ if (IS_ZEBRA_DEBUG_KERNEL && !gate)
+ zlog_debug ("rib_delete_ipv4(): route delete %s/%d directly, %s ifindex %d",
+ inet_ntop (AF_INET, &p->prefix, buf1, BUFSIZ),
+ p->prefixlen,
+ ifindex2ifname(ifindex),
+ ifindex);
+
/* Lookup route node. */
rn = route_node_lookup (table, (struct prefix *) p);
if (! rn)
@@ -1942,7 +1949,7 @@ rib_delete_ipv4 (int type, int flags, struct prefix_ipv4 *p,
break;
}
/* Make sure that the route found has the same gateway. */
- else if (gate == NULL ||
+ else if (gate != NULL &&
((nexthop = rib->nexthop) &&
(IPV4_ADDR_SAME (&nexthop->gate.ipv4, gate) ||
IPV4_ADDR_SAME (&nexthop->rgate.ipv4, gate))))
On Linux the default behaviour of getaddrinfo is to provide both IPV4 and IPV6
addresses if available. But the default behaviour of binding to an IPV6 address
is to handle both the native IPV6 address and IPV4 to IPV6 mapped addresses.
Without this patch what happens is:
1. First address is IPV6, bind succeeds.
2. Second address is IPV4, bind fails (port already used by IPV6)
3. incoming connections come in on IPV6 listen socket, as IPV4 mapped
addresses then BGP gets confused because of client with unexpected address.
The fix is to force IPV6 socket as IPV6 only.
--- a/bgpd/bgp_network.c 2008-08-27 17:59:20.000000000 -0700
+++ b/bgpd/bgp_network.c 2008-08-27 18:02:46.000000000 -0700
@@ -412,6 +412,15 @@ bgp_socket (struct bgp *bgp, unsigned sh
setsockopt_ipv4_tos (sock, IPTOS_PREC_INTERNETCONTROL);
#endif
+#ifdef IPV6_V6ONLY
+ /* Want only IPV6 on ipv6 socket (not mapped addresses) */
+ if (ainfo->ai_family == AF_INET6) {
+ int on = 1;
+ setsockopt (sock, IPPROTO_IPV6, IPV6_V6ONLY,
+ (void *) &on, sizeof (on));
+ }
+#endif
+
if (bgpd_privs.change (ZPRIVS_RAISE) )
zlog_err ("bgp_socket: could not raise privs");
diff -Nru quagga-0.99.11.orig/lib/sockopt.c quagga-0.99.11/lib/sockopt.c
--- quagga-0.99.11.orig/lib/sockopt.c 2008-09-05 14:27:26.000000000 +0000
+++ quagga-0.99.11/lib/sockopt.c 2008-10-13 21:46:13.000000000 +0000
@@ -530,6 +530,7 @@
return -1;
};
+#ifdef HAVE_IPV6
/* If this does not work, then all users of this sockopt will need to
* differentiate between IPv4 and IPv6, and keep seperate sockets for
* each.
@@ -546,6 +547,7 @@
su2->sin6.sin6_addr.s6_addr32[2] = htonl(0xffff);
memcpy (&su2->sin6.sin6_addr.s6_addr32[3], &su->sin.sin_addr, 4);
}
+#endif /* HAVE_IPV6 */
}
memset (&md5sig, 0, sizeof (md5sig));
diff -ur quagga-0.99.11.orig/lib/Makefile.am quagga-0.99.11/lib/Makefile.am
--- quagga-0.99.11.orig/lib/Makefile.am 2008-09-24 15:22:43.000000000 +0000
+++ quagga-0.99.11/lib/Makefile.am 2008-10-09 20:29:17.000000000 +0000
@@ -18,7 +18,7 @@
libzebra_la_DEPENDENCIES = @LIB_REGEX@
-libzebra_la_LIBADD = @LIB_REGEX@
+libzebra_la_LIBADD = @LIB_REGEX@ @LIBCAP@
pkginclude_HEADERS = \
buffer.h checksum.h command.h filter.h getopt.h hash.h \
diff -ur quagga-0.99.11.orig/zebra/Makefile.am quagga-0.99.11/zebra/Makefile.am
--- quagga-0.99.11.orig/zebra/Makefile.am 2008-09-05 14:27:26.000000000 +0000
+++ quagga-0.99.11/zebra/Makefile.am 2008-10-09 20:29:17.000000000 +0000
@@ -39,7 +39,7 @@
connected.h ioctl.h rib.h rt.h zserv.h redistribute.h debug.h rtadv.h \
interface.h ipforward.h irdp.h router-id.h kernel_socket.h
-zebra_LDADD = $(otherobj) $(LIBCAP) $(LIB_IPV6) ../lib/libzebra.la
+zebra_LDADD = $(otherobj) ../lib/libzebra.la $(LIBCAP) $(LIB_IPV6)
testzebra_LDADD = $(LIBCAP) $(LIB_IPV6) ../lib/libzebra.la
Currently, when accepting the connection, it can be left as zombie,
when the peer just initiates a connection, but never sends data (and
the TCP connection end packets are lost). This happens because for
accepted connections a temporary new peer entry is created until OPEN
message is exchanged, and this temporary peer entry does not get the
hold time parameter set at all.
Signed-off-by: Timo Teras <timo.teras@iki.fi>
---
bgpd/bgp_network.c | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/bgpd/bgp_network.c b/bgpd/bgp_network.c
index 5dbd487..9a4c36d 100644
--- a/bgpd/bgp_network.c
+++ b/bgpd/bgp_network.c
@@ -185,6 +185,8 @@ bgp_accept (struct thread *thread)
peer->fd = bgp_sock;
peer->status = Active;
peer->local_id = peer1->local_id;
+ peer->v_holdtime = peer1->v_holdtime;
+ peer->v_keepalive = peer1->v_keepalive;
/* Make peer's address string. */
sockunion2str (&su, buf, SU_ADDRSTRLEN);
--
1.5.6.3
#!/bin/sh
case "$1" in
pre_install)
adduser -H -h /var/empty -s /bin/false -D quagga 2>/dev/null
mkdir -p var/empty
chown root:root var/empty
chown quagga:quagga /var/run/quagga
;;
esac
exit 0
#!/sbin/runscript
# Copyright 1999-2003 DataCore GmbH, Amir Guindehi
# Distributed under the terms of the GNU General Public License, v2 or later
# $Header: /var/cvsroot/gentoo-x86/net-misc/quagga/files/ripd.init,v 1.1 2005/09/14 11:11:08 mrness Exp $
depend() {
need net zebra
}
checkconfig() {
if [ ! -e /etc/quagga/ripd.conf ] ; then
eerror "You need to create /etc/quagga/ripd.conf first."
eerror "An example can be found in /etc/quagga/samples/ripd.conf.sample"
return 1
fi
}
start() {
checkconfig || return 1
ebegin "Starting ripd"
start-stop-daemon --start --quiet --exec /usr/sbin/ripd \
-- -d -f /etc/quagga/ripd.conf \
--pid_file /var/run/quagga/ripd.pid
result=$?
eend $result
}
stop() {
ebegin "Stopping ripd"
start-stop-daemon --stop --quiet --pidfile /var/run/quagga/ripd.pid
result=$?
eend $result
}
#!/sbin/runscript
# Copyright 1999-2003 DataCore GmbH, Amir Guindehi
# Distributed under the terms of the GNU General Public License, v2 or later
# $Header: /var/cvsroot/gentoo-x86/net-misc/quagga/files/ripngd.init,v 1.1 2005/09/14 11:11:08 mrness Exp $
depend() {
need net zebra
}
checkconfig() {
if [ ! -e /etc/quagga/ripngd.conf ] ; then
eerror "You need to create /etc/quagga/ripngd.conf first."
eerror "An example can be found in /etc/quagga/samples/ripngd.conf.sample"
return 1
fi
}
start() {
checkconfig || return 1
ebegin "Starting ripngd"
start-stop-daemon --start --quiet --exec /usr/sbin/ripngd \
-- -d -f /etc/quagga/ripngd.conf \
--pid_file /var/run/quagga/ripngd.pid
result=$?
eend $result
}
stop() {
ebegin "Stopping ripngd"
start-stop-daemon --stop --quiet --pidfile /var/run/quagga/ripngd.pid
result=$?
eend $result
}
# Additional command-line parameters to run zebra with:
# -k, --keep_kernel Don't delete old routes which installed by zebra.
# -l, --log_mode number Set verbose log mode flag
# -A, --vty_addr addr Set vty's bind address
# -P, --vty_port port Set vty's port number
# -r, --retain When program terminates, retain added route by zebra.
ZEBRA_OPTS="-l 255"
#!/sbin/runscript
# Copyright 1999-2004 Gentoo Foundation
# Distributed under the terms of the GNU General Public License, v2 or later
# $Header: /var/cvsroot/gentoo-x86/net-misc/quagga/files/zebra.init,v 1.2 2007/02/25 09:57:18 mrness Exp $
depend() {
need net
}
checkconfig() {
if [ ! -e /etc/quagga/zebra.conf ] ; then
eerror "You need to create /etc/quagga/zebra.conf first."
eerror "An example can be found in /etc/quagga/samples/zebra.conf.sample"
return 1
fi
}
cleanup() {
ebegin "Cleaning up stale zebra routes..."
ip route flush proto zebra
eend $?
}
start() {
checkconfig || return 1
cleanup
ebegin "Starting zebra"
start-stop-daemon --start --quiet --exec /usr/sbin/zebra \
-- -d -f /etc/quagga/zebra.conf ${ZEBRA_OPTS} \
--pid_file /var/run/quagga/zebra.pid
result=$?
eend $result
}
stop() {
ebegin "Stopping zebra"
start-stop-daemon --stop --quiet --pidfile /var/run/quagga/zebra.pid
result=$?
eend $result
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment