[systemd-devel] [PATCH 00/24] Initial DHCPv6 client support
Patrik Flykt
patrik.flykt at linux.intel.com
Fri Jun 13 06:44:50 PDT 2014
Hi,
This patch set provides initial DHCPv6 client support for
systemd-networkd. It adds support for ICMPv6 Router Solicitation sending
and Router Advertisment receiving and the very basic Solicit, Advertise,
Request and Reply message transactions. Networkd is able to start DHCPv6
negotiation for a link, but doesn't yet do anything with the result.
As only the initial DHCPv6 client side support is implemented, this patch
set omits the following features specified in RFC 3315:
- Rapid Commit in the Solicit message
- Information Request, should the router only announce the availability
of "Other" information
- Reacquiring of an address, i.e. Renew, Rebind, etc.
- Temporary adresses, option requesting, elapsed time options
- DHCPv6 authentication
...and a few more that I for sure have forgotten from this list. The
intent is to have the remaining parts essential for the protocol
functionality to be done as quickly as possible after this patch set.
On startup, the DHCPv6 client implementation sends Router Soliciations
in order to receive Router Advertisments. Only the Managed/Other flags
in the Router Advertisment are currently used, any prefix information
is currently ignored. ICMPv6 and a basic test case is handled by patches
02-04 with the basic DHCPv6 library and test case provided in patches 01
and 08.
Machine-specific DUID and IAID identifiers are created in patches 05-07.
The DUID is used to uniquely identify the machine with the IAID
identifying a particular interface. The DUID is based on the machine ID
and the IAID on interface name from udev or, if run in a container, the
interface MAC address. Credits for implementing this part of the code
goes to Tom.
With identifiers created, the DHCPv6 message (re)transmission is provided
by patch 09 and enhanced in turn with patches 12 and 22 where Solicit
and Reply message handling is implemented, respectively. Support for DHCPv6
option appending and parsing is provided in patches 10 and 15, separated
due to implementation complexity of the IA option and need of DHCPv6 lease
handling code provided by patch 14.
The remaining patches add DHCPv6 message processing one message at a time
with the required state changes and retransmission restarting. A client
test program is provided, it should hopefully prevent possible bugs with
later commits.
As with the DHCPv4 code, also with DHCPv6 it again became evident that
borrowing code 1:1 from ConnMan wasn't really an option. The main loop
syntax and systemd coding style is different enough to prevent any direct
copying. On the positive side the ConnMan implementation exists and works
very well making it possible to thoroughly dissect the DHCPv6 messaging
going back and forth between the client and the server.
Have fun while reviewing,
Patrik
Patrik Flykt (22):
sd-dhcp6-client: Add initial DHCPv6 client files
sd-dhcp6-client: Add Router Solicitation and Advertisement support
sd-dhcp6-client: Add initial Router Advertisement test case
sd-dhcp6-client: Initialize Router Solicitation on startup
sd-dhcp6-client: Add DHCPv6 IAID functionality
sd-dhcp6-client: Add basic DHCPv6 test cases
sd-dhcp6-client: Add DHCPv6 client Solicitation timeout handling
sd-dhcp6-client: Add basic DHCPv6 option handling
sd-dhcp6-client: Add functions to bind to DHCPv6 UDP socket
sd-dhcp6-client: Add DHCPv6 Solicit message creation and sending
sd-dhcp6-client: Add RA and DHCPv6 Solicit test case
sd-dhcp6-lease: Add DHCPv6 lease handling
sd-dhcp6-client: Add IA Address option parsing
sd-dhcp6-client: Receive and parse Advertise messages
sd-dhcp6-lease: Add functions for accessing lease and addresses
sd-dhcp6-client: Add test case for Advertise message parsing
sd-dhcp6-client: Update start function to take a state
sd-dhcp6-client: Add Request message sending
sd-dhcp6-client: Add Advertise sending for test cases
sd-dhcp6-client: Receive and parse a reply and set T1 and T2 timers
sd-dhcp6-client: Add reply sending for test
networkd: Add initial DHCPv6 support
Tom Gundersen (2):
sd-dhcp6-client: Initialize DUID
network-internal: split out net_get_name()
Makefile.am | 38 +-
src/libsystemd-network/dhcp6-internal.h | 79 ++
src/libsystemd-network/dhcp6-lease-internal.h | 57 ++
src/libsystemd-network/dhcp6-network.c | 194 +++++
src/libsystemd-network/dhcp6-option.c | 314 ++++++++
src/libsystemd-network/dhcp6-protocol.h | 124 +++
src/libsystemd-network/icmp6-nd.c | 317 ++++++++
src/libsystemd-network/icmp6-nd.h | 59 ++
src/libsystemd-network/network-internal.c | 26 +-
src/libsystemd-network/network-internal.h | 1 +
src/libsystemd-network/sd-dhcp6-client.c | 1056 +++++++++++++++++++++++++
src/libsystemd-network/sd-dhcp6-lease.c | 178 +++++
src/libsystemd-network/test-dhcp6-client.c | 624 +++++++++++++++
src/libsystemd-network/test-dhcp6-rs.c | 155 ++++
src/network/networkd-link.c | 75 ++
src/network/networkd-network-gperf.gperf | 1 +
src/network/networkd.h | 3 +
src/systemd/sd-dhcp6-client.h | 62 ++
src/systemd/sd-dhcp6-lease.h | 42 +
19 files changed, 3396 insertions(+), 9 deletions(-)
create mode 100644 src/libsystemd-network/dhcp6-internal.h
create mode 100644 src/libsystemd-network/dhcp6-lease-internal.h
create mode 100644 src/libsystemd-network/dhcp6-network.c
create mode 100644 src/libsystemd-network/dhcp6-option.c
create mode 100644 src/libsystemd-network/dhcp6-protocol.h
create mode 100644 src/libsystemd-network/icmp6-nd.c
create mode 100644 src/libsystemd-network/icmp6-nd.h
create mode 100644 src/libsystemd-network/sd-dhcp6-client.c
create mode 100644 src/libsystemd-network/sd-dhcp6-lease.c
create mode 100644 src/libsystemd-network/test-dhcp6-client.c
create mode 100644 src/libsystemd-network/test-dhcp6-rs.c
create mode 100644 src/systemd/sd-dhcp6-client.h
create mode 100644 src/systemd/sd-dhcp6-lease.h
--
1.9.1
More information about the systemd-devel
mailing list