diff options
author | Henning Brauer <henning@cvs.openbsd.org> | 2004-01-11 02:35:15 +0000 |
---|---|---|
committer | Henning Brauer <henning@cvs.openbsd.org> | 2004-01-11 02:35:15 +0000 |
commit | 79985b6c591f4b1d7147d938dc9f7d0a2a6a288a (patch) | |
tree | 2619d894358340444fa9abf407469c036bd28e21 /usr.sbin | |
parent | 0481fa450146250191a980ac1b919baf24c0b7da (diff) |
new message IMSG_CTL_SHOW_NEXTHOP: request/send lost of BGP nexthops and
the result of their validity check
Diffstat (limited to 'usr.sbin')
-rw-r--r-- | usr.sbin/bgpd/bgpd.c | 3 | ||||
-rw-r--r-- | usr.sbin/bgpd/bgpd.h | 10 | ||||
-rw-r--r-- | usr.sbin/bgpd/control.c | 3 | ||||
-rw-r--r-- | usr.sbin/bgpd/kroute.c | 24 | ||||
-rw-r--r-- | usr.sbin/bgpd/session.c | 3 |
5 files changed, 35 insertions, 8 deletions
diff --git a/usr.sbin/bgpd/bgpd.c b/usr.sbin/bgpd/bgpd.c index 8f9e1e3da17..3a2093db2c3 100644 --- a/usr.sbin/bgpd/bgpd.c +++ b/usr.sbin/bgpd/bgpd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: bgpd.c,v 1.62 2004/01/11 01:00:07 claudio Exp $ */ +/* $OpenBSD: bgpd.c,v 1.63 2004/01/11 02:35:13 henning Exp $ */ /* * Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org> @@ -439,6 +439,7 @@ dispatch_imsg(struct imsgbuf *ibuf, int idx, struct mrt_head *mrtc) break; case IMSG_CTL_KROUTE: case IMSG_CTL_KROUTE_ADDR: + case IMSG_CTL_SHOW_NEXTHOP: if (idx != PFD_PIPE_SESSION) logit(LOG_CRIT, "kroute request not from SE"); else diff --git a/usr.sbin/bgpd/bgpd.h b/usr.sbin/bgpd/bgpd.h index 1e0aca93c5b..5e1ad970850 100644 --- a/usr.sbin/bgpd/bgpd.h +++ b/usr.sbin/bgpd/bgpd.h @@ -1,4 +1,4 @@ -/* $OpenBSD: bgpd.h,v 1.61 2004/01/09 19:08:50 henning Exp $ */ +/* $OpenBSD: bgpd.h,v 1.62 2004/01/11 02:35:14 henning Exp $ */ /* * Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org> @@ -161,7 +161,8 @@ enum imsg_type { IMSG_CTL_NEIGHBOR_UP, IMSG_CTL_NEIGHBOR_DOWN, IMSG_CTL_KROUTE, - IMSG_CTL_KROUTE_ADDR + IMSG_CTL_KROUTE_ADDR, + IMSG_CTL_SHOW_NEXTHOP }; struct imsg_hdr { @@ -209,6 +210,11 @@ struct kroute_nexthop { in_addr_t gateway; }; +struct ctl_show_nexthop { + struct bgpd_addr addr; + u_int8_t valid; +}; + /* prototypes */ /* bgpd.c */ void send_nexthop_update(struct kroute_nexthop *); diff --git a/usr.sbin/bgpd/control.c b/usr.sbin/bgpd/control.c index 92865d759e8..20e28337965 100644 --- a/usr.sbin/bgpd/control.c +++ b/usr.sbin/bgpd/control.c @@ -1,4 +1,4 @@ -/* $OpenBSD: control.c,v 1.15 2004/01/09 19:08:50 henning Exp $ */ +/* $OpenBSD: control.c,v 1.16 2004/01/11 02:35:14 henning Exp $ */ /* * Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org> @@ -268,6 +268,7 @@ control_dispatch_msg(struct pollfd *pfd, int i) break; case IMSG_CTL_KROUTE: case IMSG_CTL_KROUTE_ADDR: + case IMSG_CTL_SHOW_NEXTHOP: c->ibuf.pid = imsg.hdr.pid; imsg_compose_parent(imsg.hdr.type, imsg.hdr.pid, imsg.data, imsg.hdr.len - IMSG_HEADER_SIZE); diff --git a/usr.sbin/bgpd/kroute.c b/usr.sbin/bgpd/kroute.c index 929d5bfda7a..76f36f21495 100644 --- a/usr.sbin/bgpd/kroute.c +++ b/usr.sbin/bgpd/kroute.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kroute.c,v 1.61 2004/01/09 19:08:50 henning Exp $ */ +/* $OpenBSD: kroute.c,v 1.62 2004/01/11 02:35:14 henning Exp $ */ /* * Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org> @@ -303,8 +303,11 @@ kr_show_route(struct imsg *imsg) struct kroute_node *kr; struct bgpd_addr *addr; int flags; + struct ctl_show_nexthop snh; + struct knexthop_node *h; - if (imsg->hdr.type == IMSG_CTL_KROUTE) { + switch (imsg->hdr.type) { + case IMSG_CTL_KROUTE: if (imsg->hdr.len != IMSG_HEADER_SIZE + sizeof(flags)) { logit(LOG_CRIT, "kr_show_route: wrong imsg len"); return; @@ -314,7 +317,8 @@ kr_show_route(struct imsg *imsg) if (!flags || kr->r.flags & flags) send_imsg_session(IMSG_CTL_KROUTE, imsg->hdr.pid, &kr->r, sizeof(kr->r)); - } else if (imsg->hdr.type == IMSG_CTL_KROUTE_ADDR) { + break; + case IMSG_CTL_KROUTE_ADDR: if (imsg->hdr.len != IMSG_HEADER_SIZE + sizeof(struct bgpd_addr)) { logit(LOG_CRIT, "kr_show_route: wrong imsg len"); @@ -327,6 +331,20 @@ kr_show_route(struct imsg *imsg) if (kr != NULL) send_imsg_session(IMSG_CTL_KROUTE, imsg->hdr.pid, &kr->r, sizeof(kr->r)); + break; + case IMSG_CTL_SHOW_NEXTHOP: + RB_FOREACH(h, knexthop_tree, &knt) { + bzero(&snh, sizeof(snh)); + snh.addr.v4.s_addr = h->nexthop; + if (h->kroute != NULL) + if (!(h->kroute->r.flags & F_DOWN)) + snh.valid = 1; + send_imsg_session(IMSG_CTL_SHOW_NEXTHOP, imsg->hdr.pid, + &snh, sizeof(snh)); + } + break; + default: /* nada */ + break; } send_imsg_session(IMSG_CTL_END, imsg->hdr.pid, NULL, 0); } diff --git a/usr.sbin/bgpd/session.c b/usr.sbin/bgpd/session.c index 56f418e9b4b..c2df332f184 100644 --- a/usr.sbin/bgpd/session.c +++ b/usr.sbin/bgpd/session.c @@ -1,4 +1,4 @@ -/* $OpenBSD: session.c,v 1.83 2004/01/11 01:04:43 henning Exp $ */ +/* $OpenBSD: session.c,v 1.84 2004/01/11 02:35:14 henning Exp $ */ /* * Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org> @@ -1471,6 +1471,7 @@ session_dispatch_imsg(struct imsgbuf *ibuf, int idx) break; case IMSG_CTL_KROUTE: case IMSG_CTL_KROUTE_ADDR: + case IMSG_CTL_SHOW_NEXTHOP: case IMSG_CTL_END: if (idx != PFD_PIPE_MAIN) fatalx("ctl kroute request not from parent"); |