summaryrefslogtreecommitdiff
path: root/data/templates/proxy-ndp/ndppd.conf.tmpl
diff options
context:
space:
mode:
authorjack9603301 <jack9603301@163.com>2021-01-17 18:58:36 +0800
committerjack9603301 <jack9603301@163.com>2021-01-23 21:45:31 +0800
commitaf6a647bfecbc601b5c5dd7077f496b933228fce (patch)
tree63eedd231e9be0e70237072faabb31b4a95a1433 /data/templates/proxy-ndp/ndppd.conf.tmpl
parentb047855b80754d78cab4d3161ad0e97c21f479bc (diff)
downloadvyos-1x-af6a647bfecbc601b5c5dd7077f496b933228fce.tar.gz
vyos-1x-af6a647bfecbc601b5c5dd7077f496b933228fce.zip
nptv6: T2518: Improved template generation
Diffstat (limited to 'data/templates/proxy-ndp/ndppd.conf.tmpl')
-rw-r--r--data/templates/proxy-ndp/ndppd.conf.tmpl51
1 files changed, 36 insertions, 15 deletions
diff --git a/data/templates/proxy-ndp/ndppd.conf.tmpl b/data/templates/proxy-ndp/ndppd.conf.tmpl
index 9bf120b3a..a73f25a85 100644
--- a/data/templates/proxy-ndp/ndppd.conf.tmpl
+++ b/data/templates/proxy-ndp/ndppd.conf.tmpl
@@ -14,28 +14,49 @@
#
########################################################
+{% set global = namespace(ndppd_interfaces = [],ndppd_prefixs = []) %}
-{% for i in interface %}
-{%- if not interface[i].disable %}
+{% if source is defined and source.rule is defined and source.rule is not none %}
+{% for rule, config in source.rule.items() if config.disable is not defined %}
+{% if config.outbound_interface is defined %}
+{% if config.outbound_interface not in global.ndppd_interfaces %}
+{% set global.ndppd_interfaces = global.ndppd_interfaces + [config.outbound_interface] %}
+{% endif %}
+{% if config.translation.prefix is defined %}
+{% set global.ndppd_prefixs = global.ndppd_prefixs + [{'interface':config.outbound_interface,'rule':config.translation.prefix}] %}
+{% endif %}
+{% endif %}
+{% endfor %}
+{% endif %}
+
+{% if destination is defined and destination.rule is defined and destination.rule is not none %}
+{% for rule, config in destination.rule.items() if config.disable is not defined %}
+{% if config.inbound_interface is defined %}
+{% if config.inbound_interface not in global.ndppd_interfaces %}
+{% set global.ndppd_interfaces = global.ndppd_interfaces + [config.inbound_interface] %}
+{% endif %}
+{% if config.translation.address is defined %}
+{% set global.ndppd_prefixs = global.ndppd_prefixs + [{'interface':config.inbound_interface,'rule':config.translation.address}] %}
+{% endif %}
+{% endif %}
+{% endfor %}
+{% endif %}
+
+{% for i in global.ndppd_interfaces %}
proxy {{ i }} {
- router {{ interface[i].router }}
- timeout {{ interface[i].timeout }}
- ttl {{ interface[i].ttl }}
-{% for p in interface[i].prefix %}
+ router yes
+ timeout 500
+ ttl 30000
+{% for map in global.ndppd_prefixs %}
+{% if map['interface'] == i %}
+{% set p = map['rule'] %}
rule {{ p }} {
-{% if interface[i].prefix[p].mode == 'auto' %}
- auto
-{% elif interface[i].prefix[p].mode == 'static' %}
static
-{% elif interface[i].prefix[p].mode == 'iface' and interface[i].prefix[p].iface %}
- iface {{ interface[i].prefix[p].iface }}
-{% endif %}
}
-{%- endfor %}
+{% endif %}
+{% endfor %}
}
-{%- endif %}
-
{% endfor %}