diff options
author | Yegor Alexeyev <yegor.alexeyev@gmail.com> | 2021-03-09 12:57:37 +0100 |
---|---|---|
committer | Yu Watanabe <watanabe.yu+github@gmail.com> | 2021-04-14 00:30:40 +0200 |
commit | 21b6b87eb326a447ca5ed9e566e1ec7a2f227cfe (patch) | |
tree | a08c195b4851769a3d9f50611d5c6ccb5db2562d /src/network | |
parent | Merge pull request #19303 from yuwata/fix-typo (diff) | |
download | systemd-21b6b87eb326a447ca5ed9e566e1ec7a2f227cfe.tar.xz systemd-21b6b87eb326a447ca5ed9e566e1ec7a2f227cfe.zip |
dhcp: Implemented BindToInterface= configuration option
Diffstat (limited to 'src/network')
-rw-r--r-- | src/network/networkd-dhcp-server.c | 4 | ||||
-rw-r--r-- | src/network/networkd-network-gperf.gperf | 1 | ||||
-rw-r--r-- | src/network/networkd-network.c | 2 | ||||
-rw-r--r-- | src/network/networkd-network.h | 1 |
4 files changed, 7 insertions, 1 deletions
diff --git a/src/network/networkd-dhcp-server.c b/src/network/networkd-dhcp-server.c index ad979fb2c4..64bb23f387 100644 --- a/src/network/networkd-dhcp-server.c +++ b/src/network/networkd-dhcp-server.c @@ -344,6 +344,10 @@ int dhcp4_server_configure(Link *link) { dhcp_lease_server_type_to_string(type)); } + r = sd_dhcp_server_set_bind_to_interface(link->dhcp_server, link->network->dhcp_server_bind_to_interface); + if (r < 0) + return log_link_error_errno(link, r, "Failed to set interface binding for DHCP server: %m"); + r = sd_dhcp_server_set_emit_router(link->dhcp_server, link->network->dhcp_server_emit_router); if (r < 0) return log_link_error_errno(link, r, "Failed to set router emission for DHCP server: %m"); diff --git a/src/network/networkd-network-gperf.gperf b/src/network/networkd-network-gperf.gperf index 7d38d7077a..8ebeec8640 100644 --- a/src/network/networkd-network-gperf.gperf +++ b/src/network/networkd-network-gperf.gperf @@ -276,6 +276,7 @@ DHCPServer.PoolOffset, config_parse_uint32, DHCPServer.PoolSize, config_parse_uint32, 0, offsetof(Network, dhcp_server_pool_size) 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) Bridge.Cost, config_parse_uint32, 0, offsetof(Network, cost) Bridge.UseBPDU, config_parse_tristate, 0, offsetof(Network, use_bpdu) Bridge.HairPin, config_parse_tristate, 0, offsetof(Network, hairpin) diff --git a/src/network/networkd-network.c b/src/network/networkd-network.c index f532536f1c..8ae2315f1b 100644 --- a/src/network/networkd-network.c +++ b/src/network/networkd-network.c @@ -382,10 +382,10 @@ int network_load_one(Manager *manager, OrderedHashmap **networks, const char *fi .dhcp6_pd_manage_temporary_address = true, .dhcp6_pd_subnet_id = -1, + .dhcp_server_bind_to_interface = true, .dhcp_server_emit[SD_DHCP_LEASE_DNS].emit = true, .dhcp_server_emit[SD_DHCP_LEASE_NTP].emit = true, .dhcp_server_emit[SD_DHCP_LEASE_SIP].emit = true, - .dhcp_server_emit_router = true, .dhcp_server_emit_timezone = true, diff --git a/src/network/networkd-network.h b/src/network/networkd-network.h index 6fe8a76c13..44b1d0205f 100644 --- a/src/network/networkd-network.h +++ b/src/network/networkd-network.h @@ -184,6 +184,7 @@ struct Network { /* DHCP Server Support */ bool dhcp_server; + bool dhcp_server_bind_to_interface; NetworkDHCPServerEmitAddress dhcp_server_emit[_SD_DHCP_LEASE_SERVER_TYPE_MAX]; bool dhcp_server_emit_router; bool dhcp_server_emit_timezone; |