X-Git-Url: http://git.archive.openwrt.org/?p=project%2Fodhcpd.git;a=blobdiff_plain;f=src%2Fndp.c;h=586658846f87b1367d0dda63823d1e558fbe6c40;hp=c6e4eda50f13eb3e1fc31870d51fceffc9e7fea5;hb=51c756cfc15c63322df9fdb70d5c701cfb6b9a9f;hpb=8df4253ba73246d31f2e65f2004da3f9890c22c5 diff --git a/src/ndp.c b/src/ndp.c index c6e4eda..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; } @@ -539,13 +539,17 @@ static void catch_rtnl_err(struct odhcpd_event *e, int error) struct event_socket *ev_sock = container_of(e, struct event_socket, ev); if (error != ENOBUFS) - return; + goto err; /* Double netlink event buffer size */ ev_sock->sock_bufsize *= 2; if (nl_socket_set_buffer_size(ev_sock->sock, ev_sock->sock_bufsize, 0)) - return; + goto err; dump_addr_table(); + return; + +err: + odhcpd_deregister(e); }