From ef01dd9f7485bb065b90d3072b55347b6e03dffb Mon Sep 17 00:00:00 2001 From: Henning Brauer Date: Fri, 26 Dec 2003 00:14:05 +0000 Subject: finally marry rde and kroute parts of the nexthop verification: handle IMSG_NEXTHOP_ADD and send IMSG_NEXTHOP_UPDATE when appropriate --- usr.sbin/bgpd/bgpd.c | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) (limited to 'usr.sbin/bgpd/bgpd.c') 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 @@ -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)); +} -- cgit v1.2.3