From 226a5e36ca184b52e444a0a7c7602df92da80a03 Mon Sep 17 00:00:00 2001 From: "Alexander V. Chernikov" Date: Wed, 4 Dec 2013 22:08:35 +0000 Subject: [PATCH] * net/bird6 is now slave port for net/bird * Add source address selection fix from upstream * Bump PORTREVISION Reviewed by: timur --- net/bird/Makefile | 21 +-- net/{bird6 => bird}/files/bird6.in | 0 net/bird/files/patch-bfd-saddr.patch | 184 ++++++++++++++++++++++++ net/bird/pkg-plist | 12 +- net/bird6/Makefile | 27 +--- net/bird6/distinfo | 2 - net/bird6/files/patch-tools-Makefile.in | 15 -- 7 files changed, 210 insertions(+), 51 deletions(-) rename net/{bird6 => bird}/files/bird6.in (100%) create mode 100644 net/bird/files/patch-bfd-saddr.patch delete mode 100644 net/bird6/distinfo delete mode 100644 net/bird6/files/patch-tools-Makefile.in diff --git a/net/bird/Makefile b/net/bird/Makefile index c92ec2c927bf..37b1d85b3e5b 100644 --- a/net/bird/Makefile +++ b/net/bird/Makefile @@ -1,30 +1,35 @@ # Created by: Pav Lucistnik # $FreeBSD$ -PORTNAME= bird +PORTNAME?= bird PORTVERSION= 1.4.0 +PORTREVISION= 1 CATEGORIES= net MASTER_SITES= ftp://bird.network.cz/pub/bird/ \ http://bird.mpls.in/distfiles/bird/ MAINTAINER= melifaro@ipfw.ru -COMMENT= Dynamic IP routing daemon (IPv4 version) +COMMENT?= Dynamic IP routing daemon (IPv4 version) LICENSE= GPLv2 USES= bison gmake GNU_CONFIGURE= yes -CONFIGURE_ARGS= --localstatedir=/var +CONFIGURE_ARGS+= --localstatedir=/var USE_CSTD= gnu89 -OPTIONS_DEFINE= FIREWALL AGG +OPTIONS_DEFINE?= FIREWALL AGG FIREWALL_DESC= Enable firewall protocol AGG_DESC= Enable aggregation protocol (EXPERIMENTAL) NO_OPTIONS_SORT= yes MAKE_JOBS_UNSAFE= yes -USE_RC_SUBR= bird +USE_RC_SUBR= ${PORTNAME} + +SUB_LIST+= PORTNAME=${PORTNAME} + +PLIST_SUB?= VER="" NO_STAGE= yes .include @@ -55,9 +60,9 @@ post-patch: .endif post-install: - @if [ ! -f ${PREFIX}/etc/bird.conf ]; then \ - ${CP} -p ${PREFIX}/etc/bird.conf.example ${PREFIX}/etc/bird.conf ; \ - ${CHMOD} 0640 ${PREFIX}/etc/bird.conf ; \ + @if [ ! -f ${PREFIX}/etc/${PORTNAME}.conf ]; then \ + ${CP} -p ${PREFIX}/etc/${PORTNAME}.conf.example ${PREFIX}/etc/${PORTNAME}.conf ; \ + ${CHMOD} 0640 ${PREFIX}/etc/${PORTNAME}.conf ; \ fi .include diff --git a/net/bird6/files/bird6.in b/net/bird/files/bird6.in similarity index 100% rename from net/bird6/files/bird6.in rename to net/bird/files/bird6.in diff --git a/net/bird/files/patch-bfd-saddr.patch b/net/bird/files/patch-bfd-saddr.patch new file mode 100644 index 000000000000..75b964b695a8 --- /dev/null +++ b/net/bird/files/patch-bfd-saddr.patch @@ -0,0 +1,184 @@ +diff --git a/nest/iface.h b/nest/iface.h +index 697ea54..56710e4 100644 +--- nest/iface.h ++++ nest/iface.h +@@ -108,6 +108,7 @@ typedef struct neighbor { + node n; /* Node in global neighbor list */ + node if_n; /* Node in per-interface neighbor list */ + ip_addr addr; /* Address of the neighbor */ ++ struct ifa *ifa; /* Ifa on related iface */ + struct iface *iface; /* Interface it's connected to */ + struct proto *proto; /* Protocol this belongs to */ + void *data; /* Protocol-specific data */ +diff --git a/nest/neighbor.c b/nest/neighbor.c +index 11a980b..48b6b6a 100644 +--- nest/neighbor.c ++++ nest/neighbor.c +@@ -56,14 +56,20 @@ neigh_hash(struct proto *p, ip_addr *a) + } + + static int +-if_connected(ip_addr *a, struct iface *i) /* -1=error, 1=match, 0=no match */ ++if_connected(ip_addr *a, struct iface *i, struct ifa **ap) + { + struct ifa *b; + + if (!(i->flags & IF_UP)) ++ { ++ *ap = NULL; + return -1; ++ } ++ + WALK_LIST(b, i->addrs) + { ++ *ap = b; ++ + if (ipa_equal(*a, b->ip)) + return SCOPE_HOST; + if (b->flags & IA_PEER) +@@ -79,13 +85,18 @@ if_connected(ip_addr *a, struct iface *i) /* -1=error, 1=match, 0=no match */ + if ((b->pxlen < (BITS_PER_IP_ADDRESS - 1)) && + (ipa_equal(*a, b->prefix) || /* Network address */ + ipa_equal(*a, b->brd))) /* Broadcast */ ++ { ++ *ap = NULL; + return -1; ++ } + #endif + + return b->scope; + } + } + } ++ ++ *ap = NULL; + return -1; + } + +@@ -117,6 +128,7 @@ neigh_find2(struct proto *p, ip_addr *a, struct iface *ifa, unsigned flags) + int class, scope = -1; + unsigned int h = neigh_hash(p, a); + struct iface *i; ++ struct ifa *addr; + + WALK_LIST(n, neigh_hash_table[h]) /* Search the cache */ + if (n->proto == p && ipa_equal(*a, n->addr) && (!ifa || (ifa == n->iface))) +@@ -132,7 +144,7 @@ neigh_find2(struct proto *p, ip_addr *a, struct iface *ifa, unsigned flags) + + if (ifa) + { +- scope = if_connected(a, ifa); ++ scope = if_connected(a, ifa, &addr); + flags |= NEF_BIND; + + if ((scope < 0) && (flags & NEF_ONLINK)) +@@ -140,7 +152,7 @@ neigh_find2(struct proto *p, ip_addr *a, struct iface *ifa, unsigned flags) + } + else + WALK_LIST(i, iface_list) +- if ((scope = if_connected(a, i)) >= 0) ++ if ((scope = if_connected(a, i, &addr)) >= 0) + { + ifa = i; + break; +@@ -165,6 +177,7 @@ neigh_find2(struct proto *p, ip_addr *a, struct iface *ifa, unsigned flags) + scope = -1; + } + n->iface = ifa; ++ n->ifa = addr; + n->proto = p; + n->data = NULL; + n->aux = 0; +@@ -216,9 +229,10 @@ neigh_dump_all(void) + } + + static void +-neigh_up(neighbor *n, struct iface *i, int scope) ++neigh_up(neighbor *n, struct iface *i, int scope, struct ifa *a) + { + n->iface = i; ++ n->ifa = a; + n->scope = scope; + add_tail(&i->neighbors, &n->if_n); + rem_node(&n->n); +@@ -235,6 +249,7 @@ neigh_down(neighbor *n) + rem_node(&n->if_n); + if (! (n->flags & NEF_BIND)) + n->iface = NULL; ++ n->ifa = NULL; + n->scope = -1; + if (n->proto->neigh_notify && n->proto->core_state != FS_FLUSHING) + n->proto->neigh_notify(n); +@@ -245,13 +260,14 @@ neigh_down(neighbor *n) + + /* Respawn neighbor if there is another matching prefix */ + struct iface *i; ++ struct ifa *a; + int scope; + + if (!n->iface) + WALK_LIST(i, iface_list) +- if ((scope = if_connected(&n->addr, i)) >= 0) ++ if ((scope = if_connected(&n->addr, i, &a)) >= 0) + { +- neigh_up(n, i, scope); ++ neigh_up(n, i, scope, a); + return; + } + } +@@ -272,13 +288,14 @@ neigh_down(neighbor *n) + void + neigh_if_up(struct iface *i) + { ++ struct ifa *a; + neighbor *n, *next; + int scope; + + WALK_LIST_DELSAFE(n, next, sticky_neigh_list) + if ((!n->iface || n->iface == i) && +- ((scope = if_connected(&n->addr, i)) >= 0)) +- neigh_up(n, i, scope); ++ ((scope = if_connected(&n->addr, i, &a)) >= 0)) ++ neigh_up(n, i, scope, a); + } + + /** +@@ -339,8 +356,9 @@ neigh_ifa_update(struct ifa *a) + /* Remove all neighbors whose scope has changed */ + WALK_LIST_DELSAFE(x, y, i->neighbors) + { ++ struct ifa *aa; + neighbor *n = SKIP_BACK(neighbor, if_n, x); +- if (if_connected(&n->addr, i) != n->scope) ++ if (if_connected(&n->addr, i, &aa) != n->scope) + neigh_down(n); + } + +diff --git a/proto/bfd/bfd.c b/proto/bfd/bfd.c +index 8935548..b697e84 100644 +--- proto/bfd/bfd.c ++++ proto/bfd/bfd.c +@@ -740,7 +740,7 @@ bfd_neigh_notify(struct neighbor *nb) + + if ((nb->scope > 0) && !n->req) + { +- ip_addr local = ipa_nonzero(n->local) ? n->local : nb->iface->addr->ip; ++ ip_addr local = ipa_nonzero(n->local) ? n->local : nb->ifa->ip; + n->req = bfd_request_session(p->p.pool, n->addr, local, nb->iface, NULL, NULL); + } + +diff --git a/proto/bgp/bgp.c b/proto/bgp/bgp.c +index f5b6b8f..7cd0b0a 100644 +--- proto/bgp/bgp.c ++++ proto/bgp/bgp.c +@@ -718,9 +718,8 @@ bgp_start_neighbor(struct bgp_proto *p) + { + /* Called only for single-hop BGP sessions */ + +- /* Remove this ? */ + if (ipa_zero(p->source_addr)) +- p->source_addr = p->neigh->iface->addr->ip; ++ p->source_addr = p->neigh->ifa->ip; + + #ifdef IPV6 + { diff --git a/net/bird/pkg-plist b/net/bird/pkg-plist index 3ddcdebc3d4b..f1192a0ae734 100644 --- a/net/bird/pkg-plist +++ b/net/bird/pkg-plist @@ -1,6 +1,6 @@ -@unexec if cmp -s %D/etc/bird.conf.example %D/etc/bird.conf; then rm -f %D/etc/bird.conf; fi -etc/bird.conf.example -@exec if [ ! -f %D/etc/bird.conf ] ; then cp -p %D/%F %B/bird.conf; fi -sbin/bird -sbin/birdc -sbin/birdcl +@unexec if cmp -s %D/etc/bird%%VER%%.conf.example %D/etc/bird%%VER%%.conf; then rm -f %D/etc/bird%%VER%%.conf; fi +etc/bird%%VER%%.conf.example +@exec if [ ! -f %D/etc/bird%%VER%%.conf ] ; then cp -p %D/%F %B/bird%%VER%%.conf; fi +sbin/bird%%VER%% +sbin/birdc%%VER%% +sbin/birdcl%%VER%% diff --git a/net/bird6/Makefile b/net/bird6/Makefile index 72c564cb7da9..2ce4aabdae60 100644 --- a/net/bird6/Makefile +++ b/net/bird6/Makefile @@ -2,30 +2,17 @@ # $FreeBSD$ PORTNAME= bird6 -PORTVERSION= 1.4.0 -CATEGORIES= net -MASTER_SITES= ftp://bird.network.cz/pub/bird/ \ - http://bird.mpls.in/distfiles/bird/ +COMMENT= Dynamic IP routing daemon (IPv6 version) DISTNAME= bird-${PORTVERSION} -MAINTAINER= melifaro@ipfw.ru -COMMENT= Dynamic IP routing daemon (IPv6 version) +MASTERDIR= ${.CURDIR}/../bird -LICENSE= GPLv2 +OPTIONS_DEFINE= -USES= bison gmake -GNU_CONFIGURE= yes -CONFIGURE_ARGS= --enable-ipv6 --localstatedir=/var -USE_CSTD= gnu89 +USE_RC_SUBR= ${PORTNAME} -MAKE_JOBS_UNSAFE= yes +PLIST_SUB= VER="6" -USE_RC_SUBR= bird6 +CONFIGURE_ARGS= --enable-ipv6 -NO_STAGE= yes -post-install: - @if [ ! -f ${PREFIX}/etc/bird6.conf ]; then \ - ${CP} -p ${PREFIX}/etc/bird6.conf.example ${PREFIX}/etc/bird6.conf ; \ - fi - -.include +.include "${MASTERDIR}/Makefile" diff --git a/net/bird6/distinfo b/net/bird6/distinfo deleted file mode 100644 index abe4022ccdbe..000000000000 --- a/net/bird6/distinfo +++ /dev/null @@ -1,2 +0,0 @@ -SHA256 (bird-1.4.0.tar.gz) = da1b41cab26388b01d861c30afe41678df22dc9ea0110a14c1cc7b7bffc693c5 -SIZE (bird-1.4.0.tar.gz) = 1242728 diff --git a/net/bird6/files/patch-tools-Makefile.in b/net/bird6/files/patch-tools-Makefile.in deleted file mode 100644 index d4e560b1c545..000000000000 --- a/net/bird6/files/patch-tools-Makefile.in +++ /dev/null @@ -1,15 +0,0 @@ ---- tools/Makefile.in.orig 2012-08-07 13:15:45.000000000 +0400 -+++ tools/Makefile.in 2012-08-15 15:51:51.000000000 +0400 -@@ -61,11 +61,7 @@ - if test -n "@CLIENT@" ; then \ - $(INSTALL_PROGRAM) -s $(exedir)/birdc $(DESTDIR)/$(sbindir)/birdc@SUFFIX@ ; \ - fi -- if ! test -f $(DESTDIR)/@CONFIG_FILE@ ; then \ -- $(INSTALL_DATA) $(srcdir)/doc/bird.conf.example $(DESTDIR)/@CONFIG_FILE@ ; \ -- else \ -- echo "Not overwriting old bird@SUFFIX@.conf" ; \ -- fi -+ $(INSTALL_DATA) $(srcdir)/doc/bird.conf.example $(DESTDIR)/@CONFIG_FILE@.example - - install-docs: - $(INSTALL) -d $(DESTDIR)/$(docdir)