router: fix advertisement interval option
authorHans Dedecker <dedeckeh@gmail.com>
Mon, 7 Sep 2020 19:35:42 +0000 (21:35 +0200)
committerHans Dedecker <dedeckeh@gmail.com>
Mon, 7 Sep 2020 19:45:22 +0000 (21:45 +0200)
The variable maxival contains the maximum time in seconds between
successive unsolicited Router Advertisement messages; RFC6275 defines
the Advertisement Interval option as the time in milliseconds.
Therefore convert maxival to milliseconds when populating the
Advertisement Interval option.

Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
src/router.c

index 7198ee97cb357cf09624c427b40a0b74638f1c72..06f3a668c4438e0711c8a3acb03851c662a74f09 100644 (file)
@@ -732,7 +732,7 @@ static int send_router_advert(struct interface *iface, const struct in6_addr *fr
        memset(&adv_interval, 0, sizeof(adv_interval));
        adv_interval.nd_opt_adv_interval_type = ND_OPT_RTR_ADV_INTERVAL;
        adv_interval.nd_opt_adv_interval_len = 1;
-       adv_interval.nd_opt_adv_interval_ival = htonl(maxival);
+       adv_interval.nd_opt_adv_interval_ival = htonl(maxival*1000);
 
        iov[IOV_RA_ADV_INTERVAL].iov_base = (char *)&adv_interval;
        iov[IOV_RA_ADV_INTERVAL].iov_len = adv_interval.nd_opt_adv_interval_len * 8;