config: fix invalid retranstime in RA message
[project/odhcpd.git] / src / router.c
index faf9e9d..f08a7b0 100644 (file)
@@ -259,11 +259,11 @@ 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();
-       uint32_t mtu = iface->ra_mtu;
+       int mtu = iface->ra_mtu;
        int hlim = iface->ra_hoplimit;
 
        if (mtu == 0)
-                mtu = odhcpd_get_interface_config(iface->ifname, "mtu");
+               mtu = odhcpd_get_interface_config(iface->ifname, "mtu");
 
        if (mtu < 1280)
                mtu = 1280;
@@ -295,6 +295,10 @@ 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);
+       adv.h.nd_ra_retransmit = htonl(iface->ra_retranstime);
+
        odhcpd_get_mac(iface, adv.lladdr.data);
 
        // If not currently shutting down