X-Git-Url: http://git.archive.openwrt.org/?p=project%2Fodhcpd.git;a=blobdiff_plain;f=src%2Frouter.c;h=7600e2f0a7ae503bcba1e3509ef24796a976b712;hp=e8a9aa97760c0a048c08958792bb1a6d0c9b8c6d;hb=2cb6b4872a1981f2acce40018107481c82a529dc;hpb=1b630f8bc59978884c9caccebca3b6d8e9b045a1 diff --git a/src/router.c b/src/router.c index e8a9aa9..7600e2f 100644 --- a/src/router.c +++ b/src/router.c @@ -120,6 +120,7 @@ int setup_router_interface(struct interface *iface, bool enable) } else if (iface->ra == RELAYD_SERVER && !iface->master) { iface->timer_rs.cb = trigger_router_advert; uloop_timeout_set(&iface->timer_rs, 1000); + ndp_rqs_addr6_dump(); } if (iface->ra == RELAYD_RELAY || (iface->ra == RELAYD_SERVER && !iface->master)) @@ -258,12 +259,18 @@ static uint16_t calc_ra_lifetime(struct interface *iface, uint32_t maxival) static uint64_t send_router_advert(struct interface *iface, const struct in6_addr *from) { time_t now = odhcpd_time(); - int mtu = odhcpd_get_interface_config(iface->ifname, "mtu"); - int hlim = odhcpd_get_interface_config(iface->ifname, "hop_limit"); + uint32_t mtu = iface->ra_mtu; + int hlim = iface->ra_hoplimit; + + if (mtu == 0) + mtu = odhcpd_get_interface_config(iface->ifname, "mtu"); if (mtu < 1280) mtu = 1280; + if (hlim == 0) + hlim = odhcpd_get_interface_config(iface->ifname, "hop_limit"); + struct { struct nd_router_advert h; struct icmpv6_opt lladdr; @@ -288,6 +295,9 @@ static uint64_t send_router_advert(struct interface *iface, const struct in6_add adv.h.nd_ra_flags_reserved |= ND_RA_PREF_LOW; else if (iface->route_preference > 0) adv.h.nd_ra_flags_reserved |= ND_RA_PREF_HIGH; + + adv.h.nd_ra_reachable = htonl(iface->ra_reachabletime); + odhcpd_get_mac(iface, adv.lladdr.data); // If not currently shutting down @@ -318,7 +328,7 @@ static uint64_t send_router_advert(struct interface *iface, const struct in6_add struct in6_addr dns_pref, *dns_addr = &dns_pref; size_t dns_cnt = 1; - odhcpd_get_linklocal_interface_address(iface->ifindex, &dns_pref); + odhcpd_get_interface_dns_addr(iface, &dns_pref); for (ssize_t i = 0; i < ipcnt; ++i) { struct odhcpd_ipaddr *addr = &addrs[i]; @@ -616,7 +626,7 @@ static void forward_router_advertisement(uint8_t *data, size_t len) size_t rewrite_cnt = iface->dns_cnt; if (rewrite_cnt == 0) { - if (odhcpd_get_linklocal_interface_address(iface->ifindex, &addr)) + if (odhcpd_get_interface_dns_addr(iface, &addr)) continue; // Unable to comply rewrite = &addr;