From: vivek Date: Mon, 9 May 2016 22:53:06 +0000 (-0700) Subject: Quagga: Check and cleanup prior address when processing address add on interface X-Git-Tag: frr-2.0-rc1~929 X-Git-Url: https://git.puffer.fish/?a=commitdiff_plain;h=d838ddbfd1eb96a3d4395613512d73a446ded116;p=mirror%2Ffrr.git Quagga: Check and cleanup prior address when processing address add on interface IPv4 addresses can be learnt from the kernel even when the interface is down. Quagga notifis clients of addresses upon learning of them (initial read or upon NEWADDR) as well as when the interface comes up. The problem is that while zebra code itself has checks to ensure duplicate addresses aren't added to an interface, that is not true for the clients. This patch checks for duplicates when the client receives the address add. Upon this, the patch does a delete and add as done in zebra - because there is a possibility that some other parameter could have changed. The fix also takes care of the extra memory allocation for 'connected' in clients. Signed-off-by: Vivek Venkatraman Reviewed-by: Dinesh Dutt Ticket: CM-10745 Reviewed By: CCR-4660 Testing Done: Manual, bgp-min --- diff --git a/lib/zclient.c b/lib/zclient.c index 8cc6bd92a4..4351a67bee 100644 --- a/lib/zclient.c +++ b/lib/zclient.c @@ -1138,6 +1138,13 @@ zebra_interface_address_read (int type, struct stream *s, vrf_id_t vrf_id) if (type == ZEBRA_INTERFACE_ADDRESS_ADD) { + /* We have situations where the address may be replayed more than once. + * Check and delete older matching address, first. + */ + ifc = connected_delete_by_prefix(ifp, &p); + if (ifc) + connected_free (ifc); + /* N.B. NULL destination pointers are encoded as all zeroes */ ifc = connected_add_by_prefix(ifp, &p,(memconstant(&d.u.prefix,0,plen) ? NULL : &d));