summaryrefslogtreecommitdiffstats
path: root/src/proto.c
diff options
context:
space:
mode:
authorFlorian Westphal <fw@strlen.de>2018-09-04 13:53:59 +0200
committerFlorian Westphal <fw@strlen.de>2018-09-04 14:57:17 +0200
commit0f44d4f62753535d39d95d83778348bee4e88053 (patch)
treea8abdf198af2bd59e718283e54e84dea92aa7f03 /src/proto.c
parentaab7913f0e9bfd331980a4e6a478d3e350be9e89 (diff)
proto: fix icmp/icmpv6 code datatype
Andrew A. Sabitov says: I'd like to use a set (concatenation) of icmpv6 type and icmpv6 code and check incoming icmpv6 traffic against it: add set inet fw in_icmpv6_types { type icmpv6_type . icmpv6_code; } add element inet fw in_icmpv6_types { 1 . 0 } # no route to destination add element inet fw in_icmpv6_types { 1 . 1 } # communication with destination administratively prohibited # ... add rule inet fw in_icmpv6 icmpv6 type . icmpv6 code @in_icmpv6_types \ limit rate 15/minute accept yields: Error: can not use variable sized data types (integer) in concat expressions icmpv6 type . icmpv6 code @in_icmpv6_types ~~~~~~~~~~~~~~^^^^^^^^^^^ Change 'code' type to the icmp/icmpv6 code type. Needs minor change to test suite as nft will now display human-readable names instead of numeric codes. Closes: https://bugzilla.netfilter.org/show_bug.cgi?id=1276 Signed-off-by: Florian Westphal <fw@strlen.de>
Diffstat (limited to 'src/proto.c')
-rw-r--r--src/proto.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/proto.c b/src/proto.c
index ed011efa..d178bf39 100644
--- a/src/proto.c
+++ b/src/proto.c
@@ -347,7 +347,7 @@ const struct proto_desc proto_icmp = {
.checksum_key = ICMPHDR_CHECKSUM,
.templates = {
[ICMPHDR_TYPE] = ICMPHDR_TYPE("type", &icmp_type_type, type),
- [ICMPHDR_CODE] = ICMPHDR_FIELD("code", code),
+ [ICMPHDR_CODE] = ICMPHDR_TYPE("code", &icmp_code_type, code),
[ICMPHDR_CHECKSUM] = ICMPHDR_FIELD("checksum", checksum),
[ICMPHDR_ID] = ICMPHDR_FIELD("id", un.echo.id),
[ICMPHDR_SEQ] = ICMPHDR_FIELD("sequence", un.echo.sequence),
@@ -686,7 +686,7 @@ const struct proto_desc proto_icmp6 = {
.checksum_key = ICMP6HDR_CHECKSUM,
.templates = {
[ICMP6HDR_TYPE] = ICMP6HDR_TYPE("type", &icmp6_type_type, icmp6_type),
- [ICMP6HDR_CODE] = ICMP6HDR_FIELD("code", icmp6_code),
+ [ICMP6HDR_CODE] = ICMP6HDR_TYPE("code", &icmpv6_code_type, icmp6_code),
[ICMP6HDR_CHECKSUM] = ICMP6HDR_FIELD("checksum", icmp6_cksum),
[ICMP6HDR_PPTR] = ICMP6HDR_FIELD("parameter-problem", icmp6_pptr),
[ICMP6HDR_MTU] = ICMP6HDR_FIELD("mtu", icmp6_mtu),