diff options
author | Alin Năstac <alin.nastac@gmail.com> | 2017-01-17 16:16:04 +0100 |
---|---|---|
committer | Felix Fietkau <nbd@nbd.name> | 2017-02-11 21:53:21 +0100 |
commit | f1076561f4cd4e391ca654d76498b0429413c61e (patch) | |
tree | 244b014b9927f4122e048bbe692c14e8b6a306a3 /device.c | |
parent | cdc0e80300a465d507aba8e8d11be56366ebb6cd (diff) |
netifd: Add option to configure locktime for each device
The UCI parameter neighlocktime allows to control the hardware
address to IP mapping lock time in the IPv4 neighbour table.
The IPv6 lock time was not set because it is not used at all in any
kernel versions, hardware address override being controlled in this case
by the override flag present in the NA packet.
Signed-off-by: Alin Nastac <alin.nastac@gmail.com>
Diffstat (limited to 'device.c')
-rw-r--r-- | device.c | 10 |
1 files changed, 10 insertions, 0 deletions
@@ -59,6 +59,7 @@ static const struct blobmsg_policy dev_attrs[__DEV_ATTR_MAX] = { [DEV_ATTR_LEARNING] = { .name ="learning", .type = BLOBMSG_TYPE_BOOL }, [DEV_ATTR_UNICAST_FLOOD] = { .name ="unicast_flood", .type = BLOBMSG_TYPE_BOOL }, [DEV_ATTR_SENDREDIRECTS] = { .name = "sendredirects", .type = BLOBMSG_TYPE_BOOL }, + [DEV_ATTR_NEIGHLOCKTIME] = { .name = "neighlocktime", .type = BLOBMSG_TYPE_INT32 }, }; const struct uci_blob_param_list device_attr_list = { @@ -217,6 +218,8 @@ device_merge_settings(struct device *dev, struct device_settings *n) s->neigh4gcstaletime : os->neigh4gcstaletime; n->neigh6gcstaletime = s->flags & DEV_OPT_NEIGHGCSTALETIME ? s->neigh6gcstaletime : os->neigh6gcstaletime; + n->neigh4locktime = s->flags & DEV_OPT_NEIGHLOCKTIME ? + s->neigh4locktime : os->neigh4locktime; n->dadtransmits = s->flags & DEV_OPT_DADTRANSMITS ? s->dadtransmits : os->dadtransmits; n->multicast = s->flags & DEV_OPT_MULTICAST ? @@ -314,6 +317,11 @@ device_init_settings(struct device *dev, struct blob_attr **tb) s->flags |= DEV_OPT_NEIGHGCSTALETIME; } + if ((cur = tb[DEV_ATTR_NEIGHLOCKTIME])) { + s->neigh4locktime = blobmsg_get_u32(cur); + s->flags |= DEV_OPT_NEIGHLOCKTIME; + } + if ((cur = tb[DEV_ATTR_RPS])) { s->rps = blobmsg_get_bool(cur); s->flags |= DEV_OPT_RPS; @@ -1044,6 +1052,8 @@ device_dump_status(struct blob_buf *b, struct device *dev) blobmsg_add_u32(b, "neigh4gcstaletime", st.neigh4gcstaletime); blobmsg_add_u32(b, "neigh6gcstaletime", st.neigh6gcstaletime); } + if (st.flags & DEV_OPT_NEIGHLOCKTIME) + blobmsg_add_u32(b, "neigh4locktime", st.neigh4locktime); if (st.flags & DEV_OPT_DADTRANSMITS) blobmsg_add_u32(b, "dadtransmits", st.dadtransmits); if (st.flags & DEV_OPT_MULTICAST_TO_UNICAST) |