+ DHCP: add ra_slaac_only, ra_allow_slaac config settings

Close # 2076

Squashed commit of the following:

commit 7a938fc6ffa0adc1e705f59778d7e7442b83d4b9
Merge: 3db2605e 6222d17d
Author: Simon Zolin <s.zolin@adguard.com>
Date:   Thu Sep 24 16:34:23 2020 +0300

    Merge remote-tracking branch 'origin/master' into 2076-dhcp-ra-slaac

commit 3db2605efda79e8d361fb46c32bb9ec753de0e02
Author: Simon Zolin <s.zolin@adguard.com>
Date:   Thu Sep 24 16:21:36 2020 +0300

    minor

commit de31c6aeebd78dce54ca54fbff010f3dd50ce974
Author: Simon Zolin <s.zolin@adguard.com>
Date:   Thu Sep 24 12:23:09 2020 +0300

    don't initialize DHCPv6 server if we must force the clients to use SLAAC

commit 7c4239899c85880641dc5b4826ae34386bc5ee94
Author: Simon Zolin <s.zolin@adguard.com>
Date:   Tue Sep 22 19:34:27 2020 +0300

    minor

commit 2b57688ce4c31d45d2236bd397e0b3041dac68c1
Author: Simon Zolin <s.zolin@adguard.com>
Date:   Mon Sep 21 19:50:11 2020 +0300

    + DHCP: add ra_slaac_only, ra_allow_slaac config settings
This commit is contained in:
Simon Zolin
2020-09-24 18:33:11 +03:00
parent 6222d17d86
commit 990f531f54
6 changed files with 379 additions and 8 deletions

View File

@@ -33,6 +33,7 @@ Contents:
* Static IP check/set
* API: Add a static lease
* API: Reset DHCP configuration
* RA+SLAAC
* DNS general settings
* API: Get DNS general settings
* API: Set DNS general settings
@@ -725,6 +726,53 @@ Response:
200 OK
### RA+SLAAC
There are 3 options for a client to get IPv6 address:
1. via DHCPv6.
Client doesn't receive any `ICMPv6.RouterAdvertisement` packets, so it tries to use DHCPv6.
2. via SLAAC.
Client receives a `ICMPv6.RouterAdvertisement` packet with `Managed=false` flag and IPv6 prefix.
Client then assigns to itself an IPv6 address using this prefix and its MAC address.
DHCPv6 server won't be started in this case.
3. via DHCPv6 or SLAAC.
Client receives a `ICMPv6.RouterAdvertisement` packet with `Managed=true` flag and IPv6 prefix.
Client may choose to use SLAAC or DHCPv6 to obtain an IPv6 address.
Configuration:
dhcp:
...
dhcpv6:
...
ra_slaac_only: false
ra_allow_slaac: false
* `ra_slaac_only:false; ra_allow_slaac:false`: use option #1.
Don't send any `ICMPv6.RouterAdvertisement` packets.
* `ra_slaac_only:true; ra_allow_slaac:false`: use option #2.
Periodically send `ICMPv6.RouterAdvertisement(Flags=(Managed=false,Other=false))` packets.
* `ra_slaac_only:false; ra_allow_slaac:true`: use option #3.
Periodically send `ICMPv6.RouterAdvertisement(Flags=(Managed=true,Other=true))` packets.
ICMPv6.RouterAdvertisement packet description:
ICMPv6:
Type=RouterAdvertisement(134)
Flags
Managed=<BOOL>
Other=<BOOL>
Option=Prefix information(3)
<IPv6 address prefix (/64) of the network interface>
Option=MTU(5)
<...>
Option=Source link-layer address(1)
<MAC address>
Option=Recursive DNS Server(25)
<IPv6 address of DNS server>
## TLS