All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jakub Kicinski <kuba@kernel.org>
To: Donald Hunter <donald.hunter@gmail.com>
Cc: netdev@vger.kernel.org, "David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Paolo Abeni <pabeni@redhat.com>, Simon Horman <horms@kernel.org>,
	Johannes Berg <johannes@sipsolutions.net>,
	linux-wireless@vger.kernel.org, donald.hunter@redhat.com
Subject: Re: [PATCH net-next v1 4/7] tools/net/ynl: accept IP string inputs
Date: Tue, 3 Dec 2024 18:07:14 -0800	[thread overview]
Message-ID: <20241203180714.45a2af81@kernel.org> (raw)
In-Reply-To: <20241203130655.45293-5-donald.hunter@gmail.com>

On Tue,  3 Dec 2024 13:06:52 +0000 Donald Hunter wrote:
> +    def _from_string(self, string, display_hint, type):

Any reason not to pass attr_spec instead of the members one by one?

> +        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.

> +            raw = string
> +        return raw

  reply	other threads:[~2024-12-04  2:07 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-12-03 13:06 [PATCH net-next v1 0/7] netlink: specs: add a spec for nl80211 wiphy Donald Hunter
2024-12-03 13:06 ` [PATCH net-next v1 1/7] tools/net/ynl: remove extraneous plural from variable names Donald Hunter
2024-12-04  1:56   ` Jakub Kicinski
2024-12-03 13:06 ` [PATCH net-next v1 2/7] tools/net/ynl: support decoding indexed arrays as enums Donald Hunter
2024-12-04  2:00   ` Jakub Kicinski
2024-12-04 13:20     ` Donald Hunter
2024-12-03 13:06 ` [PATCH net-next v1 3/7] tools/net/ynl: support decoding C " Donald Hunter
2024-12-04  2:03   ` Jakub Kicinski
2024-12-04 13:24     ` Donald Hunter
2024-12-03 13:06 ` [PATCH net-next v1 4/7] tools/net/ynl: accept IP string inputs Donald Hunter
2024-12-04  2:07   ` Jakub Kicinski [this message]
2024-12-04 13:37     ` Donald Hunter
2024-12-10 12:00       ` Donald Hunter
2024-12-03 13:06 ` [PATCH net-next v1 5/7] netlink: specs: support nested structs in genetlink legacy Donald Hunter
2024-12-04  2:07   ` Jakub Kicinski
2024-12-03 13:06 ` [PATCH net-next v1 6/7] netlink: specs: add s8, s16 to genetlink schemas Donald Hunter
2024-12-04  2:08   ` Jakub Kicinski
2024-12-03 13:06 ` [PATCH net-next v1 7/7] netlink: specs: wireless: add a spec for nl80211 Donald Hunter
2024-12-03 13:12   ` Johannes Berg
2024-12-04 13:12     ` Donald Hunter
2024-12-04 13:28       ` Johannes Berg
2024-12-04 14:08         ` Donald Hunter

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=20241203180714.45a2af81@kernel.org \
    --to=kuba@kernel.org \
    --cc=davem@davemloft.net \
    --cc=donald.hunter@gmail.com \
    --cc=donald.hunter@redhat.com \
    --cc=edumazet@google.com \
    --cc=horms@kernel.org \
    --cc=johannes@sipsolutions.net \
    --cc=linux-wireless@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.