X-Git-Url: http://git.archive.openwrt.org/?p=project%2Fodhcpd.git;a=blobdiff_plain;f=src%2Frouter.c;h=5abf1e6bff1d3682ae336a09f2ed88c08e1d5dd7;hp=bb7ddcd27e5c1f045ce90998f2fb96006a867f23;hb=1565d76bd6ff2d1064c3d30e947dc70613417853;hpb=7117854698ba7c77da5823fc673f44e6db0fee5f;ds=sidebyside diff --git a/src/router.c b/src/router.c index bb7ddcd..5abf1e6 100644 --- a/src/router.c +++ b/src/router.c @@ -169,7 +169,7 @@ static bool parse_routes(struct odhcpd_ipaddr *n, ssize_t len) char line[512], ifname[16]; bool found_default = false; - struct odhcpd_ipaddr p = {IN6ADDR_ANY_INIT, 0, 0, 0}; + struct odhcpd_ipaddr p = {IN6ADDR_ANY_INIT, 0, false, 0, 0, 0}; while (fgets(line, sizeof(line), fp_route)) { uint32_t rflags; if (sscanf(line, "00000000000000000000000000000000 00 " @@ -254,7 +254,7 @@ static void send_router_advert(struct uloop_timeout *event) for (ssize_t i = 0; i < ipcnt; ++i) { struct odhcpd_ipaddr *addr = &addrs[i]; - if (addr->prefix > 64) + if (addr->prefix > 64 || addr->has_class) continue; // Address not suitable if (addr->preferred > MaxPreferredTime) @@ -352,7 +352,7 @@ static void send_router_advert(struct uloop_timeout *event) uint8_t pad2; uint32_t lifetime; uint8_t name[]; - } *search = malloc(sizeof(*search) + search_padded); + } *search = alloca(sizeof(*search) + search_padded); search->type = ND_OPT_DNS_SEARCH; search->len = search_len ? ((sizeof(*search) + search_padded) / 8) : 0; search->pad = 0; @@ -409,7 +409,6 @@ static void send_router_advert(struct uloop_timeout *event) struct sockaddr_in6 all_nodes = {AF_INET6, 0, 0, ALL_IPV6_NODES, 0}; odhcpd_send(router_event.uloop.fd, &all_nodes, iov, ARRAY_SIZE(iov), iface); - free(search); // Rearm timer int msecs;