lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Wed, 16 Feb 2022 18:40:25 -0800
From:   Jakub Kicinski <kuba@...nel.org>
To:     David Ahern <dsahern@...il.com>,
        Guillaume Nault <gnault@...hat.com>
Cc:     Jamal Hadi Salim <jhs@...atatu.com>,
        Cong Wang <xiyou.wangcong@...il.com>,
        stephen@...workplumber.org, netdev@...r.kernel.org
Subject: Re: [RFC iproute2] tos: interpret ToS in natural numeral system

On Wed, 16 Feb 2022 18:52:43 -0700 David Ahern wrote:
> On 2/16/22 3:23 PM, Guillaume Nault wrote:
> > On Wed, Feb 16, 2022 at 11:42:05AM -0800, Jakub Kicinski wrote:  
> >> Silently forcing a base numeral system is very painful for users.
> >> ip currently interprets tos 10 as 0x10. Imagine user's bash script
> >> does:
> >>
> >>   .. tos $((TOS * 2)) ..
> >>
> >> or any numerical operation on the ToS.
> >>
> >> This patch breaks existing scripts if they expect 10 to be 0x10.  
> > 
> > I agree that we shouldn't have forced base 16 in the first place.
> > But after so many years I find it a bit dangerous to change that.  
> 
> I agree. In this case the change in behavior will not be very obvious
> and could lead to confusion. I think this is something we have to live with.
> 
> > 
> > What about just printing a warning when the value isn't prefixed with
> > '0x'? Something like (completely untested):
> > 
> > @@ -535,6 +535,12 @@ int rtnl_dsfield_a2n(__u32 *id, const char *arg)
> >  	if (!end || end == arg || *end || res > 255)
> >  		return -1;
> >  	*id = res;
> > +
> > +	if (strncmp("0x", arg, 2))
> > +		fprintf(stderr,
> > +			"Warning: dsfield and tos parameters are interpreted as hexadecimal values\n"
> > +			"Use 'dsfield 0x%02x' to avoid this message\n", res);
> > +
> >  	return 0;
> >  }  
> 
> That seems reasonable to me to let users know of this behavior.

SGTM!

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ