summaryrefslogtreecommitdiff
path: root/src/conf_mode/dhcp_server.py
diff options
context:
space:
mode:
authorDaniil Baturin <daniil@baturin.org>2018-11-12 16:57:22 +0100
committerDaniil Baturin <daniil@baturin.org>2018-11-12 16:57:22 +0100
commit559ac84addd27c135f5799304434ad3ef872555d (patch)
tree5d06f61b62ff69760d83f63ca42927f7f61d1d1f /src/conf_mode/dhcp_server.py
parent7e6e5a211325b8f00e58a01a67ad2c01d073ff2a (diff)
parent718d9a123c2ba72b87d7f6e48a5e6d83fa86d494 (diff)
downloadvyos-1x-559ac84addd27c135f5799304434ad3ef872555d.tar.gz
vyos-1x-559ac84addd27c135f5799304434ad3ef872555d.zip
Merge branch 'current' into crux
Diffstat (limited to 'src/conf_mode/dhcp_server.py')
-rwxr-xr-xsrc/conf_mode/dhcp_server.py19
1 files changed, 10 insertions, 9 deletions
diff --git a/src/conf_mode/dhcp_server.py b/src/conf_mode/dhcp_server.py
index 2a2b1fe6c..560c80e7f 100755
--- a/src/conf_mode/dhcp_server.py
+++ b/src/conf_mode/dhcp_server.py
@@ -42,14 +42,6 @@ config_tmpl = """
# log-facility local7;
{% if hostfile_update %}
-on commit {
- set ClientName = pick-first-value(host-decl-name, option fqdn.hostname, option host-name);
- set ClientIp = binary-to-ascii(10, 8, ".", leased-address);
- set ClientMac = binary-to-ascii(16, 8, ":", substring(hardware, 1, 6));
- set ClientDomain = pick-first-value(config-option domain-name, "..YYZ!");
- execute("/usr/libexec/vyos/system/on-dhcp-event.sh", "commit", ClientName, ClientIp, ClientMac, ClientDomain);
-}
-
on release {
set ClientName = pick-first-value(host-decl-name, option fqdn.hostname, option host-name);
set ClientIp = binary-to-ascii(10, 8, ".",leased-address);
@@ -210,7 +202,16 @@ shared-network {{ network.name }} {
{%- endif %}
}
{%- endfor %}
- on commit { set shared-networkname = "{{ network.name }}"; }
+ on commit {
+ set shared-networkname = "{{ network.name }}";
+ {% if hostfile_update -%}
+ set ClientName = pick-first-value(host-decl-name, option fqdn.hostname, option host-name);
+ set ClientIp = binary-to-ascii(10, 8, ".", leased-address);
+ set ClientMac = binary-to-ascii(16, 8, ":", substring(hardware, 1, 6));
+ set ClientDomain = pick-first-value(config-option domain-name, "..YYZ!");
+ execute("/usr/libexec/vyos/system/on-dhcp-event.sh", "commit", ClientName, ClientIp, ClientMac, ClientDomain);
+ {% endif -%}
+ }
}
{%- endif %}
{% endfor %}