X-Git-Url: http://git.archive.openwrt.org/?p=project%2Fodhcpd.git;a=blobdiff_plain;f=src%2Frouter.c;h=f942d8f851639c039faff54cf985ef0a80ba8fbc;hp=3d26c5845fd96a08d2ddf1ca7bd7340d1b318481;hb=e99ca79b04f18831ada51b913a3869804ddf98ee;hpb=ee243b09f3c81f824cc463c1c757e905f882350e diff --git a/src/router.c b/src/router.c index 3d26c58..f942d8f 100644 --- a/src/router.c +++ b/src/router.c @@ -176,7 +176,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, false, 0, 0, 0}; + struct odhcpd_ipaddr p = {IN6ADDR_ANY_INIT, 0, 0, 0, 0}; while (fgets(line, sizeof(line), fp_route)) { uint32_t rflags; if (sscanf(line, "00000000000000000000000000000000 00 " @@ -209,9 +209,11 @@ static bool parse_routes(struct odhcpd_ipaddr *n, ssize_t len) // Router Advert server mode static uint64_t send_router_advert(struct interface *iface, const struct in6_addr *from) { - int mtu = odhcpd_get_interface_mtu(iface->ifname); - if (mtu < 0) - mtu = 1500; + int mtu = odhcpd_get_interface_config(iface->ifname, "mtu"); + int hlim = odhcpd_get_interface_config(iface->ifname, "hop_limit"); + + if (mtu < 1280) + mtu = 1280; struct { struct nd_router_advert h; @@ -224,6 +226,9 @@ static uint64_t send_router_advert(struct interface *iface, const struct in6_add .mtu = {ND_OPT_MTU, 1, 0, htonl(mtu)}, }; + if (hlim > 0) + adv.h.nd_ra_curhoplimit = hlim; + if (iface->dhcpv6) adv.h.nd_ra_flags_reserved = ND_RA_FLAG_OTHER; @@ -262,7 +267,7 @@ static uint64_t send_router_advert(struct interface *iface, const struct in6_add for (ssize_t i = 0; i < ipcnt; ++i) { struct odhcpd_ipaddr *addr = &addrs[i]; - if (addr->prefix > 96 || addr->has_class) + if (addr->prefix > 96) continue; // Address not suitable if (addr->preferred > MaxPreferredTime)