From 4df48d5713398800a74aae7f69932e9219a46f24 Mon Sep 17 00:00:00 2001 From: Christian Poessinger Date: Wed, 13 Apr 2022 22:53:44 +0200 Subject: conntrack: T4333: migrate to new vyos_defined Jinja2 test --- data/templates/conntrack/nftables-ct.tmpl | 4 ++-- data/templates/conntrackd/conntrackd.conf.tmpl | 18 +++++++++--------- data/templates/conntrackd/conntrackd.op-mode.tmpl | 2 +- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/data/templates/conntrack/nftables-ct.tmpl b/data/templates/conntrack/nftables-ct.tmpl index cebc1a54e..569e73df1 100644 --- a/data/templates/conntrack/nftables-ct.tmpl +++ b/data/templates/conntrack/nftables-ct.tmpl @@ -12,7 +12,7 @@ table raw { chain {{ nft_ct_ignore_name }} { {% if ignore.rule is vyos_defined %} {% for rule, rule_config in ignore.rule.items() %} - # rule-{{ rule }} {{ '- ' ~ rule_config.description if rule_config.description is defined and rule_config.description is not none }} + # rule-{{ rule }} {{ '- ' ~ rule_config.description if rule_config.description is vyos_defined }} {% set nft_command = '' %} {% if rule_config.inbound_interface is vyos_defined %} {% set nft_command = nft_command ~ ' iifname ' ~ rule_config.inbound_interface %} @@ -40,7 +40,7 @@ table raw { chain {{ nft_ct_timeout_name }} { {% if timeout.custom.rule is vyos_defined %} {% for rule, rule_config in timeout.custom.rule.items() %} - # rule-{{ rule }} {{ '- ' ~ rule_config.description if rule_config.description is defined and rule_config.description is not none }} + # rule-{{ rule }} {{ '- ' ~ rule_config.description if rule_config.description is vyos_defined }} {% endfor %} {% endif %} return diff --git a/data/templates/conntrackd/conntrackd.conf.tmpl b/data/templates/conntrackd/conntrackd.conf.tmpl index 45b7bff09..80e7254a0 100644 --- a/data/templates/conntrackd/conntrackd.conf.tmpl +++ b/data/templates/conntrackd/conntrackd.conf.tmpl @@ -3,16 +3,16 @@ # Synchronizer settings Sync { Mode FTFW { - DisableExternalCache {{ 'on' if disable_external_cache is defined else 'off' }} + DisableExternalCache {{ 'on' if disable_external_cache is vyos_defined else 'off' }} } {% for iface, iface_config in interface.items() %} -{% if iface_config.peer is defined and iface_config.peer is not none %} +{% if iface_config.peer is vyos_defined %} UDP { -{% if listen_address is defined and listen_address is not none %} +{% if listen_address is vyos_defined %} IPv4_address {{ listen_address }} {% endif %} IPv4_Destination_Address {{ iface_config.peer }} - Port {{ iface_config.port if iface_config.port is defined else '3780' }} + Port {{ iface_config.port if iface_config.port is vyos_defined else '3780' }} Interface {{ iface }} SndSocketBuffer {{ sync_queue_size | int *1024 *1024 }} RcvSocketBuffer {{ sync_queue_size | int *1024 *1024 }} @@ -22,7 +22,7 @@ Sync { Multicast { {% set ip_address = iface | get_ipv4 %} IPv4_address {{ mcast_group }} - Group {{ iface_config.port if iface_config.port is defined else '3780' }} + Group {{ iface_config.port if iface_config.port is vyos_defined else '3780' }} IPv4_interface {{ ip_address[0] | ip_from_cidr }} Interface {{ iface }} SndSocketBuffer {{ sync_queue_size | int *1024 *1024 }} @@ -31,7 +31,7 @@ Sync { } {% endif %} {% endfor %} -{% if expect_sync is defined and expect_sync is not none %} +{% if expect_sync is vyos_defined %} Options { {% if 'all' in expect_sync %} ExpectationSync on @@ -83,9 +83,9 @@ General { NetlinkBufferSizeMaxGrowth {{ event_listen_queue_size | int *1024 *1024 }} NetlinkOverrunResync off NetlinkEventsReliable on -{% if ignore_address is defined or accept_protocol is defined %} +{% if ignore_address is vyos_defined or accept_protocol is vyos_defined %} Filter From Userspace { -{% if ignore_address is defined and ignore_address is not none %} +{% if ignore_address is vyos_defined %} Address Ignore { {% for address in ignore_address if address | is_ipv4 %} IPv4_address {{ address }} @@ -95,7 +95,7 @@ General { {% endfor %} } {% endif %} -{% if accept_protocol is defined and accept_protocol is not none %} +{% if accept_protocol is vyos_defined %} Protocol Accept { {% for protocol in accept_protocol %} {% if protocol == 'icmp6' %} diff --git a/data/templates/conntrackd/conntrackd.op-mode.tmpl b/data/templates/conntrackd/conntrackd.op-mode.tmpl index 82a4b09ad..c3f6911ce 100644 --- a/data/templates/conntrackd/conntrackd.op-mode.tmpl +++ b/data/templates/conntrackd/conntrackd.op-mode.tmpl @@ -1,5 +1,5 @@ Source Destination Protocol -{% for parsed in data if parsed.flow is defined and parsed.flow.meta is defined %} +{% for parsed in data if parsed.flow.meta is vyos_defined %} {% for key in parsed.flow.meta %} {% if key['@direction'] == 'original' %} {% set saddr = key.layer3.src | bracketize_ipv6 %} -- cgit v1.2.3