]> git.puffer.fish Git - mirror/frr.git/commitdiff
Quagga: Check and cleanup prior address when processing address add on interface
authorvivek <vivek@cumulusnetworks.com>
Mon, 9 May 2016 22:53:06 +0000 (15:53 -0700)
committervivek <vivek@cumulusnetworks.com>
Mon, 9 May 2016 22:53:06 +0000 (15:53 -0700)
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 <vivek@cumulusnetworks.com>
Reviewed-by: Dinesh Dutt <ddutt@cumulusnetworks.com>
Ticket: CM-10745
Reviewed By: CCR-4660
Testing Done: Manual, bgp-min

lib/zclient.c

index 8cc6bd92a46b57a1da5bd35ff4ba92cdfca3f307..4351a67bee50424da95ef5752ed0dfdf24140b35 100644 (file)
@@ -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));