summaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorHans Dedecker <dedeckeh@gmail.com>2019-09-09 22:12:51 +0200
committerHans Dedecker <dedeckeh@gmail.com>2019-09-12 21:54:01 +0200
commite73bf11dee1073aaaddc0dc67ca8c7d75ae3c6ad (patch)
tree4881a78233600c8c25b57ea31656252da5aca685 /src
parentd818380fb6db3401c204a7cdb66af9e5ccc7693b (diff)
config: ra_management compatibility support
Keep supporting ra_management for backwards compatibility support; ra_management will only be processed if neither ra_slaac and ra_flags are set. Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
Diffstat (limited to 'src')
-rw-r--r--src/config.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/config.c b/src/config.c
index 53528a0..a8458a5 100644
--- a/src/config.c
+++ b/src/config.c
@@ -59,6 +59,7 @@ enum {
IFACE_ATTR_DHCPV6_PD,
IFACE_ATTR_DHCPV6_NA,
IFACE_ATTR_RA_DEFAULT,
+ IFACE_ATTR_RA_MANAGEMENT,
IFACE_ATTR_RA_FLAGS,
IFACE_ATTR_RA_SLAAC,
IFACE_ATTR_RA_OFFLINK,
@@ -107,6 +108,7 @@ static const struct blobmsg_policy iface_attrs[IFACE_ATTR_MAX] = {
[IFACE_ATTR_PD_MANAGER] = { .name = "pd_manager", .type = BLOBMSG_TYPE_STRING },
[IFACE_ATTR_PD_CER] = { .name = "pd_cer", .type = BLOBMSG_TYPE_STRING },
[IFACE_ATTR_RA_DEFAULT] = { .name = "ra_default", .type = BLOBMSG_TYPE_INT32 },
+ [IFACE_ATTR_RA_MANAGEMENT] = { .name = "ra_management", .type = BLOBMSG_TYPE_INT32 },
[IFACE_ATTR_RA_FLAGS] = { .name = "ra_flags", . type = BLOBMSG_TYPE_ARRAY },
[IFACE_ATTR_RA_SLAAC] = { .name = "ra_slaac", .type = BLOBMSG_TYPE_BOOL },
[IFACE_ATTR_RA_OFFLINK] = { .name = "ra_offlink", .type = BLOBMSG_TYPE_BOOL },
@@ -734,6 +736,26 @@ int config_parse_interface(void *data, size_t len, const char *name, bool overwr
if ((c = tb[IFACE_ATTR_RA_DEFAULT]))
iface->default_router = blobmsg_get_u32(c);
+ if (!tb[IFACE_ATTR_RA_FLAGS] && !tb[IFACE_ATTR_RA_SLAAC] &&
+ (c = tb[IFACE_ATTR_RA_MANAGEMENT])) {
+ switch (blobmsg_get_u32(c)) {
+ case 0:
+ iface->ra_flags = ND_RA_FLAG_OTHER;
+ iface->ra_slaac = true;
+ break;
+ case 1:
+ iface->ra_flags = ND_RA_FLAG_OTHER|ND_RA_FLAG_MANAGED;
+ iface->ra_slaac = true;
+ break;
+ case 2:
+ iface->ra_flags = ND_RA_FLAG_OTHER|ND_RA_FLAG_MANAGED;
+ iface->ra_slaac = false;
+ break;
+ default:
+ break;
+ }
+ }
+
if ((c = tb[IFACE_ATTR_RA_FLAGS])) {
iface->ra_flags = 0;
if (parse_ra_flags(&iface->ra_flags, c) < 0)