aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar netztrip <dave-tvg@netztrip.de>2020-08-02 23:31:21 +0200
committerGravatar Christian Hesse <mail@eworm.de>2020-08-07 22:08:01 +0200
commit2e1acc25059b9cc671a96ad648ef854a5bb29202 (patch)
tree3795295be73f7124d79da63699f592e837191ca4
parent354be9c222339d0d2dcaa5a5460f272f0c0b44a6 (diff)
dhcp-to-dns: add support for dhcp server name in fqdn
-rw-r--r--dhcp-to-dns3
-rw-r--r--doc/dhcp-to-dns.md1
-rw-r--r--global-config1
3 files changed, 4 insertions, 1 deletions
diff --git a/dhcp-to-dns b/dhcp-to-dns
index 352b53f..4e2c7f2 100644
--- a/dhcp-to-dns
+++ b/dhcp-to-dns
@@ -10,6 +10,7 @@
:global HostNameInZone;
:global Identity;
:global PrefixInZone;
+:global ServerNameInZone;
:global CharacterReplace;
:global IfThenElse;
@@ -46,7 +47,7 @@
[ $CharacterReplace ($LeaseVal->"mac-address") ":" "-" ] \
[ $CharacterReplace ($LeaseVal->"host-name") " " "" ] ];
- :local Fqdn ($HostName . "." . $Zone);
+ :local Fqdn ($HostName . "." . [ $IfThenElse ($ServerNameInZone = true) ($LeaseVal->"server" . ".") ] . $Zone);
:local DnsRecord [ / ip dns static find where name=$Fqdn ];
:if ([ :len $DnsRecord ] > 0) do={
:local DnsIp [ / ip dns static get $DnsRecord address ];
diff --git a/doc/dhcp-to-dns.md b/doc/dhcp-to-dns.md
index 0c112b3..699b6a5 100644
--- a/doc/dhcp-to-dns.md
+++ b/doc/dhcp-to-dns.md
@@ -34,6 +34,7 @@ The configuration goes to `global-config-overlay`, these are the parameters:
* `Domain`: the domain used for dns records
* `HostNameInZone`: whether or not to add the dhcp/dns server's hostname
* `PrefixInZone`: whether or not to add prefix `dhcp`
+* `ServerNameInZone`: whether or not to add DHCP server name
See also
--------
diff --git a/global-config b/global-config
index 4e5fd4a..0228082 100644
--- a/global-config
+++ b/global-config
@@ -14,6 +14,7 @@
:global Domain "example.com";
:global HostNameInZone true;
:global PrefixInZone true;
+:global ServerNameInZone false;
# These addresses are used to send e-mails to. The to-address needs
# to be filled; cc-address can be empty, one address or a comma