rule.uc: always format ICMP type/code list as set
authorJo-Philipp Wich <jo@mein.io>
Sun, 17 Oct 2021 09:16:27 +0000 (11:16 +0200)
committerJo-Philipp Wich <jo@mein.io>
Sun, 17 Oct 2021 09:16:27 +0000 (11:16 +0200)
Ensure that the concatenated type . code list values are always formatted
as anonymous set, even if the list just contains one item. Fixes the
following nftables error when parsing such a rule:

  Error: Use concatenations with sets and maps, not singleton values

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
root/usr/share/firewall4/templates/rule.uc

index 0aae4806cefdd227e48ca62d1e9c500f2b016b10..5f1b696c9cf9fde63c35c1096c3609af31f39615 100644 (file)
@@ -28,7 +28,7 @@
        {{ (rule.family == 4) ? "icmp" : "icmpv6" }} type {{ fw4.set(rule.icmp_types) }} {%+ endif -%}
 {%+ if (rule.icmp_codes): -%}
        {{ (rule.family == 4) ? "icmp" : "icmpv6" }} type . {{ (rule.family == 4) ? "icmp" : "icmpv6" }} code {{
-               fw4.set(rule.icmp_codes)
+               fw4.set(rule.icmp_codes, true)
        }} {%+ endif -%}
 {%+ if (rule.helper): -%}
        ct helper{% if (rule.helper.invert): %} !={% endif %} {{ fw4.quote(rule.helper.name, true) }} {%+ endif -%}