summaryrefslogtreecommitdiffhomepage
path: root/device.c
diff options
context:
space:
mode:
authorSteven Barth <steven@midlink.org>2014-12-23 14:12:32 +0100
committerSteven Barth <steven@midlink.org>2014-12-23 14:12:32 +0100
commit6b4570a107447034b5ae3861a7ca388d3052460a (patch)
tree5f65dc9775616c84d1e52c1d7c870244750addff /device.c
parent02713a50084b26a927d5d1f95455829d320aa4e1 (diff)
netifd: Add mldversion config support
Config support to set the MLD host version on device level; possible values are : 1 : MLDv1 2 : MLDv2 Signed-off-by: Hans Dedecker <dedeckeh@gmail.com> Cleaned up and simplified. Signed-off-by: Steven Barth <steven@midlink.org>
Diffstat (limited to 'device.c')
-rw-r--r--device.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/device.c b/device.c
index 6cdfb49..6eb1486 100644
--- a/device.c
+++ b/device.c
@@ -42,6 +42,7 @@ static const struct blobmsg_policy dev_attrs[__DEV_ATTR_MAX] = {
[DEV_ATTR_RPFILTER] = { .name = "rpfilter", .type = BLOBMSG_TYPE_STRING },
[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 },
};
const struct uci_blob_param_list device_attr_list = {
@@ -160,6 +161,7 @@ device_merge_settings(struct device *dev, struct device_settings *n)
n->rpfilter = s->flags & DEV_OPT_RPFILTER ? s->rpfilter : os->rpfilter;
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->flags = s->flags | os->flags;
}
@@ -216,12 +218,21 @@ device_init_settings(struct device *dev, struct blob_attr **tb)
}
if ((cur = tb[DEV_ATTR_IGMPVERSION])) {
- if (system_resolve_igmpversion(blobmsg_get_u32(cur), &s->igmpversion))
+ s->igmpversion = blobmsg_get_u32(cur);
+ if (s->igmpversion >= 1 && s->igmpversion <= 3)
s->flags |= DEV_OPT_IGMPVERSION;
else
DPRINTF("Failed to resolve igmpversion: %d\n", blobmsg_get_u32(cur));
}
+ if ((cur = tb[DEV_ATTR_MLDVERSION])) {
+ s->mldversion = blobmsg_get_u32(cur);
+ if (s->mldversion >= 1 && s->mldversion <= 2)
+ s->flags |= DEV_OPT_MLDVERSION;
+ else
+ DPRINTF("Failed to resolve mldversion: %d\n", blobmsg_get_u32(cur));
+ }
+
device_set_disabled(dev, disabled);
}
@@ -765,6 +776,8 @@ device_dump_status(struct blob_buf *b, struct device *dev)
blobmsg_add_u8(b, "acceptlocal", st.acceptlocal);
if (st.flags & DEV_OPT_IGMPVERSION)
blobmsg_add_u32(b, "igmpversion", st.igmpversion);
+ if (st.flags & DEV_OPT_MLDVERSION)
+ blobmsg_add_u32(b, "mldversion", st.mldversion);
}
s = blobmsg_open_table(b, "statistics");