[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <8734x9yd6j.fsf@nvidia.com>
Date: Mon, 13 Nov 2023 12:38:09 +0100
From: Petr Machata <petrm@...dia.com>
To: Daniel Borkmann <daniel@...earbox.net>
CC: <stephen@...workplumber.org>, <razor@...ckwall.org>,
<martin.lau@...nel.org>, <netdev@...r.kernel.org>
Subject: Re: [PATCH iproute2] ip, link: Add support for netkit
Daniel Borkmann <daniel@...earbox.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.
Powered by blists - more mailing lists