From: Francis Dupont Date: Fri, 1 Jul 2016 20:50:10 +0000 (+0200) Subject: [4274] Moved subnet selections X-Git-Tag: trac4551_base~37^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2ab5f9df65f1cbcde48eb92e807a5b25e15bf8fb;p=thirdparty%2Fkea.git [4274] Moved subnet selections --- diff --git a/doc/devel/mainpage.dox b/doc/devel/mainpage.dox index 73bf9f64ba..ebe1623d94 100644 --- a/doc/devel/mainpage.dox +++ b/doc/devel/mainpage.dox @@ -96,6 +96,8 @@ * - @subpage allocengine * - @subpage timerManager * - @subpage leaseReclamationRoutine + * - @subpage subnetSelect + * - @subpage dhcp4o6Ipc * - @subpage libdhcp_ddns * - @subpage dhcpDatabaseBackends * - @subpage dhcpEval diff --git a/src/bin/dhcp4/dhcp4o6.dox b/src/bin/dhcp4/dhcp4o6.dox index 8282ae499b..134a235615 100644 --- a/src/bin/dhcp4/dhcp4o6.dox +++ b/src/bin/dhcp4/dhcp4o6.dox @@ -59,63 +59,4 @@ remote address is set to the query one (which is in fact an IPv6 address). In @ref isc::dhcp::Dhcpv4Srv::acceptDirectRequest @c Pkt4o6 queries are accepted (they are considered as being relayed). -@section dhcp4SubnetSelect DHCPv4 Subnet Selection - -@todo Move this to libdhcpsrv - -Selectors (i.e., members of @c SubnetSelector class) are: -- incoming interface name -- gateway address - giaddr field -- client address - ciaddr field -- local address -- remote address -- option select - from the first Relay Agent Link Selection suboption or - from a Subnet Selection option -- client classes - used to reject a matching rule and try next rules - -First use the option select, next if the message was relayed (not undefined -gateway address) use the gateway address as a subnet relay address. - -If a subnet was not already selected choose an address between: - -- if the gateway address is not undefined the gateway address -- if the client address is not undefined and the local address not the - broadcast address (i.e., renew or rebind) the client address -- if the remote address is not undefined and the local address not the - broadcast address (i.e., renew or rebind) the remote address -- at this point try the interface name as a subnet interface -- if the interface name does not select a subnet choose the interface address - (last resort) - -Match the chosen address in a subnet address range. - -@section dhcp4o6SubnetSelect DHCPv4-over-DHCPv6 Subnet Selection - -@todo Move this to libdhcpsrv - -Selectors (i.e., members of @c SubnetSelector class) are: -- incoming interface name -- gateway address - giaddr field (should be always undefined) -- client address - ciaddr field -- local address - set to the interface IPv4 address -- remote address - IPv6 address -- option select - from a Subnet Selection option -- first relay link address - (IPv6) undefined or the first relay link - address which is not undefined or link local (i.e., usable) -- interface ID - (IPv6) when a relay message includes an interface ID - relay option -- client classes - used to reject a matching rule and try next rules - -Check if DHCPv4-over-DHCPv6 is enabled for this particulat subnet and -continue with the next subnet is if it is not. - -First the remote address is matched in a subnet IPv6 range, second -the interface ID if it is set is matched, third the interface name. - -These rules are applied for each subnet configuration so if two -subnets match the first one is returned (vs. the first matching rule). - -@todo better DHCPv4-over-DHCPv6 selection, e.g., handle relayed -messages and return best (vs first) match. - */ diff --git a/src/bin/dhcp6/dhcp4o6.dox b/src/bin/dhcp6/dhcp4o6.dox index a61a3e47a5..61a79c0c48 100644 --- a/src/bin/dhcp6/dhcp4o6.dox +++ b/src/bin/dhcp6/dhcp4o6.dox @@ -50,24 +50,4 @@ Following the DHCPv4-over-DHCPv6 packet flow: - the DHCPv6 DHCPv4-RESPONSE packet is sent back to the IPv6 remote address -@section dhcp6SubnetSelection DHCPv6 Subnet Selection - -@todo Move this to libdhcpsrv - -Selectors (i.e., members of @c SubnetSelector class) are: -- incoming interface name -- remote address -- first relay link address - undefined or the first relay link address which - is not undefined or link local (i.e., usable) -- interface ID - when a relay message includes an interface ID relay option -- client classes - used to reject a matching rule and try next rules - -If the first relay link address is undefined the client is directly connected: -the interface name is matched and if it does not select a subnet the remote -address is matched in a subnet address range. - -If the first relay link address is not undefined the query was relayed: -the interface ID is tried and if it does not select a subnet the first -relay address is matched as a subnet relay address. - */ diff --git a/src/lib/dhcpsrv/libdhcpsrv.dox b/src/lib/dhcpsrv/libdhcpsrv.dox index fcc2f511cc..46eb9abf6d 100644 --- a/src/lib/dhcpsrv/libdhcpsrv.dox +++ b/src/lib/dhcpsrv/libdhcpsrv.dox @@ -368,6 +368,84 @@ since expiration elapsed. These methods are executed periodically by the DHCP servers using the dedicated timers registered in the @c isc::dhcp::TimerMgr. +@section subnetSelect Subnet Selection + +An important service offered by this library is the subnet selection +from a query packet. + +@subsection dhcp4SubnetSelect DHCPv4 Subnet Selection + +Selectors (i.e., members of @c SubnetSelector class) are: +- incoming interface name +- gateway address - giaddr field +- client address - ciaddr field +- local address +- remote address +- option select - from the first Relay Agent Link Selection suboption or + from a Subnet Selection option +- client classes - used to reject a matching rule and try next rules + +First use the option select, next if the message was relayed (not undefined +gateway address) use the gateway address as a subnet relay address. + +If a subnet was not already selected choose an address between: + +- if the gateway address is not undefined the gateway address +- if the client address is not undefined and the local address not the + broadcast address (i.e., renew or rebind) the client address +- if the remote address is not undefined and the local address not the + broadcast address (i.e., renew or rebind) the remote address +- at this point try the interface name as a subnet interface +- if the interface name does not select a subnet choose the interface address + (last resort) + +Match the chosen address in a subnet address range. + +@subsection dhcp4o6SubnetSelect DHCPv4-over-DHCPv6 Subnet Selection + +Selectors (i.e., members of @c SubnetSelector class) are: +- incoming interface name +- gateway address - giaddr field (should be always undefined) +- client address - ciaddr field +- local address - set to the interface IPv4 address +- remote address - IPv6 address +- option select - from a Subnet Selection option +- first relay link address - (IPv6) undefined or the first relay link + address which is not undefined or link local (i.e., usable) +- interface ID - (IPv6) when a relay message includes an interface ID + relay option +- client classes - used to reject a matching rule and try next rules + +Check if DHCPv4-over-DHCPv6 is enabled for this particular subnet and +continue with the next subnet is if it is not. + +First the remote address is matched in a subnet IPv6 range, second +the interface ID if it is set is matched, third the interface name. + +These rules are applied for each subnet configuration so if two +subnets match the first one is returned (vs. the first matching rule). + +@todo better DHCPv4-over-DHCPv6 selection, e.g., handle relayed +messages and return best (vs first) match. + +@subsection dhcp6SubnetSelection DHCPv6 Subnet Selection + +Selectors (i.e., members of @c SubnetSelector class) are: +- incoming interface name +- remote address +- first relay link address - undefined or the first relay link address which + is not undefined or link local (i.e., usable) +- interface ID - when a relay message includes an interface ID relay option +- client classes - used to reject a matching rule and try next rules + +If the first relay link address is undefined the client is directly connected: +the interface name is matched and if it does not select a subnet the remote +address is matched in a subnet address range. + +If the first relay link address is not undefined the query was relayed: +the interface ID is tried and if it does not select a subnet the first +relay address is matched as a subnet relay address. + @section dhcp4o6Ipc DHCPv4-over-DHCPv6 Inter Process Communication DHCPv4-over-DHCPv6 support is implemented using cooperating