summaryrefslogtreecommitdiffhomepage
path: root/src/router.c
diff options
context:
space:
mode:
authorSteven Barth <steven@midlink.org>2015-04-10 13:52:00 +0200
committerSteven Barth <steven@midlink.org>2015-04-10 13:52:00 +0200
commite23972527f93a3d2a5412400384519ff550708b7 (patch)
treede695a9029e4784ace97d017fbf0b36458cd96c5 /src/router.c
parent9bdbc5a4be1ab75145431bc728159a55c723e2ca (diff)
ra: always send current hop limit
Diffstat (limited to 'src/router.c')
-rw-r--r--src/router.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/router.c b/src/router.c
index 60d6b3f..f942d8f 100644
--- a/src/router.c
+++ b/src/router.c
@@ -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;