diff options
author | Alexander V. Chernikov <melifaro@FreeBSD.org> | 2013-10-21 17:18:36 +0000 |
---|---|---|
committer | Alexander V. Chernikov <melifaro@FreeBSD.org> | 2013-10-21 17:18:36 +0000 |
commit | 7081e8f1caf97aabee7acee02fdf8e1250b05916 (patch) | |
tree | 881b81f9641197dc03c1f15ff2478164c089620b /net/bird6 | |
parent | 0ac0a9b66aa914ab2713e7818bd45e6fa1272134 (diff) |
Add some patches from net/bird git repo:
* merge PID support (4+6)
* merge correct limit checking (4+6)
* merge some OSPF fixes (4+6)
* merge BSD P2P masks fix (4)
Approved by: az
Notes
Notes:
svn path=/head/; revision=331159
Diffstat (limited to 'net/bird6')
-rw-r--r-- | net/bird6/Makefile | 4 | ||||
-rw-r--r-- | net/bird6/files/patch-netst-proto.c | 51 | ||||
-rw-r--r-- | net/bird6/files/patch-proto-ospf-lsupd.c | 22 | ||||
-rw-r--r-- | net/bird6/files/patch-sysdep-unix-main.c | 118 |
4 files changed, 193 insertions, 2 deletions
diff --git a/net/bird6/Makefile b/net/bird6/Makefile index 605f83822342..c8170dbd37b8 100644 --- a/net/bird6/Makefile +++ b/net/bird6/Makefile @@ -3,6 +3,7 @@ PORTNAME= bird6 PORTVERSION= 1.3.11 +PORTREVISION= 1 CATEGORIES= net MASTER_SITES= ftp://bird.network.cz/pub/bird/ \ http://bird.mpls.in/distfiles/bird/ @@ -13,8 +14,7 @@ COMMENT= Dynamic IP routing daemon (IPv6 version) LICENSE= GPLv2 -USES= bison -USE_GMAKE= yes +USES= bison gmake GNU_CONFIGURE= yes CONFIGURE_ARGS= --enable-ipv6 --localstatedir=/var USE_CSTD= gnu89 diff --git a/net/bird6/files/patch-netst-proto.c b/net/bird6/files/patch-netst-proto.c new file mode 100644 index 000000000000..c15d6e487d1f --- /dev/null +++ b/net/bird6/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/bird6/files/patch-proto-ospf-lsupd.c b/net/bird6/files/patch-proto-ospf-lsupd.c new file mode 100644 index 000000000000..bd25f3ad3bf4 --- /dev/null +++ b/net/bird6/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/bird6/files/patch-sysdep-unix-main.c b/net/bird6/files/patch-sysdep-unix-main.c new file mode 100644 index 000000000000..9caea0b791bf --- /dev/null +++ b/net/bird6/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 |