diff options
author | Christian Breunig <christian@breunig.cc> | 2023-08-28 21:21:14 +0200 |
---|---|---|
committer | Christian Breunig <christian@breunig.cc> | 2023-08-28 21:21:14 +0200 |
commit | 47d9c8067135b97bc1fbc5450dc5fa9b8e65e345 (patch) | |
tree | ac6f7858775346329d3b8c004b552209c12ad513 /data/templates/dhcp-client | |
parent | 396329cc9a2419c5be8ddd0bc8fbde67fdcb03fa (diff) | |
download | vyos-1x-47d9c8067135b97bc1fbc5450dc5fa9b8e65e345.tar.gz vyos-1x-47d9c8067135b97bc1fbc5450dc5fa9b8e65e345.zip |
T5428: fix DHCP address renewal/release when running in VRF
Diffstat (limited to 'data/templates/dhcp-client')
-rw-r--r-- | data/templates/dhcp-client/daemon-options.tmpl | 4 | ||||
-rw-r--r-- | data/templates/dhcp-client/ipv6.override.conf.j2 | 10 | ||||
-rw-r--r-- | data/templates/dhcp-client/override.conf.j2 | 14 |
3 files changed, 24 insertions, 4 deletions
diff --git a/data/templates/dhcp-client/daemon-options.tmpl b/data/templates/dhcp-client/daemon-options.tmpl deleted file mode 100644 index 40629dca1..000000000 --- a/data/templates/dhcp-client/daemon-options.tmpl +++ /dev/null @@ -1,4 +0,0 @@ -### Autogenerated by interface.py ### - -DHCLIENT_OPTS="-nw -cf /var/lib/dhcp/dhclient_{{ifname}}.conf -pf /var/lib/dhcp/dhclient_{{ifname}}.pid -lf /var/lib/dhcp/dhclient_{{ifname}}.leases{{" -e IF_METRIC=" ~ dhcp_options.default_route_distance if dhcp_options.default_route_distance is defined and dhcp_options.default_route_distance is not none}} {{ifname}}" - diff --git a/data/templates/dhcp-client/ipv6.override.conf.j2 b/data/templates/dhcp-client/ipv6.override.conf.j2 new file mode 100644 index 000000000..47e48e86f --- /dev/null +++ b/data/templates/dhcp-client/ipv6.override.conf.j2 @@ -0,0 +1,10 @@ +{% set vrf_command = 'ip vrf exec ' ~ vrf ~ ' ' if vrf is defined and vrf is not none else '' %} +{% set no_release = '-n' if dhcpv6_options is defined and dhcpv6_options.no_release is defined and dhcpv6_options.no_release is not none else '' %} +{% set dhcp6c_options = '-D -k /run/dhcp6c/dhcp6c.' ~ ifname ~ '.sock -c /run/dhcp6c/dhcp6c.' ~ ifname ~ '.conf -p /run/dhcp6c/dhcp6c.' ~ ifname ~ '.pid ' ~ no_release %} + +[Unit] +ConditionPathExists=/run/dhcp6c/dhcp6c.{{ ifname }}.conf + +[Service] +ExecStart= +ExecStart={{ vrf_command }}/usr/sbin/dhcp6c {{ dhcp6c_options }} {{ ifname }}
\ No newline at end of file diff --git a/data/templates/dhcp-client/override.conf.j2 b/data/templates/dhcp-client/override.conf.j2 new file mode 100644 index 000000000..5ceee9f5e --- /dev/null +++ b/data/templates/dhcp-client/override.conf.j2 @@ -0,0 +1,14 @@ +### Autogenerated by interface.py ### +{% set vrf_command = 'ip vrf exec ' ~ vrf ~ ' ' if vrf is defined and vrf is not none else '' %} +{% set if_metric = '-e IF_METRIC=' ~ dhcp_options.default_route_distance if dhcp_options is defined and dhcp_options.default_route_distance is defined and dhcp_options.default_route_distance is not none else '' %} +{% set dhclient_options = '-d -nw -cf /var/lib/dhcp/dhclient_' ~ ifname ~ '.conf -pf /var/lib/dhcp/dhclient_' ~ ifname ~ '.pid -lf /var/lib/dhcp/dhclient_' ~ ifname ~ '.leases ' ~ if_metric %} + +[Unit] +ConditionPathExists= +ConditionPathExists=/var/lib/dhcp/dhclient_{{ ifname }}.conf + +[Service] +ExecStart= +ExecStart={{ vrf_command }}/sbin/dhclient -4 {{ dhclient_options }} {{ ifname }} +ExecStop= +ExecStop={{ vrf_command }}/sbin/dhclient -4 -r {{ dhclient_options }} {{ ifname }} |