summaryrefslogtreecommitdiffhomepage
path: root/src/config.c
diff options
context:
space:
mode:
authorSteven Barth <steven@midlink.org>2014-05-30 16:59:53 +0200
committerSteven Barth <steven@midlink.org>2014-05-30 16:59:53 +0200
commitfc7fb637811089b4f26fb00ca81a0d05c09076bd (patch)
tree73ca8ed1c6cf25a9bff39cbff2850faa07660dbf /src/config.c
parent7fb8ef575d019796b212824a706b0ea5c6bdffaa (diff)
Make filtering customizable
Diffstat (limited to 'src/config.c')
-rw-r--r--src/config.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/config.c b/src/config.c
index 6dd52bb..db5ca3b 100644
--- a/src/config.c
+++ b/src/config.c
@@ -32,6 +32,7 @@ enum {
IFACE_ATTR_NDP,
IFACE_ATTR_DNS,
IFACE_ATTR_DOMAIN,
+ IFACE_ATTR_FILTER_CLASS,
IFACE_ATTR_DHCPV6_RAW,
IFACE_ATTR_RA_DEFAULT,
IFACE_ATTR_RA_MANAGEMENT,
@@ -62,6 +63,7 @@ static const struct blobmsg_policy iface_attrs[IFACE_ATTR_MAX] = {
[IFACE_ATTR_NDP] = { .name = "ndp", .type = BLOBMSG_TYPE_STRING },
[IFACE_ATTR_DNS] = { .name = "dns", .type = BLOBMSG_TYPE_ARRAY },
[IFACE_ATTR_DOMAIN] = { .name = "domain", .type = BLOBMSG_TYPE_ARRAY },
+ [IFACE_ATTR_FILTER_CLASS] = { .name = "filter_class", .type = BLOBMSG_TYPE_STRING },
[IFACE_ATTR_DHCPV6_RAW] = { .name = "dhcpv6_raw", .type = BLOBMSG_TYPE_STRING },
[IFACE_ATTR_PD_MANAGER] = { .name = "pd_manager", .type = BLOBMSG_TYPE_STRING },
[IFACE_ATTR_PD_CER] = { .name = "pd_cer", .type = BLOBMSG_TYPE_STRING },
@@ -152,6 +154,7 @@ static void clean_interface(struct interface *iface)
free(iface->static_ndp);
free(iface->dhcpv4_dns);
free(iface->dhcpv6_raw);
+ free(iface->filter_class);
memset(&iface->ra, 0, sizeof(*iface) - offsetof(struct interface, ra));
}
@@ -457,6 +460,11 @@ int config_parse_interface(void *data, size_t len, const char *name, bool overwr
}
}
+ if ((c = tb[IFACE_ATTR_FILTER_CLASS])) {
+ iface->filter_class = realloc(iface->filter_class, blobmsg_data_len(c) + 1);
+ memcpy(iface->filter_class, blobmsg_get_string(c), blobmsg_data_len(c) + 1);
+ }
+
if ((c = tb[IFACE_ATTR_DHCPV6_RAW])) {
iface->dhcpv6_raw_len = blobmsg_data_len(c) / 2;
iface->dhcpv6_raw = realloc(iface->dhcpv6_raw, iface->dhcpv6_raw_len);