diff options
author | 2016-01-15 12:43:02 +0000 | |
---|---|---|
committer | 2016-01-15 12:43:02 +0000 | |
commit | bb7278f195a191cb59657c6fb30de1e15707f9d3 (patch) | |
tree | 42600aca0b091209d0c1a7d47d66fb58f917aa20 /usr.sbin/eigrpd/packet.c | |
parent | Fix bug that happened when a passive interface was shut down and then (diff) | |
download | wireguard-openbsd-bb7278f195a191cb59657c6fb30de1e15707f9d3.tar.xz wireguard-openbsd-bb7278f195a191cb59657c6fb30de1e15707f9d3.zip |
Several fixes in the Conditionally Received (CR) mode.
* If we fail to accept a packet when in the CR mode, do not ack it;
* Add missing ntohl() when storing the next multicast sequence tlv;
* The CR flag in the neighbor should be cleared out after use.
Diffstat (limited to 'usr.sbin/eigrpd/packet.c')
-rw-r--r-- | usr.sbin/eigrpd/packet.c | 33 |
1 files changed, 17 insertions, 16 deletions
diff --git a/usr.sbin/eigrpd/packet.c b/usr.sbin/eigrpd/packet.c index 78acc8f2e7c..58c7220f68e 100644 --- a/usr.sbin/eigrpd/packet.c +++ b/usr.sbin/eigrpd/packet.c @@ -1,4 +1,4 @@ -/* $OpenBSD: packet.c,v 1.7 2016/01/15 12:29:29 renato Exp $ */ +/* $OpenBSD: packet.c,v 1.8 2016/01/15 12:43:02 renato Exp $ */ /* * Copyright (c) 2015 Renato Westphal <renato@openbsd.org> @@ -248,20 +248,6 @@ recv_packet_nbr(struct nbr *nbr, struct eigrp_hdr *eigrp_hdr, */ nbr_start_timeout(nbr); - /* ack processing */ - if (ack != 0) - rtp_process_ack(nbr, ack); - if (seq != 0) { - /* check for sequence wraparound */ - if (nbr->recv_seq >= seq && - !(nbr->recv_seq == UINT32_MAX && seq == 1)) { - log_debug("%s: duplicate packet", __func__); - rtp_send_ack(nbr); - return (-1); - } - nbr->recv_seq = seq; - } - /* handle the sequence tlv */ if (eigrp_hdr->opcode == EIGRP_OPC_HELLO && !TAILQ_EMPTY(seq_addr_list)) { @@ -288,16 +274,31 @@ recv_packet_nbr(struct nbr *nbr, struct eigrp_hdr *eigrp_hdr, } } if (tm) - nbr->next_mcast_seq = tm->seq; + nbr->next_mcast_seq = ntohl(tm->seq); } if ((ntohl(eigrp_hdr->flags) & EIGRP_HDR_FLAG_CR)) { if (!(nbr->flags & F_EIGRP_NBR_CR_MODE)) return (-1); + nbr->flags &= ~F_EIGRP_NBR_CR_MODE; if (ntohl(eigrp_hdr->seq_num) != nbr->next_mcast_seq) return (-1); } + /* ack processing */ + if (ack != 0) + rtp_process_ack(nbr, ack); + if (seq != 0) { + /* check for sequence wraparound */ + if (nbr->recv_seq >= seq && + !(nbr->recv_seq == UINT32_MAX && seq == 1)) { + log_debug("%s: duplicate packet", __func__); + rtp_send_ack(nbr); + return (-1); + } + nbr->recv_seq = seq; + } + return (0); } |