From 0fefe3c3b9250ad2ba841287a94036119728c708 Mon Sep 17 00:00:00 2001 From: Christian Poessinger Date: Fri, 8 Mar 2019 20:26:33 +0100 Subject: T103: [dhcp-server] add support to configure host declarative names --- interface-definitions/dhcp-server.xml | 6 ++++++ src/conf_mode/dhcp_server.py | 9 +++++++++ 2 files changed, 15 insertions(+) diff --git a/interface-definitions/dhcp-server.xml b/interface-definitions/dhcp-server.xml index 2002f0c65..87999f496 100644 --- a/interface-definitions/dhcp-server.xml +++ b/interface-definitions/dhcp-server.xml @@ -36,6 +36,12 @@ + + + Instruct server to use host declaration name for forward DNS name + + + DHCP shared network name [REQUIRED] diff --git a/src/conf_mode/dhcp_server.py b/src/conf_mode/dhcp_server.py index 12d138218..e57bad28b 100755 --- a/src/conf_mode/dhcp_server.py +++ b/src/conf_mode/dhcp_server.py @@ -58,6 +58,9 @@ on expiry { execute("/usr/libexec/vyos/system/on-dhcp-event.sh", "release", ClientName, ClientIp, ClientMac, ClientDomain); } {% endif %} +{%- if host_decl_name %} +use-host-decl-names on; +{%- endif %} ddns-update-style {% if ddns_enable -%} interim {%- else -%} none {%- endif %}; {% if static_route -%} option rfc3442-static-route code 121 = array of integer 8; @@ -242,6 +245,7 @@ default_config_data = { 'ddns_enable': False, 'global_parameters': [], 'hostfile_update': False, + 'host_decl_name': False, 'static_route': False, 'wpad': False, 'shared_network': [], @@ -274,6 +278,11 @@ def get_config(): if conf.exists('hostfile-update'): dhcp['hostfile_update'] = True + # If enabled every host declaration within that scope, the name provided + # for the host declaration will be supplied to the client as its hostname. + if conf.exists('host-decl-name'): + dhcp['host_decl_name'] = True + # check for multiple, shared networks served with DHCP addresses if conf.exists('shared-network-name'): for network in conf.list_nodes('shared-network-name'): -- cgit v1.2.3