summaryrefslogtreecommitdiffhomepage
path: root/device.c
diff options
context:
space:
mode:
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 5d1dcac..d261e25 100644
--- a/device.c
+++ b/device.c
@@ -39,6 +39,7 @@ static const struct blobmsg_policy dev_attrs[__DEV_ATTR_MAX] = {
[DEV_ATTR_ENABLED] = { .name = "enabled", .type = BLOBMSG_TYPE_BOOL },
[DEV_ATTR_IPV6] = { .name = "ipv6", .type = BLOBMSG_TYPE_BOOL },
[DEV_ATTR_PROMISC] = { .name = "promisc", .type = BLOBMSG_TYPE_BOOL },
+ [DEV_ATTR_RPFILTER] = { .name = "rpfilter", .type = BLOBMSG_TYPE_STRING },
};
const struct uci_blob_param_list device_attr_list = {
@@ -154,6 +155,7 @@ device_merge_settings(struct device *dev, struct device_settings *n)
sizeof(n->macaddr));
n->ipv6 = s->flags & DEV_OPT_IPV6 ? s->ipv6 : os->ipv6;
n->promisc = s->flags & DEV_OPT_PROMISC ? s->promisc : os->promisc;
+ n->rpfilter = s->flags & DEV_OPT_RPFILTER ? s->rpfilter : os->rpfilter;
n->flags = s->flags | os->flags;
}
@@ -197,6 +199,13 @@ device_init_settings(struct device *dev, struct blob_attr **tb)
s->flags |= DEV_OPT_PROMISC;
}
+ if ((cur = tb[DEV_ATTR_RPFILTER])) {
+ if (system_resolve_rpfilter(blobmsg_data(cur), &s->rpfilter))
+ s->flags |= DEV_OPT_RPFILTER;
+ else
+ DPRINTF("Failed to resolve rpfilter: %s\n", (char *) blobmsg_data(cur));
+ }
+
device_set_disabled(dev, disabled);
}
@@ -734,6 +743,8 @@ device_dump_status(struct blob_buf *b, struct device *dev)
blobmsg_add_u8(b, "ipv6", st.ipv6);
if (st.flags & DEV_OPT_PROMISC)
blobmsg_add_u8(b, "promisc", st.promisc);
+ if (st.flags & DEV_OPT_RPFILTER)
+ blobmsg_add_u32(b, "rpfilter", st.rpfilter);
}
s = blobmsg_open_table(b, "statistics");