summaryrefslogtreecommitdiffhomepage
path: root/src/config.c
diff options
context:
space:
mode:
authorHans Dedecker <dedeckeh@gmail.com>2017-02-16 12:20:08 +0100
committerHans Dedecker <dedeckeh@gmail.com>2017-02-16 18:25:41 +0100
commit942fb33d3017e8769a7354ee008daf0f31a40fe2 (patch)
tree501c416bd8c2c8b8befecfc93addf46e8f1721ac /src/config.c
parentf91333771b9625850e0f5cad8af6e9c6441e387e (diff)
router: support ra_mininterval and ra_lifetime uci parameters (FS#397)
Add support for uci parameters ra_mininterval and ra_lifetime as described in RFC4861 paragraph 6.2.1. Variable ra_mininterval allows to configure the minimum interval time between unsolicited router advertisement messages; default value is 200 seconds. The minimum allowed value is 4 seconds while the maximum value is limited to 0.75 of the maximum interval time. The calculation of the maximum interval time between unsolicited router advertisement messages has been reworked. The default value is 600 seconds as specified in RFC4861; if the maximum interval time exceeds 0.33 * the minimal valid lifetime of all IPv6 prefixes it will be limited to 0.33 * the minimal valid lifetime of all IPv6 prefixes Variable ra_lifetime allows to configure the Router Lifetime field in the router advertisement messages; the value is either 0 or a value between the maximum interval time and 9000 seconds. If the router lifetime is smaller than the RA maximum interval it will be set equal to the RA maximum interval time. Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
Diffstat (limited to 'src/config.c')
-rw-r--r--src/config.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/config.c b/src/config.c
index 69a3ad1..b621c75 100644
--- a/src/config.c
+++ b/src/config.c
@@ -45,7 +45,9 @@ enum {
IFACE_ATTR_RA_OFFLINK,
IFACE_ATTR_RA_PREFERENCE,
IFACE_ATTR_RA_ADVROUTER,
+ IFACE_ATTR_RA_MININTERVAL,
IFACE_ATTR_RA_MAXINTERVAL,
+ IFACE_ATTR_RA_LIFETIME,
IFACE_ATTR_PD_MANAGER,
IFACE_ATTR_PD_CER,
IFACE_ATTR_NDPROXY_ROUTING,
@@ -80,7 +82,9 @@ static const struct blobmsg_policy iface_attrs[IFACE_ATTR_MAX] = {
[IFACE_ATTR_RA_OFFLINK] = { .name = "ra_offlink", .type = BLOBMSG_TYPE_BOOL },
[IFACE_ATTR_RA_PREFERENCE] = { .name = "ra_preference", .type = BLOBMSG_TYPE_STRING },
[IFACE_ATTR_RA_ADVROUTER] = { .name = "ra_advrouter", .type = BLOBMSG_TYPE_BOOL },
+ [IFACE_ATTR_RA_MININTERVAL] = { .name = "ra_mininterval", .type = BLOBMSG_TYPE_INT32 },
[IFACE_ATTR_RA_MAXINTERVAL] = { .name = "ra_maxinterval", .type = BLOBMSG_TYPE_INT32 },
+ [IFACE_ATTR_RA_LIFETIME] = { .name = "ra_lifetime", .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 },
};
@@ -188,6 +192,9 @@ static void set_interface_defaults(struct interface *iface)
{
iface->managed = 1;
iface->learn_routes = 1;
+ iface->ra_maxinterval = 600;
+ iface->ra_mininterval = iface->ra_maxinterval/3;
+ iface->ra_lifetime = -1;
}
static void clean_interface(struct interface *iface)
@@ -584,9 +591,15 @@ int config_parse_interface(void *data, size_t len, const char *name, bool overwr
if ((c = tb[IFACE_ATTR_RA_ADVROUTER]))
iface->ra_advrouter = blobmsg_get_bool(c);
+ if ((c = tb[IFACE_ATTR_RA_MININTERVAL]))
+ iface->ra_mininterval = blobmsg_get_u32(c);
+
if ((c = tb[IFACE_ATTR_RA_MAXINTERVAL]))
iface->ra_maxinterval = blobmsg_get_u32(c);
+ if ((c = tb[IFACE_ATTR_RA_LIFETIME]))
+ iface->ra_lifetime = blobmsg_get_u32(c);
+
if ((c = tb[IFACE_ATTR_RA_PREFERENCE])) {
const char *prio = blobmsg_get_string(c);