diff options
author | Claudio Jeker <claudio@cvs.openbsd.org> | 2006-02-10 14:34:41 +0000 |
---|---|---|
committer | Claudio Jeker <claudio@cvs.openbsd.org> | 2006-02-10 14:34:41 +0000 |
commit | 86d5de014aeb7cbd27794d9be74ddc582906f88e (patch) | |
tree | d87d7a6534cf7587a95e78173b366dbe8913a122 | |
parent | 5d628ee84554dd75ab1fb323c174df76f03f835a (diff) |
Make it possible to turn suftreconfig in/out on or off. Default is on for
both directions. Manpage update follows. OK henning@
-rw-r--r-- | usr.sbin/bgpd/bgpd.h | 4 | ||||
-rw-r--r-- | usr.sbin/bgpd/parse.y | 13 | ||||
-rw-r--r-- | usr.sbin/bgpd/printconf.c | 13 | ||||
-rw-r--r-- | usr.sbin/bgpd/rde.c | 16 |
4 files changed, 36 insertions, 10 deletions
diff --git a/usr.sbin/bgpd/bgpd.h b/usr.sbin/bgpd/bgpd.h index 7967d837e34..f0b58ab3009 100644 --- a/usr.sbin/bgpd/bgpd.h +++ b/usr.sbin/bgpd/bgpd.h @@ -1,4 +1,4 @@ -/* $OpenBSD: bgpd.h,v 1.191 2006/02/09 21:05:09 claudio Exp $ */ +/* $OpenBSD: bgpd.h,v 1.192 2006/02/10 14:34:40 claudio Exp $ */ /* * Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org> @@ -234,6 +234,8 @@ struct peer_config { u_int8_t down; u_int8_t announce_capa; u_int8_t reflector_client; + u_int8_t softreconfig_in; + u_int8_t softreconfig_out; }; struct network_config { diff --git a/usr.sbin/bgpd/parse.y b/usr.sbin/bgpd/parse.y index aa3f8bf1fb0..2c472341e11 100644 --- a/usr.sbin/bgpd/parse.y +++ b/usr.sbin/bgpd/parse.y @@ -1,4 +1,4 @@ -/* $OpenBSD: parse.y,v 1.180 2006/02/09 21:05:09 claudio Exp $ */ +/* $OpenBSD: parse.y,v 1.181 2006/02/10 14:34:40 claudio Exp $ */ /* * Copyright (c) 2002, 2003, 2004 Henning Brauer <henning@openbsd.org> @@ -150,7 +150,7 @@ typedef struct { %token RDE EVALUATE IGNORE COMPARE %token GROUP NEIGHBOR NETWORK %token REMOTEAS DESCR LOCALADDR MULTIHOP PASSIVE MAXPREFIX ANNOUNCE -%token ENFORCE NEIGHBORAS CAPABILITIES REFLECTOR DEPEND DOWN +%token ENFORCE NEIGHBORAS CAPABILITIES REFLECTOR DEPEND DOWN SOFTRECONFIG %token DUMP IN OUT %token LOG ROUTECOLL TRANSPARENT %token TCP MD5SIG PASSWORD KEY @@ -894,6 +894,12 @@ peeropts : REMOTEAS asnumber { } free($3); } + | SOFTRECONFIG inout yesno { + if ($2) + curpeer->conf.softreconfig_in = $3; + else + curpeer->conf.softreconfig_out = $3; + } ; family : IPV4 { $$ = AFI_IPv4; } @@ -1579,6 +1585,7 @@ lookup(char *s) { "router-id", ROUTERID}, { "rtlabel", RTLABEL}, { "set", SET}, + { "softreconfig", SOFTRECONFIG}, { "source-as", SOURCEAS}, { "spi", SPI}, { "static", STATIC}, @@ -2107,6 +2114,8 @@ alloc_peer(void) p->conf.capabilities.mp_v4 = SAFI_UNICAST; p->conf.capabilities.mp_v6 = SAFI_NONE; p->conf.capabilities.refresh = 1; + p->conf.softreconfig_in = 1; + p->conf.softreconfig_out = 1; return (p); } diff --git a/usr.sbin/bgpd/printconf.c b/usr.sbin/bgpd/printconf.c index 2fddffe3f29..9581937bef3 100644 --- a/usr.sbin/bgpd/printconf.c +++ b/usr.sbin/bgpd/printconf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: printconf.c,v 1.52 2006/02/09 21:05:09 claudio Exp $ */ +/* $OpenBSD: printconf.c,v 1.53 2006/02/10 14:34:40 claudio Exp $ */ /* * Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org> @@ -307,6 +307,17 @@ print_peer(struct peer_config *p, struct bgpd_config *conf, const char *c) printf("%s\tannounce IPv4 %s\n", c, print_safi(p->capabilities.mp_v4)); printf("%s\tannounce IPv6 %s\n", c, print_safi(p->capabilities.mp_v6)); + if (p->softreconfig_in == 1) + printf("%s\tsoftreconfig in yes\n", c); + else + printf("%s\tsoftreconfig in no\n", c); + + if (p->softreconfig_out == 1) + printf("%s\tsoftreconfig out yes\n", c); + else + printf("%s\tsoftreconfig out no\n", c); + + print_mrt(p->id, p->groupid, c, "\t"); printf("%s}\n", c); diff --git a/usr.sbin/bgpd/rde.c b/usr.sbin/bgpd/rde.c index d2c0a558ec7..6eb2abcfbcf 100644 --- a/usr.sbin/bgpd/rde.c +++ b/usr.sbin/bgpd/rde.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rde.c,v 1.199 2006/02/02 14:06:05 claudio Exp $ */ +/* $OpenBSD: rde.c,v 1.200 2006/02/10 14:34:40 claudio Exp $ */ /* * Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org> @@ -535,12 +535,14 @@ rde_dispatch_imsg_parent(struct imsgbuf *ibuf) LIST_FOREACH(peer, &peerlist, peer_l) { peer->reconf_out = 0; peer->reconf_in = 0; - if (!rde_filter_equal(rules_l, newrules, peer, + if (peer->conf.softreconfig_out && + !rde_filter_equal(rules_l, newrules, peer, DIR_OUT)) { peer->reconf_out = 1; reconf_out = 1; } - if (!rde_filter_equal(rules_l, newrules, peer, + if (peer->conf.softreconfig_in && + !rde_filter_equal(rules_l, newrules, peer, DIR_IN)) { peer->reconf_in = 1; reconf_in = 1; @@ -854,7 +856,8 @@ rde_update_dispatch(struct imsg *imsg) } /* add original path to the Adj-RIB-In */ - path_update(peer, asp, &prefix, prefixlen, F_ORIGINAL); + if (peer->conf.softreconfig_in) + path_update(peer, asp, &prefix, prefixlen, F_ORIGINAL); /* input filter */ if (rde_filter(&fasp, rules_l, peer, asp, &prefix, prefixlen, @@ -944,8 +947,9 @@ rde_update_dispatch(struct imsg *imsg) mplen -= pos; /* add original path to the Adj-RIB-In */ - path_update(peer, asp, &prefix, prefixlen, - F_ORIGINAL); + if (peer->conf.softreconfig_in) + path_update(peer, asp, &prefix, + prefixlen, F_ORIGINAL); /* input filter */ if (rde_filter(&fasp, rules_l, peer, asp, |