summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Christian Hesse <mail@eworm.de>2016-09-30 09:23:27 +0200
committerGravatar Christian Hesse <mail@eworm.de>2016-09-30 09:23:27 +0200
commit9d4eaca63c31ca03a1ed1a9ed38639743d44f657 (patch)
treec21d3bfa000284d30c6c5d66d453003f46d6932f
parent14ad87900ea7a286a2b1319f8a19df6b3736d42e (diff)
downloaddyndhcpd-9d4eaca63c31ca03a1ed1a9ed38639743d44f657.tar.gz
dyndhcpd-9d4eaca63c31ca03a1ed1a9ed38639743d44f657.tar.zst
allow to use hostname in config
-rw-r--r--config/dhcpd.conf2
-rw-r--r--dyndhcpd.c1
2 files changed, 2 insertions, 1 deletions
diff --git a/config/dhcpd.conf b/config/dhcpd.conf
index 65764a8..c69f4e7 100644
--- a/config/dhcpd.conf
+++ b/config/dhcpd.conf
@@ -9,7 +9,7 @@ ignore client-updates;
default-lease-time 21600;
max-lease-time 43200;
-option domain-name "__DOMAINNAME__";
+option domain-name "__HOSTNAME__.__DOMAINNAME__";
class "PXEClient" {
match if substring(option vendor-class-identifier, 0, 9) = "PXEClient";
diff --git a/dyndhcpd.c b/dyndhcpd.c
index a9283a0..de7a793 100644
--- a/dyndhcpd.c
+++ b/dyndhcpd.c
@@ -239,6 +239,7 @@ int main(int argc, char ** argv) {
if (*tmp == '_') {
if (replace(&config, &length, &tmp, "__INTERFACE__", interface) ||
replace(&config, &length, &tmp, "__VERSION__", VERSION) ||
+ replace(&config, &length, &tmp, "__HOSTNAME__", hostname) ||
replace(&config, &length, &tmp, "__DOMAINNAME__", domainname) ||
replace(&config, &length, &tmp, "__ADDRESS__", network.address.c) ||
replace(&config, &length, &tmp, "__NETADDRESS__", network.netaddress.c) ||