diff options
author | Renato Westphal <renato@cvs.openbsd.org> | 2015-10-05 01:59:34 +0000 |
---|---|---|
committer | Renato Westphal <renato@cvs.openbsd.org> | 2015-10-05 01:59:34 +0000 |
commit | 2a26a16179c6f1f78ed5298704d0ea56585df541 (patch) | |
tree | 69699760c61c0ed913bfb5330aa5412fa54e9905 /usr.sbin | |
parent | 767311b3a231c0d330c10ec8eab112926394912a (diff) |
When the SIA state is declared for a given destination, reset the
adjacency with the unresponsive neighbor(s).
Diffstat (limited to 'usr.sbin')
-rw-r--r-- | usr.sbin/eigrpd/eigrpe.c | 13 | ||||
-rw-r--r-- | usr.sbin/eigrpd/eigrpe.h | 8 | ||||
-rw-r--r-- | usr.sbin/eigrpd/hello.c | 8 | ||||
-rw-r--r-- | usr.sbin/eigrpd/interface.c | 4 | ||||
-rw-r--r-- | usr.sbin/eigrpd/rde.c | 10 | ||||
-rw-r--r-- | usr.sbin/eigrpd/rde.h | 4 | ||||
-rw-r--r-- | usr.sbin/eigrpd/rde_dual.c | 12 | ||||
-rw-r--r-- | usr.sbin/eigrpd/rtp.c | 4 | ||||
-rw-r--r-- | usr.sbin/eigrpd/tlv.c | 14 |
9 files changed, 51 insertions, 26 deletions
diff --git a/usr.sbin/eigrpd/eigrpe.c b/usr.sbin/eigrpd/eigrpe.c index 8370655a86c..e5c3a249914 100644 --- a/usr.sbin/eigrpd/eigrpe.c +++ b/usr.sbin/eigrpd/eigrpe.c @@ -1,4 +1,4 @@ -/* $OpenBSD: eigrpe.c,v 1.2 2015/10/04 23:00:10 renato Exp $ */ +/* $OpenBSD: eigrpe.c,v 1.3 2015/10/05 01:59:33 renato Exp $ */ /* * Copyright (c) 2015 Renato Westphal <renato@openbsd.org> @@ -533,6 +533,17 @@ eigrpe_dispatch_rde(int fd, short event, void *bula) break; } break; + case IMSG_NEIGHBOR_DOWN: + nbr = nbr_find_peerid(imsg.hdr.peerid); + if (nbr == NULL) { + log_debug("%s: cannot find rde neighbor", + __func__); + break; + } + /* announce that this neighborship is dead */ + send_hello(nbr->ei, NULL, 0, 1); + nbr_del(nbr); + break; case IMSG_CTL_SHOW_TOPOLOGY: case IMSG_CTL_END: control_imsg_relay(&imsg); diff --git a/usr.sbin/eigrpd/eigrpe.h b/usr.sbin/eigrpd/eigrpe.h index ea773ed58f7..434c26d6159 100644 --- a/usr.sbin/eigrpd/eigrpe.h +++ b/usr.sbin/eigrpd/eigrpe.h @@ -1,4 +1,4 @@ -/* $OpenBSD: eigrpe.h,v 1.2 2015/10/04 23:08:57 renato Exp $ */ +/* $OpenBSD: eigrpe.h,v 1.3 2015/10/05 01:59:33 renato Exp $ */ /* * Copyright (c) 2015 Renato Westphal <renato@openbsd.org> @@ -159,7 +159,8 @@ void recv_packet_v4(int, short, void *); void recv_packet_v6(int, short, void *); /* tlv.c */ -int gen_parameter_tlv(struct ibuf *, struct eigrp_iface *); +int gen_parameter_tlv(struct ibuf *, struct eigrp_iface *, + int); int gen_sequence_tlv(struct ibuf *, struct seq_addr_head *); int gen_sw_version_tlv(struct ibuf *); @@ -177,7 +178,8 @@ void metric_encode_mtu(uint8_t *, int); int metric_decode_mtu(uint8_t *); /* hello.c */ -void send_hello(struct eigrp_iface *, struct seq_addr_head *, uint32_t); +void send_hello(struct eigrp_iface *, struct seq_addr_head *, uint32_t, + int); void recv_hello(struct eigrp_iface *, union eigrpd_addr *, struct nbr *, struct tlv_parameter *); diff --git a/usr.sbin/eigrpd/hello.c b/usr.sbin/eigrpd/hello.c index 401e5b4f6b2..c422cdfe21f 100644 --- a/usr.sbin/eigrpd/hello.c +++ b/usr.sbin/eigrpd/hello.c @@ -1,4 +1,4 @@ -/* $OpenBSD: hello.c,v 1.1 2015/10/02 04:26:47 renato Exp $ */ +/* $OpenBSD: hello.c,v 1.2 2015/10/05 01:59:33 renato Exp $ */ /* * Copyright (c) 2015 Renato Westphal <renato@openbsd.org> @@ -28,7 +28,7 @@ void send_hello(struct eigrp_iface *ei, struct seq_addr_head *seq_addr_list, - uint32_t mcast_seq) + uint32_t mcast_seq, int peerterm) { struct eigrp *eigrp = ei->eigrp; struct ibuf *buf; @@ -42,7 +42,7 @@ send_hello(struct eigrp_iface *ei, struct seq_addr_head *seq_addr_list, if (gen_eigrp_hdr(buf, EIGRP_OPC_HELLO, flags, 0, eigrp->as)) goto fail; - if (gen_parameter_tlv(buf, ei)) + if (gen_parameter_tlv(buf, ei, peerterm)) goto fail; if (gen_sw_version_tlv(buf)) @@ -95,7 +95,7 @@ recv_hello(struct eigrp_iface *ei, union eigrpd_addr *src, struct nbr *nbr, nbr = nbr_new(ei, src, ntohs(tp->holdtime), 0); /* send an expedited hello */ - send_hello(ei, NULL, 0); + send_hello(ei, NULL, 0, 0); send_update(nbr->ei, nbr, EIGRP_HDR_FLAG_INIT, 0, NULL); } diff --git a/usr.sbin/eigrpd/interface.c b/usr.sbin/eigrpd/interface.c index db0e6dfc708..b7f4bec0dba 100644 --- a/usr.sbin/eigrpd/interface.c +++ b/usr.sbin/eigrpd/interface.c @@ -1,4 +1,4 @@ -/* $OpenBSD: interface.c,v 1.2 2015/10/04 23:00:10 renato Exp $ */ +/* $OpenBSD: interface.c,v 1.3 2015/10/05 01:59:33 renato Exp $ */ /* * Copyright (c) 2015 Renato Westphal <renato@openbsd.org> @@ -431,7 +431,7 @@ eigrp_if_hello_timer(int fd, short event, void *arg) struct eigrp_iface *ei = arg; struct timeval tv; - send_hello(ei, NULL, 0); + send_hello(ei, NULL, 0, 0); /* reschedule hello_timer */ timerclear(&tv); diff --git a/usr.sbin/eigrpd/rde.c b/usr.sbin/eigrpd/rde.c index 1e142ab7165..704231af6fe 100644 --- a/usr.sbin/eigrpd/rde.c +++ b/usr.sbin/eigrpd/rde.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rde.c,v 1.2 2015/10/04 23:00:10 renato Exp $ */ +/* $OpenBSD: rde.c,v 1.3 2015/10/05 01:59:33 renato Exp $ */ /* * Copyright (c) 2015 Renato Westphal <renato@openbsd.org> @@ -241,7 +241,7 @@ rde_dispatch_imsg(int fd, short event, void *bula) rde_check_link_down_nbr(nbr); rde_flush_queries(); - rde_nbr_del(rde_nbr_find(imsg.hdr.peerid)); + rde_nbr_del(rde_nbr_find(imsg.hdr.peerid), 0); break; case IMSG_RECV_UPDATE_INIT: nbr = rde_nbr_find(imsg.hdr.peerid); @@ -473,9 +473,9 @@ rde_instance_del(struct eigrp *eigrp) /* clear nbrs */ RB_FOREACH_SAFE(nbr, rde_nbr_head, &rde_nbrs, safe) if (nbr->eigrp == eigrp) - rde_nbr_del(nbr); - rde_nbr_del(eigrp->rnbr_redist); - rde_nbr_del(eigrp->rnbr_summary); + rde_nbr_del(nbr, 0); + rde_nbr_del(eigrp->rnbr_redist, 0); + rde_nbr_del(eigrp->rnbr_summary, 0); free(eigrp); } diff --git a/usr.sbin/eigrpd/rde.h b/usr.sbin/eigrpd/rde.h index ba491a53142..47adebb642f 100644 --- a/usr.sbin/eigrpd/rde.h +++ b/usr.sbin/eigrpd/rde.h @@ -1,4 +1,4 @@ -/* $OpenBSD: rde.h,v 1.1 2015/10/02 04:26:47 renato Exp $ */ +/* $OpenBSD: rde.h,v 1.2 2015/10/05 01:59:33 renato Exp $ */ /* * Copyright (c) 2015 Renato Westphal <renato@openbsd.org> @@ -140,7 +140,7 @@ void rt_dump(struct ctl_show_topology_req *, pid_t); /* rde_nbr.c */ struct rde_nbr *rde_nbr_find(uint32_t); struct rde_nbr *rde_nbr_new(uint32_t, struct rde_nbr *); -void rde_nbr_del(struct rde_nbr *); +void rde_nbr_del(struct rde_nbr *, int); /* rde_dual.c */ int dual_fsm(struct rt_node *, enum dual_event); diff --git a/usr.sbin/eigrpd/rde_dual.c b/usr.sbin/eigrpd/rde_dual.c index c49efbf3d3f..a397669233f 100644 --- a/usr.sbin/eigrpd/rde_dual.c +++ b/usr.sbin/eigrpd/rde_dual.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rde_dual.c,v 1.3 2015/10/04 23:00:10 renato Exp $ */ +/* $OpenBSD: rde_dual.c,v 1.4 2015/10/05 01:59:33 renato Exp $ */ /* * Copyright (c) 2015 Renato Westphal <renato@openbsd.org> @@ -434,7 +434,7 @@ reply_active_timer(int fd, short event, void *arg) log_debug("%s: neighbor %s is stuck in active", log_addr(nbr->eigrp->af, &nbr->addr)); - rde_nbr_del(reply->nbr); + rde_nbr_del(reply->nbr, 1); } void @@ -475,7 +475,7 @@ reply_sia_timer(int fd, short event, void *arg) if (reply->siaquery_sent > 0 && reply->siareply_recv == 0) { log_debug("%s: neighbor %s is stuck in active", log_addr(nbr->eigrp->af, &nbr->addr)); - rde_nbr_del(nbr); + rde_nbr_del(nbr, 1); return; } @@ -1239,10 +1239,14 @@ rde_nbr_new(uint32_t peerid, struct rde_nbr *new) } void -rde_nbr_del(struct rde_nbr *nbr) +rde_nbr_del(struct rde_nbr *nbr, int send_peerterm) { struct reply_node *reply; + if (send_peerterm) + rde_imsg_compose_eigrpe(IMSG_NEIGHBOR_DOWN, nbr->peerid, + 0, NULL, 0); + while((reply = TAILQ_FIRST(&nbr->rijk)) != NULL) reply_outstanding_remove(reply); diff --git a/usr.sbin/eigrpd/rtp.c b/usr.sbin/eigrpd/rtp.c index 556da6bb6f9..a11cbaf20a5 100644 --- a/usr.sbin/eigrpd/rtp.c +++ b/usr.sbin/eigrpd/rtp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rtp.c,v 1.1 2015/10/02 04:26:47 renato Exp $ */ +/* $OpenBSD: rtp.c,v 1.2 2015/10/05 01:59:33 renato Exp $ */ /* * Copyright (c) 2015 Renato Westphal <renato@openbsd.org> @@ -192,7 +192,7 @@ rtp_send_mcast(struct eigrp_iface *ei, struct ibuf *buf) TAILQ_INSERT_TAIL(&seq_addr_list, sa, entry); } - send_hello(ei, &seq_addr_list, eigrp->seq_num); + send_hello(ei, &seq_addr_list, eigrp->seq_num, 0); seq_addr_list_clr(&seq_addr_list); } send_packet(ei, NULL, flags, buf); diff --git a/usr.sbin/eigrpd/tlv.c b/usr.sbin/eigrpd/tlv.c index c6670752da1..54953366378 100644 --- a/usr.sbin/eigrpd/tlv.c +++ b/usr.sbin/eigrpd/tlv.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tlv.c,v 1.3 2015/10/04 23:08:57 renato Exp $ */ +/* $OpenBSD: tlv.c,v 1.4 2015/10/05 01:59:33 renato Exp $ */ /* * Copyright (c) 2015 Renato Westphal <renato@openbsd.org> @@ -29,13 +29,21 @@ #include "eigrpe.h" int -gen_parameter_tlv(struct ibuf *buf, struct eigrp_iface *ei) +gen_parameter_tlv(struct ibuf *buf, struct eigrp_iface *ei, int peerterm) { struct tlv_parameter tp; tp.type = htons(TLV_TYPE_PARAMETER); tp.length = htons(TLV_TYPE_PARAMETER_LEN); - memcpy(tp.kvalues, ei->eigrp->kvalues, 6); + if (peerterm) { + tp.kvalues[0] = 255; + tp.kvalues[1] = 255; + tp.kvalues[2] = 255; + tp.kvalues[3] = 255; + tp.kvalues[4] = 255; + tp.kvalues[5] = 0; + } else + memcpy(tp.kvalues, ei->eigrp->kvalues, 6); tp.holdtime = htons(ei->hello_holdtime); return (ibuf_add(buf, &tp, sizeof(tp))); |