summaryrefslogtreecommitdiff
path: root/src/network
diff options
context:
space:
mode:
Diffstat (limited to 'src/network')
-rw-r--r--src/network/networkd-link.c21
-rw-r--r--src/network/networkd-network-gperf.gperf2
-rw-r--r--src/network/networkd-network.h2
3 files changed, 8 insertions, 17 deletions
diff --git a/src/network/networkd-link.c b/src/network/networkd-link.c
index ff693ed0fd..979f3115f6 100644
--- a/src/network/networkd-link.c
+++ b/src/network/networkd-link.c
@@ -730,7 +730,6 @@ static int link_enter_set_addresses(Link *link) {
/* now that we can figure out a default address for the dhcp server,
start it */
if (link_dhcp4_server_enabled(link)) {
- struct in_addr pool_start;
Address *address;
Link *uplink = NULL;
bool acquired_uplink = false;
@@ -742,16 +741,9 @@ static int link_enter_set_addresses(Link *link) {
return 0;
}
- r = sd_dhcp_server_set_address(link->dhcp_server,
- &address->in_addr.in,
- address->prefixlen);
- if (r < 0)
- return r;
-
- /* offer 32 addresses starting from the address following the server address */
- pool_start.s_addr = htobe32(be32toh(address->in_addr.in.s_addr) + 1);
- r = sd_dhcp_server_set_lease_pool(link->dhcp_server,
- &pool_start, 32);
+ /* use the server address' subnet as the pool */
+ r = sd_dhcp_server_configure_pool(link->dhcp_server, &address->in_addr.in, address->prefixlen,
+ link->network->dhcp_server_pool_offset, link->network->dhcp_server_pool_size);
if (r < 0)
return r;
@@ -760,11 +752,6 @@ static int link_enter_set_addresses(Link *link) {
&main_address->in_addr.in);
if (r < 0)
return r;
-
- r = sd_dhcp_server_set_prefixlen(link->dhcp_server,
- main_address->prefixlen);
- if (r < 0)
- return r;
*/
if (link->network->dhcp_server_max_lease_time_usec > 0) {
@@ -823,7 +810,7 @@ static int link_enter_set_addresses(Link *link) {
if (link->network->dhcp_server_emit_timezone) {
_cleanup_free_ char *buffer = NULL;
- const char *tz;
+ const char *tz = NULL;
if (link->network->dhcp_server_timezone)
tz = link->network->dhcp_server_timezone;
diff --git a/src/network/networkd-network-gperf.gperf b/src/network/networkd-network-gperf.gperf
index 108e892fb8..10ca9dae35 100644
--- a/src/network/networkd-network-gperf.gperf
+++ b/src/network/networkd-network-gperf.gperf
@@ -82,6 +82,8 @@ DHCPServer.EmitNTP, config_parse_bool, 0
DHCPServer.NTP, config_parse_dhcp_server_ntp, 0, 0
DHCPServer.EmitTimezone, config_parse_bool, 0, offsetof(Network, dhcp_server_emit_timezone)
DHCPServer.Timezone, config_parse_timezone, 0, offsetof(Network, dhcp_server_timezone)
+DHCPServer.PoolOffset, config_parse_uint32, 0, offsetof(Network, dhcp_server_pool_offset)
+DHCPServer.PoolSize, config_parse_uint32, 0, offsetof(Network, dhcp_server_pool_size)
Bridge.Cost, config_parse_unsigned, 0, offsetof(Network, cost)
Bridge.UseBPDU, config_parse_bool, 0, offsetof(Network, use_bpdu)
Bridge.HairPin, config_parse_bool, 0, offsetof(Network, hairpin)
diff --git a/src/network/networkd-network.h b/src/network/networkd-network.h
index d691cc3a45..c3439a70ba 100644
--- a/src/network/networkd-network.h
+++ b/src/network/networkd-network.h
@@ -102,6 +102,8 @@ struct Network {
bool dhcp_server_emit_timezone;
char *dhcp_server_timezone;
usec_t dhcp_server_default_lease_time_usec, dhcp_server_max_lease_time_usec;
+ uint32_t dhcp_server_pool_offset;
+ uint32_t dhcp_server_pool_size;
/* IPV4LL Support */
AddressFamilyBoolean link_local;