summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--README4
-rw-r--r--src/config.c8
-rw-r--r--src/dhcpv6-ia.c2
-rw-r--r--src/odhcpd.h2
4 files changed, 14 insertions, 2 deletions
diff --git a/README b/README
index fbcd993..f4945ce 100644
--- a/README
+++ b/README
@@ -90,6 +90,10 @@ ndp string disabled Neighbor Discovery Proxy
dynamicdhcp bool 1 Dynamically create leases
for DHCPv4 and DHCPv6
+dhcpv6_assignall bool 1 Assign all viable DHCPv6 addresses
+ in statefull mode; if disabled
+ only the DHCPv6 address having the
+ longest preferred lifetime is assigned
router list <local address> Routers to announce
accepts IPv4 only
dns list <local address> DNS servers to announce
diff --git a/src/config.c b/src/config.c
index 8670efc..19b901c 100644
--- a/src/config.c
+++ b/src/config.c
@@ -43,6 +43,7 @@ enum {
IFACE_ATTR_DOMAIN,
IFACE_ATTR_FILTER_CLASS,
IFACE_ATTR_DHCPV6_RAW,
+ IFACE_ATTR_DHCPV6_ASSIGNALL,
IFACE_ATTR_RA_DEFAULT,
IFACE_ATTR_RA_MANAGEMENT,
IFACE_ATTR_RA_OFFLINK,
@@ -83,6 +84,7 @@ static const struct blobmsg_policy iface_attrs[IFACE_ATTR_MAX] = {
[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_DHCPV6_ASSIGNALL] = { .name ="dhcpv6_assignall", .type = BLOBMSG_TYPE_BOOL },
[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 },
@@ -205,9 +207,10 @@ static struct interface* get_interface(const char *name)
static void set_interface_defaults(struct interface *iface)
{
- iface->ra_managed = RA_MANAGED_MFLAG;
iface->learn_routes = 1;
iface->dhcpv4_leasetime = 43200;
+ iface->dhcpv6_assignall = true;
+ iface->ra_managed = RA_MANAGED_MFLAG;
iface->ra_maxinterval = 600;
iface->ra_mininterval = iface->ra_maxinterval/3;
iface->ra_lifetime = -1;
@@ -617,6 +620,9 @@ int config_parse_interface(void *data, size_t len, const char *name, bool overwr
odhcpd_unhexlify(iface->dhcpv6_raw, iface->dhcpv6_raw_len, blobmsg_get_string(c));
}
+ if ((c = tb[IFACE_ATTR_DHCPV6_ASSIGNALL]))
+ iface->dhcpv6_assignall = blobmsg_get_bool(c);
+
if ((c = tb[IFACE_ATTR_RA_DEFAULT]))
iface->default_router = blobmsg_get_u32(c);
diff --git a/src/dhcpv6-ia.c b/src/dhcpv6-ia.c
index 8bf42c8..847ede4 100644
--- a/src/dhcpv6-ia.c
+++ b/src/dhcpv6-ia.c
@@ -36,7 +36,7 @@
#include <libubox/usock.h>
#define ADDR_ENTRY_VALID_IA_ADDR(iface, i, m, addrs) \
- ((iface)->ra_managed == RA_MANAGED_NO_AFLAG || (i) == (m) || \
+ ((iface)->dhcpv6_assignall || (i) == (m) || \
(addrs)[(i)].prefix > 64)
static void free_dhcpv6_assignment(struct dhcpv6_assignment *c);
diff --git a/src/odhcpd.h b/src/odhcpd.h
index 10f0edb..a03baf0 100644
--- a/src/odhcpd.h
+++ b/src/odhcpd.h
@@ -185,8 +185,10 @@ struct interface {
uint8_t *search;
size_t search_len;
+ // DHCPV6
void *dhcpv6_raw;
size_t dhcpv6_raw_len;
+ bool dhcpv6_assignall;
char *upstream;
size_t upstream_len;