From: Petr Machata <petrm@nvidia.com>
To: Daniel Borkmann <daniel@iogearbox.net>
Cc: <stephen@networkplumber.org>, <razor@blackwall.org>,
<martin.lau@kernel.org>, <netdev@vger.kernel.org>
Subject: Re: [PATCH iproute2] ip, link: Add support for netkit
Date: Mon, 13 Nov 2023 12:38:09 +0100 [thread overview]
Message-ID: <8734x9yd6j.fsf@nvidia.com> (raw)
In-Reply-To: <20231113032323.14717-1-daniel@iogearbox.net>
Daniel Borkmann <daniel@iogearbox.net> writes:
> +static bool seen_mode, seen_peer;
> +static struct rtattr *data;
Is there a reason to have these as globals? Neither seems to be used
outside of netkit_parse_opt(), nor seems to rely on maintaining state
between calls?
> +static int netkit_parse_opt(struct link_util *lu, int argc, char **argv,
> + struct nlmsghdr *n)
> +{
> + __u32 ifi_flags, ifi_change, ifi_index;
> + struct ifinfomsg *ifm, *peer_ifm;
> + int err;
> +
> + ifm = NLMSG_DATA(n);
> + ifi_flags = ifm->ifi_flags;
> + ifi_change = ifm->ifi_change;
> + ifi_index = ifm->ifi_index;
> + ifm->ifi_flags = 0;
> + ifm->ifi_change = 0;
> + ifm->ifi_index = 0;
> + while (argc > 0) {
> + if (matches(*argv, "mode") == 0) {
matches() has been out of fashion in iproute2 lately, because it makes
it not obvious that newly-added keywords do not break parsing of the
existing ones. Please just make it strcmp().
LGTM otherwise.
next prev parent reply other threads:[~2023-11-13 13:51 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-11-13 3:23 [PATCH iproute2] ip, link: Add support for netkit Daniel Borkmann
2023-11-13 11:38 ` Petr Machata [this message]
2023-11-13 12:42 ` Nikolay Aleksandrov
2023-11-13 13:07 ` Daniel Borkmann
2023-11-13 17:34 ` Stephen Hemminger
2023-11-13 22:38 ` David Ahern
2023-11-14 2:12 ` Daniel Borkmann
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=8734x9yd6j.fsf@nvidia.com \
--to=petrm@nvidia.com \
--cc=daniel@iogearbox.net \
--cc=martin.lau@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=razor@blackwall.org \
--cc=stephen@networkplumber.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).