X-Git-Url: http://git.archive.openwrt.org/?p=project%2Fodhcpd.git;a=blobdiff_plain;f=src%2Fndp.c;h=586658846f87b1367d0dda63823d1e558fbe6c40;hp=427547dad9995899d54ac341bd0c36cc32bb017c;hb=68ee0b59040625d2ab5830b1c1cc8eca2da0dcf1;hpb=fa57225cb62b43adffc37a50c3dbd3fa7d225b0b diff --git a/src/ndp.c b/src/ndp.c index 427547d..5866588 100644 --- a/src/ndp.c +++ b/src/ndp.c @@ -328,8 +328,8 @@ static void setup_route(struct in6_addr *addr, struct interface *iface, bool add static int prefixcmp(const void *va, const void *vb) { const struct odhcpd_ipaddr *a = va, *b = vb; - uint32_t a_pref = ((a->addr.s6_addr[0] & 0xfe) != 0xfc) ? a->preferred : 1; - uint32_t b_pref = ((b->addr.s6_addr[0] & 0xfe) != 0xfc) ? b->preferred : 1; + uint32_t a_pref = IN6_IS_ADDR_ULA(&a->addr) ? 1 : a->preferred; + uint32_t b_pref = IN6_IS_ADDR_ULA(&b->addr) ? 1 : b->preferred; return (a_pref < b_pref) ? 1 : (a_pref > b_pref) ? -1 : 0; }