diff options
author | Hans Dedecker <dedeckeh@gmail.com> | 2017-05-12 10:53:25 +0200 |
---|---|---|
committer | Hans Dedecker <dedeckeh@gmail.com> | 2017-05-12 10:53:25 +0200 |
commit | a9e9bc4c67ac9fa8aecf5f20954a58093705831b (patch) | |
tree | d32d1628130e0730f4ca4642427a6dbf3e21bafd | |
parent | 2cb6b4872a1981f2acce40018107481c82a529dc (diff) |
config: make RA retransTime configurable via uci
Allow to specify the router advertisement retrans time via the uci
parameter ra_retranstime. If retransmit time is not configured the
value is set to 0 in RA message meaning undefined.
-rw-r--r-- | README | 2 | ||||
-rw-r--r-- | src/config.c | 5 | ||||
-rw-r--r-- | src/odhcpd.h | 1 | ||||
-rw-r--r-- | src/router.c | 1 |
4 files changed, 9 insertions, 0 deletions
@@ -118,6 +118,8 @@ ra_useleasetime bool 0 Use configured leasetime as valid lifetime of a prefix ra_reachabletime integer 0 Reachable Time in milliseconds to be advertised in RA messages +ra_retranstime integer 0 Retransmit Time in milliseconds to be + advertised in RA messages ra_hoplimit integer 0 Current hoplimit to be advertised in RA messages ra_mtu integer 0 MTU to be advertised in diff --git a/src/config.c b/src/config.c index 211ac1f..9348985 100644 --- a/src/config.c +++ b/src/config.c @@ -51,6 +51,7 @@ enum { IFACE_ATTR_RA_LIFETIME, IFACE_ATTR_RA_USELEASETIME, IFACE_ATTR_RA_REACHABLETIME, + IFACE_ATTR_RA_RETRANSTIME, IFACE_ATTR_RA_HOPLIMIT, IFACE_ATTR_RA_MTU, IFACE_ATTR_PD_MANAGER, @@ -92,6 +93,7 @@ static const struct blobmsg_policy iface_attrs[IFACE_ATTR_MAX] = { [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_REACHABLETIME] = { .name = "ra_reachabletime", .type = BLOBMSG_TYPE_INT32 }, + [IFACE_ATTR_RA_RETRANSTIME] = { .name = "ra_retranstime", .type = BLOBMSG_TYPE_INT32 }, [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 }, @@ -606,6 +608,9 @@ int config_parse_interface(void *data, size_t len, const char *name, bool overwr goto err; } + if ((c = tb[IFACE_ATTR_RA_RETRANSTIME])) + iface->ra_retranstime = blobmsg_get_u32(c); + if ((c = tb[IFACE_ATTR_RA_HOPLIMIT])) { iface->ra_hoplimit = blobmsg_get_u32(c); if (iface->ra_hoplimit > 255) diff --git a/src/odhcpd.h b/src/odhcpd.h index a50fd76..bb4702e 100644 --- a/src/odhcpd.h +++ b/src/odhcpd.h @@ -163,6 +163,7 @@ struct interface { int ra_mininterval; int ra_lifetime; uint32_t ra_reachabletime; + uint32_t ra_retranstime; uint32_t ra_hoplimit; uint32_t ra_mtu; diff --git a/src/router.c b/src/router.c index 7600e2f..8a2f816 100644 --- a/src/router.c +++ b/src/router.c @@ -297,6 +297,7 @@ static uint64_t send_router_advert(struct interface *iface, const struct in6_add 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); |