diff options
author | Yu Watanabe <watanabe.yu+github@gmail.com> | 2024-09-15 22:00:57 +0200 |
---|---|---|
committer | Yu Watanabe <watanabe.yu+github@gmail.com> | 2024-10-15 11:23:59 +0200 |
commit | 180cc5421d9712fb95a6bbc725dc8ba459360c8b (patch) | |
tree | b01046811ab962563bb70aea3e9b85a61239824f /src/libsystemd-network | |
parent | network/dhcp6: set hostname even if UseAddress=no (diff) | |
download | systemd-180cc5421d9712fb95a6bbc725dc8ba459360c8b.tar.xz systemd-180cc5421d9712fb95a6bbc725dc8ba459360c8b.zip |
sd-dhcp6-client: allow to request IA_PD on information requesting mode
To support RFC 7084, WPD-4.
Diffstat (limited to 'src/libsystemd-network')
-rw-r--r-- | src/libsystemd-network/sd-dhcp6-client.c | 8 | ||||
-rw-r--r-- | src/libsystemd-network/sd-dhcp6-lease.c | 5 | ||||
-rw-r--r-- | src/libsystemd-network/test-dhcp6-client.c | 5 |
3 files changed, 13 insertions, 5 deletions
diff --git a/src/libsystemd-network/sd-dhcp6-client.c b/src/libsystemd-network/sd-dhcp6-client.c index 3e992d7cad..5661beeb65 100644 --- a/src/libsystemd-network/sd-dhcp6-client.c +++ b/src/libsystemd-network/sd-dhcp6-client.c @@ -767,6 +767,14 @@ int dhcp6_client_send_message(sd_dhcp6_client *client) { switch (client->state) { case DHCP6_STATE_INFORMATION_REQUEST: + /* RFC 7084 section 4.2 (https://datatracker.ietf.org/doc/html/rfc7084#section-4.2) + * WPD-4: By default, the IPv6 CE router MUST initiate DHCPv6 prefix delegation when either + * the M or O flags are set to 1 in a received Router Advertisement (RA) message. */ + if (FLAGS_SET(client->request_ia, DHCP6_REQUEST_IA_PD)) { + r = dhcp6_option_append_ia(&buf, &offset, (client->lease ? client->lease->ia_pd : NULL) ?: &client->ia_pd); + if (r < 0) + return r; + } break; case DHCP6_STATE_SOLICITATION: diff --git a/src/libsystemd-network/sd-dhcp6-lease.c b/src/libsystemd-network/sd-dhcp6-lease.c index 30c0e514f8..3f8183c2c6 100644 --- a/src/libsystemd-network/sd-dhcp6-lease.c +++ b/src/libsystemd-network/sd-dhcp6-lease.c @@ -769,11 +769,6 @@ static int dhcp6_lease_parse_message( case SD_DHCP6_OPTION_IA_PD: { _cleanup_(dhcp6_ia_freep) DHCP6IA *ia = NULL; - if (client->state == DHCP6_STATE_INFORMATION_REQUEST) { - log_dhcp6_client(client, "Ignoring IA PD option in information requesting mode."); - break; - } - r = dhcp6_option_parse_ia(client, client->ia_pd.header.id, optcode, optlen, optval, &ia); if (r == -ENOMEM) return log_oom_debug(); diff --git a/src/libsystemd-network/test-dhcp6-client.c b/src/libsystemd-network/test-dhcp6-client.c index 7afd464dc0..29cbdc95b4 100644 --- a/src/libsystemd-network/test-dhcp6-client.c +++ b/src/libsystemd-network/test-dhcp6-client.c @@ -493,6 +493,11 @@ static const uint8_t msg_information_request[] = { DHCP6_MESSAGE_INFORMATION_REQUEST, /* Transaction ID */ 0x0f, 0xb4, 0xe5, + /* IA_PD */ + 0x00, SD_DHCP6_OPTION_IA_PD, 0x00, 0x0c, + IA_ID_BYTES, + 0x00, 0x00, 0x00, 0x00, /* lifetime T1 */ + 0x00, 0x00, 0x00, 0x00, /* lifetime T2 */ /* MUD URL */ /* ORO */ 0x00, SD_DHCP6_OPTION_ORO, 0x00, 0x0c, |