network/dhcp4: 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.

Co-authored-by: Avram Dorfman <dorfman@est.org>
This commit is contained in:
Colin Foster
2024-10-22 13:26:36 -05:00
committed by Yu Watanabe
parent 2871f967cc
commit 0dbb5139a7
4 changed files with 17 additions and 0 deletions

View File

@@ -2603,6 +2603,16 @@ NFTSet=prefix:netdev:filter:eth_ipv4_prefix</programlisting>
</listitem>
</varlistentry>
<varlistentry>
<term><varname>BOOTP=</varname></term>
<listitem>
<para>Takes a boolean. When enabled, the DHCPv4 client will be configured to communicate with BOOTP
servers, rather than with DHCP servers. Defaults to off.</para>
<xi:include href="version-info.xml" xpointer="v258"/>
</listitem>
</varlistentry>
<!-- How to use the DHCP lease -->
<varlistentry>

View File

@@ -1498,6 +1498,11 @@ 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_use_bootp);
if (r < 0)
return log_link_debug_errno(link, r, "DHCPv4 CLIENT: Failed to %s BOOTP: %m",
enable_disable(link->network->dhcp_use_bootp));
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");

View File

@@ -269,6 +269,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_use_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)

View File

@@ -114,6 +114,7 @@ typedef struct Network {
/* DHCP Client Support */
AddressFamily dhcp;
struct in_addr dhcp_request_address;
bool dhcp_use_bootp;
DHCPClientIdentifier dhcp_client_identifier;
DUID dhcp_duid;
uint32_t dhcp_iaid;