summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTom Gundersen <teg@jklm.no>2015-08-29 00:18:20 +0200
committerTom Gundersen <teg@jklm.no>2015-08-31 21:42:33 +0200
commit9b3a67c55b7df6642a0389306c513b17c211f280 (patch)
treec0356bf32d2fc716ba9716a72c6ee4012e614f7f /src
parent61986155d273342ffaf5be4d6a4386be96f9b46b (diff)
networkd: dhcp-server - allow configuration of the pool
The constraints we place on the pool is that it is a contiguous sequence of addresses in the same subnet as the server address, not including the subnet nor broadcast addresses, but possibly including the server address itself. If the server address is included in the pool it is (obviously) reserved and not handed out to clients.
Diffstat (limited to 'src')
-rw-r--r--src/network/networkd-link.c3
-rw-r--r--src/network/networkd-network-gperf.gperf2
-rw-r--r--src/network/networkd-network.h2
-rw-r--r--src/shared/conf-parser.c1
-rw-r--r--src/shared/conf-parser.h1
5 files changed, 8 insertions, 1 deletions
diff --git a/src/network/networkd-link.c b/src/network/networkd-link.c
index c5434147ed..979f3115f6 100644
--- a/src/network/networkd-link.c
+++ b/src/network/networkd-link.c
@@ -742,7 +742,8 @@ static int link_enter_set_addresses(Link *link) {
}
/* use the server address' subnet as the pool */
- r = sd_dhcp_server_configure_pool(link->dhcp_server, &address->in_addr.in, address->prefixlen, 0, 0);
+ 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;
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;
diff --git a/src/shared/conf-parser.c b/src/shared/conf-parser.c
index d99aa1d6e9..1f4aea6d6b 100644
--- a/src/shared/conf-parser.c
+++ b/src/shared/conf-parser.c
@@ -450,6 +450,7 @@ int config_parse_many(const char *conf_file,
DEFINE_PARSER(int, int, safe_atoi)
DEFINE_PARSER(long, long, safe_atoli)
+DEFINE_PARSER(uint32, uint32_t, safe_atou32)
DEFINE_PARSER(uint64, uint64_t, safe_atou64)
DEFINE_PARSER(unsigned, unsigned, safe_atou)
DEFINE_PARSER(double, double, safe_atod)
diff --git a/src/shared/conf-parser.h b/src/shared/conf-parser.h
index 6152ee33b9..66c80890d3 100644
--- a/src/shared/conf-parser.h
+++ b/src/shared/conf-parser.h
@@ -104,6 +104,7 @@ int config_parse_many(const char *conf_file, /* possibly NULL */
int config_parse_int(const char *unit, const char *filename, unsigned line, const char *section, unsigned section_line, const char *lvalue, int ltype, const char *rvalue, void *data, void *userdata);
int config_parse_unsigned(const char *unit, const char *filename, unsigned line, const char *section, unsigned section_line, const char *lvalue, int ltype, const char *rvalue, void *data, void *userdata);
int config_parse_long(const char *unit, const char *filename, unsigned line, const char *section, unsigned section_line, const char *lvalue, int ltype, const char *rvalue, void *data, void *userdata);
+int config_parse_uint32(const char *unit, const char *filename, unsigned line, const char *section, unsigned section_line, const char *lvalue, int ltype, const char *rvalue, void *data, void *userdata);
int config_parse_uint64(const char *unit, const char *filename, unsigned line, const char *section, unsigned section_line, const char *lvalue, int ltype, const char *rvalue, void *data, void *userdata);
int config_parse_double(const char *unit, const char *filename, unsigned line, const char *section, unsigned section_line, const char *lvalue, int ltype, const char *rvalue, void *data, void *userdata);
int config_parse_iec_size(const char *unit, const char *filename, unsigned line, const char *section, unsigned section_line, const char *lvalue, int ltype, const char *rvalue, void *data, void *userdata);