summaryrefslogtreecommitdiffhomepage
path: root/device.c
diff options
context:
space:
mode:
authorHans Dedecker <dedeckeh@gmail.com>2014-11-13 15:57:59 +0000
committerSteven Barth <steven@midlink.org>2014-11-19 09:30:30 +0100
commita34e76b707355a2bdaee0cda243f4f82ef17eb9a (patch)
tree947562bba412810932f6e3dcc1968f9e77ded5ae /device.c
parentf6f065d3997ccc8d42805529e4aad59b789579ad (diff)
netifd: Add acceptlocal config support
Adds support to accept packets with local source address. Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
Diffstat (limited to 'device.c')
-rw-r--r--device.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/device.c b/device.c
index d261e25..aa5818f 100644
--- a/device.c
+++ b/device.c
@@ -40,6 +40,7 @@ static const struct blobmsg_policy dev_attrs[__DEV_ATTR_MAX] = {
[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 },
+ [DEV_ATTR_ACCEPTLOCAL] = { .name = "acceptlocal", .type = BLOBMSG_TYPE_BOOL },
};
const struct uci_blob_param_list device_attr_list = {
@@ -156,6 +157,7 @@ device_merge_settings(struct device *dev, struct device_settings *n)
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->acceptlocal = s->flags & DEV_OPT_ACCEPTLOCAL ? s->acceptlocal : os->acceptlocal;
n->flags = s->flags | os->flags;
}
@@ -206,6 +208,11 @@ device_init_settings(struct device *dev, struct blob_attr **tb)
DPRINTF("Failed to resolve rpfilter: %s\n", (char *) blobmsg_data(cur));
}
+ if ((cur = tb[DEV_ATTR_ACCEPTLOCAL])) {
+ s->acceptlocal = blobmsg_get_bool(cur);
+ s->flags |= DEV_OPT_ACCEPTLOCAL;
+ }
+
device_set_disabled(dev, disabled);
}
@@ -745,6 +752,8 @@ device_dump_status(struct blob_buf *b, struct device *dev)
blobmsg_add_u8(b, "promisc", st.promisc);
if (st.flags & DEV_OPT_RPFILTER)
blobmsg_add_u32(b, "rpfilter", st.rpfilter);
+ if (st.flags & DEV_OPT_ACCEPTLOCAL)
+ blobmsg_add_u8(b, "acceptlocal", st.acceptlocal);
}
s = blobmsg_open_table(b, "statistics");