[quagga-dev 8491] Node lock in bgp_table.c prevents proper node deletion

Barry Friedman barryf at google.com
Thu Feb 3 22:13:50 GMT 2011


Hi all,

I noticed that bgpd does not fully clean up its rib table when routes
are withdrawn. Example:

This shows 52 table nodes in use for 27 routes:

q1# sh ip bgp sum
BGP router identifier 12.1.1.1, local AS number 1
RIB entries 52, using 4992 bytes of memory
Peers 1, using 4560 bytes of memory

Neighbor        V    AS MsgRcvd MsgSent   TblVer  InQ OutQ Up/Down  State/PfxRcd
12.1.1.2        4     1       2       3        0    0    0 00:00:09       27

After all routes withdrawn, 25 nodes are still in use:

q1# sh ip bgp sum
BGP router identifier 12.1.1.1, local AS number 1
RIB entries 25, using 2400 bytes of memory
Peers 1, using 4560 bytes of memory

Neighbor        V    AS MsgRcvd MsgSent   TblVer  InQ OutQ Up/Down  State/PfxRcd
12.1.1.2        4     1       3       3        0    0    0 00:00:30        0


The root cause of the leftover nodes seems to be that if the radix
tree creates an extra interior node in bgp_node_get(), it locks the
interior node even though this node is not returned to the caller, so
it may never be unlocked. The lock prevents this node from being
deleted.

After removing the call to lock the interior node, deletion works
properly after the routes are withdrawn (RIB entries = 0):

q1# sh ip bgp sum
BGP router identifier 12.1.1.1, local AS number 1
RIB entries 0, using 0 bytes of memory
Peers 1, using 4560 bytes of memory

Neighbor        V    AS MsgRcvd MsgSent   TblVer  InQ OutQ Up/Down  State/PfxRcd
12.1.1.2        4     1       4       6        0    0    0 00:01:28        0

This change may be of use to prevent bgp table walks from encountering
lots of unused table nodes (where node->info pointer is NULL).

Patch file with the code change is attached.

Thanks,
Barry
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-bgpd-Remove-extra-lock-on-interior-table-node.patch
Type: text/x-patch
Size: 1076 bytes
Desc: not available
URL: <http://lists.quagga.net/pipermail/quagga-dev/attachments/20110203/06b24548/attachment-0001.bin>


More information about the Quagga-dev mailing list