From: Hans Dedecker Date: Mon, 5 Dec 2016 08:57:12 +0000 (+0100) Subject: config: Fix RA interface config being overwritten X-Git-Url: http://git.archive.openwrt.org/?p=project%2Fodhcpd.git;a=commitdiff_plain;h=3af23ad72888393a863d7be545d1bd5af99ca442;ds=inline config: Fix RA interface config being overwritten In case multiple dhcp uci sections are configured and one section contains RA config while the other section does not; the RA interface config of the first section will be overwritten by the second section. Fix this by setting the default values for ra_management and ndp_proxy_routing uci parameters when the interface is created and by removing the overwrite check Signed-off-by: Hans Dedecker --- diff --git a/src/config.c b/src/config.c index 8b0d945..372ea67 100644 --- a/src/config.c +++ b/src/config.c @@ -333,6 +333,11 @@ int config_parse_interface(void *data, size_t len, const char *name, bool overwr return -1; strncpy(iface->name, name, sizeof(iface->name) - 1); + + /* Default settings */ + iface->managed = 1; + iface->learn_routes = true; + list_add(&iface->head, &interfaces); overwrite = true; } @@ -533,8 +538,6 @@ int config_parse_interface(void *data, size_t len, const char *name, bool overwr if ((c = tb[IFACE_ATTR_RA_MANAGEMENT])) iface->managed = blobmsg_get_u32(c); - else if (overwrite) - iface->managed = 1; if ((c = tb[IFACE_ATTR_RA_OFFLINK])) iface->ra_not_onlink = blobmsg_get_bool(c); @@ -568,8 +571,6 @@ int config_parse_interface(void *data, size_t len, const char *name, bool overwr if ((c = tb[IFACE_ATTR_NDPROXY_ROUTING])) iface->learn_routes = blobmsg_get_bool(c); - else if (overwrite) - iface->learn_routes = true; if ((c = tb[IFACE_ATTR_NDPROXY_SLAVE])) iface->external = blobmsg_get_bool(c);