[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAD4GDZwwjZvc1YXogJFdmqAA-1W66DdjYpxAKucmVQFDzbyY6w@mail.gmail.com>
Date: Tue, 10 Dec 2024 12:00:33 +0000
From: Donald Hunter <donald.hunter@...il.com>
To: Jakub Kicinski <kuba@...nel.org>
Cc: netdev@...r.kernel.org, "David S. Miller" <davem@...emloft.net>,
Eric Dumazet <edumazet@...gle.com>, Paolo Abeni <pabeni@...hat.com>, Simon Horman <horms@...nel.org>,
Johannes Berg <johannes@...solutions.net>, linux-wireless@...r.kernel.org,
donald.hunter@...hat.com
Subject: Re: [PATCH net-next v1 4/7] tools/net/ynl: accept IP string inputs
On Wed, 4 Dec 2024 at 13:37, Donald Hunter <donald.hunter@...il.com> wrote:
>
> On Wed, 4 Dec 2024 at 02:07, Jakub Kicinski <kuba@...nel.org> wrote:
> >
> > > + if display_hint in ['ipv4', 'ipv6']:
> > > + ip = ipaddress.ip_address(string)
> > > + if type == 'binary':
> > > + raw = ip.packed
> > > + else:
> > > + raw = int(ip)
> > > + else:
> >
> > I wonder if we should raise in this case?
> > Especially if type is binary passing the string back will just blow up
> > later, right? We could instead rise with a nice clear error message
> > here.
>
> It's actually a bit misleading that the attr is called 'string'
> because it could be a binary input if it was supplied from python
> code, i.e. not parsed from JSON on the command-line.
I was wrong, the binary input is handled already by the caller, so
this should just raise an exception.
Powered by blists - more mailing lists