summaryrefslogtreecommitdiffhomepage
path: root/device.c
diff options
context:
space:
mode:
authorHans Dedecker <dedeckeh@gmail.com>2015-02-02 16:11:24 +0100
committerSteven Barth <steven@midlink.org>2015-02-09 09:26:25 +0100
commit2dae3867c8730e194c036a7827b0322726adf81a (patch)
tree0b2b06698ae49d1897137f7b2a6a8cd9ebb33ae4 /device.c
parent258b79f7a912abc84a3066c90266d8835597362e (diff)
netifd: Add option to configure base_reachable_time_ms for each device
The UCI parameter neighreachabletime allows to control the hardware address to IP mapping lifetime in the neighbour table for both IPv4 and IPv6 Signed-off-by: Hans Dedecker <dedeckeh@gmail.com> Signed-off-by: Jean-Francois Remy <jeff@melix.org>
Diffstat (limited to 'device.c')
-rw-r--r--device.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/device.c b/device.c
index 54638e7..556d9fc 100644
--- a/device.c
+++ b/device.c
@@ -43,6 +43,7 @@ static const struct blobmsg_policy dev_attrs[__DEV_ATTR_MAX] = {
[DEV_ATTR_ACCEPTLOCAL] = { .name = "acceptlocal", .type = BLOBMSG_TYPE_BOOL },
[DEV_ATTR_IGMPVERSION] = { .name = "igmpversion", .type = BLOBMSG_TYPE_INT32 },
[DEV_ATTR_MLDVERSION] = { .name = "mldversion", .type = BLOBMSG_TYPE_INT32 },
+ [DEV_ATTR_NEIGHREACHABLETIME] = { .name = "neighreachabletime", .type = BLOBMSG_TYPE_INT32 },
};
const struct uci_blob_param_list device_attr_list = {
@@ -162,6 +163,10 @@ device_merge_settings(struct device *dev, struct device_settings *n)
n->acceptlocal = s->flags & DEV_OPT_ACCEPTLOCAL ? s->acceptlocal : os->acceptlocal;
n->igmpversion = s->flags & DEV_OPT_IGMPVERSION ? s->igmpversion : os->igmpversion;
n->mldversion = s->flags & DEV_OPT_MLDVERSION ? s->mldversion : os->mldversion;
+ n->neigh4reachabletime = s->flags & DEV_OPT_NEIGHREACHABLETIME ?
+ s->neigh4reachabletime : os->neigh4reachabletime;
+ n->neigh6reachabletime = s->flags & DEV_OPT_NEIGHREACHABLETIME ?
+ s->neigh6reachabletime : os->neigh6reachabletime;
n->flags = s->flags | os->flags;
}
@@ -233,6 +238,11 @@ device_init_settings(struct device *dev, struct blob_attr **tb)
DPRINTF("Failed to resolve mldversion: %d\n", blobmsg_get_u32(cur));
}
+ if ((cur = tb[DEV_ATTR_NEIGHREACHABLETIME])) {
+ s->neigh6reachabletime = s->neigh4reachabletime = blobmsg_get_u32(cur);
+ s->flags |= DEV_OPT_NEIGHREACHABLETIME;
+ }
+
device_set_disabled(dev, disabled);
}
@@ -794,6 +804,10 @@ device_dump_status(struct blob_buf *b, struct device *dev)
blobmsg_add_u32(b, "igmpversion", st.igmpversion);
if (st.flags & DEV_OPT_MLDVERSION)
blobmsg_add_u32(b, "mldversion", st.mldversion);
+ if (st.flags & DEV_OPT_NEIGHREACHABLETIME) {
+ blobmsg_add_u32(b, "neigh4reachabletime", st.neigh4reachabletime);
+ blobmsg_add_u32(b, "neigh6reachabletime", st.neigh6reachabletime);
+ }
}
s = blobmsg_open_table(b, "statistics");