summaryrefslogtreecommitdiffstats
path: root/eigrpd
diff options
context:
space:
mode:
authorDonald Sharp <sharpd@cumulusnetworks.com>2017-10-29 13:28:01 +0100
committerDonald Sharp <sharpd@cumulusnetworks.com>2017-10-29 13:28:01 +0100
commitb42a4a099a105c0e12b30c27c820b27afbcf1871 (patch)
tree904fd3043e5cdcdc1dabe3a3caf48b9533d22b36 /eigrpd
parenteigrpd: Query Send is not incrementing the sequence number (diff)
downloadfrr-b42a4a099a105c0e12b30c27c820b27afbcf1871.tar.xz
frr-b42a4a099a105c0e12b30c27c820b27afbcf1871.zip
eigrpd: Fix crash in reply receive packet.
When we receive a reply for a prefix we no longer have we should note the issue and move on instead of crashing eigrp. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
Diffstat (limited to 'eigrpd')
-rw-r--r--eigrpd/eigrp_reply.c91
1 files changed, 49 insertions, 42 deletions
diff --git a/eigrpd/eigrp_reply.c b/eigrpd/eigrp_reply.c
index 8dbd1a5b3..0ccffde72 100644
--- a/eigrpd/eigrp_reply.c
+++ b/eigrpd/eigrp_reply.c
@@ -149,49 +149,56 @@ void eigrp_reply_receive(struct eigrp *eigrp, struct ip *iph,
while (s->endp > s->getp) {
type = stream_getw(s);
- if (type == EIGRP_TLV_IPv4_INT) {
- struct prefix dest_addr;
-
- stream_set_getp(s, s->getp - sizeof(u_int16_t));
-
- tlv = eigrp_read_ipv4_tlv(s);
-
- dest_addr.family = AF_INET;
- dest_addr.u.prefix4 = tlv->destination;
- dest_addr.prefixlen = tlv->prefix_length;
- struct eigrp_prefix_entry *dest =
- eigrp_topology_table_lookup_ipv4(
- eigrp->topology_table, &dest_addr);
- /*
- * Destination must exists
- */
- assert(dest);
-
- struct eigrp_fsm_action_message msg;
- struct eigrp_nexthop_entry *entry =
- eigrp_prefix_entry_lookup(dest->entries, nbr);
-
- if (eigrp_update_prefix_apply(eigrp, ei,
- EIGRP_FILTER_IN,
- &dest_addr)) {
- tlv->metric.delay = EIGRP_MAX_METRIC;
- }
- /*
- * End of filtering
- */
-
- msg.packet_type = EIGRP_OPC_REPLY;
- msg.eigrp = eigrp;
- msg.data_type = EIGRP_INT;
- msg.adv_router = nbr;
- msg.metrics = tlv->metric;
- msg.entry = entry;
- msg.prefix = dest;
- eigrp_fsm_event(&msg);
-
-
- eigrp_IPv4_InternalTLV_free(tlv);
+
+ if (type != EIGRP_TLV_IPv4_INT)
+ continue;
+
+ struct prefix dest_addr;
+
+ stream_set_getp(s, s->getp - sizeof(u_int16_t));
+
+ tlv = eigrp_read_ipv4_tlv(s);
+
+ dest_addr.family = AF_INET;
+ dest_addr.u.prefix4 = tlv->destination;
+ dest_addr.prefixlen = tlv->prefix_length;
+ struct eigrp_prefix_entry *dest =
+ eigrp_topology_table_lookup_ipv4(
+ eigrp->topology_table, &dest_addr);
+ /*
+ * Destination must exists
+ */
+ if (!dest) {
+ char buf[PREFIX_STRLEN];
+ zlog_err("%s: Received prefix %s which we do not know about",
+ __PRETTY_FUNCTION__,
+ prefix2str(&dest_addr, buf, strlen(buf)));
+ continue;
+ }
+
+ struct eigrp_fsm_action_message msg;
+ struct eigrp_nexthop_entry *entry =
+ eigrp_prefix_entry_lookup(dest->entries, nbr);
+
+ if (eigrp_update_prefix_apply(eigrp, ei,
+ EIGRP_FILTER_IN,
+ &dest_addr)) {
+ tlv->metric.delay = EIGRP_MAX_METRIC;
}
+ /*
+ * End of filtering
+ */
+
+ msg.packet_type = EIGRP_OPC_REPLY;
+ msg.eigrp = eigrp;
+ msg.data_type = EIGRP_INT;
+ msg.adv_router = nbr;
+ msg.metrics = tlv->metric;
+ msg.entry = entry;
+ msg.prefix = dest;
+ eigrp_fsm_event(&msg);
+
+ eigrp_IPv4_InternalTLV_free(tlv);
}
eigrp_hello_send_ack(nbr);
}