From ae1203c7d22dfded65bb465f8663ae0057ddd94c Mon Sep 17 00:00:00 2001 From: Colin Foster Date: Tue, 22 Oct 2024 13:26:36 -0500 Subject: [PATCH] networkd: add ability to use BOOTP Add the following network option to enable BOOTP: [DHCPv4] Bootp=yes This will allow a two message request / reply sequence that doesn't require DHCP message types. --- man/systemd.network.xml | 11 +++++++++++ src/network/networkd-dhcp4.c | 4 ++++ src/network/networkd-network-gperf.gperf | 1 + src/network/networkd-network.h | 1 + 4 files changed, 17 insertions(+) diff --git a/man/systemd.network.xml b/man/systemd.network.xml index e2d698285e5..4eae51ad2b0 100644 --- a/man/systemd.network.xml +++ b/man/systemd.network.xml @@ -2565,6 +2565,17 @@ NFTSet=prefix:netdev:filter:eth_ipv4_prefix + + BOOTP= + + Takes a boolean. The DHCPv4 client can be configured to communicate with BOOP servers that + don't accept Option 53, DHCP Message Type. In this configuration, a BOOTP Request is sent without + any options by default. A BOOTP reply that contains Option 1: Subnet Mask is expected. + + + + + diff --git a/src/network/networkd-dhcp4.c b/src/network/networkd-dhcp4.c index d94ac1a213a..eb300a4e44a 100644 --- a/src/network/networkd-dhcp4.c +++ b/src/network/networkd-dhcp4.c @@ -1477,6 +1477,10 @@ static int dhcp4_configure(Link *link) { if (r < 0) return log_link_debug_errno(link, r, "DHCPv4 CLIENT: Failed to allocate DHCPv4 client: %m"); + r = sd_dhcp_client_set_bootp(link->dhcp_client, link->network->dhcp_send_bootp); + if (r < 0) + return log_link_debug_errno(link, r, "DHCPv4 CLIENT: Failed to set BOOTP flag: %m"); + r = sd_dhcp_client_attach_event(link->dhcp_client, link->manager->event, 0); if (r < 0) return log_link_debug_errno(link, r, "DHCPv4 CLIENT: Failed to attach event to DHCPv4 client: %m"); diff --git a/src/network/networkd-network-gperf.gperf b/src/network/networkd-network-gperf.gperf index dc462b690c2..ebaf97a412c 100644 --- a/src/network/networkd-network-gperf.gperf +++ b/src/network/networkd-network-gperf.gperf @@ -245,6 +245,7 @@ DHCPv4.QuickAck, config_parse_bool, DHCPv4.RequestOptions, config_parse_dhcp_request_options, AF_INET, 0 DHCPv4.Anonymize, config_parse_bool, 0, offsetof(Network, dhcp_anonymize) DHCPv4.SendHostname, config_parse_dhcp_send_hostname, AF_INET, 0 +DHCPv4.BOOTP, config_parse_bool, 0, offsetof(Network, dhcp_send_bootp) DHCPv4.Hostname, config_parse_hostname, 0, offsetof(Network, dhcp_hostname) DHCPv4.Label, config_parse_dhcp_label, 0, offsetof(Network, dhcp_label) DHCPv4.RequestBroadcast, config_parse_tristate, 0, offsetof(Network, dhcp_broadcast) diff --git a/src/network/networkd-network.h b/src/network/networkd-network.h index b61914ea7aa..55c08bbed7d 100644 --- a/src/network/networkd-network.h +++ b/src/network/networkd-network.h @@ -179,6 +179,7 @@ struct Network { OrderedHashmap *dhcp_client_send_vendor_options; char *dhcp_netlabel; NFTSetContext dhcp_nft_set_context; + bool dhcp_send_bootp; /* DHCPv6 Client support */ bool dhcp6_use_address;