chiark / gitweb /
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 629f89697448d495138f8486d4a757d2f3956868..e520cdfa6d272e75475e8e486b679c1110dde128 100644 (file)
@@ -50,7 +50,7 @@ static int address_compare(const void *_a, const void *_b) {
         if (a->ifindex > b->ifindex)
                 return 1;
 
         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) {
 }
 
 int local_addresses(sd_rtnl *context, int ifindex, int af, struct local_address **ret) {