summaryrefslogtreecommitdiff
path: root/device.c
diff options
context:
space:
mode:
authorHans Dedecker <dedeckeh@gmail.com>2014-12-04 12:07:18 +0000
committerSteven Barth <steven@midlink.org>2014-12-08 18:23:59 +0100
commit7c5d82806c11886bcc08821584fe51790a593feb (patch)
tree7c82070126191c13061e8880b1692c32b2e6f4da /device.c
parentdb99fce3f59d1a9629ca5bc7ec8f8208acf02816 (diff)
downloadnetifd-7c5d82806c11886bcc08821584fe51790a593feb.tar.gz
netifd: Add igmpversion config support
Config support to set the IGMP host version on device level; possible values are : 1 : IGMPv1 2 : IGMPv2 3 : IGMPv3 Signed-off-by: Hans Dedecker <dedeckeh@gmail.com> Cleand up and simplified Signed-off-by: Steven Barth <steven@midlink.org>
Diffstat (limited to 'device.c')
-rw-r--r--device.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/device.c b/device.c
index aa5818f..6cdfb49 100644
--- a/device.c
+++ b/device.c
@@ -41,6 +41,7 @@ static const struct blobmsg_policy dev_attrs[__DEV_ATTR_MAX] = {
[DEV_ATTR_PROMISC] = { .name = "promisc", .type = BLOBMSG_TYPE_BOOL },
[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 },
};
const struct uci_blob_param_list device_attr_list = {
@@ -158,6 +159,7 @@ device_merge_settings(struct device *dev, struct device_settings *n)
n->promisc = s->flags & DEV_OPT_PROMISC ? s->promisc : os->promisc;
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->flags = s->flags | os->flags;
}
@@ -213,6 +215,13 @@ device_init_settings(struct device *dev, struct blob_attr **tb)
s->flags |= DEV_OPT_ACCEPTLOCAL;
}
+ if ((cur = tb[DEV_ATTR_IGMPVERSION])) {
+ if (system_resolve_igmpversion(blobmsg_get_u32(cur), &s->igmpversion))
+ s->flags |= DEV_OPT_IGMPVERSION;
+ else
+ DPRINTF("Failed to resolve igmpversion: %d\n", blobmsg_get_u32(cur));
+ }
+
device_set_disabled(dev, disabled);
}
@@ -754,6 +763,8 @@ device_dump_status(struct blob_buf *b, struct device *dev)
blobmsg_add_u32(b, "rpfilter", st.rpfilter);
if (st.flags & DEV_OPT_ACCEPTLOCAL)
blobmsg_add_u8(b, "acceptlocal", st.acceptlocal);
+ if (st.flags & DEV_OPT_IGMPVERSION)
+ blobmsg_add_u32(b, "igmpversion", st.igmpversion);
}
s = blobmsg_open_table(b, "statistics");