dhcpv6-ia: simplify logic to write statefile and dhcpv6 logging
[project/odhcpd.git] / src / config.c
index df0cbc4..943f243 100644 (file)
@@ -48,6 +48,7 @@ enum {
        IFACE_ATTR_RA_MININTERVAL,
        IFACE_ATTR_RA_MAXINTERVAL,
        IFACE_ATTR_RA_LIFETIME,
+       IFACE_ATTR_RA_USELEASETIME,
        IFACE_ATTR_PD_MANAGER,
        IFACE_ATTR_PD_CER,
        IFACE_ATTR_NDPROXY_ROUTING,
@@ -85,6 +86,7 @@ static const struct blobmsg_policy iface_attrs[IFACE_ATTR_MAX] = {
        [IFACE_ATTR_RA_MININTERVAL] = { .name = "ra_mininterval", .type = BLOBMSG_TYPE_INT32 },
        [IFACE_ATTR_RA_MAXINTERVAL] = { .name = "ra_maxinterval", .type = BLOBMSG_TYPE_INT32 },
        [IFACE_ATTR_RA_LIFETIME] = { .name = "ra_lifetime", .type = BLOBMSG_TYPE_INT32 },
+       [IFACE_ATTR_RA_USELEASETIME] = { .name = "ra_useleasetime", .type = BLOBMSG_TYPE_BOOL },
        [IFACE_ATTR_NDPROXY_ROUTING] = { .name = "ndproxy_routing", .type = BLOBMSG_TYPE_BOOL },
        [IFACE_ATTR_NDPROXY_SLAVE] = { .name = "ndproxy_slave", .type = BLOBMSG_TYPE_BOOL },
 };
@@ -599,6 +601,9 @@ int config_parse_interface(void *data, size_t len, const char *name, bool overwr
        if ((c = tb[IFACE_ATTR_RA_LIFETIME]))
                iface->ra_lifetime = blobmsg_get_u32(c);
 
+       if ((c = tb[IFACE_ATTR_RA_USELEASETIME]))
+               iface->ra_useleasetime = blobmsg_get_bool(c);
+
        if ((c = tb[IFACE_ATTR_RA_PREFERENCE])) {
                const char *prio = blobmsg_get_string(c);
 
@@ -755,11 +760,11 @@ void odhcpd_reload(void)
                        setup_dhcpv6_interface(i, !i->ignore || i->dhcpv6 != RELAYD_DISABLED);
                        setup_ndp_interface(i, !i->ignore || i->ndp != RELAYD_DISABLED);
                        setup_dhcpv4_interface(i, !i->ignore || i->dhcpv4 != RELAYD_DISABLED);
-               } else {
+               } else
                        close_interface(i);
-               }
        }
 
+       ndp_handle_addr6_dump();
        uci_unload(uci, dhcp);
        uci_free_context(uci);
 }