summaryrefslogtreecommitdiff
path: root/bgpd
diff options
context:
space:
mode:
authorRakesh Garimella <rakesh.garimella@sophos.com>2013-03-11 12:38:31 +0000
committerDavid Lamparter <equinox@opensourcerouting.org>2013-07-30 20:27:50 +0200
commit9e47abd862f71847a85f330435c7b3a9b1f76099 (patch)
tree375f9e63d4a1b206addb615a906f2f5608823612 /bgpd
parent397b5bded5654a31b4bd3b904f091fd3859aecf7 (diff)
bgpd: prevent double address delete on shutdown
bgp_interface_down() and bgp_exit() both proceed to delete the address from bgpd's interface representation, so the second call gets a NULL result from the hash lookup and subsequently crashes. Signed-off-by: Rakesh Garimella <rakesh.garimella@sophos.com> [reformatted] Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
Diffstat (limited to 'bgpd')
-rw-r--r--bgpd/bgp_nexthop.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/bgpd/bgp_nexthop.c b/bgpd/bgp_nexthop.c
index d4692366..4076fe41 100644
--- a/bgpd/bgp_nexthop.c
+++ b/bgpd/bgp_nexthop.c
@@ -604,6 +604,10 @@ bgp_address_del (struct prefix *p)
tmp.addr = p->u.prefix4;
addr = hash_lookup (bgp_address_hash, &tmp);
+ /* may have been deleted earlier by bgp_interface_down() */
+ if (addr == NULL)
+ return;
+
addr->refcnt--;
if (addr->refcnt == 0)