netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Phil Sutter <phil@nwl.cc>
To: Florian Westphal <fw@strlen.de>
Cc: netfilter-devel@vger.kernel.org
Subject: Re: [PATCH 4/4] json: icmp: refresh json output
Date: Thu, 21 Jan 2021 16:04:25 +0100	[thread overview]
Message-ID: <20210121150425.GR3158@orbyte.nwl.cc> (raw)
In-Reply-To: <20210121135510.14941-5-fw@strlen.de>

Hi,

On Thu, Jan 21, 2021 at 02:55:10PM +0100, Florian Westphal wrote:
> nft inserts dependencies for icmp header types, but I forgot to
> update the json test files to reflect this change.

For asymmetric JSON output, there are *.t.json.output files. Please add
the missing dependency expressions there.

In general, *.t.json files should contain JSON equivalents for rules as
they are *input* into nft. So we want them to be as close to the
introductory standard syntax comment as possible. This patch "breaks" a
few cases, e.g.:

[...]
> @@ -301,6 +301,8 @@
>                      "source-quench",
>                      "redirect",
>                      "echo-request",
> +                    "router-advertisement",
> +                    "router-solicitation",
>                      "time-exceeded",
>                      "parameter-problem",
>                      "timestamp-request",
> @@ -308,9 +310,7 @@
>                      "info-request",
>                      "info-reply",
>                      "address-mask-request",
> -                    "address-mask-reply",
> -                    "router-advertisement",
> -                    "router-solicitation"
> +                    "address-mask-reply"
>                  ]
>              }
>          }

Input is indeed sorted as prior to this patch. The reordered output is
found in icmp.t.json.output. The benefit from being picky here is minor,
but here's a better example:

[...]
> @@ -466,11 +482,11 @@
>                      "protocol": "icmp"
>                  }
>              },
> -	    "op": "==",
> +            "op": "==",
>              "right": {
>                  "set": [
> -                    2,
> -                    4,
> +                    "prot-unreachable",
> +                    "frag-needed",
>                      33,
>                      54,
>                      56

We test that icmp code values 2 and 4 are accepted. Standard syntax test
covers the asymmetric output containing the names. JSON should do the
same. OTOH, names as input is tested in the negated form of the same
test which follows this one.

Thanks, Phil

      reply	other threads:[~2021-01-21 15:08 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-21 13:55 [PATCH nft 0/4] json test case fixups Florian Westphal
2021-01-21 13:55 ` [PATCH 1/4] json: fix icmpv6.t test cases Florian Westphal
2021-01-21 15:12   ` Phil Sutter
2021-01-21 13:55 ` [PATCH 2/4] json: limit: set default burst to 5 Florian Westphal
2021-01-21 14:44   ` Phil Sutter
2021-01-21 14:57     ` Pablo Neira Ayuso
2021-01-21 14:59       ` Pablo Neira Ayuso
2021-01-21 15:10         ` Phil Sutter
2021-01-21 13:55 ` [PATCH 3/4] json: ct: add missing rule Florian Westphal
2021-01-21 15:13   ` Phil Sutter
2021-01-21 13:55 ` [PATCH 4/4] json: icmp: refresh json output Florian Westphal
2021-01-21 15:04   ` Phil Sutter [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210121150425.GR3158@orbyte.nwl.cc \
    --to=phil@nwl.cc \
    --cc=fw@strlen.de \
    --cc=netfilter-devel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).