[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <ZC08FhWsRHSGr6Dk@Laptop-X1>
Date: Wed, 5 Apr 2023 17:15:02 +0800
From: Hangbin Liu <liuhangbin@...il.com>
To: Vladimir Nikishkin <vladimir@...ishkin.pw>
Cc: netdev@...r.kernel.org, davem@...emloft.net, edumazet@...gle.com,
kuba@...nel.org, pabeni@...hat.com,
eng.alaamohamedsoliman.am@...il.com, gnault@...hat.com,
razor@...ckwall.org, idosch@...dia.com, eyal.birger@...il.com,
jtoppins@...hat.com
Subject: Re: [PATCH iproute2-next v1 1/1 v1] ip-link: add support for
nolocalbypass in vxlan
On Wed, Apr 05, 2023 at 01:21:17PM +0800, Vladimir Nikishkin wrote:
> > There is no need to include the uapi header. Stephen will sync it with upstream.
> >
> > Hi Stephen, should we add this note to the README.devel?
> >
>
> Without this change, my code does not compile. I ended up modifying the
> header, but not adding it to git. Is this the correct way of doing it?
Yes, that's what I did.
>
> >> diff --git a/ip/iplink_vxlan.c b/ip/iplink_vxlan.c
> >> index c7e0e1c4..17fa5cf7 100644
> >> --- a/ip/iplink_vxlan.c
> >> +++ b/ip/iplink_vxlan.c
> >> @@ -276,6 +276,12 @@ static int vxlan_parse_opt(struct link_util *lu, int argc, char **argv,
> >> } else if (!matches(*argv, "noudpcsum")) {
> >> check_duparg(&attrs, IFLA_VXLAN_UDP_CSUM, *argv, *argv);
> >> addattr8(n, 1024, IFLA_VXLAN_UDP_CSUM, 0);
> >> + } else if (!matches(*argv, "localbypass")) {
> >> + check_duparg(&attrs, IFLA_VXLAN_LOCALBYPASS, *argv, *argv);
> >> + addattr8(n, 1024, IFLA_VXLAN_LOCALBYPASS, 1);
> >> + } else if (!matches(*argv, "nolocalbypass")) {
> >> + check_duparg(&attrs, IFLA_VXLAN_LOCALBYPASS, *argv, *argv);
> >> + addattr8(n, 1024, IFLA_VXLAN_LOCALBYPASS, 0);
> >
> > matches is deparated, please use strcmp instead.
>
> Why is strcmp recommended, not strncmp? I remember strcmp being frowned
> upon for some potential memory bounds violations.
We can't limit the string length as the parameter may have same prefix. e.g.
when you have 2 parameters "beef" and "beefsalad".
Hangbin
Powered by blists - more mailing lists