Skip to content

Commit cb1b877

Browse files
AlphixNoltari
authored andcommitted
config: add default value for dhcpv6_pd_min_len
Right now, dhcpv6_pd_min_len is zero, meaning any request would be accepted (as long as it fits what we have available). That means that with a /56 (a common residential scenario), a downstream router can request a /57 and gobble up 1/2 of the available address space. Even a default dhcpv6_pd_min_len value of 60 means that we'd support 15 PDs in total. So let's err on the side of caution and set /62 as the default, people who want larger allocations can easily override the default. (cherry picked from commit 35f0e05) Signed-off-by: David Härdeman <david@hardeman.nu> Link: openwrt#357 Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
1 parent 20eb94d commit cb1b877

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ and may also receive information from ubus
8989
| dhcpv6_na |bool | 1 | DHCPv6 stateful addressing hands out IA_NA - Internet Address - Network Address |
9090
| dhcpv6_pd |bool | 1 | DHCPv6 stateful addressing hands out IA_PD - Internet Address - Prefix Delegation (PD) |
9191
| dhcpv6_pd_preferred |bool | 0 | Set the DHCPv6-PD Preferred (P) flag in outgoing ICMPv6 RA message PIOs (RFC9762); requires `dhcpv6` and `dhcpv6_pd`. |
92-
| dhcpv6_pd_min_len |integer| - | Minimum prefix length to delegate with IA_PD (value is adjusted if needed to be greater than the interface prefix length). Range [1,64] |
92+
| dhcpv6_pd_min_len |integer| 62 | Minimum prefix length to delegate with IA_PD (adjusted, if necessary, to be longer than the interface prefix length). Range [1,64] |
9393
| router |list |`<local address>`| IPv4 addresses of routers on a given subnet (provided via DHCPv4, should be in order of preference) |
9494
| dns |list |`<local address>`| DNS servers to announce, accepts IPv4 and IPv6 |
9595
| dnr |list |disabled| Encrypted DNS servers to announce, `<priority> <domain name> [<comma separated IP addresses> <SvcParams (key=value)>...]` |

src/config.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,8 @@ struct sys_conf sys_conf = {
6969
#define HOSTID_LEN_MAX 64
7070
#define HOSTID_LEN_DEFAULT HOSTID_LEN_MIN
7171

72-
#define PD_MIN_LEN_MAX 64
72+
#define PD_MIN_LEN_MAX 64
73+
#define PD_MIN_LEN_DEFAULT 62
7374

7475
#define OAF_DHCPV6 (OAF_DHCPV6_NA | OAF_DHCPV6_PD)
7576

@@ -324,7 +325,7 @@ static void set_interface_defaults(struct interface *iface)
324325
iface->dhcpv6_assignall = true;
325326
iface->dhcpv6_pd = true;
326327
iface->dhcpv6_pd_preferred = false;
327-
iface->dhcpv6_pd_min_len = 0;
328+
iface->dhcpv6_pd_min_len = PD_MIN_LEN_DEFAULT;
328329
iface->dhcpv6_na = true;
329330
iface->dhcpv6_hostid_len = HOSTID_LEN_DEFAULT;
330331
iface->dns_service = true;

0 commit comments

Comments
 (0)