summaryrefslogtreecommitdiff
path: root/data/templates/dhcp-relay
diff options
context:
space:
mode:
Diffstat (limited to 'data/templates/dhcp-relay')
-rw-r--r--data/templates/dhcp-relay/dhcrelay.conf.j29
-rw-r--r--data/templates/dhcp-relay/dhcrelay6.conf.j220
2 files changed, 29 insertions, 0 deletions
diff --git a/data/templates/dhcp-relay/dhcrelay.conf.j2 b/data/templates/dhcp-relay/dhcrelay.conf.j2
new file mode 100644
index 0000000..71a3954
--- /dev/null
+++ b/data/templates/dhcp-relay/dhcrelay.conf.j2
@@ -0,0 +1,9 @@
+### Autogenerated by service_dhcp-relay.py ###
+
+{% set max_size = '-A ' ~ relay_options.max_size if relay_options.max_size is vyos_defined %}
+{# hop_count and relay_agents_packets is a default option, thus it is always present #}
+{% if interface is vyos_defined %}
+OPTIONS="-c {{ relay_options.hop_count }} -a -m {{ relay_options.relay_agents_packets }} {{ max_size }} -i {{ interface | join(' -i ') }} {{ server | join(' ') }}"
+{% else %}
+OPTIONS="-c {{ relay_options.hop_count }} -a -m {{ relay_options.relay_agents_packets }} {{ max_size }} -id {{ listen_interface | join(' -id ') }} -iu {{ upstream_interface | join(' -iu ') }} {{ server | join(' ') }}"
+{% endif %}
diff --git a/data/templates/dhcp-relay/dhcrelay6.conf.j2 b/data/templates/dhcp-relay/dhcrelay6.conf.j2
new file mode 100644
index 0000000..25f7671
--- /dev/null
+++ b/data/templates/dhcp-relay/dhcrelay6.conf.j2
@@ -0,0 +1,20 @@
+### Autogenerated by service_dhcpv6-relay.py ###
+
+{# upstream_interface is mandatory so it's always present #}
+{% set upstream = namespace(value='') %}
+{% for interface, config in upstream_interface.items() %}
+{% for address in config.address %}
+{% set upstream.value = upstream.value ~ '-u ' ~ address ~ '%' ~ interface ~ ' ' %}
+{% endfor %}
+{% endfor %}
+{# listen_interface is mandatory so it's always present #}
+{% set listen = namespace(value='') %}
+{% for interface, config in listen_interface.items() %}
+{% if config.address is vyos_defined %}
+{% set listen.value = listen.value ~ '-l ' ~ config.address ~ '%' ~ interface ~ ' ' %}
+{% else %}
+{% set listen.value = listen.value ~ '-l ' ~ interface ~ ' ' %}
+{% endif %}
+{% endfor %}
+
+OPTIONS="{{ listen.value }} {{ upstream.value }} -c {{ max_hop_count }} {{ '-I' if use_interface_id_option is vyos_defined }}"