]> granicus.if.org Git - libnl/commitdiff
route/addr: consider CACHEINFO in addr_compare()/nl_object_diff()
authorThomas Haller <thaller@redhat.com>
Thu, 27 Nov 2014 10:38:26 +0000 (11:38 +0100)
committerThomas Haller <thaller@redhat.com>
Thu, 27 Nov 2014 11:53:38 +0000 (12:53 +0100)
Indicate this change of behavior with the capability
NL_CAPABILITY_ROUTE_ADDR_COMPARE_CACHEINFO.

This is a behavioral change as we now consider an additional
field when comparing addresses.

Acked-by: Thomas Graf <tgraf@suug.ch>
Signed-off-by: Thomas Haller <thaller@redhat.com>
include/netlink/utils.h
lib/route/addr.c
lib/utils.c

index 431502f0ce6fa3b4d23375bf7d8b5fb739ca3589..a172f3a940adc14fa19a359af351f8c9fd297792 100644 (file)
@@ -121,6 +121,14 @@ enum {
        NL_CAPABILITY_ROUTE_LINK_GET_KERNEL_FAIL_OPNOTSUPP = 5,
 #define NL_CAPABILITY_ROUTE_LINK_GET_KERNEL_FAIL_OPNOTSUPP NL_CAPABILITY_ROUTE_LINK_GET_KERNEL_FAIL_OPNOTSUPP
 
+       /**
+        * Also consider the a_cacheinfo field (ADDR_ATTR_CACHEINFO) that contains the
+        * address timestamps and expiry when comparing struct rtnl_addr objects with
+        * nl_object_diff().
+        */
+       NL_CAPABILITY_ROUTE_ADDR_COMPARE_CACHEINFO   = 6,
+#define NL_CAPABILITY_ROUTE_ADDR_COMPARE_CACHEINFO NL_CAPABILITY_ROUTE_ADDR_COMPARE_CACHEINFO
+
        __NL_CAPABILITY_MAX
 #define NL_CAPABILITY_MAX                               (__NL_CAPABILITY_MAX - 1)
 };
index 426b4dcbeec8d1471872be1730ee0cddb79d3d16..3bde2bf8b2ec865c86f5ea67946a0905aff44216 100644 (file)
@@ -448,6 +448,8 @@ static int addr_compare(struct nl_object *_a, struct nl_object *_b,
                                                    b->a_multicast));
        diff |= ADDR_DIFF(BROADCAST,    nl_addr_cmp(a->a_bcast, b->a_bcast));
        diff |= ADDR_DIFF(ANYCAST,      nl_addr_cmp(a->a_anycast, b->a_anycast));
+       diff |= ADDR_DIFF(CACHEINFO,    memcmp(&a->a_cacheinfo, &b->a_cacheinfo,
+                                              sizeof (a->a_cacheinfo)));
 
        if (flags & LOOSE_COMPARISON)
                diff |= ADDR_DIFF(FLAGS,
index 795eeb780e11765010a9330a98fee8454846c000..5e853f11f0e27d3eed0503cfe355f9ea231122bb 100644 (file)
@@ -1149,7 +1149,7 @@ int nl_has_capability (int capability)
                        NL_CAPABILITY_ROUTE_LINK_CLS_ADD_ACT_OWN_REFERENCE,
                        NL_CAPABILITY_NL_CONNECT_RETRY_GENERATE_PORT_ON_ADDRINUSE,
                        NL_CAPABILITY_ROUTE_LINK_GET_KERNEL_FAIL_OPNOTSUPP,
-                       0,
+                       NL_CAPABILITY_ROUTE_ADDR_COMPARE_CACHEINFO,
                        0,
                        0),
 #undef _NL_SET