diff options
author | hrs <hrs@FreeBSD.org> | 2010-04-10 20:26:08 +0800 |
---|---|---|
committer | hrs <hrs@FreeBSD.org> | 2010-04-10 20:26:08 +0800 |
commit | 71f4276fd3938e8bf5b5bbd3362f2ff41daf6d23 (patch) | |
tree | 7fe77463745493f101db661a10b8bde873f96090 /net | |
parent | e8a886e126b217c51738dd87ae7ea2ba10065760 (diff) | |
download | freebsd-ports-gnome-71f4276fd3938e8bf5b5bbd3362f2ff41daf6d23.tar.gz freebsd-ports-gnome-71f4276fd3938e8bf5b5bbd3362f2ff41daf6d23.tar.zst freebsd-ports-gnome-71f4276fd3938e8bf5b5bbd3362f2ff41daf6d23.zip |
Update to 4.7.20100410.
Diffstat (limited to 'net')
-rw-r--r-- | net/openbgpd/Makefile | 2 | ||||
-rw-r--r-- | net/openbgpd/files/patch-bgpctl_bgpctl.c | 75 | ||||
-rw-r--r-- | net/openbgpd/files/patch-bgpctl_parser.c | 30 | ||||
-rw-r--r-- | net/openbgpd/files/patch-bgpd_bgpd.c | 126 | ||||
-rw-r--r-- | net/openbgpd/files/patch-bgpd_bgpd.conf.5 | 50 | ||||
-rw-r--r-- | net/openbgpd/files/patch-bgpd_bgpd.h | 64 | ||||
-rw-r--r-- | net/openbgpd/files/patch-bgpd_imsg.c | 17 | ||||
-rw-r--r-- | net/openbgpd/files/patch-bgpd_kroute.c | 157 | ||||
-rw-r--r-- | net/openbgpd/files/patch-bgpd_parse.y | 106 | ||||
-rw-r--r-- | net/openbgpd/files/patch-bgpd_printconf.c | 56 | ||||
-rw-r--r-- | net/openbgpd/files/patch-bgpd_rde.c | 39 | ||||
-rw-r--r-- | net/openbgpd/files/patch-bgpd_rde.h | 49 | ||||
-rw-r--r-- | net/openbgpd/files/patch-bgpd_rde_attr.c | 137 | ||||
-rw-r--r-- | net/openbgpd/files/patch-bgpd_rde_filter.c | 27 | ||||
-rw-r--r-- | net/openbgpd/files/patch-bgpd_rde_prefix.c | 31 | ||||
-rw-r--r-- | net/openbgpd/files/patch-bgpd_rde_rib.c | 112 | ||||
-rw-r--r-- | net/openbgpd/files/patch-bgpd_util.c | 56 |
17 files changed, 813 insertions, 321 deletions
diff --git a/net/openbgpd/Makefile b/net/openbgpd/Makefile index a4a44309e8c5..21feb49d6059 100644 --- a/net/openbgpd/Makefile +++ b/net/openbgpd/Makefile @@ -6,7 +6,7 @@ # PORTNAME= openbgpd -PORTVERSION= 4.6.20100227 +PORTVERSION= 4.7.20100410 CATEGORIES= net MASTER_SITES= ${MASTER_SITE_OPENBSD} MASTER_SITE_SUBDIR= OpenBGPD diff --git a/net/openbgpd/files/patch-bgpctl_bgpctl.c b/net/openbgpd/files/patch-bgpctl_bgpctl.c index 96f7769b8144..a55bb3e66674 100644 --- a/net/openbgpd/files/patch-bgpctl_bgpctl.c +++ b/net/openbgpd/files/patch-bgpctl_bgpctl.c @@ -2,13 +2,13 @@ Index: bgpctl/bgpctl.c =================================================================== RCS file: /home/cvs/private/hrs/openbgpd/bgpctl/bgpctl.c,v retrieving revision 1.1.1.7 -retrieving revision 1.6 -diff -u -p -r1.1.1.7 -r1.6 +retrieving revision 1.7 +diff -u -p -r1.1.1.7 -r1.7 --- bgpctl/bgpctl.c 14 Feb 2010 20:20:14 -0000 1.1.1.7 -+++ bgpctl/bgpctl.c 14 Feb 2010 19:55:02 -0000 1.6 ++++ bgpctl/bgpctl.c 10 Apr 2010 12:17:18 -0000 1.7 @@ -1,4 +1,4 @@ -/* $OpenBSD: bgpctl.c,v 1.142 2009/06/06 06:33:15 eric Exp $ */ -+/* $OpenBSD: bgpctl.c,v 1.155 2010/01/10 00:16:23 claudio Exp $ */ ++/* $OpenBSD: bgpctl.c,v 1.157 2010/03/08 17:02:19 claudio Exp $ */ /* * Copyright (c) 2003 Henning Brauer <henning@openbsd.org> @@ -90,7 +90,20 @@ diff -u -p -r1.1.1.7 -r1.6 struct imsg imsg; struct network_config net; struct parse_result *res; -@@ -164,15 +179,17 @@ main(int argc, char *argv[]) +@@ -128,8 +143,11 @@ main(int argc, char *argv[]) + if ((res = parse(argc, argv)) == NULL) + exit(1); + +- if (res->action == IRRFILTER) ++ if (res->action == IRRFILTER) { ++ if (!(res->flags & (F_IPV4|F_IPV6))) ++ res->flags |= (F_IPV4|F_IPV6); + irr_main(res->as.as, res->flags, res->irr_outdir); ++ } + + memcpy(&neighbor.addr, &res->peeraddr, sizeof(neighbor.addr)); + strlcpy(neighbor.descr, res->peerdesc, sizeof(neighbor.descr)); +@@ -164,15 +182,17 @@ main(int argc, char *argv[]) imsg_compose(ibuf, IMSG_CTL_SHOW_TERSE, 0, 0, -1, NULL, 0); break; case SHOW_FIB: @@ -111,7 +124,7 @@ diff -u -p -r1.1.1.7 -r1.6 errx(1, "imsg_add failure"); imsg_close(ibuf, msg); } else -@@ -192,7 +209,7 @@ main(int argc, char *argv[]) +@@ -192,7 +212,7 @@ main(int argc, char *argv[]) case SHOW_NEIGHBOR_TIMERS: case SHOW_NEIGHBOR_TERSE: neighbor.show_timers = (res->action == SHOW_NEIGHBOR_TIMERS); @@ -120,7 +133,7 @@ diff -u -p -r1.1.1.7 -r1.6 imsg_compose(ibuf, IMSG_CTL_SHOW_NEIGHBOR, 0, 0, -1, &neighbor, sizeof(neighbor)); else -@@ -206,7 +223,7 @@ main(int argc, char *argv[]) +@@ -206,7 +226,7 @@ main(int argc, char *argv[]) memcpy(&ribreq.as, &res->as, sizeof(res->as)); type = IMSG_CTL_SHOW_RIB_AS; } @@ -129,7 +142,7 @@ diff -u -p -r1.1.1.7 -r1.6 memcpy(&ribreq.prefix, &res->addr, sizeof(res->addr)); ribreq.prefixlen = res->prefixlen; type = IMSG_CTL_SHOW_RIB_PREFIX; -@@ -220,7 +237,7 @@ main(int argc, char *argv[]) +@@ -220,7 +240,7 @@ main(int argc, char *argv[]) memcpy(&ribreq.neighbor, &neighbor, sizeof(ribreq.neighbor)); strlcpy(ribreq.rib, res->rib, sizeof(ribreq.rib)); @@ -138,7 +151,7 @@ diff -u -p -r1.1.1.7 -r1.6 ribreq.flags = res->flags; imsg_compose(ibuf, type, 0, 0, -1, &ribreq, sizeof(ribreq)); if (!(res->flags & F_CTL_DETAIL)) -@@ -290,12 +307,21 @@ main(int argc, char *argv[]) +@@ -290,12 +310,21 @@ main(int argc, char *argv[]) break; case NETWORK_SHOW: bzero(&ribreq, sizeof(ribreq)); @@ -161,7 +174,7 @@ diff -u -p -r1.1.1.7 -r1.6 } while (ibuf->w.queued) -@@ -304,13 +330,13 @@ main(int argc, char *argv[]) +@@ -304,13 +333,13 @@ main(int argc, char *argv[]) while (!done) { if ((n = imsg_read(ibuf)) == -1) @@ -177,7 +190,7 @@ diff -u -p -r1.1.1.7 -r1.6 if (n == 0) break; -@@ -373,6 +399,8 @@ main(int argc, char *argv[]) +@@ -373,6 +402,8 @@ main(int argc, char *argv[]) case NETWORK_REMOVE: case NETWORK_FLUSH: case IRRFILTER: @@ -186,7 +199,7 @@ diff -u -p -r1.1.1.7 -r1.6 break; } imsg_free(&imsg); -@@ -398,8 +426,8 @@ fmt_peer(const char *descr, const struct +@@ -398,8 +429,8 @@ fmt_peer(const char *descr, const struct } ip = log_addr(remote_addr); @@ -197,7 +210,7 @@ diff -u -p -r1.1.1.7 -r1.6 if (asprintf(&p, "%s/%u", ip, masklen) == -1) err(1, NULL); } else { -@@ -521,13 +549,15 @@ show_neighbor_msg(struct imsg *imsg, enu +@@ -521,13 +552,15 @@ show_neighbor_msg(struct imsg *imsg, enu struct ctl_timer *t; struct in_addr ina; char buf[NI_MAXHOST], pbuf[NI_MAXSERV], *s; @@ -215,7 +228,7 @@ diff -u -p -r1.1.1.7 -r1.6 p->conf.remote_masklen != 128)) { if (asprintf(&s, "%s/%u", log_addr(&p->conf.remote_addr), -@@ -549,6 +579,10 @@ show_neighbor_msg(struct imsg *imsg, enu +@@ -549,6 +582,10 @@ show_neighbor_msg(struct imsg *imsg, enu printf(", Template"); if (p->conf.cloned) printf(", Cloned"); @@ -226,7 +239,7 @@ diff -u -p -r1.1.1.7 -r1.6 printf("\n"); if (p->conf.descr[0]) printf(" Description: %s\n", p->conf.descr); -@@ -563,17 +597,16 @@ show_neighbor_msg(struct imsg *imsg, enu +@@ -563,17 +600,16 @@ show_neighbor_msg(struct imsg *imsg, enu printf(" Last read %s, holdtime %us, keepalive interval %us\n", fmt_timeframe(p->stats.last_read), p->holdtime, p->holdtime/3); @@ -253,7 +266,7 @@ diff -u -p -r1.1.1.7 -r1.6 } if (p->capa.peer.refresh) printf(" Route Refresh\n"); -@@ -633,20 +666,16 @@ show_neighbor_msg(struct imsg *imsg, enu +@@ -633,20 +669,16 @@ show_neighbor_msg(struct imsg *imsg, enu } void @@ -283,7 +296,7 @@ diff -u -p -r1.1.1.7 -r1.6 } void -@@ -680,7 +709,7 @@ print_neighbor_msgstats(struct peer *p) +@@ -680,7 +712,7 @@ print_neighbor_msgstats(struct peer *p) } void @@ -292,7 +305,7 @@ diff -u -p -r1.1.1.7 -r1.6 { printf(" %-20s ", name); -@@ -848,35 +877,70 @@ show_fib_msg(struct imsg *imsg) +@@ -848,35 +880,70 @@ show_fib_msg(struct imsg *imsg) void show_nexthop_head(void) { @@ -381,7 +394,7 @@ diff -u -p -r1.1.1.7 -r1.6 } printf("\n"); break; -@@ -898,9 +962,8 @@ show_interface_head(void) +@@ -898,9 +965,8 @@ show_interface_head(void) "Link state"); } @@ -393,18 +406,18 @@ diff -u -p -r1.1.1.7 -r1.6 const struct ifmedia_description ifm_type_descriptions[] = IFM_TYPE_DESCRIPTIONS; -@@ -936,36 +999,36 @@ get_media_descr(int media_type) +@@ -936,36 +1002,36 @@ get_media_descr(int media_type) const char * get_linkstate(int media_type, int link_state) { - const struct ifmedia_status_description *p; - int i; +- +- if (link_state == LINK_STATE_UNKNOWN) +- return ("unknown"); + const struct if_status_description *p; + static char buf[8]; -- if (link_state == LINK_STATE_UNKNOWN) -- return ("unknown"); -- - for (i = 0; ifm_status_valid_list[i] != 0; i++) - for (p = ifm_status_descriptions; p->ifms_valid != 0; p++) { - if (p->ifms_type != media_type || @@ -452,7 +465,7 @@ diff -u -p -r1.1.1.7 -r1.6 } int -@@ -982,17 +1045,12 @@ show_interface_msg(struct imsg *imsg) +@@ -982,17 +1048,12 @@ show_interface_msg(struct imsg *imsg) printf("%-15s", k->flags & IFF_UP ? "UP" : ""); if ((ifms_type = ift2ifm(k->media_type)) != 0) @@ -475,7 +488,7 @@ diff -u -p -r1.1.1.7 -r1.6 printf("\n"); break; case IMSG_CTL_END: -@@ -1011,7 +1069,7 @@ show_rib_summary_head(void) +@@ -1011,7 +1072,7 @@ show_rib_summary_head(void) printf( "flags: * = Valid, > = Selected, I = via IBGP, A = Announced\n"); printf("origin: i = IGP, e = EGP, ? = Incomplete\n\n"); @@ -484,7 +497,7 @@ diff -u -p -r1.1.1.7 -r1.6 "gateway", "lpref", "med", "aspath origin"); } -@@ -1085,7 +1143,7 @@ show_rib_summary_msg(struct imsg *imsg) +@@ -1085,7 +1146,7 @@ show_rib_summary_msg(struct imsg *imsg) memcpy(&rib, imsg->data, sizeof(rib)); print_prefix(&rib.prefix, rib.prefixlen, rib.flags); @@ -493,7 +506,7 @@ diff -u -p -r1.1.1.7 -r1.6 printf(" %5u %5u ", rib.local_pref, rib.med); -@@ -1190,7 +1248,7 @@ show_rib_detail_msg(struct imsg *imsg, i +@@ -1190,7 +1251,7 @@ show_rib_detail_msg(struct imsg *imsg, i memcpy(&as, data, sizeof(as)); memcpy(&id, data + sizeof(as), sizeof(id)); printf(" Aggregator: %s [%s]\n", @@ -502,7 +515,7 @@ diff -u -p -r1.1.1.7 -r1.6 break; case ATTR_ORIGINATOR_ID: memcpy(&id, data, sizeof(id)); -@@ -1236,22 +1294,27 @@ fmt_mem(int64_t num) +@@ -1236,22 +1297,27 @@ fmt_mem(int64_t num) return (buf); } @@ -537,7 +550,7 @@ diff -u -p -r1.1.1.7 -r1.6 printf("%10lld rib entries using %s of memory\n", (long long)stats.rib_cnt, fmt_mem(stats.rib_cnt * sizeof(struct rib_entry))); -@@ -1272,9 +1335,7 @@ show_rib_memory_msg(struct imsg *imsg) +@@ -1272,9 +1338,7 @@ show_rib_memory_msg(struct imsg *imsg) (long long)stats.attr_refs); printf("%10lld BGP attributes using %s of memory\n", (long long)stats.attr_dcnt, fmt_mem(stats.attr_data)); @@ -548,7 +561,7 @@ diff -u -p -r1.1.1.7 -r1.6 stats.prefix_cnt * sizeof(struct prefix) + stats.rib_cnt * sizeof(struct rib_entry) + stats.path_cnt * sizeof(struct rde_aspath) + -@@ -1328,30 +1389,6 @@ show_community(u_char *data, u_int16_t l +@@ -1328,30 +1392,6 @@ show_community(u_char *data, u_int16_t l } } @@ -579,7 +592,7 @@ diff -u -p -r1.1.1.7 -r1.6 void show_ext_community(u_char *data, u_int16_t len) { -@@ -1372,24 +1409,25 @@ show_ext_community(u_char *data, u_int16 +@@ -1372,24 +1412,25 @@ show_ext_community(u_char *data, u_int16 case EXT_COMMUNITY_TWO_AS: memcpy(&as2, data + i + 2, sizeof(as2)); memcpy(&u32, data + i + 4, sizeof(u32)); diff --git a/net/openbgpd/files/patch-bgpctl_parser.c b/net/openbgpd/files/patch-bgpctl_parser.c index dd0ae874e3df..5efa4ce8cd49 100644 --- a/net/openbgpd/files/patch-bgpctl_parser.c +++ b/net/openbgpd/files/patch-bgpctl_parser.c @@ -2,13 +2,13 @@ Index: bgpctl/parser.c =================================================================== RCS file: /home/cvs/private/hrs/openbgpd/bgpctl/parser.c,v retrieving revision 1.1.1.6 -retrieving revision 1.4 -diff -u -p -r1.1.1.6 -r1.4 +retrieving revision 1.5 +diff -u -p -r1.1.1.6 -r1.5 --- bgpctl/parser.c 14 Feb 2010 20:20:14 -0000 1.1.1.6 -+++ bgpctl/parser.c 4 Feb 2010 16:22:26 -0000 1.4 ++++ bgpctl/parser.c 10 Apr 2010 12:17:18 -0000 1.5 @@ -1,4 +1,4 @@ -/* $OpenBSD: parser.c,v 1.54 2009/06/12 16:44:02 claudio Exp $ */ -+/* $OpenBSD: parser.c,v 1.60 2010/01/13 06:04:00 claudio Exp $ */ ++/* $OpenBSD: parser.c,v 1.61 2010/03/08 17:02:19 claudio Exp $ */ /* * Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org> @@ -52,15 +52,7 @@ diff -u -p -r1.1.1.6 -r1.4 static struct parse_result res; const struct token *match_token(int *argc, char **argv[], -@@ -336,6 +348,7 @@ parse(int argc, char *argv[]) - bzero(&res, sizeof(res)); - res.community.as = COMMUNITY_UNSET; - res.community.type = COMMUNITY_UNSET; -+ res.flags = (F_IPV4 | F_IPV6); - TAILQ_INIT(&res.set); - if ((res.irr_outdir = getcwd(NULL, 0)) == NULL) { - fprintf(stderr, "getcwd failed: %s", strerror(errno)); -@@ -404,15 +417,22 @@ match_token(int *argc, char **argv[], co +@@ -404,15 +416,22 @@ match_token(int *argc, char **argv[], co case FAMILY: if (word == NULL) break; @@ -87,7 +79,7 @@ diff -u -p -r1.1.1.6 -r1.4 } break; case ADDRESS: -@@ -584,7 +604,7 @@ show_valid_args(const struct token table +@@ -584,7 +603,7 @@ show_valid_args(const struct token table fprintf(stderr, " <pftable>\n"); break; case FAMILY: @@ -96,7 +88,7 @@ diff -u -p -r1.1.1.6 -r1.4 break; case GETOPT: fprintf(stderr, " <options>\n"); -@@ -608,7 +628,7 @@ parse_addr(const char *word, struct bgpd +@@ -608,7 +627,7 @@ parse_addr(const char *word, struct bgpd bzero(&ina, sizeof(ina)); if (inet_net_pton(AF_INET, word, &ina, sizeof(ina)) != -1) { @@ -105,7 +97,7 @@ diff -u -p -r1.1.1.6 -r1.4 addr->v4 = ina; return (1); } -@@ -618,13 +638,7 @@ parse_addr(const char *word, struct bgpd +@@ -618,13 +637,7 @@ parse_addr(const char *word, struct bgpd hints.ai_socktype = SOCK_DGRAM; /*dummy*/ hints.ai_flags = AI_NUMERICHOST; if (getaddrinfo(word, "0", &hints, &r) == 0) { @@ -120,7 +112,7 @@ diff -u -p -r1.1.1.6 -r1.4 freeaddrinfo(r); return (1); } -@@ -663,15 +677,15 @@ parse_prefix(const char *word, struct bg +@@ -663,15 +676,15 @@ parse_prefix(const char *word, struct bg if (parse_addr(word, addr) == 0) return (0); @@ -139,7 +131,7 @@ diff -u -p -r1.1.1.6 -r1.4 if (mask == -1) mask = 128; inet6applymask(&addr->v6, &addr->v6, mask); -@@ -706,7 +720,7 @@ parse_asnum(const char *word, u_int32_t +@@ -706,7 +719,7 @@ parse_asnum(const char *word, u_int32_t if (errstr) errx(1, "AS number is %s: %s", errstr, word); } else { @@ -148,7 +140,7 @@ diff -u -p -r1.1.1.6 -r1.4 if (errstr) errx(1, "AS number is %s: %s", errstr, word); } -@@ -882,8 +896,14 @@ bgpctl_getopt(int *argc, char **argv[], +@@ -882,8 +895,14 @@ bgpctl_getopt(int *argc, char **argv[], int ch; optind = optreset = 1; diff --git a/net/openbgpd/files/patch-bgpd_bgpd.c b/net/openbgpd/files/patch-bgpd_bgpd.c index 520f82348b10..788b053a2d48 100644 --- a/net/openbgpd/files/patch-bgpd_bgpd.c +++ b/net/openbgpd/files/patch-bgpd_bgpd.c @@ -2,45 +2,57 @@ Index: bgpd/bgpd.c =================================================================== RCS file: /home/cvs/private/hrs/openbgpd/bgpd/bgpd.c,v retrieving revision 1.1.1.7 -retrieving revision 1.1.1.8 -diff -u -p -r1.1.1.7 -r1.1.1.8 +retrieving revision 1.1.1.9 +diff -u -p -r1.1.1.7 -r1.1.1.9 --- bgpd/bgpd.c 14 Feb 2010 20:19:57 -0000 1.1.1.7 -+++ bgpd/bgpd.c 14 Feb 2010 20:27:06 -0000 1.1.1.8 ++++ bgpd/bgpd.c 10 Apr 2010 12:13:04 -0000 1.1.1.9 @@ -1,4 +1,4 @@ -/* $OpenBSD: bgpd.c,v 1.148 2009/06/07 00:30:23 claudio Exp $ */ -+/* $OpenBSD: bgpd.c,v 1.154 2010/02/11 14:40:06 claudio Exp $ */ ++/* $OpenBSD: bgpd.c,v 1.156 2010/03/29 09:09:25 claudio Exp $ */ /* * Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org> -@@ -101,15 +101,11 @@ int +@@ -42,7 +42,7 @@ int main(int, char *[]); + int check_child(pid_t, const char *); + int send_filterset(struct imsgbuf *, struct filter_set_head *); + int reconfigure(char *, struct bgpd_config *, struct mrt_head *, +- struct peer **, struct filter_head *); ++ struct peer **); + int dispatch_imsg(struct imsgbuf *, int); + + int rfd = -1; +@@ -101,15 +101,10 @@ int main(int argc, char *argv[]) { struct bgpd_config conf; - struct peer *peer_l, *p; struct mrt_head mrt_l; - struct network_head net_l; -+ struct peer *peer_l, *p; - struct filter_head *rules_l; +- struct filter_head *rules_l; - struct network *net; - struct filter_rule *r; ++ struct peer *peer_l, *p; struct mrt *m; struct listen_addr *la; - struct rde_rib *rr; struct pollfd pfd[POLL_MAX]; pid_t io_pid = 0, rde_pid = 0, pid; char *conffile; -@@ -129,9 +125,8 @@ main(int argc, char *argv[]) - err(1, NULL); +@@ -125,13 +120,8 @@ main(int argc, char *argv[]) + log_init(1); /* log to stderr until daemonized */ + +- if ((rules_l = calloc(1, sizeof(struct filter_head))) == NULL) +- err(1, NULL); +- bzero(&conf, sizeof(conf)); -- LIST_INIT(&mrt_l); + LIST_INIT(&mrt_l); - TAILQ_INIT(&net_l); - TAILQ_INIT(rules_l); -+ LIST_INIT(&mrt_l); +- TAILQ_INIT(rules_l); peer_l = NULL; conf.csock = SOCKET_NAME; -@@ -158,6 +153,7 @@ main(int argc, char *argv[]) +@@ -158,6 +148,7 @@ main(int argc, char *argv[]) if (conf.opts & BGPD_OPT_VERBOSE) conf.opts |= BGPD_OPT_VERBOSE2; conf.opts |= BGPD_OPT_VERBOSE; @@ -48,7 +60,7 @@ diff -u -p -r1.1.1.7 -r1.1.1.8 break; case 'r': conf.rcsock = optarg; -@@ -176,12 +172,15 @@ main(int argc, char *argv[]) +@@ -176,14 +167,16 @@ main(int argc, char *argv[]) if (argc > 0) usage(); @@ -58,18 +70,20 @@ diff -u -p -r1.1.1.7 -r1.1.1.8 - } - if (conf.opts & BGPD_OPT_NOACTION) { -+ struct network_head net_l; -+ TAILQ_INIT(&net_l); ++ struct network_head net_l; ++ struct filter_head rules_l; ++ + if (parse_config(conffile, &conf, &mrt_l, &peer_l, &net_l, -+ rules_l)) { -+ free(rules_l); ++ &rules_l)) + exit(1); -+ } + if (conf.opts & BGPD_OPT_VERBOSE) - print_config(&conf, &ribnames, &net_l, peer_l, rules_l, +- print_config(&conf, &ribnames, &net_l, peer_l, rules_l, ++ print_config(&conf, &ribnames, &net_l, peer_l, &rules_l, &mrt_l); -@@ -225,13 +224,10 @@ main(int argc, char *argv[]) + else + fprintf(stderr, "configuration OK\n"); +@@ -225,13 +218,10 @@ main(int argc, char *argv[]) session_socket_blockmode(pipe_s2r_c[0], BM_NONBLOCK); session_socket_blockmode(pipe_s2r_c[1], BM_NONBLOCK); @@ -86,11 +100,11 @@ diff -u -p -r1.1.1.7 -r1.1.1.8 setproctitle("parent"); -@@ -254,33 +250,13 @@ main(int argc, char *argv[]) +@@ -254,33 +244,13 @@ main(int argc, char *argv[]) imsg_init(ibuf_se, pipe_m2s[0]); imsg_init(ibuf_rde, pipe_m2r[0]); mrt_init(ibuf_rde, ibuf_se); -+ quit = reconfigure(conffile, &conf, &mrt_l, &peer_l, rules_l); ++ quit = reconfigure(conffile, &conf, &mrt_l, &peer_l); if ((rfd = kr_init(!(conf.flags & BGPD_FLAG_NO_FIB_UPDATE), conf.rtableid)) == -1) quit = 1; @@ -121,7 +135,17 @@ diff -u -p -r1.1.1.7 -r1.1.1.8 while (quit == 0) { bzero(pfd, sizeof(pfd)); pfd[PFD_PIPE_SESSION].fd = ibuf_se->fd; -@@ -389,11 +365,12 @@ main(int argc, char *argv[]) +@@ -336,8 +306,7 @@ main(int argc, char *argv[]) + + reconfig = 0; + log_info("rereading config"); +- switch (reconfigure(conffile, &conf, &mrt_l, &peer_l, +- rules_l)) { ++ switch (reconfigure(conffile, &conf, &mrt_l, &peer_l)) { + case -1: /* fatal error */ + quit = 1; + break; +@@ -389,13 +358,13 @@ main(int argc, char *argv[]) LIST_REMOVE(m, entry); free(m); } @@ -137,10 +161,27 @@ diff -u -p -r1.1.1.7 -r1.1.1.8 + free(la); + } - free(rules_l); +- free(rules_l); control_cleanup(conf.csock); -@@ -464,6 +441,10 @@ reconfigure(char *conffile, struct bgpd_ - if (parse_config(conffile, conf, mrt_l, peer_l, &net_l, rules_l)) { + control_cleanup(conf.rcsock); + carp_demote_shutdown(); +@@ -452,18 +421,23 @@ send_filterset(struct imsgbuf *i, struct + + int + reconfigure(char *conffile, struct bgpd_config *conf, struct mrt_head *mrt_l, +- struct peer **peer_l, struct filter_head *rules_l) ++ struct peer **peer_l) + { + struct network_head net_l; ++ struct filter_head rules_l; + struct network *n; + struct peer *p; + struct filter_rule *r; + struct listen_addr *la; + struct rde_rib *rr; + +- if (parse_config(conffile, conf, mrt_l, peer_l, &net_l, rules_l)) { ++ if (parse_config(conffile, conf, mrt_l, peer_l, &net_l, &rules_l)) { log_warnx("config file %s has errors, not reloading", conffile); + while ((rr = SIMPLEQ_FIRST(&ribnames))) { @@ -150,7 +191,23 @@ diff -u -p -r1.1.1.7 -r1.1.1.8 return (1); } -@@ -550,8 +531,8 @@ int +@@ -525,13 +499,13 @@ reconfigure(char *conffile, struct bgpd_ + return (-1); + + /* filters for the RDE */ +- while ((r = TAILQ_FIRST(rules_l)) != NULL) { ++ while ((r = TAILQ_FIRST(&rules_l)) != NULL) { + if (imsg_compose(ibuf_rde, IMSG_RECONF_FILTER, 0, 0, -1, + r, sizeof(struct filter_rule)) == -1) + return (-1); + if (send_filterset(ibuf_rde, &r->set) == -1) + return (-1); +- TAILQ_REMOVE(rules_l, r, entry); ++ TAILQ_REMOVE(&rules_l, r, entry); + filterset_free(&r->set); + free(r); + } +@@ -550,8 +524,8 @@ int dispatch_imsg(struct imsgbuf *ibuf, int idx) { struct imsg imsg; @@ -161,7 +218,7 @@ diff -u -p -r1.1.1.7 -r1.1.1.8 if ((n = imsg_read(ibuf)) == -1) return (-1); -@@ -692,6 +673,11 @@ dispatch_imsg(struct imsgbuf *ibuf, int +@@ -692,6 +666,11 @@ dispatch_imsg(struct imsgbuf *ibuf, int carp_demote_set(msg->demote_group, msg->level); } break; @@ -173,7 +230,7 @@ diff -u -p -r1.1.1.7 -r1.1.1.8 default: break; } -@@ -707,7 +693,7 @@ send_nexthop_update(struct kroute_nextho +@@ -707,7 +686,7 @@ send_nexthop_update(struct kroute_nextho { char *gw = NULL; @@ -182,7 +239,7 @@ diff -u -p -r1.1.1.7 -r1.1.1.8 if (asprintf(&gw, ": via %s", log_addr(&msg->gateway)) == -1) { log_warn("send_nexthop_update"); -@@ -717,7 +703,7 @@ send_nexthop_update(struct kroute_nextho +@@ -717,7 +696,7 @@ send_nexthop_update(struct kroute_nextho log_info("nexthop %s now %s%s%s", log_addr(&msg->nexthop), msg->valid ? "valid" : "invalid", msg->connected ? ": directly connected" : "", @@ -191,7 +248,7 @@ diff -u -p -r1.1.1.7 -r1.1.1.8 free(gw); -@@ -758,12 +744,12 @@ bgpd_redistribute(int type, struct krout +@@ -758,17 +737,16 @@ bgpd_redistribute(int type, struct krout fatalx("bgpd_redistribute: unable to redistribute v4 and v6" "together"); if (kr != NULL) { @@ -206,3 +263,8 @@ diff -u -p -r1.1.1.7 -r1.1.1.8 memcpy(&net.prefix.v6, &kr6->prefix, sizeof(struct in6_addr)); net.prefixlen = kr6->prefixlen; } + +- + if (imsg_compose(ibuf_rde, type, 0, 0, -1, &net, + sizeof(struct network_config)) == -1) + return (-1); diff --git a/net/openbgpd/files/patch-bgpd_bgpd.conf.5 b/net/openbgpd/files/patch-bgpd_bgpd.conf.5 index b1ccbec4a8f2..3c658e499a18 100644 --- a/net/openbgpd/files/patch-bgpd_bgpd.conf.5 +++ b/net/openbgpd/files/patch-bgpd_bgpd.conf.5 @@ -2,13 +2,13 @@ Index: bgpd/bgpd.conf.5 =================================================================== RCS file: /home/cvs/private/hrs/openbgpd/bgpd/bgpd.conf.5,v retrieving revision 1.1.1.7 -retrieving revision 1.6 -diff -u -p -r1.1.1.7 -r1.6 +retrieving revision 1.7 +diff -u -p -r1.1.1.7 -r1.7 --- bgpd/bgpd.conf.5 14 Feb 2010 20:19:57 -0000 1.1.1.7 -+++ bgpd/bgpd.conf.5 4 Feb 2010 16:22:23 -0000 1.6 ++++ bgpd/bgpd.conf.5 10 Apr 2010 12:16:23 -0000 1.7 @@ -1,4 +1,4 @@ -.\" $OpenBSD: bgpd.conf.5,v 1.94 2009/06/07 00:31:22 claudio Exp $ -+.\" $OpenBSD: bgpd.conf.5,v 1.103 2009/12/16 15:40:55 claudio Exp $ ++.\" $OpenBSD: bgpd.conf.5,v 1.104 2010/03/05 15:25:00 claudio Exp $ .\" .\" Copyright (c) 2004 Claudio Jeker <claudio@openbsd.org> .\" Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org> @@ -17,7 +17,7 @@ diff -u -p -r1.1.1.7 -r1.6 .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. .\" -.Dd $Mdocdate: June 7 2009 $ -+.Dd $Mdocdate: November 26 2009 $ ++.Dd $Mdocdate: December 16 2009 $ .Dt BGPD.CONF 5 .Os .Sh NAME @@ -141,7 +141,39 @@ diff -u -p -r1.1.1.7 -r1.6 Bind the neighbor to the specified RIB. .Pp .It Ic route-reflector Op Ar address -@@ -1028,6 +1068,12 @@ matches a rule which has the +@@ -917,6 +957,31 @@ may be set to + which is expanded to the current neighbor remote AS number. + .Pp + .It Xo ++.Ic ext-community ++.Ar subtype Ar as-number Ns Li : Ns Ar local ++.Xc ++.It Xo ++.Ic ext-community ++.Ar subtype Ar IP Ns Li : Ns Ar local ++.Xc ++.It Xo ++.Ic ext-community ++.Ar subtype Ar numvalue ++.Xc ++This rule applies only to ++.Em UPDATES ++where the ++.Em extended community ++path attribute is present and matches. ++Extended Communities are specified by a ++.Ar subtype ++and normally two values, a globally unique part (e.g. the AS number) and a ++local part. ++See also the ++.Sx ATTRIBUTE SET ++section for further information about the encoding. ++.Pp ++.It Xo + .Pq Ic from Ns \&| Ns Ic to + .Ar peer + .Xc +@@ -1028,6 +1093,12 @@ matches a rule which has the option set, this rule is considered the last matching rule, and evaluation of subsequent rules is skipped. .Pp @@ -154,7 +186,7 @@ diff -u -p -r1.1.1.7 -r1.6 .It Ic set Ar attribute ... All matching rules can set the .Em AS path attributes -@@ -1079,6 +1125,48 @@ Alternately, well-known communities may +@@ -1079,6 +1150,48 @@ Alternately, well-known communities may or .Ic NO_PEER . .Pp @@ -203,7 +235,7 @@ diff -u -p -r1.1.1.7 -r1.6 .It Ic localpref Ar number Set the .Em LOCAL_PREF -@@ -1108,6 +1196,20 @@ otherwise it will be set to +@@ -1108,6 +1221,20 @@ otherwise it will be set to .Ar number . .Pp .It Xo @@ -224,7 +256,7 @@ diff -u -p -r1.1.1.7 -r1.6 .Ic nexthop .Sm off .Po Ar address \*(Ba -@@ -1181,8 +1283,8 @@ For prefixes with equally long paths, th +@@ -1181,8 +1308,8 @@ For prefixes with equally long paths, th is selected. .El .Sh FILES diff --git a/net/openbgpd/files/patch-bgpd_bgpd.h b/net/openbgpd/files/patch-bgpd_bgpd.h index 89f2e5115d14..d522bad36b14 100644 --- a/net/openbgpd/files/patch-bgpd_bgpd.h +++ b/net/openbgpd/files/patch-bgpd_bgpd.h @@ -2,13 +2,13 @@ Index: bgpd/bgpd.h =================================================================== RCS file: /home/cvs/private/hrs/openbgpd/bgpd/bgpd.h,v retrieving revision 1.1.1.8 -retrieving revision 1.10 -diff -u -p -r1.1.1.8 -r1.10 +retrieving revision 1.11 +diff -u -p -r1.1.1.8 -r1.11 --- bgpd/bgpd.h 14 Feb 2010 20:19:57 -0000 1.1.1.8 -+++ bgpd/bgpd.h 14 Feb 2010 19:53:36 -0000 1.10 ++++ bgpd/bgpd.h 10 Apr 2010 12:16:23 -0000 1.11 @@ -1,4 +1,4 @@ -/* $OpenBSD: bgpd.h,v 1.241 2009/06/12 16:42:53 claudio Exp $ */ -+/* $OpenBSD: bgpd.h,v 1.252 2010/01/13 06:02:37 claudio Exp $ */ ++/* $OpenBSD: bgpd.h,v 1.255 2010/04/06 13:25:08 claudio Exp $ */ /* * Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org> @@ -150,7 +150,24 @@ diff -u -p -r1.1.1.8 -r1.10 IMSG_NETWORK_ADD, IMSG_NETWORK_REMOVE, IMSG_NETWORK_FLUSH, -@@ -423,8 +483,7 @@ struct kif { +@@ -400,14 +460,12 @@ struct kroute6 { + }; + + struct kroute_nexthop { +- union { +- struct kroute kr4; +- struct kroute6 kr6; +- } kr; + struct bgpd_addr nexthop; + struct bgpd_addr gateway; ++ struct bgpd_addr net; + u_int8_t valid; + u_int8_t connected; ++ u_int8_t netlen; + }; + + struct kif { +@@ -423,8 +481,7 @@ struct kif { struct session_up { struct bgpd_addr local_addr; struct bgpd_addr remote_addr; @@ -160,7 +177,7 @@ diff -u -p -r1.1.1.8 -r1.10 u_int32_t remote_bgpid; u_int16_t short_as; }; -@@ -437,8 +496,13 @@ struct pftable_msg { +@@ -437,8 +494,13 @@ struct pftable_msg { struct ctl_show_nexthop { struct bgpd_addr addr; @@ -175,11 +192,12 @@ diff -u -p -r1.1.1.8 -r1.10 }; struct ctl_neighbor { -@@ -508,6 +572,27 @@ struct filter_community { +@@ -508,6 +570,28 @@ struct filter_community { int type; }; +struct filter_extcommunity { ++ u_int16_t flags; + u_int8_t type; + u_int8_t subtype; /* if extended type */ + union { @@ -203,7 +221,7 @@ diff -u -p -r1.1.1.8 -r1.10 struct ctl_show_rib_request { char rib[PEER_DESCR_LEN]; struct ctl_neighbor neighbor; -@@ -518,8 +603,8 @@ struct ctl_show_rib_request { +@@ -518,8 +602,8 @@ struct ctl_show_rib_request { pid_t pid; u_int16_t flags; enum imsg_type type; @@ -213,12 +231,13 @@ diff -u -p -r1.1.1.8 -r1.10 }; enum filter_actions { -@@ -585,6 +670,27 @@ struct filter_peers { +@@ -585,6 +669,28 @@ struct filter_peers { #define EXT_COMMUNITY_OSPF_RTR_TYPE 6 /* RFC 4577 */ #define EXT_COMMUNITY_OSPF_RTR_ID 7 /* RFC 4577 */ #define EXT_COMMUNITY_BGP_COLLECT 8 /* RFC 4384 */ +/* other handy defines */ +#define EXT_COMMUNITY_OPAQUE_MAX 0xffffffffffffULL ++#define EXT_COMMUNITY_FLAG_VALID 0x01 + +struct ext_comm_pairs { + u_int8_t type; @@ -241,7 +260,7 @@ diff -u -p -r1.1.1.8 -r1.10 struct filter_prefix { -@@ -594,7 +700,7 @@ struct filter_prefix { +@@ -594,16 +700,17 @@ struct filter_prefix { struct filter_prefixlen { enum comp_ops op; @@ -250,7 +269,21 @@ diff -u -p -r1.1.1.8 -r1.10 u_int8_t len_min; u_int8_t len_max; }; -@@ -635,10 +741,13 @@ enum action_types { + + struct filter_match { +- struct filter_prefix prefix; +- struct filter_prefixlen prefixlen; +- struct filter_as as; +- struct filter_community community; ++ struct filter_prefix prefix; ++ struct filter_prefixlen prefixlen; ++ struct filter_as as; ++ struct filter_community community; ++ struct filter_extcommunity ext_community; + }; + + TAILQ_HEAD(filter_head, filter_rule); +@@ -635,10 +742,13 @@ enum action_types { ACTION_SET_NEXTHOP_SELF, ACTION_SET_COMMUNITY, ACTION_DEL_COMMUNITY, @@ -265,7 +298,7 @@ diff -u -p -r1.1.1.8 -r1.10 }; struct filter_set { -@@ -650,23 +759,31 @@ struct filter_set { +@@ -650,23 +760,31 @@ struct filter_set { int32_t relative; struct bgpd_addr nexthop; struct filter_community community; @@ -302,7 +335,7 @@ diff -u -p -r1.1.1.8 -r1.10 int64_t nexthop_cnt; int64_t aspath_cnt; int64_t aspath_size; -@@ -677,28 +794,17 @@ struct rde_memstats { +@@ -677,28 +795,17 @@ struct rde_memstats { int64_t attr_dcnt; }; @@ -342,7 +375,7 @@ diff -u -p -r1.1.1.8 -r1.10 /* prototypes */ /* bgpd.c */ -@@ -709,6 +815,7 @@ int bgpd_filternexthop(struct kroute * +@@ -709,6 +816,7 @@ int bgpd_filternexthop(struct kroute * /* log.c */ void log_init(int); @@ -350,10 +383,11 @@ diff -u -p -r1.1.1.8 -r1.10 void vlog(int, const char *, va_list); void log_peer_warn(const struct peer_config *, const char *, ...); void log_peer_warnx(const struct peer_config *, const char *, ...); -@@ -779,11 +886,19 @@ const char *log_addr(const struct bgpd_a +@@ -779,11 +887,20 @@ const char *log_addr(const struct bgpd_a const char *log_in6addr(const struct in6_addr *); const char *log_sockaddr(struct sockaddr *); const char *log_as(u_int32_t); ++const char *log_rd(u_int64_t); +const char *log_ext_subtype(u_int8_t); int aspath_snprint(char *, size_t, void *, u_int16_t); int aspath_asprint(char **, void *, u_int16_t); diff --git a/net/openbgpd/files/patch-bgpd_imsg.c b/net/openbgpd/files/patch-bgpd_imsg.c index 3bc2bb9a90b0..0cd9ad061d24 100644 --- a/net/openbgpd/files/patch-bgpd_imsg.c +++ b/net/openbgpd/files/patch-bgpd_imsg.c @@ -2,16 +2,25 @@ Index: bgpd/imsg.c =================================================================== RCS file: /home/cvs/private/hrs/openbgpd/bgpd/imsg.c,v retrieving revision 1.1.1.6 -retrieving revision 1.1.1.7 -diff -u -p -r1.1.1.6 -r1.1.1.7 +retrieving revision 1.1.1.8 +diff -u -p -r1.1.1.6 -r1.1.1.8 --- bgpd/imsg.c 14 Feb 2010 20:19:57 -0000 1.1.1.6 -+++ bgpd/imsg.c 14 Feb 2010 20:27:06 -0000 1.1.1.7 ++++ bgpd/imsg.c 10 Apr 2010 12:13:04 -0000 1.1.1.8 @@ -1,4 +1,4 @@ -/* $OpenBSD: imsg.c,v 1.47 2009/06/08 08:30:06 dlg Exp $ */ -+/* $OpenBSD: imsg.c,v 1.48 2009/08/08 18:33:40 nicm Exp $ */ ++/* $OpenBSD: imsg.c,v 1.49 2010/04/07 18:09:39 nicm Exp $ */ /* * Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org> +@@ -79,7 +79,7 @@ imsg_read(struct imsgbuf *ibuf) + cmsg->cmsg_type == SCM_RIGHTS) { + fd = (*(int *)CMSG_DATA(cmsg)); + if ((ifd = calloc(1, sizeof(struct imsg_fd))) == NULL) { +- /* XXX: this return can leak */ ++ close(fd); + return (-1); + } + ifd->fd = fd; @@ -263,6 +263,9 @@ imsg_flush(struct imsgbuf *ibuf) void imsg_clear(struct imsgbuf *ibuf) diff --git a/net/openbgpd/files/patch-bgpd_kroute.c b/net/openbgpd/files/patch-bgpd_kroute.c index abf246d0a986..08bb5eacbf50 100644 --- a/net/openbgpd/files/patch-bgpd_kroute.c +++ b/net/openbgpd/files/patch-bgpd_kroute.c @@ -2,17 +2,17 @@ Index: bgpd/kroute.c =================================================================== RCS file: /home/cvs/private/hrs/openbgpd/bgpd/kroute.c,v retrieving revision 1.1.1.7 -retrieving revision 1.8 -diff -u -p -r1.1.1.7 -r1.8 +retrieving revision 1.9 +diff -u -p -r1.1.1.7 -r1.9 --- bgpd/kroute.c 14 Feb 2010 20:19:57 -0000 1.1.1.7 -+++ bgpd/kroute.c 2 Mar 2010 05:48:19 -0000 1.8 ++++ bgpd/kroute.c 10 Apr 2010 12:16:23 -0000 1.9 @@ -1,4 +1,4 @@ -/* $OpenBSD: kroute.c,v 1.169 2009/06/25 15:54:22 claudio Exp $ */ -+/* $OpenBSD: kroute.c,v 1.173 2009/12/01 14:28:05 claudio Exp $ */ ++/* $OpenBSD: kroute.c,v 1.176 2010/04/06 13:25:08 claudio Exp $ */ /* * Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org> -@@ -463,21 +463,21 @@ kr_nexthop_add(struct bgpd_addr *addr) +@@ -463,25 +463,30 @@ kr_nexthop_add(struct bgpd_addr *addr) bzero(&nh, sizeof(nh)); memcpy(&nh.nexthop, addr, sizeof(nh.nexthop)); nh.valid = 1; @@ -26,8 +26,11 @@ diff -u -p -r1.1.1.7 -r1.8 nh.gateway.v4.s_addr = k->r.nexthop.s_addr; } - memcpy(&nh.kr.kr4, &k->r, sizeof(nh.kr.kr4)); +- memcpy(&nh.kr.kr4, &k->r, sizeof(nh.kr.kr4)); - } else if (h->kroute != NULL && addr->af == AF_INET6) { ++ nh.net.aid = AID_INET; ++ nh.net.v4.s_addr = k->r.prefix.s_addr; ++ nh.netlen = k->r.prefixlen; + } else if (h->kroute != NULL && addr->aid == AID_INET6) { k6 = h->kroute; nh.connected = k6->r.flags & F_CONNECTED; @@ -38,7 +41,15 @@ diff -u -p -r1.1.1.7 -r1.8 memcpy(&nh.gateway.v6, &k6->r.nexthop, sizeof(struct in6_addr)); } -@@ -563,14 +563,14 @@ kr_show_route(struct imsg *imsg) +- memcpy(&nh.kr.kr6, &k6->r, sizeof(nh.kr.kr6)); ++ nh.net.aid = AID_INET6; ++ memcpy(&nh.net.v6, &k6->r.nexthop, ++ sizeof(struct in6_addr)); ++ nh.netlen = k6->r.prefixlen; + } + + send_nexthop_update(&nh); +@@ -563,14 +568,14 @@ kr_show_route(struct imsg *imsg) } addr = imsg->data; kr = NULL; @@ -56,7 +67,7 @@ diff -u -p -r1.1.1.7 -r1.8 kr6 = kroute6_match(&addr->v6, 1); if (kr6 != NULL) send_imsg_session(IMSG_CTL_KROUTE6, -@@ -583,15 +583,21 @@ kr_show_route(struct imsg *imsg) +@@ -583,15 +588,21 @@ kr_show_route(struct imsg *imsg) bzero(&snh, sizeof(snh)); memcpy(&snh.addr, &h->nexthop, sizeof(snh.addr)); if (h->kroute != NULL) { @@ -81,7 +92,7 @@ diff -u -p -r1.1.1.7 -r1.8 ifindex = kr6->r.ifindex; break; } -@@ -846,26 +852,28 @@ kroute6_compare(struct kroute6_node *a, +@@ -846,26 +857,28 @@ kroute6_compare(struct kroute6_node *a, int knexthop_compare(struct knexthop_node *a, struct knexthop_node *b) { @@ -126,7 +137,7 @@ diff -u -p -r1.1.1.7 -r1.8 } return (0); -@@ -945,7 +953,7 @@ kroute_insert(struct kroute_node *kr) +@@ -945,7 +958,7 @@ kroute_insert(struct kroute_node *kr) mask = prefixlen2mask(kr->r.prefixlen); ina = ntohl(kr->r.prefix.s_addr); RB_FOREACH(h, knexthop_tree, &knt) @@ -135,7 +146,7 @@ diff -u -p -r1.1.1.7 -r1.8 (ntohl(h->nexthop.v4.s_addr) & mask) == ina) knexthop_validate(h); -@@ -1065,7 +1073,7 @@ kroute6_matchgw(struct kroute6_node *kr, +@@ -1065,7 +1078,7 @@ kroute6_matchgw(struct kroute6_node *kr, memcpy(&nexthop, &sa_in6->sin6_addr, sizeof(nexthop)); while (kr) { @@ -144,7 +155,7 @@ diff -u -p -r1.1.1.7 -r1.8 return (kr); kr = kr->next; } -@@ -1091,7 +1099,7 @@ kroute6_insert(struct kroute6_node *kr) +@@ -1091,7 +1104,7 @@ kroute6_insert(struct kroute6_node *kr) if (kr->r.flags & F_KERNEL) { inet6applymask(&ina, &kr->r.prefix, kr->r.prefixlen); RB_FOREACH(h, knexthop_tree, &knt) @@ -153,7 +164,7 @@ diff -u -p -r1.1.1.7 -r1.8 inet6applymask(&inb, &h->nexthop.v6, kr->r.prefixlen); if (memcmp(&ina, &inb, sizeof(ina)) == 0) -@@ -1184,6 +1192,7 @@ knexthop_find(struct bgpd_addr *addr) +@@ -1184,6 +1197,7 @@ knexthop_find(struct bgpd_addr *addr) { struct knexthop_node s; @@ -161,7 +172,7 @@ diff -u -p -r1.1.1.7 -r1.8 memcpy(&s.nexthop, addr, sizeof(s.nexthop)); return (RB_FIND(knexthop_tree, &knt, &s)); -@@ -1480,17 +1489,17 @@ knexthop_validate(struct knexthop_node * +@@ -1480,17 +1494,17 @@ knexthop_validate(struct knexthop_node * struct kroute_nexthop n; int was_valid = 0; @@ -183,16 +194,20 @@ diff -u -p -r1.1.1.7 -r1.8 if ((kr = kroute_match(kn->nexthop.v4.s_addr, 0)) == NULL) { if (was_valid) send_nexthop_update(&n); -@@ -1500,7 +1509,7 @@ knexthop_validate(struct knexthop_node * +@@ -1500,8 +1514,10 @@ knexthop_validate(struct knexthop_node * n.connected = kr->r.flags & F_CONNECTED; if ((n.gateway.v4.s_addr = kr->r.nexthop.s_addr) != 0) - n.gateway.af = AF_INET; +- memcpy(&n.kr.kr4, &kr->r, sizeof(n.kr.kr4)); + n.gateway.aid = AID_INET; - memcpy(&n.kr.kr4, &kr->r, sizeof(n.kr.kr4)); ++ n.net.aid = AID_INET; ++ n.net.v4.s_addr = kr->r.prefix.s_addr; ++ n.netlen = kr->r.prefixlen; send_nexthop_update(&n); } else /* down */ -@@ -1511,7 +1520,7 @@ knexthop_validate(struct knexthop_node * + if (was_valid) +@@ -1511,7 +1527,7 @@ knexthop_validate(struct knexthop_node * kr->r.flags |= F_NEXTHOP; } break; @@ -201,7 +216,7 @@ diff -u -p -r1.1.1.7 -r1.8 if ((kr6 = kroute6_match(&kn->nexthop.v6, 0)) == NULL) { if (was_valid) send_nexthop_update(&n); -@@ -1521,7 +1530,7 @@ knexthop_validate(struct knexthop_node * +@@ -1521,11 +1537,14 @@ knexthop_validate(struct knexthop_node * n.connected = kr6->r.flags & F_CONNECTED; if (memcmp(&kr6->r.nexthop, &in6addr_any, sizeof(struct in6_addr)) != 0) { @@ -210,7 +225,15 @@ diff -u -p -r1.1.1.7 -r1.8 memcpy(&n.gateway.v6, &kr6->r.nexthop, sizeof(struct in6_addr)); } -@@ -1551,23 +1560,23 @@ knexthop_track(void *krn) +- memcpy(&n.kr.kr6, &kr6->r, sizeof(n.kr.kr6)); ++ n.net.aid = AID_INET6; ++ memcpy(&n.net.v6, &kr6->r.nexthop, ++ sizeof(struct in6_addr)); ++ n.netlen = kr6->r.prefixlen; + send_nexthop_update(&n); + } else /* down */ + if (was_valid) +@@ -1551,27 +1570,32 @@ knexthop_track(void *krn) bzero(&n, sizeof(n)); memcpy(&n.nexthop, &kn->nexthop, sizeof(n.nexthop)); @@ -224,8 +247,11 @@ diff -u -p -r1.1.1.7 -r1.8 if ((n.gateway.v4.s_addr = kr->r.nexthop.s_addr) != 0) - n.gateway.af = AF_INET; +- memcpy(&n.kr.kr4, &kr->r, sizeof(n.kr.kr4)); + n.gateway.aid = AID_INET; - memcpy(&n.kr.kr4, &kr->r, sizeof(n.kr.kr4)); ++ n.net.aid = AID_INET; ++ n.net.v4.s_addr = kr->r.prefix.s_addr; ++ n.netlen = kr->r.prefixlen; break; - case AF_INET6: + case AID_INET6: @@ -239,7 +265,15 @@ diff -u -p -r1.1.1.7 -r1.8 memcpy(&n.gateway.v6, &kr6->r.nexthop, sizeof(struct in6_addr)); } -@@ -1645,12 +1654,12 @@ kroute_detach_nexthop(struct knexthop_no +- memcpy(&n.kr.kr6, &kr6->r, sizeof(n.kr.kr6)); ++ n.net.aid = AID_INET6; ++ memcpy(&n.net.v6, &kr6->r.nexthop, ++ sizeof(struct in6_addr)); ++ n.netlen = kr6->r.prefixlen; + break; + } + send_nexthop_update(&n); +@@ -1645,12 +1669,12 @@ kroute_detach_nexthop(struct knexthop_no ; /* nothing */ if (s == NULL) { @@ -255,7 +289,7 @@ diff -u -p -r1.1.1.7 -r1.8 k6 = kn->kroute; k6->r.flags &= ~F_NEXTHOP; break; -@@ -1675,7 +1684,7 @@ protect_lo(void) +@@ -1675,7 +1699,7 @@ protect_lo(void) log_warn("protect_lo"); return (-1); } @@ -264,7 +298,7 @@ diff -u -p -r1.1.1.7 -r1.8 kr->r.prefixlen = 8; kr->r.flags = F_KERNEL|F_CONNECTED; -@@ -1689,7 +1698,7 @@ protect_lo(void) +@@ -1689,7 +1713,7 @@ protect_lo(void) } memcpy(&kr6->r.prefix, &in6addr_loopback, sizeof(kr6->r.prefix)); kr6->r.prefixlen = 128; @@ -273,7 +307,7 @@ diff -u -p -r1.1.1.7 -r1.8 if (RB_INSERT(kroute6_tree, &krt6, kr6) != NULL) free(kr6); /* kernel route already there, no problem */ -@@ -1788,7 +1797,7 @@ prefixlen2mask6(u_int8_t prefixlen) +@@ -1788,7 +1812,7 @@ prefixlen2mask6(u_int8_t prefixlen) } #define ROUNDUP(a) \ @@ -282,16 +316,22 @@ diff -u -p -r1.1.1.7 -r1.8 void get_rtaddrs(int addrs, struct sockaddr *sa, struct sockaddr **rti_info) -@@ -1849,7 +1858,7 @@ if_change(u_short ifindex, int flags, st +@@ -1849,10 +1873,11 @@ if_change(u_short ifindex, int flags, st nh.connected = 1; if ((nh.gateway.v4.s_addr = kkr->kr->r.nexthop.s_addr) != 0) - nh.gateway.af = AF_INET; + nh.gateway.aid = AID_INET; } - memcpy(&nh.kr.kr4, &kkr->kr->r, - sizeof(nh.kr.kr4)); -@@ -1873,7 +1882,7 @@ if_change(u_short ifindex, int flags, st +- memcpy(&nh.kr.kr4, &kkr->kr->r, +- sizeof(nh.kr.kr4)); ++ nh.net.aid = AID_INET; ++ nh.net.v4.s_addr = kkr->kr->r.prefix.s_addr; ++ nh.netlen = kkr->kr->r.prefixlen; + send_nexthop_update(&nh); + } + } +@@ -1873,14 +1898,16 @@ if_change(u_short ifindex, int flags, st if (memcmp(&kkr6->kr->r.nexthop, &in6addr_any, sizeof(struct in6_addr))) { @@ -300,7 +340,18 @@ diff -u -p -r1.1.1.7 -r1.8 memcpy(&nh.gateway.v6, &kkr6->kr->r.nexthop, sizeof(struct in6_addr)); -@@ -1924,7 +1933,9 @@ send_rtmsg(int fd, int action, struct kr + } + } +- memcpy(&nh.kr.kr6, &kkr6->kr->r, +- sizeof(nh.kr.kr6)); ++ nh.net.aid = AID_INET6; ++ memcpy(&nh.net.v6, &kkr6->kr->r.nexthop, ++ sizeof(struct in6_addr)); ++ nh.netlen = kkr6->kr->r.prefixlen; + send_nexthop_update(&nh); + } + } +@@ -1924,7 +1951,9 @@ send_rtmsg(int fd, int action, struct kr struct sockaddr_in prefix; struct sockaddr_in nexthop; struct sockaddr_in mask; @@ -310,7 +361,7 @@ diff -u -p -r1.1.1.7 -r1.8 int iovcnt = 0; if (kr_state.fib_sync == 0) -@@ -1934,8 +1945,13 @@ send_rtmsg(int fd, int action, struct kr +@@ -1934,8 +1963,13 @@ send_rtmsg(int fd, int action, struct kr bzero(&hdr, sizeof(hdr)); hdr.rtm_version = RTM_VERSION; hdr.rtm_type = action; @@ -324,7 +375,7 @@ diff -u -p -r1.1.1.7 -r1.8 if (kroute->flags & F_BLACKHOLE) hdr.rtm_flags |= RTF_BLACKHOLE; if (kroute->flags & F_REJECT) -@@ -1984,6 +2000,7 @@ send_rtmsg(int fd, int action, struct kr +@@ -1984,6 +2018,7 @@ send_rtmsg(int fd, int action, struct kr iov[iovcnt].iov_base = &mask; iov[iovcnt++].iov_len = sizeof(mask); @@ -332,7 +383,7 @@ diff -u -p -r1.1.1.7 -r1.8 if (kroute->labelid) { bzero(&label, sizeof(label)); label.sr_len = sizeof(label); -@@ -1996,6 +2013,7 @@ send_rtmsg(int fd, int action, struct kr +@@ -1996,6 +2031,7 @@ send_rtmsg(int fd, int action, struct kr iov[iovcnt].iov_base = &label; iov[iovcnt++].iov_len = sizeof(label); } @@ -340,7 +391,7 @@ diff -u -p -r1.1.1.7 -r1.8 retry: if (writev(fd, iov, iovcnt) == -1) { -@@ -2037,7 +2055,9 @@ send_rt6msg(int fd, int action, struct k +@@ -2037,7 +2073,9 @@ send_rt6msg(int fd, int action, struct k struct sockaddr_in6 addr; char pad[sizeof(long)]; } prefix, nexthop, mask; @@ -350,7 +401,7 @@ diff -u -p -r1.1.1.7 -r1.8 int iovcnt = 0; if (kr_state.fib_sync == 0) -@@ -2047,7 +2067,10 @@ send_rt6msg(int fd, int action, struct k +@@ -2047,7 +2085,10 @@ send_rt6msg(int fd, int action, struct k bzero(&hdr, sizeof(hdr)); hdr.rtm_version = RTM_VERSION; hdr.rtm_type = action; @@ -361,7 +412,7 @@ diff -u -p -r1.1.1.7 -r1.8 if (kroute->flags & F_BLACKHOLE) hdr.rtm_flags |= RTF_BLACKHOLE; if (kroute->flags & F_REJECT) -@@ -2100,6 +2123,7 @@ send_rt6msg(int fd, int action, struct k +@@ -2100,6 +2141,7 @@ send_rt6msg(int fd, int action, struct k iov[iovcnt].iov_base = &mask; iov[iovcnt++].iov_len = ROUNDUP(sizeof(struct sockaddr_in6)); @@ -369,7 +420,7 @@ diff -u -p -r1.1.1.7 -r1.8 if (kroute->labelid) { bzero(&label, sizeof(label)); label.sr_len = sizeof(label); -@@ -2112,6 +2136,7 @@ send_rt6msg(int fd, int action, struct k +@@ -2112,6 +2154,7 @@ send_rt6msg(int fd, int action, struct k iov[iovcnt].iov_base = &label; iov[iovcnt++].iov_len = sizeof(label); } @@ -377,7 +428,7 @@ diff -u -p -r1.1.1.7 -r1.8 retry: if (writev(fd, iov, iovcnt) == -1) { -@@ -2147,8 +2172,8 @@ retry: +@@ -2147,8 +2190,8 @@ retry: int fetchtable(u_int rtableid, int connected_only) { @@ -388,7 +439,7 @@ diff -u -p -r1.1.1.7 -r1.8 char *buf, *next, *lim; struct rt_msghdr *rtm; struct sockaddr *sa, *gw, *rti_info[RTAX_MAX]; -@@ -2163,9 +2188,8 @@ fetchtable(u_int rtableid, int connected +@@ -2163,9 +2206,8 @@ fetchtable(u_int rtableid, int connected mib[3] = 0; mib[4] = NET_RT_DUMP; mib[5] = 0; @@ -399,7 +450,7 @@ diff -u -p -r1.1.1.7 -r1.8 if (rtableid != 0 && errno == EINVAL) /* table nonexistent */ return (0); log_warn("sysctl"); -@@ -2175,7 +2199,7 @@ fetchtable(u_int rtableid, int connected +@@ -2175,7 +2217,7 @@ fetchtable(u_int rtableid, int connected log_warn("fetchtable"); return (-1); } @@ -408,7 +459,7 @@ diff -u -p -r1.1.1.7 -r1.8 log_warn("sysctl"); free(buf); return (-1); -@@ -2186,7 +2210,11 @@ fetchtable(u_int rtableid, int connected +@@ -2186,7 +2228,11 @@ fetchtable(u_int rtableid, int connected rtm = (struct rt_msghdr *)next; if (rtm->rtm_version != RTM_VERSION) continue; @@ -420,7 +471,7 @@ diff -u -p -r1.1.1.7 -r1.8 get_rtaddrs(rtm->rtm_addrs, sa, rti_info); if ((sa = rti_info[RTAX_DST]) == NULL) -@@ -2205,7 +2233,11 @@ fetchtable(u_int rtableid, int connected +@@ -2205,7 +2251,11 @@ fetchtable(u_int rtableid, int connected } kr->r.flags = F_KERNEL; @@ -432,7 +483,7 @@ diff -u -p -r1.1.1.7 -r1.8 kr->r.ifindex = rtm->rtm_index; kr->r.prefix.s_addr = ((struct sockaddr_in *)sa)->sin_addr.s_addr; -@@ -2223,8 +2255,12 @@ fetchtable(u_int rtableid, int connected +@@ -2223,8 +2273,12 @@ fetchtable(u_int rtableid, int connected break; kr->r.prefixlen = mask2prefixlen(sa_in->sin_addr.s_addr); @@ -446,7 +497,7 @@ diff -u -p -r1.1.1.7 -r1.8 else kr->r.prefixlen = prefixlen_classful(kr->r.prefix.s_addr); -@@ -2238,7 +2274,11 @@ fetchtable(u_int rtableid, int connected +@@ -2238,7 +2292,11 @@ fetchtable(u_int rtableid, int connected } kr6->r.flags = F_KERNEL; @@ -458,7 +509,7 @@ diff -u -p -r1.1.1.7 -r1.8 kr6->r.ifindex = rtm->rtm_index; memcpy(&kr6->r.prefix, &((struct sockaddr_in6 *)sa)->sin6_addr, -@@ -2257,8 +2297,12 @@ fetchtable(u_int rtableid, int connected +@@ -2257,8 +2315,12 @@ fetchtable(u_int rtableid, int connected if (sa_in6->sin6_len == 0) break; kr6->r.prefixlen = mask2prefixlen6(sa_in6); @@ -472,7 +523,7 @@ diff -u -p -r1.1.1.7 -r1.8 else fatalx("INET6 route without netmask"); break; -@@ -2290,7 +2334,12 @@ fetchtable(u_int rtableid, int connected +@@ -2290,7 +2352,12 @@ fetchtable(u_int rtableid, int connected } if (sa->sa_family == AF_INET) { @@ -485,7 +536,7 @@ diff -u -p -r1.1.1.7 -r1.8 send_rtmsg(kr_state.fd, RTM_DELETE, &kr->r); free(kr); } else if (connected_only && -@@ -2299,7 +2348,12 @@ fetchtable(u_int rtableid, int connected +@@ -2299,7 +2366,12 @@ fetchtable(u_int rtableid, int connected else kroute_insert(kr); } else if (sa->sa_family == AF_INET6) { @@ -498,7 +549,7 @@ diff -u -p -r1.1.1.7 -r1.8 send_rt6msg(kr_state.fd, RTM_DELETE, &kr6->r); free(kr6); } else if (connected_only && -@@ -2418,7 +2472,11 @@ dispatch_rtmsg(void) +@@ -2418,7 +2490,11 @@ dispatch_rtmsg(void) case RTM_ADD: case RTM_CHANGE: case RTM_DELETE: @@ -510,7 +561,7 @@ diff -u -p -r1.1.1.7 -r1.8 get_rtaddrs(rtm->rtm_addrs, sa, rti_info); if (rtm->rtm_pid == kr_state.pid) /* cause by us */ -@@ -2431,12 +2489,14 @@ dispatch_rtmsg(void) +@@ -2431,12 +2507,14 @@ dispatch_rtmsg(void) continue; connected_only = 0; @@ -525,7 +576,7 @@ diff -u -p -r1.1.1.7 -r1.8 if (dispatch_rtmsg_addr(rtm, rti_info, connected_only) == -1) -@@ -2494,31 +2554,44 @@ dispatch_rtmsg_addr(struct rt_msghdr *rt +@@ -2494,31 +2572,44 @@ dispatch_rtmsg_addr(struct rt_msghdr *rt mpath = 1; #endif @@ -574,7 +625,7 @@ diff -u -p -r1.1.1.7 -r1.8 else fatalx("in6 net addr without netmask"); break; -@@ -2537,8 +2610,8 @@ dispatch_rtmsg_addr(struct rt_msghdr *rt +@@ -2537,8 +2628,8 @@ dispatch_rtmsg_addr(struct rt_msghdr *rt } if (rtm->rtm_type == RTM_DELETE) { @@ -585,7 +636,7 @@ diff -u -p -r1.1.1.7 -r1.8 sa_in = (struct sockaddr_in *)sa; if ((kr = kroute_find(prefix.v4.s_addr, prefixlen, prio)) == NULL) -@@ -2557,7 +2630,7 @@ dispatch_rtmsg_addr(struct rt_msghdr *rt +@@ -2557,7 +2648,7 @@ dispatch_rtmsg_addr(struct rt_msghdr *rt if (kroute_remove(kr) == -1) return (-1); break; @@ -594,7 +645,7 @@ diff -u -p -r1.1.1.7 -r1.8 sa_in6 = (struct sockaddr_in6 *)sa; if ((kr6 = kroute6_find(&prefix.v6, prefixlen, prio)) == NULL) -@@ -2590,8 +2663,8 @@ dispatch_rtmsg_addr(struct rt_msghdr *rt +@@ -2590,8 +2681,8 @@ dispatch_rtmsg_addr(struct rt_msghdr *rt return (0); } @@ -605,7 +656,7 @@ diff -u -p -r1.1.1.7 -r1.8 sa_in = (struct sockaddr_in *)sa; if ((kr = kroute_find(prefix.v4.s_addr, prefixlen, prio)) != NULL) { -@@ -2654,7 +2727,7 @@ add4: +@@ -2654,7 +2745,7 @@ add4: kroute_insert(kr); } break; diff --git a/net/openbgpd/files/patch-bgpd_parse.y b/net/openbgpd/files/patch-bgpd_parse.y index 4f60625dae3a..fd81af9709ae 100644 --- a/net/openbgpd/files/patch-bgpd_parse.y +++ b/net/openbgpd/files/patch-bgpd_parse.y @@ -2,13 +2,13 @@ Index: bgpd/parse.y =================================================================== RCS file: /home/cvs/private/hrs/openbgpd/bgpd/parse.y,v retrieving revision 1.1.1.8 -retrieving revision 1.7 -diff -u -p -r1.1.1.8 -r1.7 +retrieving revision 1.8 +diff -u -p -r1.1.1.8 -r1.8 --- bgpd/parse.y 14 Feb 2010 20:19:57 -0000 1.1.1.8 -+++ bgpd/parse.y 4 Feb 2010 16:22:23 -0000 1.7 ++++ bgpd/parse.y 10 Apr 2010 12:16:23 -0000 1.8 @@ -1,4 +1,4 @@ -/* $OpenBSD: parse.y,v 1.231 2009/06/06 01:10:29 claudio Exp $ */ -+/* $OpenBSD: parse.y,v 1.248 2010/01/13 06:02:37 claudio Exp $ */ ++/* $OpenBSD: parse.y,v 1.250 2010/03/31 18:53:23 claudio Exp $ */ /* * Copyright (c) 2002, 2003, 2004 Henning Brauer <henning@openbsd.org> @@ -149,7 +149,26 @@ diff -u -p -r1.1.1.8 -r1.7 free($3); YYERROR; } -@@ -575,11 +565,16 @@ conf_main : AS as4number { +@@ -459,18 +449,6 @@ conf_main : AS as4number { + } + free($4); + } +- | NETWORK STATIC filter_set { +- /* keep for compatibility till after next release */ +- conf->flags |= BGPD_FLAG_REDIST_STATIC; +- move_filterset($3, &conf->staticset); +- free($3); +- } +- | NETWORK CONNECTED filter_set { +- /* keep for compatibility till after next release */ +- conf->flags |= BGPD_FLAG_REDIST_CONNECTED; +- move_filterset($3, &conf->connectset); +- free($3); +- } + | DUMP STRING STRING optnumber { + int action; + +@@ -575,11 +553,16 @@ conf_main : AS as4number { free($4); } | RTABLE NUMBER { @@ -166,7 +185,7 @@ diff -u -p -r1.1.1.8 -r1.7 } | CONNECTRETRY NUMBER { if ($2 > USHRT_MAX || $2 < 1) { -@@ -635,11 +630,11 @@ address : STRING { +@@ -635,11 +618,11 @@ address : STRING { } free($1); @@ -181,7 +200,7 @@ diff -u -p -r1.1.1.8 -r1.7 YYERROR; } } -@@ -686,7 +681,7 @@ prefix : STRING '/' NUMBER { +@@ -686,7 +669,7 @@ prefix : STRING '/' NUMBER { addrspec : address { memcpy(&$$.prefix, &$1, sizeof(struct bgpd_addr)); @@ -190,7 +209,7 @@ diff -u -p -r1.1.1.8 -r1.7 $$.len = 32; else $$.len = 128; -@@ -710,9 +705,13 @@ neighbor : { curpeer = new_peer(); } +@@ -710,9 +693,13 @@ neighbor : { curpeer = new_peer(); } memcpy(&curpeer->conf.remote_addr, &$3.prefix, sizeof(curpeer->conf.remote_addr)); curpeer->conf.remote_masklen = $3.len; @@ -206,7 +225,7 @@ diff -u -p -r1.1.1.8 -r1.7 if (get_id(curpeer)) { yyerror("get_id failed"); YYERROR; -@@ -802,6 +801,17 @@ peeropts : REMOTEAS as4number { +@@ -802,6 +789,17 @@ peeropts : REMOTEAS as4number { } free($2); } @@ -224,7 +243,7 @@ diff -u -p -r1.1.1.8 -r1.7 | LOCALADDR address { memcpy(&curpeer->conf.local_addr, &$2, sizeof(curpeer->conf.local_addr)); -@@ -852,13 +862,17 @@ peeropts : REMOTEAS as4number { +@@ -852,13 +850,17 @@ peeropts : REMOTEAS as4number { curpeer->conf.min_holdtime = $3; } | ANNOUNCE family STRING { @@ -247,7 +266,7 @@ diff -u -p -r1.1.1.8 -r1.7 yyerror("unknown/unsupported SAFI \"%s\"", $3); free($3); -@@ -866,25 +880,31 @@ peeropts : REMOTEAS as4number { +@@ -866,25 +868,31 @@ peeropts : REMOTEAS as4number { } free($3); @@ -289,7 +308,7 @@ diff -u -p -r1.1.1.8 -r1.7 curpeer->conf.announce_type = ANNOUNCE_NONE; else if (!strcmp($2, "all")) curpeer->conf.announce_type = ANNOUNCE_ALL; -@@ -1083,7 +1103,7 @@ peeropts : REMOTEAS as4number { +@@ -1083,7 +1091,7 @@ peeropts : REMOTEAS as4number { curpeer->conf.reflector_client = 1; } | REFLECTOR address { @@ -298,7 +317,7 @@ diff -u -p -r1.1.1.8 -r1.7 yyerror("route reflector cluster-id must be " "an IPv4 address"); YYERROR; -@@ -1336,12 +1356,12 @@ filter_prefix_l : filter_prefix { $$ +@@ -1336,12 +1344,12 @@ filter_prefix_l : filter_prefix { $$ ; filter_prefix : prefix { @@ -313,7 +332,7 @@ diff -u -p -r1.1.1.8 -r1.7 if (($$ = calloc(1, sizeof(struct filter_prefix_l))) == NULL) fatal(NULL); -@@ -1437,18 +1457,18 @@ filter_elm : filter_prefix_h { +@@ -1437,18 +1445,18 @@ filter_elm : filter_prefix_h { fmopts.prefix_l = $1; } | PREFIXLEN prefixlenop { @@ -335,7 +354,7 @@ diff -u -p -r1.1.1.8 -r1.7 } | filter_as_h { if (fmopts.as_l != NULL) { -@@ -1463,26 +1483,25 @@ filter_elm : filter_prefix_h { +@@ -1463,26 +1471,43 @@ filter_elm : filter_prefix_h { free($2); YYERROR; } @@ -347,6 +366,24 @@ diff -u -p -r1.1.1.8 -r1.7 } free($2); } ++ | EXTCOMMUNITY STRING STRING { ++ if (fmopts.m.ext_community.flags & ++ EXT_COMMUNITY_FLAG_VALID) { ++ yyerror("\"ext-community\" already specified"); ++ free($2); ++ free($3); ++ YYERROR; ++ } ++ ++ if (parseextcommunity(&fmopts.m.ext_community, ++ $2, $3) == -1) { ++ free($2); ++ free($3); ++ YYERROR; ++ } ++ free($2); ++ free($3); ++ } | IPV4 { - if (fmopts.af) { + if (fmopts.aid) { @@ -367,7 +404,7 @@ diff -u -p -r1.1.1.8 -r1.7 } ; -@@ -1782,8 +1801,7 @@ filter_set_opt : LOCALPREF NUMBER { +@@ -1782,8 +1807,7 @@ filter_set_opt : LOCALPREF NUMBER { else $$->type = ACTION_SET_COMMUNITY; @@ -377,7 +414,7 @@ diff -u -p -r1.1.1.8 -r1.7 free($3); free($$); YYERROR; -@@ -1796,40 +1814,62 @@ filter_set_opt : LOCALPREF NUMBER { +@@ -1796,40 +1820,62 @@ filter_set_opt : LOCALPREF NUMBER { free($$); YYERROR; } @@ -460,7 +497,7 @@ diff -u -p -r1.1.1.8 -r1.7 ; %% -@@ -1873,6 +1913,7 @@ lookup(char *s) +@@ -1873,6 +1919,7 @@ lookup(char *s) { "allow", ALLOW}, { "announce", ANNOUNCE}, { "any", ANY}, @@ -468,7 +505,7 @@ diff -u -p -r1.1.1.8 -r1.7 { "blackhole", BLACKHOLE}, { "capabilities", CAPABILITIES}, { "community", COMMUNITY}, -@@ -1889,6 +1930,7 @@ lookup(char *s) +@@ -1889,6 +1936,7 @@ lookup(char *s) { "enforce", ENFORCE}, { "esp", ESP}, { "evaluate", EVALUATE}, @@ -476,7 +513,7 @@ diff -u -p -r1.1.1.8 -r1.7 { "fib-update", FIBUPDATE}, { "from", FROM}, { "group", GROUP}, -@@ -1899,6 +1941,9 @@ lookup(char *s) +@@ -1899,6 +1947,9 @@ lookup(char *s) { "include", INCLUDE}, { "inet", IPV4}, { "inet6", IPV6}, @@ -486,7 +523,7 @@ diff -u -p -r1.1.1.8 -r1.7 { "ipsec", IPSEC}, { "key", KEY}, { "listen", LISTEN}, -@@ -1918,6 +1963,7 @@ lookup(char *s) +@@ -1918,6 +1969,7 @@ lookup(char *s) { "nexthop", NEXTHOP}, { "no-modify", NOMODIFY}, { "on", ON}, @@ -494,7 +531,7 @@ diff -u -p -r1.1.1.8 -r1.7 { "out", OUT}, { "passive", PASSIVE}, { "password", PASSWORD}, -@@ -1930,6 +1976,7 @@ lookup(char *s) +@@ -1930,6 +1982,7 @@ lookup(char *s) { "qualify", QUALIFY}, { "quick", QUICK}, { "rde", RDE}, @@ -502,7 +539,7 @@ diff -u -p -r1.1.1.8 -r1.7 { "reject", REJECT}, { "remote-as", REMOTEAS}, { "restart", RESTART}, -@@ -2135,6 +2182,26 @@ top: +@@ -2135,6 +2188,26 @@ top: if (yylval.v.string == NULL) fatal("yylex: strdup"); return (STRING); @@ -529,7 +566,7 @@ diff -u -p -r1.1.1.8 -r1.7 } #define allowed_to_end_number(x) \ -@@ -2505,27 +2572,27 @@ getcommunity(char *s) +@@ -2505,27 +2578,27 @@ getcommunity(char *s) } int @@ -567,7 +604,7 @@ diff -u -p -r1.1.1.8 -r1.7 return (0); } -@@ -2537,23 +2604,175 @@ parsecommunity(char *s, int *as, int *ty +@@ -2537,23 +2610,176 @@ parsecommunity(char *s, int *as, int *ty if ((i = getcommunity(s)) == COMMUNITY_ERROR) return (-1); @@ -730,6 +767,7 @@ diff -u -p -r1.1.1.8 -r1.7 + if (iana[i].type == type && iana[i].subtype == subtype) { + if (iana[i].transitive) + c->type |= EXT_COMMUNITY_TRANSITIVE; ++ c->flags |= EXT_COMMUNITY_FLAG_VALID; + return (0); + } + } @@ -746,7 +784,7 @@ diff -u -p -r1.1.1.8 -r1.7 if ((p = calloc(1, sizeof(struct peer))) == NULL) fatal("new_peer"); -@@ -2564,11 +2783,11 @@ alloc_peer(void) +@@ -2564,11 +2790,11 @@ alloc_peer(void) p->conf.distance = 1; p->conf.announce_type = ANNOUNCE_UNDEF; p->conf.announce_capa = 1; @@ -761,7 +799,7 @@ diff -u -p -r1.1.1.8 -r1.7 p->conf.local_as = conf->as; p->conf.local_short_as = conf->short_as; p->conf.softreconfig_in = 1; -@@ -2592,6 +2811,9 @@ new_peer(void) +@@ -2592,6 +2818,9 @@ new_peer(void) if (strlcpy(p->conf.descr, curgroup->conf.descr, sizeof(p->conf.descr)) >= sizeof(p->conf.descr)) fatalx("new_peer descr strlcpy"); @@ -771,7 +809,7 @@ diff -u -p -r1.1.1.8 -r1.7 p->conf.groupid = curgroup->conf.id; p->conf.local_as = curgroup->conf.local_as; p->conf.local_short_as = curgroup->conf.local_short_as; -@@ -2715,7 +2937,7 @@ get_id(struct peer *newpeer) +@@ -2715,7 +2944,7 @@ get_id(struct peer *newpeer) struct peer *p; for (p = peer_l_old; p != NULL; p = p->next) @@ -780,7 +818,7 @@ diff -u -p -r1.1.1.8 -r1.7 if (!memcmp(&p->conf.remote_addr, &newpeer->conf.remote_addr, sizeof(p->conf.remote_addr))) { -@@ -2856,9 +3078,11 @@ str2key(char *s, char *dest, size_t max_ +@@ -2856,9 +3085,11 @@ str2key(char *s, char *dest, size_t max_ int neighbor_consistent(struct peer *p) { @@ -794,7 +832,7 @@ diff -u -p -r1.1.1.8 -r1.7 yyerror("local-address and neighbor address " "must be of the same address family"); return (-1); -@@ -2869,7 +3093,7 @@ neighbor_consistent(struct peer *p) +@@ -2869,7 +3100,7 @@ neighbor_consistent(struct peer *p) p->conf.auth.method == AUTH_IPSEC_IKE_AH || p->conf.auth.method == AUTH_IPSEC_MANUAL_ESP || p->conf.auth.method == AUTH_IPSEC_MANUAL_AH) && @@ -803,7 +841,7 @@ diff -u -p -r1.1.1.8 -r1.7 yyerror("neighbors with any form of IPsec configured " "need local-address to be specified"); return (-1); -@@ -2889,10 +3113,6 @@ neighbor_consistent(struct peer *p) +@@ -2889,10 +3120,6 @@ neighbor_consistent(struct peer *p) return (-1); } @@ -814,7 +852,7 @@ diff -u -p -r1.1.1.8 -r1.7 /* set default values if they where undefined */ p->conf.ebgp = (p->conf.remote_as != conf->as); if (p->conf.announce_type == ANNOUNCE_UNDEF) -@@ -2909,6 +3129,11 @@ neighbor_consistent(struct peer *p) +@@ -2909,6 +3136,11 @@ neighbor_consistent(struct peer *p) return (-1); } @@ -826,7 +864,7 @@ diff -u -p -r1.1.1.8 -r1.7 return (0); } -@@ -2927,6 +3152,11 @@ merge_filterset(struct filter_set_head * +@@ -2927,6 +3159,11 @@ merge_filterset(struct filter_set_head * yyerror("community is already set"); else if (s->type == ACTION_DEL_COMMUNITY) yyerror("community will already be deleted"); @@ -838,7 +876,7 @@ diff -u -p -r1.1.1.8 -r1.7 else yyerror("redefining set parameter %s", filterset_name(s->type)); -@@ -2953,9 +3183,18 @@ merge_filterset(struct filter_set_head * +@@ -2953,9 +3190,18 @@ merge_filterset(struct filter_set_head * return (0); } break; diff --git a/net/openbgpd/files/patch-bgpd_printconf.c b/net/openbgpd/files/patch-bgpd_printconf.c index 58cfb9a75c70..ee5be19032af 100644 --- a/net/openbgpd/files/patch-bgpd_printconf.c +++ b/net/openbgpd/files/patch-bgpd_printconf.c @@ -2,13 +2,13 @@ Index: bgpd/printconf.c =================================================================== RCS file: /home/cvs/private/hrs/openbgpd/bgpd/printconf.c,v retrieving revision 1.1.1.7 -retrieving revision 1.6 -diff -u -p -r1.1.1.7 -r1.6 +retrieving revision 1.7 +diff -u -p -r1.1.1.7 -r1.7 --- bgpd/printconf.c 14 Feb 2010 20:19:57 -0000 1.1.1.7 -+++ bgpd/printconf.c 4 Feb 2010 16:22:23 -0000 1.6 ++++ bgpd/printconf.c 10 Apr 2010 12:16:23 -0000 1.7 @@ -1,4 +1,4 @@ -/* $OpenBSD: printconf.c,v 1.70 2009/06/06 01:10:29 claudio Exp $ */ -+/* $OpenBSD: printconf.c,v 1.77 2009/12/17 09:32:59 claudio Exp $ */ ++/* $OpenBSD: printconf.c,v 1.79 2010/03/05 15:25:00 claudio Exp $ */ /* * Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org> @@ -48,23 +48,23 @@ diff -u -p -r1.1.1.7 -r1.6 +{ + switch (c->type & EXT_COMMUNITY_VALUE) { + case EXT_COMMUNITY_TWO_AS: -+ printf("%s %i:%i", log_ext_subtype(c->subtype), ++ printf("%s %i:%i ", log_ext_subtype(c->subtype), + c->data.ext_as.as, c->data.ext_as.val); + break; + case EXT_COMMUNITY_IPV4: -+ printf("%s %s:%i", log_ext_subtype(c->subtype), ++ printf("%s %s:%i ", log_ext_subtype(c->subtype), + inet_ntoa(c->data.ext_ip.addr), c->data.ext_ip.val); + break; + case EXT_COMMUNITY_FOUR_AS: -+ printf("%s %s:%i", log_ext_subtype(c->subtype), ++ printf("%s %s:%i ", log_ext_subtype(c->subtype), + log_as(c->data.ext_as4.as4), c->data.ext_as.val); + break; + case EXT_COMMUNITY_OPAQUE: -+ printf("%s 0x%llx", log_ext_subtype(c->subtype), ++ printf("%s 0x%llx ", log_ext_subtype(c->subtype), + c->data.ext_opaq); + break; + default: -+ printf("0x%x 0x%llx", c->type, c->data.ext_opaq); ++ printf("0x%x 0x%llx ", c->type, c->data.ext_opaq); + break; + } +} @@ -86,7 +86,7 @@ diff -u -p -r1.1.1.7 -r1.6 print_set(struct filter_set_head *set) { struct filter_set *s; -@@ -161,11 +205,25 @@ print_set(struct filter_set_head *set) +@@ -161,11 +205,23 @@ print_set(struct filter_set_head *set) case ACTION_RTLABEL: printf("rtlabel %s ", s->action.rtlabel); break; @@ -102,17 +102,24 @@ diff -u -p -r1.1.1.7 -r1.6 + case ACTION_SET_EXT_COMMUNITY: + printf("ext-community "); + print_extcommunity(&s->action.ext_community); -+ printf(" "); + break; + case ACTION_DEL_EXT_COMMUNITY: + printf("ext-community delete "); + print_extcommunity(&s->action.ext_community); -+ printf(" "); + break; } } printf("}"); -@@ -263,8 +321,8 @@ print_peer(struct peer_config *p, struct +@@ -236,7 +292,7 @@ print_mainconf(struct bgpd_config *conf) + print_set(&conf->connectset6); + printf("\n"); + } +- if (conf->flags & BGPD_FLAG_REDIST_STATIC) { ++ if (conf->flags & BGPD_FLAG_REDIST6_STATIC) { + printf("network inet6 static"); + if (!TAILQ_EMPTY(&conf->staticset6)) + printf(" "); +@@ -263,8 +319,8 @@ print_peer(struct peer_config *p, struct char *method; struct in_addr ina; @@ -123,7 +130,7 @@ diff -u -p -r1.1.1.7 -r1.6 printf("%sneighbor %s/%u {\n", c, log_addr(&p->remote_addr), p->remote_masklen); else -@@ -281,7 +339,7 @@ print_peer(struct peer_config *p, struct +@@ -281,7 +337,7 @@ print_peer(struct peer_config *p, struct printf("%s\tmultihop %u\n", c, p->distance); if (p->passive) printf("%s\tpassive\n", c); @@ -132,7 +139,7 @@ diff -u -p -r1.1.1.7 -r1.6 printf("%s\tlocal-address %s\n", c, log_addr(&p->local_addr)); if (p->max_prefix) { printf("%s\tmax-prefix %u", c, p->max_prefix); -@@ -295,6 +353,12 @@ print_peer(struct peer_config *p, struct +@@ -295,6 +351,12 @@ print_peer(struct peer_config *p, struct printf("%s\tholdtime min %u\n", c, p->min_holdtime); if (p->announce_capa == 0) printf("%s\tannounce capabilities no\n", c); @@ -145,7 +152,7 @@ diff -u -p -r1.1.1.7 -r1.6 if (p->announce_type == ANNOUNCE_SELF) printf("%s\tannounce self\n", c); else if (p->announce_type == ANNOUNCE_NONE) -@@ -324,6 +388,10 @@ print_peer(struct peer_config *p, struct +@@ -324,6 +386,10 @@ print_peer(struct peer_config *p, struct printf("%s\tdepend on \"%s\"\n", c, p->if_depend); if (p->flags & PEERFLAG_TRANS_AS) printf("%s\ttransparent-as yes\n", c); @@ -156,7 +163,7 @@ diff -u -p -r1.1.1.7 -r1.6 if (p->auth.method == AUTH_MD5SIG) printf("%s\ttcp md5sig\n", c); -@@ -354,8 +422,7 @@ print_peer(struct peer_config *p, struct +@@ -354,8 +420,7 @@ print_peer(struct peer_config *p, struct if (p->ttlsec) printf("%s\tttl-security yes\n", c); @@ -166,7 +173,7 @@ diff -u -p -r1.1.1.7 -r1.6 if (p->softreconfig_in == 1) printf("%s\tsoftreconfig in yes\n", c); -@@ -399,17 +466,14 @@ print_enc_alg(u_int8_t alg) +@@ -399,17 +464,14 @@ print_enc_alg(u_int8_t alg) } } @@ -191,7 +198,7 @@ diff -u -p -r1.1.1.7 -r1.6 } void -@@ -455,14 +519,14 @@ print_rule(struct peer *peer_l, struct f +@@ -455,14 +517,14 @@ print_rule(struct peer *peer_l, struct f } else printf("any "); @@ -210,3 +217,14 @@ diff -u -p -r1.1.1.7 -r1.6 printf("inet6 "); } +@@ -497,6 +559,10 @@ print_rule(struct peer *peer_l, struct f + print_community(r->match.community.as, + r->match.community.type); + } ++ if (r->match.ext_community.flags & EXT_COMMUNITY_FLAG_VALID) { ++ printf("ext-community "); ++ print_extcommunity(&r->match.ext_community); ++ } + + print_set(&r->set); + diff --git a/net/openbgpd/files/patch-bgpd_rde.c b/net/openbgpd/files/patch-bgpd_rde.c index 7a2e01710e95..55e10012aa47 100644 --- a/net/openbgpd/files/patch-bgpd_rde.c +++ b/net/openbgpd/files/patch-bgpd_rde.c @@ -2,13 +2,13 @@ Index: bgpd/rde.c =================================================================== RCS file: /home/cvs/private/hrs/openbgpd/bgpd/rde.c,v retrieving revision 1.1.1.8 -retrieving revision 1.8 -diff -u -p -r1.1.1.8 -r1.8 +retrieving revision 1.9 +diff -u -p -r1.1.1.8 -r1.9 --- bgpd/rde.c 14 Feb 2010 20:19:57 -0000 1.1.1.8 -+++ bgpd/rde.c 14 Feb 2010 19:53:36 -0000 1.8 ++++ bgpd/rde.c 10 Apr 2010 12:16:23 -0000 1.9 @@ -1,4 +1,4 @@ -/* $OpenBSD: rde.c,v 1.264 2009/06/29 12:22:16 claudio Exp $ */ -+/* $OpenBSD: rde.c,v 1.284 2010/01/13 06:02:37 claudio Exp $ */ ++/* $OpenBSD: rde.c,v 1.290 2010/03/30 15:43:30 claudio Exp $ */ /* * Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org> @@ -307,6 +307,27 @@ diff -u -p -r1.1.1.8 -r1.8 default: break; } +@@ -587,7 +568,7 @@ rde_dispatch_imsg_parent(struct imsgbuf + fatal(NULL); + memcpy(nconf, imsg.data, sizeof(struct bgpd_config)); + for (rid = 0; rid < rib_size; rid++) +- ribs[rid].state = RIB_DELETE; ++ ribs[rid].state = RECONF_DELETE; + break; + case IMSG_NETWORK_ADD: + memcpy(&netconf_p, imsg.data, sizeof(netconf_p)); +@@ -615,9 +596,9 @@ rde_dispatch_imsg_parent(struct imsgbuf + memcpy(&rn, imsg.data, sizeof(rn)); + rid = rib_find(rn.name); + if (rid == RIB_FAILED) +- rib_new(-1, rn.name, rn.flags); ++ rib_new(rn.name, rn.flags); + else +- ribs[rid].state = RIB_ACTIVE; ++ ribs[rid].state = RECONF_KEEP; + break; + case IMSG_RECONF_FILTER: + if (imsg.hdr.len - IMSG_HEADER_SIZE != @@ -644,9 +625,17 @@ rde_dispatch_imsg_parent(struct imsgbuf nconf->flags &= ~BGPD_FLAG_NO_EVALUATE; } @@ -332,9 +353,9 @@ diff -u -p -r1.1.1.8 -r1.8 - /* XXX this needs rework anyway */ + /* bring ribs in sync before softreconfig dance */ + for (rid = 0; rid < rib_size; rid++) { -+ if (ribs[rid].state == RIB_DELETE) ++ if (ribs[rid].state == RECONF_DELETE) + rib_free(&ribs[rid]); -+ else if (ribs[rid].state == RIB_NEW) ++ else if (ribs[rid].state == RECONF_REINIT) + rib_dump(&ribs[0], + rde_softreconfig_load, &ribs[rid], + AID_UNSPEC); @@ -349,7 +370,7 @@ diff -u -p -r1.1.1.8 -r1.8 int i; - for (i = 1; i < rib_size; i++) + for (i = 1; i < rib_size; i++) { -+ if (ribs[i].state == RIB_NEW) ++ if (ribs[i].state == RECONF_REINIT) + /* already synced by _load */ + continue; rib_dump(&ribs[i], rde_softreconfig_out, @@ -1159,7 +1180,7 @@ diff -u -p -r1.1.1.8 -r1.8 for (i = 1; i < rib_size; i++) { + /* only active ribs need a softreconfig rerun */ -+ if (ribs[i].state != RIB_ACTIVE) ++ if (ribs[i].state != RECONF_KEEP) + continue; + /* check if prefix changed */ @@ -1495,7 +1516,7 @@ diff -u -p -r1.1.1.8 -r1.8 asp->flags |= F_ANN_DYNAMIC; - rde_apply_set(asp, &nc->attrset, nc->prefix.af, peerself, peerself); -+ rde_apply_set(asp, &nc->attrset, aid2af(nc->prefix.aid), peerself, peerself); ++ rde_apply_set(asp, &nc->attrset, nc->prefix.aid, peerself, peerself); for (i = 1; i < rib_size; i++) path_update(&ribs[i], peerself, asp, &nc->prefix, nc->prefixlen); diff --git a/net/openbgpd/files/patch-bgpd_rde.h b/net/openbgpd/files/patch-bgpd_rde.h index 479725479263..a19b053cac1d 100644 --- a/net/openbgpd/files/patch-bgpd_rde.h +++ b/net/openbgpd/files/patch-bgpd_rde.h @@ -2,13 +2,13 @@ Index: bgpd/rde.h =================================================================== RCS file: /home/cvs/private/hrs/openbgpd/bgpd/rde.h,v retrieving revision 1.1.1.8 -retrieving revision 1.1.1.9 -diff -u -p -r1.1.1.8 -r1.1.1.9 +retrieving revision 1.1.1.10 +diff -u -p -r1.1.1.8 -r1.1.1.10 --- bgpd/rde.h 14 Feb 2010 20:19:57 -0000 1.1.1.8 -+++ bgpd/rde.h 14 Feb 2010 20:27:06 -0000 1.1.1.9 ++++ bgpd/rde.h 10 Apr 2010 12:13:05 -0000 1.1.1.10 @@ -1,4 +1,4 @@ -/* $OpenBSD: rde.h,v 1.120 2009/06/06 01:10:29 claudio Exp $ */ -+/* $OpenBSD: rde.h,v 1.129 2010/01/13 06:02:37 claudio Exp $ */ ++/* $OpenBSD: rde.h,v 1.133 2010/03/29 09:24:07 claudio Exp $ */ /* * Copyright (c) 2003, 2004 Claudio Jeker <claudio@openbsd.org> and @@ -89,15 +89,25 @@ diff -u -p -r1.1.1.8 -r1.1.1.9 }; struct rib_entry { -@@ -264,6 +275,7 @@ struct rib_entry { +@@ -262,16 +273,10 @@ struct rib_entry { + u_int16_t flags; + }; - enum rib_state { - RIB_NONE, -+ RIB_NEW, - RIB_ACTIVE, - RIB_DELETE +-enum rib_state { +- RIB_NONE, +- RIB_ACTIVE, +- RIB_DELETE +-}; +- + struct rib { + char name[PEER_DESCR_LEN]; + struct rib_tree rib; +- enum rib_state state; ++ enum reconf_action state; + u_int16_t flags; + u_int16_t id; }; -@@ -342,9 +354,13 @@ int aspath_loopfree(struct aspath *, u +@@ -342,21 +347,29 @@ int aspath_loopfree(struct aspath *, u int aspath_compare(struct aspath *, struct aspath *); u_char *aspath_prepend(struct aspath *, u_int32_t, int, u_int16_t *); int aspath_match(struct aspath *, enum as_spec, u_int32_t); @@ -105,14 +115,23 @@ diff -u -p -r1.1.1.8 -r1.1.1.9 +int community_match(struct rde_aspath *, int, int); int community_set(struct rde_aspath *, int, int); void community_delete(struct rde_aspath *, int, int); ++int community_ext_match(struct rde_aspath *, ++ struct filter_extcommunity *, u_int16_t); +int community_ext_set(struct rde_aspath *, + struct filter_extcommunity *, u_int16_t); +void community_ext_delete(struct rde_aspath *, + struct filter_extcommunity *, u_int16_t); ++int community_ext_conv(struct filter_extcommunity *, u_int16_t, ++ u_int64_t *); /* rde_rib.c */ extern u_int16_t rib_size; -@@ -356,7 +372,7 @@ void rib_free(struct rib *); + extern struct rib *ribs; + +-u_int16_t rib_new(int, char *, u_int16_t); ++u_int16_t rib_new(char *, u_int16_t); + u_int16_t rib_find(char *); + void rib_free(struct rib *); struct rib_entry *rib_get(struct rib *, struct bgpd_addr *, int); struct rib_entry *rib_lookup(struct rib *, struct bgpd_addr *); void rib_dump(struct rib *, void (*)(struct rib_entry *, void *), @@ -121,7 +140,7 @@ diff -u -p -r1.1.1.8 -r1.1.1.9 void rib_dump_r(struct rib_context *); void rib_dump_runner(void); int rib_dump_pending(void); -@@ -395,7 +411,7 @@ void prefix_network_clean(struct rde_p +@@ -395,7 +408,7 @@ void prefix_network_clean(struct rde_p void nexthop_init(u_int32_t); void nexthop_shutdown(void); void nexthop_modify(struct rde_aspath *, struct bgpd_addr *, @@ -130,7 +149,7 @@ diff -u -p -r1.1.1.8 -r1.1.1.9 void nexthop_link(struct rde_aspath *); void nexthop_unlink(struct rde_aspath *); int nexthop_delete(struct nexthop *); -@@ -415,12 +431,15 @@ int up_generate(struct rde_peer *, str +@@ -415,12 +428,15 @@ int up_generate(struct rde_peer *, str void up_generate_updates(struct filter_head *, struct rde_peer *, struct prefix *, struct prefix *); void up_generate_default(struct filter_head *, struct rde_peer *, @@ -149,7 +168,7 @@ diff -u -p -r1.1.1.8 -r1.1.1.9 /* rde_prefix.c */ #define pt_empty(pt) ((pt)->refcnt == 0) -@@ -452,8 +471,7 @@ enum filter_actions rde_filter(u_int16_t +@@ -452,8 +468,7 @@ enum filter_actions rde_filter(u_int16_t struct rde_aspath *, struct bgpd_addr *, u_int8_t, struct rde_peer *, enum directions); void rde_apply_set(struct rde_aspath *, struct filter_set_head *, diff --git a/net/openbgpd/files/patch-bgpd_rde_attr.c b/net/openbgpd/files/patch-bgpd_rde_attr.c index 7aa74567837d..f62d59f083f0 100644 --- a/net/openbgpd/files/patch-bgpd_rde_attr.c +++ b/net/openbgpd/files/patch-bgpd_rde_attr.c @@ -2,13 +2,13 @@ Index: bgpd/rde_attr.c =================================================================== RCS file: /home/cvs/private/hrs/openbgpd/bgpd/rde_attr.c,v retrieving revision 1.1.1.6 -retrieving revision 1.4 -diff -u -p -r1.1.1.6 -r1.4 +retrieving revision 1.5 +diff -u -p -r1.1.1.6 -r1.5 --- bgpd/rde_attr.c 14 Feb 2010 20:19:57 -0000 1.1.1.6 -+++ bgpd/rde_attr.c 4 Feb 2010 16:22:23 -0000 1.4 ++++ bgpd/rde_attr.c 10 Apr 2010 12:16:23 -0000 1.5 @@ -1,4 +1,4 @@ -/* $OpenBSD: rde_attr.c,v 1.79 2009/03/19 06:52:59 claudio Exp $ */ -+/* $OpenBSD: rde_attr.c,v 1.81 2009/12/18 15:51:37 claudio Exp $ */ ++/* $OpenBSD: rde_attr.c,v 1.83 2010/03/29 09:24:07 claudio Exp $ */ /* * Copyright (c) 2004 Claudio Jeker <claudio@openbsd.org> @@ -34,7 +34,7 @@ diff -u -p -r1.1.1.6 -r1.4 #include "bgpd.h" #include "rde.h" -@@ -971,13 +978,26 @@ aspath_match(struct aspath *a, enum as_s +@@ -971,15 +978,26 @@ aspath_match(struct aspath *a, enum as_s return (0); } @@ -42,7 +42,7 @@ diff -u -p -r1.1.1.6 -r1.4 + * Functions handling communities and extended communities. + */ + -+int community_ext_conv(struct filter_extcommunity *, u_int16_t, u_int64_t *); ++int community_ext_matchone(struct filter_extcommunity *, u_int16_t, u_int64_t); + int -community_match(void *data, u_int16_t len, int as, int type) @@ -59,13 +59,14 @@ diff -u -p -r1.1.1.6 -r1.4 + if (a == NULL) + /* no communities, no match */ + return (0); -+ -+ len = a->len / 4; -+ p = a->data; - for (; len > 0; len--) { +- for (; len > 0; len--) { ++ p = a->data; ++ for (len = a->len / 4; len > 0; len--) { eas = *p++; -@@ -1000,7 +1020,6 @@ community_set(struct rde_aspath *asp, in + eas <<= 8; + eas |= *p++; +@@ -1000,7 +1018,6 @@ community_set(struct rde_aspath *asp, in u_int8_t *p = NULL; unsigned int i, ncommunities = 0; u_int8_t f = ATTR_OPTIONAL|ATTR_TRANSITIVE; @@ -73,7 +74,7 @@ diff -u -p -r1.1.1.6 -r1.4 attr = attr_optget(asp, ATTR_COMMUNITIES); if (attr != NULL) { -@@ -1017,7 +1036,7 @@ community_set(struct rde_aspath *asp, in +@@ -1017,7 +1034,7 @@ community_set(struct rde_aspath *asp, in p += 4; } @@ -82,7 +83,7 @@ diff -u -p -r1.1.1.6 -r1.4 /* overflow */ return (0); -@@ -1032,11 +1051,10 @@ community_set(struct rde_aspath *asp, in +@@ -1032,11 +1049,10 @@ community_set(struct rde_aspath *asp, in if (attr != NULL) { memcpy(p + 4, attr->data, attr->len); f = attr->flags; @@ -95,7 +96,7 @@ diff -u -p -r1.1.1.6 -r1.4 free(p); return (1); -@@ -1049,7 +1067,7 @@ community_delete(struct rde_aspath *asp, +@@ -1049,7 +1065,7 @@ community_delete(struct rde_aspath *asp, u_int8_t *p, *n; u_int16_t l, len = 0; u_int16_t eas, etype; @@ -104,7 +105,7 @@ diff -u -p -r1.1.1.6 -r1.4 attr = attr_optget(asp, ATTR_COMMUNITIES); if (attr == NULL) -@@ -1100,10 +1118,146 @@ community_delete(struct rde_aspath *asp, +@@ -1100,10 +1116,250 @@ community_delete(struct rde_aspath *asp, } f = attr->flags; @@ -117,6 +118,31 @@ diff -u -p -r1.1.1.6 -r1.4 +} + +int ++community_ext_match(struct rde_aspath *asp, struct filter_extcommunity *c, ++ u_int16_t neighas) ++{ ++ struct attr *attr; ++ u_int8_t *p; ++ u_int64_t ec; ++ u_int16_t len; ++ ++ attr = attr_optget(asp, ATTR_EXT_COMMUNITIES); ++ if (attr == NULL) ++ /* no communities, no match */ ++ return (0); ++ ++ p = attr->data; ++ for (len = attr->len / sizeof(ec); len > 0; len--) { ++ memcpy(&ec, p, sizeof(ec)); ++ if (community_ext_matchone(c, neighas, ec)) ++ return (1); ++ p += sizeof(ec); ++ } ++ ++ return (0); ++} ++ ++int +community_ext_set(struct rde_aspath *asp, struct filter_extcommunity *c, + u_int16_t neighas) +{ @@ -132,7 +158,7 @@ diff -u -p -r1.1.1.6 -r1.4 + attr = attr_optget(asp, ATTR_EXT_COMMUNITIES); + if (attr != NULL) { + p = attr->data; -+ ncommunities = attr->len / 8; /* 64bit per ext-community */ ++ ncommunities = attr->len / sizeof(community); + } + + /* first check if the community is not already set */ @@ -253,3 +279,82 @@ diff -u -p -r1.1.1.6 -r1.4 + + return (0); +} ++ ++int ++community_ext_matchone(struct filter_extcommunity *c, u_int16_t neighas, ++ u_int64_t community) ++{ ++ u_int64_t com, mask; ++ u_int32_t ip; ++ ++ community = betoh64(community); ++ ++ com = (u_int64_t)c->type << 56; ++ mask = 0xffULL << 56; ++ if ((com & mask) != (community & mask)) ++ return (0); ++ ++ switch (c->type & EXT_COMMUNITY_VALUE) { ++ case EXT_COMMUNITY_TWO_AS: ++ case EXT_COMMUNITY_IPV4: ++ case EXT_COMMUNITY_FOUR_AS: ++ case EXT_COMMUNITY_OPAQUE: ++ com = (u_int64_t)c->subtype << 48; ++ mask = 0xffULL << 48; ++ if ((com & mask) != (community & mask)) ++ return (0); ++ break; ++ default: ++ com = c->data.ext_opaq & 0xffffffffffffffULL; ++ mask = 0xffffffffffffffULL; ++ if ((com & mask) == (community & mask)) ++ return (1); ++ return (0); ++ } ++ ++ ++ switch (c->type & EXT_COMMUNITY_VALUE) { ++ case EXT_COMMUNITY_TWO_AS: ++ com = (u_int64_t)c->data.ext_as.as << 32; ++ mask = 0xffffULL << 32; ++ if ((com & mask) != (community & mask)) ++ return (0); ++ ++ com = c->data.ext_as.val; ++ mask = 0xffffffffULL; ++ if ((com & mask) == (community & mask)) ++ return (1); ++ break; ++ case EXT_COMMUNITY_IPV4: ++ ip = ntohl(c->data.ext_ip.addr.s_addr); ++ com = (u_int64_t)ip << 16; ++ mask = 0xffffffff0000ULL; ++ if ((com & mask) != (community & mask)) ++ return (0); ++ ++ com = c->data.ext_ip.val; ++ mask = 0xffff; ++ if ((com & mask) == (community & mask)) ++ return (1); ++ break; ++ case EXT_COMMUNITY_FOUR_AS: ++ com = (u_int64_t)c->data.ext_as4.as4 << 16; ++ mask = 0xffffffffULL << 16; ++ if ((com & mask) != (community & mask)) ++ return (0); ++ ++ com = c->data.ext_as4.val; ++ mask = 0xffff; ++ if ((com & mask) == (community & mask)) ++ return (1); ++ break; ++ case EXT_COMMUNITY_OPAQUE: ++ com = c->data.ext_opaq & EXT_COMMUNITY_OPAQUE_MAX; ++ mask = EXT_COMMUNITY_OPAQUE_MAX; ++ if ((com & mask) == (community & mask)) ++ return (1); ++ break; ++ } ++ ++ return (0); ++} diff --git a/net/openbgpd/files/patch-bgpd_rde_filter.c b/net/openbgpd/files/patch-bgpd_rde_filter.c index a19d044bb451..e3cd6712b9f6 100644 --- a/net/openbgpd/files/patch-bgpd_rde_filter.c +++ b/net/openbgpd/files/patch-bgpd_rde_filter.c @@ -2,13 +2,13 @@ Index: bgpd/rde_filter.c =================================================================== RCS file: /home/cvs/private/hrs/openbgpd/bgpd/rde_filter.c,v retrieving revision 1.1.1.7 -retrieving revision 1.5 -diff -u -p -r1.1.1.7 -r1.5 +retrieving revision 1.6 +diff -u -p -r1.1.1.7 -r1.6 --- bgpd/rde_filter.c 14 Feb 2010 20:19:57 -0000 1.1.1.7 -+++ bgpd/rde_filter.c 4 Feb 2010 16:22:23 -0000 1.5 ++++ bgpd/rde_filter.c 10 Apr 2010 12:16:23 -0000 1.6 @@ -1,4 +1,4 @@ -/* $OpenBSD: rde_filter.c,v 1.56 2009/06/06 01:10:29 claudio Exp $ */ -+/* $OpenBSD: rde_filter.c,v 1.61 2009/12/18 15:51:37 claudio Exp $ */ ++/* $OpenBSD: rde_filter.c,v 1.62 2010/03/05 15:25:00 claudio Exp $ */ /* * Copyright (c) 2004 Claudio Jeker <claudio@openbsd.org> @@ -71,7 +71,7 @@ diff -u -p -r1.1.1.7 -r1.5 } } } -@@ -281,12 +299,12 @@ rde_filter_match(struct filter_rule *f, +@@ -281,12 +299,17 @@ rde_filter_match(struct filter_rule *f, break; } @@ -79,6 +79,11 @@ diff -u -p -r1.1.1.7 -r1.5 + if (community_match(asp, as, type) == 0) return (0); } ++ if (asp != NULL && ++ (f->match.ext_community.flags & EXT_COMMUNITY_FLAG_VALID)) ++ if (community_ext_match(asp, &f->match.ext_community, ++ peer->conf.remote_as) == 0) ++ return (0); - if (f->match.prefix.addr.af != 0) { - if (f->match.prefix.addr.af != prefix->af) @@ -87,7 +92,7 @@ diff -u -p -r1.1.1.7 -r1.5 /* don't use IPv4 rules for IPv6 and vice versa */ return (0); -@@ -322,7 +340,7 @@ rde_filter_match(struct filter_rule *f, +@@ -322,7 +345,7 @@ rde_filter_match(struct filter_rule *f, } else if (f->match.prefixlen.op != OP_NONE) { /* only prefixlen without a prefix */ @@ -96,7 +101,7 @@ diff -u -p -r1.1.1.7 -r1.5 /* don't use IPv4 rules for IPv6 and vice versa */ return (0); -@@ -356,19 +374,6 @@ rde_filter_match(struct filter_rule *f, +@@ -356,19 +379,6 @@ rde_filter_match(struct filter_rule *f, } int @@ -116,7 +121,7 @@ diff -u -p -r1.1.1.7 -r1.5 rde_filter_equal(struct filter_head *a, struct filter_head *b, struct rde_peer *peer, enum directions dir) { -@@ -476,6 +481,12 @@ filterset_cmp(struct filter_set *a, stru +@@ -476,6 +486,12 @@ filterset_cmp(struct filter_set *a, stru return (a->action.community.type - b->action.community.type); } @@ -129,7 +134,7 @@ diff -u -p -r1.1.1.7 -r1.5 if (a->type == ACTION_SET_NEXTHOP && b->type == ACTION_SET_NEXTHOP) { /* * This is the only interesting case, all others are considered -@@ -483,7 +494,7 @@ filterset_cmp(struct filter_set *a, stru +@@ -483,7 +499,7 @@ filterset_cmp(struct filter_set *a, stru * reject it at the same time. Allow one IPv4 and one IPv6 * per filter set or only one of the other nexthop modifiers. */ @@ -138,7 +143,7 @@ diff -u -p -r1.1.1.7 -r1.5 } /* equal */ -@@ -574,6 +585,19 @@ filterset_equal(struct filter_set_head * +@@ -574,6 +590,19 @@ filterset_equal(struct filter_set_head * if (strcmp(as, bs) == 0) continue; break; @@ -158,7 +163,7 @@ diff -u -p -r1.1.1.7 -r1.5 } /* compare failed */ return (0); -@@ -616,7 +640,14 @@ filterset_name(enum action_types type) +@@ -616,7 +645,14 @@ filterset_name(enum action_types type) case ACTION_RTLABEL: case ACTION_RTLABEL_ID: return ("rtlabel"); diff --git a/net/openbgpd/files/patch-bgpd_rde_prefix.c b/net/openbgpd/files/patch-bgpd_rde_prefix.c index 7df1c4ee65e0..a2612312ffcc 100644 --- a/net/openbgpd/files/patch-bgpd_rde_prefix.c +++ b/net/openbgpd/files/patch-bgpd_rde_prefix.c @@ -2,13 +2,13 @@ Index: bgpd/rde_prefix.c =================================================================== RCS file: /home/cvs/private/hrs/openbgpd/bgpd/rde_prefix.c,v retrieving revision 1.1.1.6 -retrieving revision 1.4 -diff -u -p -r1.1.1.6 -r1.4 +retrieving revision 1.5 +diff -u -p -r1.1.1.6 -r1.5 --- bgpd/rde_prefix.c 14 Feb 2010 20:19:57 -0000 1.1.1.6 -+++ bgpd/rde_prefix.c 4 Feb 2010 16:22:23 -0000 1.4 ++++ bgpd/rde_prefix.c 10 Apr 2010 12:16:23 -0000 1.5 @@ -1,4 +1,4 @@ -/* $OpenBSD: rde_prefix.c,v 1.29 2009/05/30 18:27:17 claudio Exp $ */ -+/* $OpenBSD: rde_prefix.c,v 1.31 2010/01/13 06:02:37 claudio Exp $ */ ++/* $OpenBSD: rde_prefix.c,v 1.32 2010/03/26 15:41:04 claudio Exp $ */ /* * Copyright (c) 2003, 2004 Claudio Jeker <claudio@openbsd.org> @@ -123,7 +123,7 @@ diff -u -p -r1.1.1.6 -r1.4 } struct pt_entry * -@@ -131,34 +155,9 @@ struct pt_entry * +@@ -131,39 +155,12 @@ struct pt_entry * pt_add(struct bgpd_addr *prefix, int prefixlen) { struct pt_entry *p = NULL; @@ -155,13 +155,20 @@ diff -u -p -r1.1.1.6 -r1.4 - default: - fatalx("pt_add: unknown af"); - } -+ + +- if (RB_INSERT(pt_tree, &pttable, p) != NULL) { +- log_warnx("pt_add: insert failed"); +- return (NULL); +- } + p = pt_fill(prefix, prefixlen); + p = pt_alloc(p); ++ ++ if (RB_INSERT(pt_tree, &pttable, p) != NULL) ++ fatalx("pt_add: insert failed"); - if (RB_INSERT(pt_tree, &pttable, p) != NULL) { - log_warnx("pt_add: insert failed"); -@@ -183,13 +182,14 @@ struct pt_entry * + return (p); + } +@@ -183,13 +180,14 @@ struct pt_entry * pt_lookup(struct bgpd_addr *addr) { struct pt_entry *p; @@ -180,7 +187,7 @@ diff -u -p -r1.1.1.6 -r1.4 i = 128; break; default: -@@ -206,17 +206,18 @@ pt_lookup(struct bgpd_addr *addr) +@@ -206,17 +204,18 @@ pt_lookup(struct bgpd_addr *addr) int pt_prefix_cmp(const struct pt_entry *a, const struct pt_entry *b) { @@ -206,7 +213,7 @@ diff -u -p -r1.1.1.6 -r1.4 a4 = (const struct pt_entry4 *)a; b4 = (const struct pt_entry4 *)b; if (ntohl(a4->prefix4.s_addr) > ntohl(b4->prefix4.s_addr)) -@@ -228,7 +229,7 @@ pt_prefix_cmp(const struct pt_entry *a, +@@ -228,7 +227,7 @@ pt_prefix_cmp(const struct pt_entry *a, if (a4->prefixlen < b4->prefixlen) return (-1); return (0); @@ -215,7 +222,7 @@ diff -u -p -r1.1.1.6 -r1.4 a6 = (const struct pt_entry6 *)a; b6 = (const struct pt_entry6 *)b; -@@ -242,49 +243,49 @@ pt_prefix_cmp(const struct pt_entry *a, +@@ -242,49 +241,49 @@ pt_prefix_cmp(const struct pt_entry *a, if (a6->prefixlen > b6->prefixlen) return (1); return (0); diff --git a/net/openbgpd/files/patch-bgpd_rde_rib.c b/net/openbgpd/files/patch-bgpd_rde_rib.c index 369b44477475..edea241a977e 100644 --- a/net/openbgpd/files/patch-bgpd_rde_rib.c +++ b/net/openbgpd/files/patch-bgpd_rde_rib.c @@ -2,13 +2,13 @@ Index: bgpd/rde_rib.c =================================================================== RCS file: /home/cvs/private/hrs/openbgpd/bgpd/rde_rib.c,v retrieving revision 1.1.1.7 -retrieving revision 1.5 -diff -u -p -r1.1.1.7 -r1.5 +retrieving revision 1.6 +diff -u -p -r1.1.1.7 -r1.6 --- bgpd/rde_rib.c 14 Feb 2010 20:19:57 -0000 1.1.1.7 -+++ bgpd/rde_rib.c 4 Feb 2010 16:22:23 -0000 1.5 ++++ bgpd/rde_rib.c 10 Apr 2010 12:16:23 -0000 1.6 @@ -1,4 +1,4 @@ -/* $OpenBSD: rde_rib.c,v 1.116 2009/06/29 14:13:48 claudio Exp $ */ -+/* $OpenBSD: rde_rib.c,v 1.120 2010/01/13 06:02:37 claudio Exp $ */ ++/* $OpenBSD: rde_rib.c,v 1.125 2010/04/07 09:44:11 claudio Exp $ */ /* * Copyright (c) 2003, 2004 Claudio Jeker <claudio@openbsd.org> @@ -24,16 +24,38 @@ diff -u -p -r1.1.1.7 -r1.5 #include <stdlib.h> #include <string.h> -@@ -78,7 +82,7 @@ rib_new(int id, char *name, u_int16_t fl +@@ -50,16 +54,15 @@ RB_GENERATE(rib_tree, rib_entry, rib_e, + + /* RIB specific functions */ + u_int16_t +-rib_new(int id, char *name, u_int16_t flags) ++rib_new(char *name, u_int16_t flags) + { + struct rib *xribs; + size_t newsize; ++ u_int16_t id; + +- if (id < 0) { +- for (id = 0; id < rib_size; id++) { +- if (*ribs[id].name == '\0') +- break; +- } ++ for (id = 0; id < rib_size; id++) { ++ if (*ribs[id].name == '\0') ++ break; + } + + if (id == RIB_FAILED) +@@ -78,7 +81,7 @@ rib_new(int id, char *name, u_int16_t fl bzero(&ribs[id], sizeof(struct rib)); strlcpy(ribs[id].name, name, sizeof(ribs[id].name)); RB_INIT(&ribs[id].rib); - ribs[id].state = RIB_ACTIVE; -+ ribs[id].state = RIB_NEW; ++ ribs[id].state = RECONF_REINIT; ribs[id].id = id; ribs[id].flags = flags; -@@ -173,15 +177,16 @@ rib_lookup(struct rib *rib, struct bgpd_ +@@ -173,15 +176,16 @@ rib_lookup(struct rib *rib, struct bgpd_ struct rib_entry *re; int i; @@ -53,7 +75,7 @@ diff -u -p -r1.1.1.7 -r1.5 for (i = 128; i >= 0; i--) { re = rib_get(rib, addr, i); if (re != NULL) -@@ -254,7 +259,7 @@ rib_empty(struct rib_entry *re) +@@ -254,7 +258,7 @@ rib_empty(struct rib_entry *re) void rib_dump(struct rib *rib, void (*upcall)(struct rib_entry *, void *), @@ -62,7 +84,7 @@ diff -u -p -r1.1.1.7 -r1.5 { struct rib_context *ctx; -@@ -263,7 +268,7 @@ rib_dump(struct rib *rib, void (*upcall) +@@ -263,7 +267,7 @@ rib_dump(struct rib *rib, void (*upcall) ctx->ctx_rib = rib; ctx->ctx_upcall = upcall; ctx->ctx_arg = arg; @@ -71,7 +93,7 @@ diff -u -p -r1.1.1.7 -r1.5 rib_dump_r(ctx); } -@@ -280,7 +285,8 @@ rib_dump_r(struct rib_context *ctx) +@@ -280,7 +284,8 @@ rib_dump_r(struct rib_context *ctx) re = rib_restart(ctx); for (i = 0; re != NULL; re = RB_NEXT(rib_tree, unused, re)) { @@ -81,7 +103,16 @@ diff -u -p -r1.1.1.7 -r1.5 continue; if (ctx->ctx_count && i++ >= ctx->ctx_count && (re->flags & F_RIB_ENTRYLOCK) == 0) { -@@ -632,11 +638,11 @@ prefix_compare(const struct bgpd_addr *a +@@ -308,7 +313,7 @@ rib_restart(struct rib_context *ctx) + re->flags &= ~F_RIB_ENTRYLOCK; + + /* find first non empty element */ +- while (rib_empty(re)) ++ while (re && rib_empty(re)) + re = RB_NEXT(rib_tree, unused, re); + + /* free the previously locked rib element if empty */ +@@ -632,11 +637,11 @@ prefix_compare(const struct bgpd_addr *a int i; u_int8_t m; @@ -97,7 +128,7 @@ diff -u -p -r1.1.1.7 -r1.5 if (prefixlen > 32) fatalx("prefix_cmp: bad IPv4 prefixlen"); mask = htonl(prefixlen2mask(prefixlen)); -@@ -645,7 +651,7 @@ prefix_compare(const struct bgpd_addr *a +@@ -645,7 +650,7 @@ prefix_compare(const struct bgpd_addr *a if (aa != ba) return (aa - ba); return (0); @@ -106,7 +137,7 @@ diff -u -p -r1.1.1.7 -r1.5 if (prefixlen > 128) fatalx("prefix_cmp: bad IPv6 prefixlen"); for (i = 0; i < prefixlen / 8; i++) -@@ -660,6 +666,24 @@ prefix_compare(const struct bgpd_addr *a +@@ -660,6 +665,24 @@ prefix_compare(const struct bgpd_addr *a (b->v6.s6_addr[prefixlen / 8] & m)); } return (0); @@ -131,7 +162,7 @@ diff -u -p -r1.1.1.7 -r1.5 default: fatalx("prefix_cmp: unknown af"); } -@@ -806,16 +830,33 @@ prefix_write(u_char *buf, int len, struc +@@ -806,16 +829,33 @@ prefix_write(u_char *buf, int len, struc { int totlen; @@ -172,28 +203,47 @@ diff -u -p -r1.1.1.7 -r1.5 } /* -@@ -1088,15 +1129,15 @@ nexthop_update(struct kroute_nexthop *ms +@@ -1070,10 +1110,6 @@ nexthop_update(struct kroute_nexthop *ms + return; + } + +- if (nexthop_delete(nh)) +- /* nexthop no longer used */ +- return; +- + oldstate = nh->state; + if (msg->valid) + nh->state = NEXTHOP_REACH; +@@ -1088,21 +1124,13 @@ nexthop_update(struct kroute_nexthop *ms memcpy(&nh->true_nexthop, &msg->gateway, sizeof(nh->true_nexthop)); - switch (msg->nexthop.af) { - case AF_INET: -+ switch (msg->nexthop.aid) { -+ case AID_INET: - nh->nexthop_netlen = msg->kr.kr4.prefixlen; +- nh->nexthop_netlen = msg->kr.kr4.prefixlen; - nh->nexthop_net.af = AF_INET; -+ nh->nexthop_net.aid = AID_INET; - nh->nexthop_net.v4.s_addr = msg->kr.kr4.prefix.s_addr; - break; +- nh->nexthop_net.v4.s_addr = msg->kr.kr4.prefix.s_addr; +- break; - case AF_INET6: -+ case AID_INET6: - nh->nexthop_netlen = msg->kr.kr6.prefixlen; +- nh->nexthop_netlen = msg->kr.kr6.prefixlen; - nh->nexthop_net.af = AF_INET6; -+ nh->nexthop_net.aid = AID_INET6; - memcpy(&nh->nexthop_net.v6, &msg->kr.kr6.prefix, - sizeof(struct in6_addr)); - break; -@@ -1118,7 +1159,7 @@ nexthop_update(struct kroute_nexthop *ms +- memcpy(&nh->nexthop_net.v6, &msg->kr.kr6.prefix, +- sizeof(struct in6_addr)); +- break; +- default: +- fatalx("nexthop_update: unknown af"); +- } ++ memcpy(&nh->nexthop_net, &msg->net, ++ sizeof(nh->nexthop_net)); ++ nh->nexthop_netlen = msg->netlen; ++ ++ if (nexthop_delete(nh)) ++ /* nexthop no longer used */ ++ return; + + if (rde_noevaluate()) + /* +@@ -1118,7 +1146,7 @@ nexthop_update(struct kroute_nexthop *ms void nexthop_modify(struct rde_aspath *asp, struct bgpd_addr *nexthop, @@ -202,7 +252,7 @@ diff -u -p -r1.1.1.7 -r1.5 { struct nexthop *nh; -@@ -1138,7 +1179,7 @@ nexthop_modify(struct rde_aspath *asp, s +@@ -1138,7 +1166,7 @@ nexthop_modify(struct rde_aspath *asp, s asp->flags |= F_NEXTHOP_SELF; return; } @@ -211,7 +261,7 @@ diff -u -p -r1.1.1.7 -r1.5 return; nh = nexthop_get(nexthop); -@@ -1233,17 +1274,17 @@ nexthop_compare(struct nexthop *na, stru +@@ -1233,17 +1261,17 @@ nexthop_compare(struct nexthop *na, stru a = &na->exit_nexthop; b = &nb->exit_nexthop; @@ -234,7 +284,7 @@ diff -u -p -r1.1.1.7 -r1.5 return (memcmp(&a->v6, &b->v6, sizeof(struct in6_addr))); default: fatalx("nexthop_cmp: unknown af"); -@@ -1269,14 +1310,14 @@ nexthop_hash(struct bgpd_addr *nexthop) +@@ -1269,14 +1297,14 @@ nexthop_hash(struct bgpd_addr *nexthop) { u_int32_t h = 0; diff --git a/net/openbgpd/files/patch-bgpd_util.c b/net/openbgpd/files/patch-bgpd_util.c index 4503f07a196b..88c95a8423d8 100644 --- a/net/openbgpd/files/patch-bgpd_util.c +++ b/net/openbgpd/files/patch-bgpd_util.c @@ -2,13 +2,13 @@ Index: bgpd/util.c =================================================================== RCS file: /home/cvs/private/hrs/openbgpd/bgpd/util.c,v retrieving revision 1.1.1.6 -retrieving revision 1.4 -diff -u -p -r1.1.1.6 -r1.4 +retrieving revision 1.5 +diff -u -p -r1.1.1.6 -r1.5 --- bgpd/util.c 14 Feb 2010 20:19:57 -0000 1.1.1.6 -+++ bgpd/util.c 4 Feb 2010 16:22:23 -0000 1.4 ++++ bgpd/util.c 10 Apr 2010 12:16:23 -0000 1.5 @@ -1,4 +1,4 @@ -/* $OpenBSD: util.c,v 1.6 2009/06/12 16:42:53 claudio Exp $ */ -+/* $OpenBSD: util.c,v 1.10 2010/01/13 06:02:37 claudio Exp $ */ ++/* $OpenBSD: util.c,v 1.11 2010/03/29 09:04:43 claudio Exp $ */ /* * Copyright (c) 2006 Claudio Jeker <claudio@openbsd.org> @@ -22,9 +22,11 @@ diff -u -p -r1.1.1.6 -r1.4 #include <netinet/in.h> #include <arpa/inet.h> #include <netdb.h> -@@ -33,10 +36,20 @@ log_addr(const struct bgpd_addr *addr) +@@ -32,11 +35,24 @@ const char * + log_addr(const struct bgpd_addr *addr) { static char buf[48]; ++ char tbuf[16]; - if (inet_ntop(addr->af, &addr->ba, buf, sizeof(buf)) == NULL) - return ("?"); @@ -37,20 +39,54 @@ diff -u -p -r1.1.1.6 -r1.4 + return ("?"); + return (buf); + case AID_VPN_IPv4: -+ if (inet_ntop(AF_INET, &addr->vpn4.addr, buf, -+ sizeof(buf)) == NULL) ++ if (inet_ntop(AF_INET, &addr->vpn4.addr, tbuf, ++ sizeof(tbuf)) == NULL) + return ("?"); ++ snprintf(buf, sizeof(buf), "%s %s", log_rd(addr->vpn4.rd), ++ tbuf); return (buf); + } + return ("???"); } const char * -@@ -90,6 +103,32 @@ log_as(u_int32_t as) +@@ -90,6 +106,64 @@ log_as(u_int32_t as) return (buf); } -+/* XXX this function does not check if the type/subtype combo is ++const char * ++log_rd(u_int64_t rd) ++{ ++ static char buf[32]; ++ struct in_addr addr; ++ u_int32_t u32; ++ u_int16_t u16; ++ ++ rd = betoh64(rd); ++ switch (rd >> 48) { ++ case EXT_COMMUNITY_TWO_AS: ++ u32 = rd & 0xffffffff; ++ u16 = (rd >> 32) & 0xffff; ++ snprintf(buf, sizeof(buf), "rd %i:%i", u16, u32); ++ break; ++ case EXT_COMMUNITY_FOUR_AS: ++ u32 = (rd >> 16) & 0xffffffff; ++ u16 = rd & 0xffff; ++ snprintf(buf, sizeof(buf), "rd %s:%i", log_as(u32), u16); ++ break; ++ case EXT_COMMUNITY_IPV4: ++ u32 = (rd >> 16) & 0xffffffff; ++ u16 = rd & 0xffff; ++ addr.s_addr = htonl(u32); ++ snprintf(buf, sizeof(buf), "rd %s:%i", inet_ntoa(addr), u16); ++ break; ++ default: ++ return ("rd ?"); ++ } ++ return (buf); ++} ++ ++/* NOTE: this function does not check if the type/subtype combo is + * actually valid. */ +const char * +log_ext_subtype(u_int8_t subtype) @@ -79,7 +115,7 @@ diff -u -p -r1.1.1.6 -r1.4 int aspath_snprint(char *buf, size_t size, void *data, u_int16_t len) { -@@ -276,3 +315,115 @@ inet6applymask(struct in6_addr *dest, co +@@ -276,3 +350,115 @@ inet6applymask(struct in6_addr *dest, co for (i = 0; i < 16; i++) dest->s6_addr[i] = src->s6_addr[i] & mask.s6_addr[i]; } |