forked from Mirror/frr
eigrpd: When writing packet don't crash in some cases
When we are writing a packet if we have gotten ourselves into a bad situation, note it and move on. Hopefully dumping enough information so that we can find the offending reason. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
This commit is contained in:
parent
b42a4a099a
commit
d4395853e8
|
@ -344,8 +344,18 @@ int eigrp_write(struct thread *thread)
|
|||
|
||||
/* Get one packet from queue. */
|
||||
ep = eigrp_fifo_next(ei->obuf);
|
||||
assert(ep);
|
||||
assert(ep->length >= EIGRP_HEADER_LEN);
|
||||
if (!ep) {
|
||||
zlog_err("%s: Interface %s no packet on queue?",
|
||||
__PRETTY_FUNCTION__, ei->ifp->name);
|
||||
goto out;
|
||||
}
|
||||
if (ep->length < EIGRP_HEADER_LEN) {
|
||||
zlog_err("%s: Packet just has a header?",
|
||||
__PRETTY_FUNCTION__);
|
||||
eigrp_header_dump((struct eigrp_header *)ep->s->data);
|
||||
eigrp_packet_delete(ei);
|
||||
goto out;
|
||||
}
|
||||
|
||||
if (ep->dst.s_addr == htonl(EIGRP_MULTICAST_ADDRESS))
|
||||
eigrp_if_ipmulticast(eigrp, ei->address, ei->ifp->ifindex);
|
||||
|
@ -442,6 +452,7 @@ int eigrp_write(struct thread *thread)
|
|||
/* Now delete packet from queue. */
|
||||
eigrp_packet_delete(ei);
|
||||
|
||||
out:
|
||||
if (eigrp_fifo_next(ei->obuf) == NULL) {
|
||||
ei->on_write_q = 0;
|
||||
list_delete_node(eigrp->oi_write_q, node);
|
||||
|
|
|
@ -165,7 +165,7 @@ void eigrp_send_query(struct eigrp_interface *ei)
|
|||
struct listnode *node, *nnode, *node2, *nnode2;
|
||||
struct eigrp_neighbor *nbr;
|
||||
struct eigrp_prefix_entry *pe;
|
||||
char has_tlv;
|
||||
bool has_tlv = false;
|
||||
bool ep_saved = false;
|
||||
|
||||
ep = eigrp_packet_new(ei->ifp->mtu, NULL);
|
||||
|
@ -180,7 +180,6 @@ void eigrp_send_query(struct eigrp_interface *ei)
|
|||
length += eigrp_add_authTLV_MD5_to_stream(ep->s, ei);
|
||||
}
|
||||
|
||||
has_tlv = 0;
|
||||
for (ALL_LIST_ELEMENTS(ei->eigrp->topology_changes_internalIPV4, node,
|
||||
nnode, pe)) {
|
||||
if (!(pe->req_action & EIGRP_FSM_NEED_QUERY))
|
||||
|
@ -190,7 +189,7 @@ void eigrp_send_query(struct eigrp_interface *ei)
|
|||
for (ALL_LIST_ELEMENTS(ei->nbrs, node2, nnode2, nbr)) {
|
||||
if (nbr->state == EIGRP_NEIGHBOR_UP) {
|
||||
listnode_add(pe->rij, nbr);
|
||||
has_tlv = 1;
|
||||
has_tlv = true;;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue