summaryrefslogtreecommitdiff
path: root/data/templates/dhcp-client/ipv4.j2
diff options
context:
space:
mode:
authorChristian Poessinger <christian@poessinger.com>2022-04-16 12:14:56 +0200
committerChristian Poessinger <christian@poessinger.com>2022-04-16 12:14:56 +0200
commit039e323d7e46f7d8244c42794f713a0bfecbe2d3 (patch)
treea7e3e29f7f110cbf2adccd717eca9d09c8c1eb0b /data/templates/dhcp-client/ipv4.j2
parentcb014d8818a864512680f57953d6f21ad5467e59 (diff)
downloadvyos-1x-039e323d7e46f7d8244c42794f713a0bfecbe2d3.tar.gz
vyos-1x-039e323d7e46f7d8244c42794f713a0bfecbe2d3.zip
dhcp(v6)-client: T4353: fix Jinja2 linting errors
Diffstat (limited to 'data/templates/dhcp-client/ipv4.j2')
-rw-r--r--data/templates/dhcp-client/ipv4.j234
1 files changed, 34 insertions, 0 deletions
diff --git a/data/templates/dhcp-client/ipv4.j2 b/data/templates/dhcp-client/ipv4.j2
new file mode 100644
index 000000000..cc5ddf09c
--- /dev/null
+++ b/data/templates/dhcp-client/ipv4.j2
@@ -0,0 +1,34 @@
+### Autogenerated by interface.py ###
+
+option rfc3442-classless-static-routes code 121 = array of unsigned integer 8;
+timeout 60;
+retry 60;
+initial-interval 2;
+
+interface "{{ ifname }}" {
+ send host-name "{{ dhcp_options.host_name }}";
+{% if dhcp_options.client_id is vyos_defined %}
+{% set client_id = dhcp_options.client_id %}
+{# Use HEX representation of client-id as it is send in MAC-address style using hex characters. If not HEX, use double quotes ASCII format #}
+{% if not dhcp_options.client_id.split(':') | length >= 5 %}
+{% set client_id = '"' + dhcp_options.client_id + '"' %}
+{% endif %}
+ send dhcp-client-identifier {{ client_id }};
+{% endif %}
+{% if dhcp_options.vendor_class_id is vyos_defined %}
+ send vendor-class-identifier "{{ dhcp_options.vendor_class_id }}";
+{% endif %}
+ # The request statement causes the client to request that any server responding to the
+ # client send the client its values for the specified options.
+ request subnet-mask, broadcast-address,{{ " routers," if dhcp_options.no_default_route is not vyos_defined }} domain-name-servers,
+ rfc3442-classless-static-routes, domain-name, interface-mtu;
+
+ # The require statement lists options that must be sent in order for an offer to be
+ # accepted. Offers that do not contain all the listed options will be ignored!
+ require subnet-mask;
+{% if dhcp_options.reject is vyos_defined %}
+ # Block addresses coming from theses dhcp servers if configured.
+ reject {{ dhcp_options.reject | join(', ') }};
+{% endif %}
+}
+