rtnl: order local addresses/gateways by the address itself as last resort
authorLennart Poettering <lennart@poettering.net>
Thu, 4 Dec 2014 03:16:29 +0000 (04:16 +0100)
committerLennart Poettering <lennart@poettering.net>
Thu, 4 Dec 2014 03:16:31 +0000 (04:16 +0100)
This way we can be sure that the returned list is stable regarding
modifications in the kernel.

src/libsystemd/sd-rtnl/local-addresses.c

index 629f896..e520cdf 100644 (file)
@@ -50,7 +50,7 @@ static int address_compare(const void *_a, const void *_b) {
         if (a->ifindex > b->ifindex)
                 return 1;
 
-        return 0;
+        return memcmp(&a->address, &b->address, FAMILY_ADDRESS_SIZE(a->family));
 }
 
 int local_addresses(sd_rtnl *context, int ifindex, int af, struct local_address **ret) {