diff options
Diffstat (limited to 'main/opennhrp')
-rw-r--r-- | main/opennhrp/0001-netlink-ignore-kernel-routes-for-GRE-interfaces.patch | 54 | ||||
-rw-r--r-- | main/opennhrp/APKBUILD | 40 | ||||
-rw-r--r-- | main/opennhrp/opennhrp-0.9.3-peer-up-bgp.patch | 11 | ||||
-rw-r--r-- | main/opennhrp/opennhrp.confd | 2 | ||||
-rwxr-xr-x | main/opennhrp/opennhrp.initd | 33 |
5 files changed, 140 insertions, 0 deletions
diff --git a/main/opennhrp/0001-netlink-ignore-kernel-routes-for-GRE-interfaces.patch b/main/opennhrp/0001-netlink-ignore-kernel-routes-for-GRE-interfaces.patch new file mode 100644 index 0000000000..78cf3f89b4 --- /dev/null +++ b/main/opennhrp/0001-netlink-ignore-kernel-routes-for-GRE-interfaces.patch @@ -0,0 +1,54 @@ +From 7747c86253114ed9702346a93587e4e6cac444aa Mon Sep 17 00:00:00 2001 +From: David Ward <david.ward@ll.mit.edu> +Date: Tue, 29 Mar 2011 22:43:03 -0400 +Subject: [PATCH] netlink: ignore kernel routes for GRE interfaces + +The kernel route should not be added as a peer, except on shortcut- +destination interfaces. It can prevent NHRP resolution requests from +being routed correctly to a statically-configured next hop server. + +Signed-off-by: David Ward <david.ward@ll.mit.edu> +--- + nhrp/sysdep_netlink.c | 9 ++++----- + 1 files changed, 4 insertions(+), 5 deletions(-) + +diff --git a/nhrp/sysdep_netlink.c b/nhrp/sysdep_netlink.c +index a76acc2..e3e588b 100644 +--- a/nhrp/sysdep_netlink.c ++++ b/nhrp/sysdep_netlink.c +@@ -691,7 +691,8 @@ static void netlink_route_new(struct nlmsghdr *msg) + } else if (iface->flags & NHRP_INTERFACE_FLAG_CONFIGURED) { + /* Routes which might get additional outbound + * shortcuts */ +- if (rtm->rtm_table != iface->route_table) ++ if (rtm->rtm_table != iface->route_table || ++ rtm->rtm_protocol == RTPROT_KERNEL) + return; + type = NHRP_PEER_TYPE_LOCAL_ROUTE; + } +@@ -728,12 +729,9 @@ static void netlink_route_del(struct nlmsghdr *msg) + if (rta[RTA_OIF] == NULL || rta[RTA_DST] == NULL) + return; + +- /* Consider only routes from main table */ + if (rtm->rtm_family != PF_INET) + return; + +- /* Only consider routes for local interfaces that accept +- * shortcut connections */ + iface = nhrp_interface_get_by_index(*(int*)RTA_DATA(rta[RTA_OIF]), + FALSE); + if (iface == NULL) +@@ -747,7 +745,8 @@ static void netlink_route_del(struct nlmsghdr *msg) + } else if (iface->flags & NHRP_INTERFACE_FLAG_CONFIGURED) { + /* Routes which might get additional outbound + * shortcuts */ +- if (rtm->rtm_table != iface->route_table) ++ if (rtm->rtm_table != iface->route_table || ++ rtm->rtm_protocol == RTPROT_KERNEL) + return; + type = NHRP_PEER_TYPE_LOCAL_ROUTE; + } +-- +1.7.1 + diff --git a/main/opennhrp/APKBUILD b/main/opennhrp/APKBUILD new file mode 100644 index 0000000000..610fd53db6 --- /dev/null +++ b/main/opennhrp/APKBUILD @@ -0,0 +1,40 @@ +# Maintainer: Natanael Copa <ncopa@alpinelinux.org> +pkgname=opennhrp +pkgver=0.12.1 +pkgrel=1 +pkgdesc="NBMA Next Hop Resolution Protocol daemon" +url="http://sourceforge.net/projects/opennhrp" +arch="all" +license="GPL-2" +depends= +makedepends="c-ares-dev" +subpackages="$pkgname-doc" +source="http://downloads.sourceforge.net/$pkgname/$pkgname-$pkgver.tar.bz2 + 0001-netlink-ignore-kernel-routes-for-GRE-interfaces.patch + opennhrp-0.9.3-peer-up-bgp.patch + $pkgname.initd + $pkgname.confd + " + +build() { + cd "$srcdir"/$pkgname-$pkgver + for i in ../*.patch; do + msg "Applying $i" + patch -p1 < $i || return 1 + done + + sed -i -e 's/-Werror//' Make.rules + make || return 1 +} + +package() { + cd "$srcdir"/$pkgname-$pkgver + make DESTDIR="$pkgdir" install + install -Dm755 "$srcdir"/opennhrp.initd "$pkgdir"/etc/init.d/opennhrp + install -Dm644 "$srcdir"/opennhrp.confd "$pkgdir"/etc/conf.d/opennhrp +} +md5sums="31ada6dede3c62dac491002624d34778 opennhrp-0.12.1.tar.bz2 +d6dbf1ac009615cea63e0ede894133a0 0001-netlink-ignore-kernel-routes-for-GRE-interfaces.patch +f81539fc92800bb79668dda119a97d1d opennhrp-0.9.3-peer-up-bgp.patch +ae65f88ccf849ef882669a8b4f0c7fc0 opennhrp.initd +8eee86233728dc0d156bbfee6d98f338 opennhrp.confd" diff --git a/main/opennhrp/opennhrp-0.9.3-peer-up-bgp.patch b/main/opennhrp/opennhrp-0.9.3-peer-up-bgp.patch new file mode 100644 index 0000000000..60e4827d6f --- /dev/null +++ b/main/opennhrp/opennhrp-0.9.3-peer-up-bgp.patch @@ -0,0 +1,11 @@ +diff -ru opennhrp-0.9.3.orig/etc/opennhrp-script opennhrp-0.9.3/etc/opennhrp-script +--- opennhrp-0.9.3.orig/etc/opennhrp-script 2009-02-26 10:35:38 +0000 ++++ opennhrp-0.9.3/etc/opennhrp-script 2009-02-26 10:52:26 +0000 +@@ -15,6 +15,7 @@ + echo "Create link from $NHRP_SRCADDR ($NHRP_SRCNBMA) to $NHRP_DESTADDR ($NHRP_DESTNBMA)" + racoonctl establish-sa -w isakmp inet $NHRP_SRCNBMA $NHRP_DESTNBMA || exit 1 + racoonctl establish-sa -w esp inet $NHRP_SRCNBMA $NHRP_DESTNBMA gre || exit 1 ++ vtysh -d bgpd -c "clear bgp $NHRP_DESTADDR" 2>/dev/null || true + ;; + peer-down) + echo "Delete link from $NHRP_SRCADDR ($NHRP_SRCNBMA) to $NHRP_DESTADDR ($NHRP_DESTNBMA)" diff --git a/main/opennhrp/opennhrp.confd b/main/opennhrp/opennhrp.confd new file mode 100644 index 0000000000..c3bece169e --- /dev/null +++ b/main/opennhrp/opennhrp.confd @@ -0,0 +1,2 @@ +# Uncomment the row below to enable verbose logging. +#OPENNHRP_OPTS=-v diff --git a/main/opennhrp/opennhrp.initd b/main/opennhrp/opennhrp.initd new file mode 100755 index 0000000000..6ddb9eca20 --- /dev/null +++ b/main/opennhrp/opennhrp.initd @@ -0,0 +1,33 @@ +#!/sbin/runscript +# Copyright 1999-2004 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/net-analyzer/net-snmp/files/snmpd.rc7,v 1.1 2006/11/26 21:37:22 cedk Exp $ + +PIDFILE=/var/run/opennhrp.pid + +depend() { + use logger dns + need net + after firewall ipsec +} + +checkconfig() { + if [ ! -e /etc/opennhrp/opennhrp.conf ] ; then + eerror "You need an /etc/opennhrp/opennhrp.conf config file to run opennhrp" + return 1 + fi +} + +start() { + checkconfig || return 1 + ebegin "Starting opennhrp" + start-stop-daemon --start --quiet --pidfile $PIDFILE \ + --exec /usr/sbin/opennhrp -- -d -p $PIDFILE 2> /dev/null + eend $? +} + +stop() { + ebegin "Stopping opennhrp" + start-stop-daemon --stop --quiet --pidfile $PIDFILE + eend $? +} |