mirror of
https://github.com/pi-hole/dnsmasq.git
synced 2025-12-19 18:28:25 +00:00
Support prefixed ranges of ipv6 addresses in dhcp-host.
When a request matching the clid or mac address is recieved the server will iterate over all candidate addresses until it find's one that is not already leased to a different clid/iaid and advertise this address. Using multiple reservations for a single host makes it possible to maintain a static leases only configuration which support network booting systems with UEFI firmware that request a new address (a new SOLICIT with a new IA_NA option using a new IAID) for different boot modes, for instance 'PXE over IPv6', and 'HTTP-Boot over IPv6'. Open Virtual Machine Firmware (OVMF) and most UEFI firmware build on the EDK2 code base exhibit this behaviour.
This commit is contained in:
18
src/option.c
18
src/option.c
@@ -3264,8 +3264,11 @@ static int one_opt(int option, char *arg, char *errstr, char *gen_err, int comma
|
||||
#ifdef HAVE_DHCP6
|
||||
else if (arg[0] == '[' && arg[strlen(arg)-1] == ']')
|
||||
{
|
||||
char *pref;
|
||||
|
||||
arg[strlen(arg)-1] = 0;
|
||||
arg++;
|
||||
pref = split_chr(arg, '/');
|
||||
|
||||
if (!inet_pton(AF_INET6, arg, &new->addr6))
|
||||
{
|
||||
@@ -3273,6 +3276,21 @@ static int one_opt(int option, char *arg, char *errstr, char *gen_err, int comma
|
||||
ret_err(_("bad IPv6 address"));
|
||||
}
|
||||
|
||||
if (pref)
|
||||
{
|
||||
u64 addrpart = addr6part(&new->addr6);
|
||||
|
||||
if (!atoi_check(pref, &new->prefix) ||
|
||||
new->prefix > 128 ||
|
||||
(((1<<(128-new->prefix))-1) & addrpart) != 0)
|
||||
{
|
||||
dhcp_config_free(new);
|
||||
ret_err(_("bad IPv6 prefix"));
|
||||
}
|
||||
|
||||
new->flags |= CONFIG_PREFIX;
|
||||
}
|
||||
|
||||
for (i= 0; i < 8; i++)
|
||||
if (new->addr6.s6_addr[i] != 0)
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user