Kea  2.1.2-git
DHCPv4-over-DHCPv6 DHCPv4 Server Side

Kea supports DHCPv4-over-DHCPv6 using cooperating DHCPv6 and DHCPv4 servers.

This section describes the DHCPv4 server side. For its DHCPv6 counter-part, see DHCPv4-over-DHCPv6 DHCPv6 Server Side.

DHCPv6-to-DHCPv4 Inter Process Communication

The Dhcp4to6Ipc class is derived from the base Dhcp4o6IpcBase as a singleton class (by the static isc::dhcp::Dhcp4to6Ipc::instance function). isc::dhcp::Dhcp4to6Ipc::open is called to open IPC UDP sockets and to register isc::dhcp::Dhcp4to6Ipc::handler on external sockets on the IfaceMgr.

DHCPv4-over-DHCPv6 Packet Processing

DHCPv6 DHCPv4-QUERY messages are forwarded by the DHCPv6 server on the IPC. The interface manager (IfaceMgr) using the external socket mechanism invokes isc::dhcp::Dhcp4to6Ipc::handler, the packet is received using (inherited) isc::dhcp::Dhcp4o6IpcBase::receive which decodes and strips the ISC Vendor option.

The handler verifies there is one and only one DHCPv4-Message option and extracts it. isc::dhcp::Dhcpv4Srv::processPacket processes the DHCPv4 query as a Pkt4o6 instance and builds the DHCPv4-over-DHCPv6 response. Registered callouts for "buffer4_send" are called (buffer4_send, note all the other DHCPv4 hook points are served during the standard processing). The response is sent back to the DHCPv6 server on the IPC.

Modified DHCPv4 Routines

For a Pkt4o6 query the isc::dhcp::Dhcpv4Exchange::initResponse performs some extra steps (isc::dhcp::Dhcpv4Exchange::initResponse4o6): the DHCPv6 response is built and the response member is reset to a Pkt4o6 instance with DHCPv4 and DHCPv6 parts.

The subnet selection (isc::dhcp::Dhcpv4Srv::selectSubnet) is specialized for Pkt4o6 queries (isc::dhcp::Dhcpv4Srv::selectSubnet4o6): the subnet selector class (SubnetSelector) is filled using DHCPv4 and DHCPv6 information and the isc::dhcp::CfgSubnets4::selectSubnet4o6 function is called (instead of isc::dhcp::CfgSubnets4::selectSubnet).

In isc::dhcp::Dhcpv4Srv::adjustIfaceData for Pkt4o6 queries the local address is set to the incoming interface assigned address (same case than for a broadcast local address).

In isc::dhcp::Dhcpv4Srv::adjustRemoteAddr for Pkt4o6 queries the remote address is set to the query one (which is in fact an IPv6 address).

In isc::dhcp::Dhcpv4Srv::acceptDirectRequest Pkt4o6 queries are accepted (they are considered as being relayed).