]> git.ipfire.org Git - location/libloc.git/commitdiff
network: Fix checking upper bound when matching IP addresses
authorMichael Tremer <michael.tremer@ipfire.org>
Tue, 30 Jan 2018 23:29:28 +0000 (23:29 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Tue, 30 Jan 2018 23:29:28 +0000 (23:29 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/network.c

index 45afd4058f9819dca4a2aaf5e28cc3ca1c50e242..cf396473e835ce2a577dec1579105021ea1b15c6 100644 (file)
@@ -276,7 +276,7 @@ LOC_EXPORT int loc_network_match_address(struct loc_network* network, const stru
        struct in6_addr last_address = make_last_address(&network->start_address, network->prefix);
 
        // Address must be smaller than the last address
-       if (in6_addr_cmp(&last_address, address) > 0)
+       if (in6_addr_cmp(address, &last_address) > 0)
                return 1;
 
        // The address is inside this network