aboutsummaryrefslogtreecommitdiff
path: root/net/bird
diff options
context:
space:
mode:
authorAlexander V. Chernikov <melifaro@FreeBSD.org>2013-10-21 17:18:36 +0000
committerAlexander V. Chernikov <melifaro@FreeBSD.org>2013-10-21 17:18:36 +0000
commit7081e8f1caf97aabee7acee02fdf8e1250b05916 (patch)
tree881b81f9641197dc03c1f15ff2478164c089620b /net/bird
parent0ac0a9b66aa914ab2713e7818bd45e6fa1272134 (diff)
downloadports-7081e8f1caf97aabee7acee02fdf8e1250b05916.tar.gz
ports-7081e8f1caf97aabee7acee02fdf8e1250b05916.zip
Notes
Diffstat (limited to 'net/bird')
-rw-r--r--net/bird/Makefile5
-rw-r--r--net/bird/files/agg_support.patch16
-rw-r--r--net/bird/files/patch-netst-proto.c51
-rw-r--r--net/bird/files/patch-proto-ospf-hello.c31
-rw-r--r--net/bird/files/patch-proto-ospf-lsupd.c22
-rw-r--r--net/bird/files/patch-sysdep-bsd-krt-sock.c54
-rw-r--r--net/bird/files/patch-sysdep-unix-main.c118
7 files changed, 294 insertions, 3 deletions
diff --git a/net/bird/Makefile b/net/bird/Makefile
index 80eff1f68f6a..85c60dee3937 100644
--- a/net/bird/Makefile
+++ b/net/bird/Makefile
@@ -3,7 +3,7 @@
PORTNAME= bird
PORTVERSION= 1.3.11
-PORTREVISION= 1
+PORTREVISION= 2
CATEGORIES= net
MASTER_SITES= ftp://bird.network.cz/pub/bird/ \
http://bird.mpls.in/distfiles/bird/
@@ -13,8 +13,7 @@ COMMENT= Dynamic IP routing daemon (IPv4 version)
LICENSE= GPLv2
-USES= bison
-USE_GMAKE= yes
+USES= bison gmake
GNU_CONFIGURE= yes
CONFIGURE_ARGS= --localstatedir=/var
USE_CSTD= gnu89
diff --git a/net/bird/files/agg_support.patch b/net/bird/files/agg_support.patch
index 39c513e86cb4..9dd8ca459fa2 100644
--- a/net/bird/files/agg_support.patch
+++ b/net/bird/files/agg_support.patch
@@ -2793,3 +2793,19 @@ index ac6f7a8..4d4dba5 100644
--
1.7.3.2
+--- configure.orig 2012-08-07 13:28:04.000000000 +0400
++++ configure 2012-08-15 15:54:05.000000000 +0400
+@@ -2355,11 +2355,11 @@
+ if test "$enable_ipv6" = yes ; then
+ ip=ipv6
+ SUFFIX=6
+- all_protocols=bgp,ospf,pipe,radv,rip,static
++ all_protocols=bgp,ospf,pipe,radv,rip,static,agg
+ else
+ ip=ipv4
+ SUFFIX=""
+- all_protocols=bgp,ospf,pipe,rip,static
++ all_protocols=bgp,ospf,pipe,rip,static,agg
+ fi
+
+ if test "$given_suffix" = yes ; then
diff --git a/net/bird/files/patch-netst-proto.c b/net/bird/files/patch-netst-proto.c
new file mode 100644
index 000000000000..c15d6e487d1f
--- /dev/null
+++ b/net/bird/files/patch-netst-proto.c
@@ -0,0 +1,51 @@
+diff --git a/nest/proto.c b/nest/proto.c
+index 60495aa..140ec94 100644
+--- nest/proto.c
++++ nest/proto.c
+@@ -376,6 +376,7 @@ int proto_reconfig_type; /* Hack to propagate type info to pipe reconfigure hoo
+ static int
+ proto_reconfigure(struct proto *p, struct proto_config *oc, struct proto_config *nc, int type)
+ {
++ struct announce_hook *ah = p->main_ahook;
+ /* If the protocol is DOWN, we just restart it */
+ if (p->proto_state == PS_DOWN)
+ return 0;
+@@ -407,14 +408,31 @@ proto_reconfigure(struct proto *p, struct proto_config *oc, struct proto_config
+
+ /* Update filters and limits in the main announce hook
+ Note that this also resets limit state */
+- if (p->main_ahook)
++ if (ah)
+ {
+- p->main_ahook->in_filter = nc->in_filter;
+- p->main_ahook->out_filter = nc->out_filter;
+- p->main_ahook->rx_limit = nc->rx_limit;
+- p->main_ahook->in_limit = nc->in_limit;
+- p->main_ahook->out_limit = nc->out_limit;
+- p->main_ahook->in_keep_filtered = nc->in_keep_filtered;
++ ah->in_filter = nc->in_filter;
++ ah->out_filter = nc->out_filter;
++ ah->rx_limit = nc->rx_limit;
++ ah->in_limit = nc->in_limit;
++ ah->out_limit = nc->out_limit;
++ ah->in_keep_filtered = nc->in_keep_filtered;
++
++ if (p->proto_state == PS_UP) /* Recheck export/import/receive limit */
++ {
++ struct proto_stats *stats = ah->stats;
++ struct proto_limit *l = ah->in_limit;
++ u32 all_routes = stats->imp_routes + stats->filt_routes;
++
++ if (l && (stats->imp_routes >= l->limit)) proto_notify_limit(ah, l, PLD_IN, stats->imp_routes);
++
++ l = ah->rx_limit;
++
++ if (l && ( all_routes >= l->limit)) proto_notify_limit(ah, l, PLD_RX, all_routes );
++
++ l = ah->out_limit;
++
++ if (l && ( stats->exp_routes >= l->limit)) proto_notify_limit(ah, l, PLD_OUT, stats->exp_routes);
++ }
+ }
+
+ /* Update routes when filters changed. If the protocol in not UP,
diff --git a/net/bird/files/patch-proto-ospf-hello.c b/net/bird/files/patch-proto-ospf-hello.c
new file mode 100644
index 000000000000..253dc872e3b6
--- /dev/null
+++ b/net/bird/files/patch-proto-ospf-hello.c
@@ -0,0 +1,31 @@
+diff --git a/proto/ospf/hello.c b/proto/ospf/hello.c
+index d5aa1b9..58e87bb 100644
+--- proto/ospf/hello.c
++++ proto/ospf/hello.c
+@@ -101,6 +101,17 @@ ospf_hello_receive(struct ospf_packet *ps_i, struct ospf_iface *ifa,
+ return;
+ }
+
++#ifdef OSPFv2
++ if (n && (n->rid != ntohl(ps_i->routerid)))
++ {
++ OSPF_TRACE(D_EVENTS,
++ "Neighbor %I has changed router id from %R to %R.",
++ n->ip, n->rid, ntohl(ps_i->routerid));
++ ospf_neigh_remove(n);
++ n = NULL;
++ }
++#endif
++
+ if (!n)
+ {
+ if ((ifa->type == OSPF_IT_NBMA) || (ifa->type == OSPF_IT_PTMP))
+@@ -132,7 +143,7 @@ ospf_hello_receive(struct ospf_packet *ps_i, struct ospf_iface *ifa,
+
+ n = ospf_neighbor_new(ifa);
+
+- n->rid = ntohl(((struct ospf_packet *) ps)->routerid);
++ n->rid = ntohl(ps_i->routerid);
+ n->ip = faddr;
+ n->dr = ntohl(ps->dr);
+ n->bdr = ntohl(ps->bdr);
diff --git a/net/bird/files/patch-proto-ospf-lsupd.c b/net/bird/files/patch-proto-ospf-lsupd.c
new file mode 100644
index 000000000000..bd25f3ad3bf4
--- /dev/null
+++ b/net/bird/files/patch-proto-ospf-lsupd.c
@@ -0,0 +1,22 @@
+diff --git a/proto/ospf/lsupd.c b/proto/ospf/lsupd.c
+index a5da425..b19f261 100644
+--- proto/ospf/lsupd.c
++++ proto/ospf/lsupd.c
+@@ -205,7 +205,7 @@ ospf_lsupd_flood(struct proto_ospf *po,
+ en->lsa_body = NULL;
+ DBG("Removing from lsreq list for neigh %R\n", nn->rid);
+ ospf_hash_delete(nn->lsrqh, en);
+- if (EMPTY_SLIST(nn->lsrql))
++ if ((EMPTY_SLIST(nn->lsrql)) && (nn->state == NEIGHBOR_LOADING))
+ ospf_neigh_sm(nn, INM_LOADDONE);
+ continue;
+ break;
+@@ -216,7 +216,7 @@ ospf_lsupd_flood(struct proto_ospf *po,
+ en->lsa_body = NULL;
+ DBG("Removing from lsreq list for neigh %R\n", nn->rid);
+ ospf_hash_delete(nn->lsrqh, en);
+- if (EMPTY_SLIST(nn->lsrql))
++ if ((EMPTY_SLIST(nn->lsrql)) && (nn->state == NEIGHBOR_LOADING))
+ ospf_neigh_sm(nn, INM_LOADDONE);
+ break;
+ default:
diff --git a/net/bird/files/patch-sysdep-bsd-krt-sock.c b/net/bird/files/patch-sysdep-bsd-krt-sock.c
new file mode 100644
index 000000000000..3518b1b085b6
--- /dev/null
+++ b/net/bird/files/patch-sysdep-bsd-krt-sock.c
@@ -0,0 +1,54 @@
+diff --git a/sysdep/bsd/krt-sock.c b/sysdep/bsd/krt-sock.c
+index 08dfccc..3d30036 100644
+--- sysdep/bsd/krt-sock.c
++++ sysdep/bsd/krt-sock.c
+@@ -676,22 +676,18 @@ krt_read_addr(struct ks_msg *msg)
+
+ #ifdef IPV6
+ /* Clean up embedded interface ID returned in link-local address */
++
+ if (ipa_has_link_scope(ifa.ip))
+ _I0(ifa.ip) = 0xfe800000;
+-#endif
+
+-#ifdef IPV6
+- /* Why not the same check also for IPv4? */
+- if ((iface->flags & IF_MULTIACCESS) || (masklen != BITS_PER_IP_ADDRESS))
+-#else
+- if (iface->flags & IF_MULTIACCESS)
++ if (ipa_has_link_scope(ifa.brd))
++ _I0(ifa.brd) = 0xfe800000;
+ #endif
++
++ if (masklen < BITS_PER_IP_ADDRESS)
+ {
+ ifa.prefix = ipa_and(ifa.ip, ipa_mkmask(masklen));
+
+- if (masklen == BITS_PER_IP_ADDRESS)
+- ifa.flags |= IA_HOST;
+-
+ if (masklen == (BITS_PER_IP_ADDRESS - 1))
+ ifa.opposite = ipa_opposite_m1(ifa.ip);
+
+@@ -699,11 +695,19 @@ krt_read_addr(struct ks_msg *msg)
+ if (masklen == (BITS_PER_IP_ADDRESS - 2))
+ ifa.opposite = ipa_opposite_m2(ifa.ip);
+ #endif
++
++ if (!(iface->flags & IF_MULTIACCESS))
++ ifa.opposite = ifa.brd;
+ }
+- else /* PtP iface */
++ else if (!(iface->flags & IF_MULTIACCESS) && ipa_nonzero(ifa.brd))
+ {
+- ifa.flags |= IA_PEER;
+ ifa.prefix = ifa.opposite = ifa.brd;
++ ifa.flags |= IA_PEER;
++ }
++ else
++ {
++ ifa.prefix = ifa.ip;
++ ifa.flags |= IA_HOST;
+ }
+
+ if (new)
diff --git a/net/bird/files/patch-sysdep-unix-main.c b/net/bird/files/patch-sysdep-unix-main.c
new file mode 100644
index 000000000000..9caea0b791bf
--- /dev/null
+++ b/net/bird/files/patch-sysdep-unix-main.c
@@ -0,0 +1,118 @@
+diff --git a/sysdep/unix/main.c b/sysdep/unix/main.c
+index bd80ba2..c7db7c8 100644
+--- sysdep/unix/main.c
++++ sysdep/unix/main.c
+@@ -473,6 +473,58 @@ cli_init_unix(uid_t use_uid, gid_t use_gid)
+ }
+
+ /*
++ * PID file
++ */
++
++static char *pid_file;
++static int pid_fd;
++
++static inline void
++open_pid_file(void)
++{
++ if (!pid_file)
++ return;
++
++ pid_fd = open(pid_file, O_WRONLY|O_CREAT, 0664);
++ if (pid_fd < 0)
++ die("Cannot create PID file %s: %m", pid_file);
++}
++
++static inline void
++write_pid_file(void)
++{
++ int pl, rv;
++ char ps[24];
++
++ if (!pid_file)
++ return;
++
++ /* We don't use PID file for uniqueness, so no need for locking */
++
++ pl = bsnprintf(ps, sizeof(ps), "%ld\n", (long) getpid());
++ if (pl < 0)
++ bug("PID buffer too small");
++
++ rv = ftruncate(pid_fd, 0);
++ if (rv < 0)
++ die("fruncate: %m");
++
++ rv = write(pid_fd, ps, pl);
++ if(rv < 0)
++ die("write: %m");
++
++ close(pid_fd);
++}
++
++static inline void
++unlink_pid_file(void)
++{
++ if (pid_file)
++ unlink(pid_file);
++}
++
++
++/*
+ * Shutdown
+ */
+
+@@ -496,6 +548,7 @@ async_shutdown(void)
+ void
+ sysdep_shutdown_done(void)
+ {
++ unlink_pid_file();
+ unlink(path_control_socket);
+ log_msg(L_FATAL "Shutdown completed");
+ exit(0);
+@@ -548,7 +601,7 @@ signal_init(void)
+ * Parsing of command-line arguments
+ */
+
+-static char *opt_list = "c:dD:ps:u:g:";
++static char *opt_list = "c:dD:ps:P:u:g:";
+ static int parse_and_exit;
+ char *bird_name;
+ static char *use_user;
+@@ -557,7 +610,7 @@ static char *use_group;
+ static void
+ usage(void)
+ {
+- fprintf(stderr, "Usage: %s [-c <config-file>] [-d] [-D <debug-file>] [-p] [-s <control-socket>] [-u <user>] [-g <group>]\n", bird_name);
++ fprintf(stderr, "Usage: %s [-c <config-file>] [-d] [-D <debug-file>] [-p] [-s <control-socket>] [-P <pid-file>] [-u <user>] [-g <group>]\n", bird_name);
+ exit(1);
+ }
+
+@@ -656,6 +709,9 @@ parse_args(int argc, char **argv)
+ case 's':
+ path_control_socket = optarg;
+ break;
++ case 'P':
++ pid_file = optarg;
++ break;
+ case 'u':
+ use_user = optarg;
+ break;
+@@ -709,6 +765,9 @@ main(int argc, char **argv)
+ if (use_uid)
+ drop_uid(use_uid);
+
++ if (!parse_and_exit)
++ open_pid_file();
++
+ protos_build();
+ proto_build(&proto_unix_kernel);
+ proto_build(&proto_unix_iface);
+@@ -733,6 +792,8 @@ main(int argc, char **argv)
+ dup2(0, 2);
+ }
+
++ write_pid_file();
++
+ signal_init();
+
+ #ifdef LOCAL_DEBUG