1
0
mirror of https://github.com/systemd/systemd.git synced 2024-12-22 17:35:35 +03:00

network: add NextServer= and Filename= setting to [DHCPServer] section

Closes #4403.
This commit is contained in:
Yu Watanabe 2022-02-25 02:43:40 +09:00
parent d5e5cd5c34
commit 369ac19243
6 changed files with 32 additions and 0 deletions

View File

@ -2626,6 +2626,23 @@ Token=prefixstable:2002:da8:1::</programlisting></para>
<filename>/etc/localtime</filename> symlink.</para></listitem>
</varlistentry>
<varlistentry>
<term><varname>NextServer=</varname></term>
<listitem>
<para>Takes an IPv4 address. Configures the next server used by e.g. PXE boot systems.
Defaults to unset.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><varname>Filename=</varname></term>
<listitem>
<para>Takes a path or url to a file loaded by e.g. a PXE boot loader. Defaults to unset.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><varname>SendOption=</varname></term>
<listitem>

View File

@ -416,6 +416,14 @@ static int dhcp4_server_configure(Link *link) {
return log_link_error_errno(link, r, "Failed to set default lease time for DHCPv4 server instance: %m");
}
r = sd_dhcp_server_set_next_server(link->dhcp_server, &link->network->dhcp_server_next_server);
if (r < 0)
return log_link_warning_errno(link, r, "Failed to set next server for DHCPv4 server instance: %m");
r = sd_dhcp_server_set_filename(link->dhcp_server, link->network->dhcp_server_filename);
if (r < 0)
return log_link_warning_errno(link, r, "Failed to set filename for DHCPv4 server instance: %m");
for (sd_dhcp_lease_server_type_t type = 0; type < _SD_DHCP_LEASE_SERVER_TYPE_MAX; type ++) {
if (!link->network->dhcp_server_emit[type].emit)

View File

@ -305,6 +305,8 @@ DHCPServer.PoolSize, config_parse_uint32,
DHCPServer.SendVendorOption, config_parse_dhcp_send_option, 0, offsetof(Network, dhcp_server_send_vendor_options)
DHCPServer.SendOption, config_parse_dhcp_send_option, 0, offsetof(Network, dhcp_server_send_options)
DHCPServer.BindToInterface, config_parse_bool, 0, offsetof(Network, dhcp_server_bind_to_interface)
DHCPServer.NextServer, config_parse_in_addr_non_null, AF_INET, offsetof(Network, dhcp_server_next_server)
DHCPServer.Filename, config_parse_string, 0, offsetof(Network, dhcp_server_filename)
DHCPServerStaticLease.Address, config_parse_dhcp_static_lease_address, 0, 0
DHCPServerStaticLease.MACAddress, config_parse_dhcp_static_lease_hwaddr, 0, 0
Bridge.Cost, config_parse_uint32, 0, offsetof(Network, cost)

View File

@ -700,6 +700,7 @@ static Network *network_free(Network *network) {
free(network->dhcp_server_relay_agent_circuit_id);
free(network->dhcp_server_relay_agent_remote_id);
free(network->dhcp_server_filename);
free(network->description);
free(network->dhcp_vendor_class_identifier);

View File

@ -200,6 +200,8 @@ struct Network {
uint32_t dhcp_server_pool_size;
OrderedHashmap *dhcp_server_send_options;
OrderedHashmap *dhcp_server_send_vendor_options;
struct in_addr dhcp_server_next_server;
char *dhcp_server_filename;
/* link local addressing support */
AddressFamily link_local;

View File

@ -409,6 +409,8 @@ RelayAgentCircuitId=
RelayAgentRemoteId=
ServerAddress=
UplinkInterface=
NextServer=
Filename=
[DHCPServerStaticLease]
MACAddress=
Address=