diff options
author | Michele Marchetto <michele@cvs.openbsd.org> | 2009-04-16 20:11:13 +0000 |
---|---|---|
committer | Michele Marchetto <michele@cvs.openbsd.org> | 2009-04-16 20:11:13 +0000 |
commit | f1afa167968d41d3e1f4e207258ae903ea8e6170 (patch) | |
tree | dd9bfee4d7c701bb1a7c8d2870e865e9b0037306 /usr.sbin | |
parent | 53a57edf4fd09c7d8a6e6f38bf1f299be55f51ab (diff) |
Notify the rde when a neighbor goes down.
When this happens we have to rebuild the list of downstream
interfaces.
ok claudio@
Diffstat (limited to 'usr.sbin')
-rw-r--r-- | usr.sbin/dvmrpd/dvmrpd.h | 8 | ||||
-rw-r--r-- | usr.sbin/dvmrpd/neighbor.c | 9 | ||||
-rw-r--r-- | usr.sbin/dvmrpd/rde.c | 11 | ||||
-rw-r--r-- | usr.sbin/dvmrpd/rde.h | 4 | ||||
-rw-r--r-- | usr.sbin/dvmrpd/rde_srt.c | 14 |
5 files changed, 37 insertions, 9 deletions
diff --git a/usr.sbin/dvmrpd/dvmrpd.h b/usr.sbin/dvmrpd/dvmrpd.h index 5cfc7e77919..fd41c286f3a 100644 --- a/usr.sbin/dvmrpd/dvmrpd.h +++ b/usr.sbin/dvmrpd/dvmrpd.h @@ -1,4 +1,4 @@ -/* $OpenBSD: dvmrpd.h,v 1.16 2009/03/14 15:32:55 michele Exp $ */ +/* $OpenBSD: dvmrpd.h,v 1.17 2009/04/16 20:11:12 michele Exp $ */ /* * Copyright (c) 2004, 2005, 2006 Esben Norby <norby@openbsd.org> @@ -111,6 +111,7 @@ enum imsg_type { IMSG_MFC_DEL, IMSG_GROUP_ADD, IMSG_GROUP_DEL, + IMSG_NBR_DEL, IMSG_SEND_PRUNE, IMSG_RECV_PRUNE, IMSG_FLASH_UPDATE, @@ -207,6 +208,11 @@ struct prune { u_int32_t lifetime; }; +struct nbr_msg { + struct in_addr address; + unsigned int ifindex; +}; + TAILQ_HEAD(rr_head, rr_entry); RB_HEAD(src_head, src_node); diff --git a/usr.sbin/dvmrpd/neighbor.c b/usr.sbin/dvmrpd/neighbor.c index 93c50b7230d..d8dca760bd1 100644 --- a/usr.sbin/dvmrpd/neighbor.c +++ b/usr.sbin/dvmrpd/neighbor.c @@ -1,4 +1,4 @@ -/* $OpenBSD: neighbor.c,v 1.6 2009/03/07 12:47:17 michele Exp $ */ +/* $OpenBSD: neighbor.c,v 1.7 2009/04/16 20:11:12 michele Exp $ */ /* * Copyright (c) 2005 Claudio Jeker <claudio@openbsd.org> @@ -348,6 +348,8 @@ nbr_act_start_itimer(struct nbr *nbr) int nbr_act_delete(struct nbr *nbr) { + struct nbr_msg nm; + log_debug("nbr_act_delete: neighbor ID %s", inet_ntoa(nbr->id)); /* stop timers */ @@ -357,6 +359,11 @@ nbr_act_delete(struct nbr *nbr) return (-1); } + nm.address.s_addr = nbr->addr.s_addr; + nm.ifindex = nbr->iface->ifindex; + + dvmrpe_imsg_compose_rde(IMSG_NBR_DEL, 0, 0, &nm, sizeof(nm)); + return (nbr_del(nbr)); } diff --git a/usr.sbin/dvmrpd/rde.c b/usr.sbin/dvmrpd/rde.c index 92aac1e4a81..2f40a042370 100644 --- a/usr.sbin/dvmrpd/rde.c +++ b/usr.sbin/dvmrpd/rde.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rde.c,v 1.14 2009/04/11 10:21:20 michele Exp $ */ +/* $OpenBSD: rde.c,v 1.15 2009/04/16 20:11:12 michele Exp $ */ /* * Copyright (c) 2004, 2005 Claudio Jeker <claudio@openbsd.org> @@ -193,6 +193,7 @@ rde_dispatch_imsg(int fd, short event, void *bula) struct imsgbuf *ibuf = bula; struct imsg imsg; struct route_report rr; + struct nbr_msg nm; int i, n, connected = 0; struct iface *iface; @@ -297,6 +298,14 @@ rde_dispatch_imsg(int fd, short event, void *bula) rde_group_list_remove(iface, mfc.group); break; + case IMSG_NBR_DEL: + if (imsg.hdr.len - IMSG_HEADER_SIZE != sizeof(nm)) + fatalx("invalid size of OE request"); + + memcpy(&nm, imsg.data, sizeof(nm)); + srt_expire_nbr(nm.address, nm.ifindex); + + break; case IMSG_RECV_PRUNE: if (imsg.hdr.len - IMSG_HEADER_SIZE != sizeof(p)) fatalx("invalid size of OE request"); diff --git a/usr.sbin/dvmrpd/rde.h b/usr.sbin/dvmrpd/rde.h index aa125b45415..aea9a2c04e2 100644 --- a/usr.sbin/dvmrpd/rde.h +++ b/usr.sbin/dvmrpd/rde.h @@ -1,4 +1,4 @@ -/* $OpenBSD: rde.h,v 1.14 2009/04/14 19:27:43 michele Exp $ */ +/* $OpenBSD: rde.h,v 1.15 2009/04/16 20:11:12 michele Exp $ */ /* * Copyright (c) 2005, 2006 Esben Norby <norby@openbsd.org> @@ -113,7 +113,7 @@ struct rt_node *rt_match_origin(in_addr_t); int srt_check_route(struct route_report *, int); int src_compare(struct src_node *, struct src_node *); -void srt_expire_nbr(struct in_addr, struct iface *); +void srt_expire_nbr(struct in_addr, unsigned int); void srt_check_downstream_ifaces(struct rt_node *, struct iface *); RB_PROTOTYPE(src_head, src_node, entry, src_compare); diff --git a/usr.sbin/dvmrpd/rde_srt.c b/usr.sbin/dvmrpd/rde_srt.c index 05127b336e1..d90a95bde1c 100644 --- a/usr.sbin/dvmrpd/rde_srt.c +++ b/usr.sbin/dvmrpd/rde_srt.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rde_srt.c,v 1.21 2009/04/16 17:59:07 michele Exp $ */ +/* $OpenBSD: rde_srt.c,v 1.22 2009/04/16 20:11:12 michele Exp $ */ /* * Copyright (c) 2009 Michele Marchetto <michele@openbsd.org> @@ -571,11 +571,15 @@ srt_check_downstream_ifaces(struct rt_node *rn, struct iface *iface) } void -srt_expire_nbr(struct in_addr addr, struct iface *iface) +srt_expire_nbr(struct in_addr addr, unsigned int ifindex) { struct ds_nbr *ds; struct rt_node *rn; - u_int32_t ifindex = iface->ifindex; + struct iface *iface; + + iface = if_find_index(ifindex); + if (iface == NULL) + fatal("srt_expire_nbr: interface not found"); RB_FOREACH(rn, rt_tree, &rt) { if (rn->adv_rtr[ifindex].addr.s_addr == addr.s_addr) { @@ -586,8 +590,10 @@ srt_expire_nbr(struct in_addr addr, struct iface *iface) } else if (rn->adv_rtr[ifindex].addr.s_addr == iface->addr.s_addr) { ds = srt_find_ds(rn, addr.s_addr); - if (ds) + if (ds) { srt_delete_ds(rn, ds, iface); + srt_check_downstream_ifaces(rn, iface); + } } } } |