summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--README2
-rw-r--r--src/config.c8
-rw-r--r--src/odhcpd.h1
-rw-r--r--src/router.c5
4 files changed, 15 insertions, 1 deletions
diff --git a/README b/README
index 3ad17f9..1099297 100644
--- a/README
+++ b/README
@@ -116,6 +116,8 @@ ra_lifetime integer 1800 Value to be placed in Router
ra_useleasetime bool 0 Use configured leasetime as
limit for the preferred and
valid lifetime of a prefix
+ra_hoplimit integer 0 Current hoplimit to be advertised
+ in RA messages
ra_mtu integer 0 MTU to be advertised in
RA messages
ndproxy_routing bool 1 Learn routes from NDP
diff --git a/src/config.c b/src/config.c
index d6b4e81..1f6877a 100644
--- a/src/config.c
+++ b/src/config.c
@@ -50,6 +50,7 @@ enum {
IFACE_ATTR_RA_MAXINTERVAL,
IFACE_ATTR_RA_LIFETIME,
IFACE_ATTR_RA_USELEASETIME,
+ IFACE_ATTR_RA_HOPLIMIT,
IFACE_ATTR_RA_MTU,
IFACE_ATTR_PD_MANAGER,
IFACE_ATTR_PD_CER,
@@ -89,6 +90,7 @@ static const struct blobmsg_policy iface_attrs[IFACE_ATTR_MAX] = {
[IFACE_ATTR_RA_MAXINTERVAL] = { .name = "ra_maxinterval", .type = BLOBMSG_TYPE_INT32 },
[IFACE_ATTR_RA_LIFETIME] = { .name = "ra_lifetime", .type = BLOBMSG_TYPE_INT32 },
[IFACE_ATTR_RA_USELEASETIME] = { .name = "ra_useleasetime", .type = BLOBMSG_TYPE_BOOL },
+ [IFACE_ATTR_RA_HOPLIMIT] = { .name = "ra_hoplimit", .type = BLOBMSG_TYPE_INT32 },
[IFACE_ATTR_RA_MTU] = { .name = "ra_mtu", .type = BLOBMSG_TYPE_INT32 },
[IFACE_ATTR_NDPROXY_ROUTING] = { .name = "ndproxy_routing", .type = BLOBMSG_TYPE_BOOL },
[IFACE_ATTR_NDPROXY_SLAVE] = { .name = "ndproxy_slave", .type = BLOBMSG_TYPE_BOOL },
@@ -596,6 +598,12 @@ int config_parse_interface(void *data, size_t len, const char *name, bool overwr
if ((c = tb[IFACE_ATTR_RA_MANAGEMENT]))
iface->managed = blobmsg_get_u32(c);
+ if ((c = tb[IFACE_ATTR_RA_HOPLIMIT])) {
+ iface->ra_hoplimit = blobmsg_get_u32(c);
+ if (iface->ra_hoplimit > 255)
+ goto err;
+ }
+
if ((c = tb[IFACE_ATTR_RA_MTU])) {
iface->ra_mtu = blobmsg_get_u32(c);
if (iface->ra_mtu < 1280)
diff --git a/src/odhcpd.h b/src/odhcpd.h
index 50827a4..28c81eb 100644
--- a/src/odhcpd.h
+++ b/src/odhcpd.h
@@ -162,6 +162,7 @@ struct interface {
int ra_maxinterval;
int ra_mininterval;
int ra_lifetime;
+ uint32_t ra_hoplimit;
uint32_t ra_mtu;
// DHCPv4
diff --git a/src/router.c b/src/router.c
index a31bf4e..faf9e9d 100644
--- a/src/router.c
+++ b/src/router.c
@@ -260,7 +260,7 @@ static uint64_t send_router_advert(struct interface *iface, const struct in6_add
{
time_t now = odhcpd_time();
uint32_t mtu = iface->ra_mtu;
- int hlim = odhcpd_get_interface_config(iface->ifname, "hop_limit");
+ int hlim = iface->ra_hoplimit;
if (mtu == 0)
mtu = odhcpd_get_interface_config(iface->ifname, "mtu");
@@ -268,6 +268,9 @@ static uint64_t send_router_advert(struct interface *iface, const struct in6_add
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;