From: Pablo Neira Ayuso <pablo@netfilter.org>
To: Mikhail Sennikovsky <mikhail.sennikovskii@ionos.com>
Cc: netfilter-devel@vger.kernel.org, mikhail.sennikovsky@gmail.com
Subject: Re: [PATCH 6/6] conntrack: fix -o save dump for unknown protocols
Date: Thu, 23 Jun 2022 21:27:33 +0200 [thread overview]
Message-ID: <YrS+pfx7yxkuzXAH@salvia> (raw)
In-Reply-To: <20220623175000.49259-7-mikhail.sennikovskii@ionos.com>
On Thu, Jun 23, 2022 at 07:50:00PM +0200, Mikhail Sennikovsky wrote:
> Make sure the protocol (-p) option is included in the -o save
> ct entry dumps for L4 protocols unknown to the conntrack tool
>
> Signed-off-by: Mikhail Sennikovsky <mikhail.sennikovskii@ionos.com>
> ---
> src/conntrack.c | 11 ++++++++++-
> 1 file changed, 10 insertions(+), 1 deletion(-)
>
> diff --git a/src/conntrack.c b/src/conntrack.c
> index dca7da6..f8a228f 100644
> --- a/src/conntrack.c
> +++ b/src/conntrack.c
> @@ -870,9 +870,18 @@ static int ct_save_snprintf(char *buf, size_t len,
>
> ret = ct_snprintf_opts(buf + offset, len, ct, cur->print_opts);
> BUFFER_SIZE(ret, size, len, offset);
> - break;
> + goto done_proto4;
I'd suggest:
l4proto_set = true;
so you can remove this goto.
> }
>
> + /**
> + * Do not use getprotobynumber here to ensure
> + * "-o save" data incompatibility between hosts having
> + * different /etc/protocols contents
> + */
No need for this comment, explain this in the commit message, git
annotate will help to find the reason for this.
> + ret = snprintf(buf + offset, len, "-p %d ", l4proto);
> + BUFFER_SIZE(ret, size, len, offset);
if (!l4proto_set) {
ret = snprintf(buf + offset, len, "-p %d ", l4proto);
BUFFER_SIZE(ret, size, len, offset);
}
> +
> +done_proto4:
> /* skip trailing space, if any */
> for (; size && buf[size-1] == ' '; --size)
> buf[size-1] = '\0';
> --
> 2.25.1
>
prev parent reply other threads:[~2022-06-23 19:39 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-06-23 17:49 [PATCH 0/6] conntrack: fixes for handling unknown protocols Mikhail Sennikovsky
2022-06-23 17:49 ` [PATCH 1/6] tests/conntrack: ct create for " Mikhail Sennikovsky
2022-06-23 17:49 ` [PATCH 2/6] conntrack: set reply l4 proto for unknown protocol Mikhail Sennikovsky
2022-06-23 19:30 ` Pablo Neira Ayuso
2022-06-23 17:49 ` [PATCH 3/6] tests/conntrack: invalid protocol values Mikhail Sennikovsky
2022-06-23 19:29 ` Pablo Neira Ayuso
2022-06-23 17:49 ` [PATCH 4/6] conntrack: fix protocol number parsing Mikhail Sennikovsky
2022-06-23 19:29 ` Pablo Neira Ayuso
2022-06-23 17:49 ` [PATCH 5/6] tests/conntrack: ct -o save for unknown protocols Mikhail Sennikovsky
2022-06-23 19:28 ` Pablo Neira Ayuso
2022-06-23 17:50 ` [PATCH 6/6] conntrack: fix -o save dump " Mikhail Sennikovsky
2022-06-23 19:27 ` Pablo Neira Ayuso [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=YrS+pfx7yxkuzXAH@salvia \
--to=pablo@netfilter.org \
--cc=mikhail.sennikovskii@ionos.com \
--cc=mikhail.sennikovsky@gmail.com \
--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