summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorhagbard-01 <39653662+hagbard-01@users.noreply.github.com>2018-11-08 10:42:04 -0800
committerGitHub <noreply@github.com>2018-11-08 10:42:04 -0800
commit0ca7de211398fca1b11618585c477233ab716a4f (patch)
treeef9ff35fc97d6241aa3755894d5ef215a3b64721 /src
parent38c17bb66683a5dcbc0f2de1753f388e083fdeca (diff)
parent9f5abb65f04d1ce40532e266e942ad35b8ebae92 (diff)
downloadvyos-1x-0ca7de211398fca1b11618585c477233ab716a4f.tar.gz
vyos-1x-0ca7de211398fca1b11618585c477233ab716a4f.zip
Merge pull request #57 from thinkl33t/T976-fix-update-hostfile
Fixes T976: dhcp - move commit hook into shared-network
Diffstat (limited to 'src')
-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 %}