diff options
author | Henning Brauer <henning@cvs.openbsd.org> | 2003-12-26 00:14:05 +0000 |
---|---|---|
committer | Henning Brauer <henning@cvs.openbsd.org> | 2003-12-26 00:14:05 +0000 |
commit | ef01dd9f7485bb065b90d3072b55347b6e03dffb (patch) | |
tree | d36d64420edfd1d83891ae769f397657edd69f37 | |
parent | 29105c423c718cf455430c13c0b1185bea48edda (diff) |
finally marry rde and kroute parts of the nexthop verification:
handle IMSG_NEXTHOP_ADD and send IMSG_NEXTHOP_UPDATE when appropriate
-rw-r--r-- | usr.sbin/bgpd/bgpd.c | 22 | ||||
-rw-r--r-- | usr.sbin/bgpd/bgpd.h | 5 | ||||
-rw-r--r-- | usr.sbin/bgpd/kroute.c | 6 |
3 files changed, 26 insertions, 7 deletions
diff --git a/usr.sbin/bgpd/bgpd.c b/usr.sbin/bgpd/bgpd.c index f065e021238..ac5b448380a 100644 --- a/usr.sbin/bgpd/bgpd.c +++ b/usr.sbin/bgpd/bgpd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: bgpd.c,v 1.29 2003/12/25 17:07:24 henning Exp $ */ +/* $OpenBSD: bgpd.c,v 1.30 2003/12/26 00:14:04 henning Exp $ */ /* * Copyright (c) 2003 Henning Brauer <henning@openbsd.org> @@ -320,6 +320,7 @@ dispatch_imsg(struct imsgbuf *ibuf, int idx, struct mrt_config *conf) struct mrtdump_config *m; ssize_t len; int n; + in_addr_t ina; if (imsg_get(ibuf, &imsg) > 0) { switch (imsg.hdr.type) { @@ -355,6 +356,19 @@ dispatch_imsg(struct imsgbuf *ibuf, int idx, struct mrt_config *conf) if (kroute_delete(rfd, imsg.data)) fatal("kroute_delete error", errno); break; + case IMSG_NEXTHOP_ADD: + if (idx != PFD_PIPE_ROUTE) + fatal("nexthop request not from RDE", 0); + memcpy(&ina, imsg.data, sizeof(ina)); + kroute_nexthop_check(ina); + break; + case IMSG_NEXTHOP_REMOVE: + if (idx != PFD_PIPE_ROUTE) + fatal("nexthop request not from RDE", 0); + memcpy(&ina, imsg.data, sizeof(ina)); + /* XXX */ + /* kroute_nexthop_delete(ina); */ + break; default: break; } @@ -363,3 +377,9 @@ dispatch_imsg(struct imsgbuf *ibuf, int idx, struct mrt_config *conf) return (0); } +void +send_nexthop_update(struct kroute_nexthop *msg) +{ + imsg_compose(&ibuf_rde, IMSG_NEXTHOP_UPDATE, 0, + msg, sizeof(struct kroute_nexthop)); +} diff --git a/usr.sbin/bgpd/bgpd.h b/usr.sbin/bgpd/bgpd.h index c6faedb393c..51c67b81e7c 100644 --- a/usr.sbin/bgpd/bgpd.h +++ b/usr.sbin/bgpd/bgpd.h @@ -1,4 +1,4 @@ -/* $OpenBSD: bgpd.h,v 1.27 2003/12/25 23:22:13 claudio Exp $ */ +/* $OpenBSD: bgpd.h,v 1.28 2003/12/26 00:14:04 henning Exp $ */ /* * Copyright (c) 2003 Henning Brauer <henning@openbsd.org> @@ -259,6 +259,9 @@ struct kroute_nexthop { }; /* prototypes */ +/* bgpd.c */ +void send_nexthop_update(struct kroute_nexthop *); + /* session.c */ int session_main(struct bgpd_config *, int[2], int[2]); diff --git a/usr.sbin/bgpd/kroute.c b/usr.sbin/bgpd/kroute.c index 1e1d7ff375d..4fb03b809b8 100644 --- a/usr.sbin/bgpd/kroute.c +++ b/usr.sbin/bgpd/kroute.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kroute.c,v 1.23 2003/12/26 00:12:23 henning Exp $ */ +/* $OpenBSD: kroute.c,v 1.24 2003/12/26 00:14:04 henning Exp $ */ /* * Copyright (c) 2003 Henning Brauer <henning@openbsd.org> @@ -468,10 +468,8 @@ kroute_remove(struct kroute_node *kr) */ bzero(&nh, sizeof(nh)); kroute_validate_nexthop(s->nexthop, &nh); -#if 0 if (nh.valid == 0) /* no alternate route */ send_nexthop_update(&nh); -#endif } free(kr); @@ -515,9 +513,7 @@ kroute_nexthop_check(in_addr_t key) } } else kroute_validate_nexthop(key, &nh); -#if 0 send_nexthop_update(&nh); -#endif } void |