All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jakub Kicinski <kuba@kernel.org>
To: Ilya Maximets <i.maximets@ovn.org>
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>,
	Donald Hunter <donald.hunter@gmail.com>,
	Shuah Khan <shuah@kernel.org>,
	Adrian Moreno <amorenoz@redhat.com>, Jiri Benc <jbenc@redhat.com>,
	Nicolas Dichtel <nicolas.dichtel@6wind.com>,
	linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org,
	Matteo Perin <matteo.perin@canonical.com>
Subject: Re: [PATCH net 4/5] tools: ynl: support listening on all nsids
Date: Tue, 19 May 2026 17:11:15 -0700	[thread overview]
Message-ID: <20260519171115.60aceb71@kernel.org> (raw)
In-Reply-To: <20260515201937.2813983-5-i.maximets@ovn.org>

On Fri, 15 May 2026 22:19:23 +0200 Ilya Maximets wrote:
> +    def ntf_listen_all_nsid(self):

doc-string needed

> +        self.sock.setsockopt(Netlink.SOL_NETLINK,
> +                             Netlink.NETLINK_LISTEN_ALL_NSID, 1)
> +
> +    @staticmethod
> +    def _decode_nsid(ancdata):
> +        for cmsg_level, cmsg_type, cmsg_data in ancdata:
> +            if (cmsg_level == Netlink.SOL_NETLINK and
> +                    cmsg_type == Netlink.NETLINK_LISTEN_ALL_NSID):
> +                nsid = struct.unpack('i', cmsg_data)[0]
> +                if nsid >= 0:
> +                    return nsid
> +                return None
> +        return None
> +
>      def set_recv_dbg(self, enabled):
>          self._recv_dbg = enabled
>  
> @@ -1235,7 +1251,7 @@ class YnlFamily(SpecFamily):
>                              f" when parsing '{attr_spec['name']}'")
>          return raw
>  
> -    def handle_ntf(self, decoded):
> +    def handle_ntf(self, decoded, nsid=None):
>          msg = {}
>          if self.include_raw:
>              msg['raw'] = decoded
> @@ -1246,15 +1262,20 @@ class YnlFamily(SpecFamily):
>  
>          msg['name'] = op['name']
>          msg['msg'] = attrs
> +        if nsid is not None:
> +            msg['nsid'] = nsid
>          self.async_msg_queue.put(msg)
>  
>      def check_ntf(self):
>          while True:
>              try:
> -                reply = self.sock.recv(self._recv_size, socket.MSG_DONTWAIT)
> +                reply, ancdata, _, _ = self.sock.recvmsg(self._recv_size,
> +                                                         4096,
> +                                                         socket.MSG_DONTWAIT)

please add a helper method (_recvmsg()?) that only takes flags
and doesn't return flags or addr since neither caller cares

  reply	other threads:[~2026-05-20  0:11 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-15 20:19 [PATCH net 0/5] netlink: fixes for cross-namespace nsid reporting Ilya Maximets
2026-05-15 20:19 ` [PATCH net 1/5] net: rtnetlink: fix link nsid reported when the link is local Ilya Maximets
2026-05-18  6:21   ` Jiri Benc
2026-05-18 12:11     ` Ilya Maximets
2026-05-18 12:46       ` Nicolas Dichtel
2026-05-18 13:55         ` Ilya Maximets
2026-05-18 14:59           ` Nicolas Dichtel
2026-05-18 12:26     ` Nicolas Dichtel
2026-05-18 13:45       ` Ilya Maximets
2026-05-15 20:19 ` [PATCH net 2/5] selftests: net: add a test case for cross-namespace peer netns Ilya Maximets
2026-05-15 20:19 ` [PATCH net 3/5] net: netlink: don't set nsid on local notifications Ilya Maximets
2026-05-18 12:14   ` Nicolas Dichtel
2026-05-18 12:46     ` Ilya Maximets
2026-05-18 12:56       ` Nicolas Dichtel
2026-05-18 14:06         ` Ilya Maximets
2026-05-18 15:41           ` Nicolas Dichtel
2026-05-15 20:19 ` [PATCH net 4/5] tools: ynl: support listening on all nsids Ilya Maximets
2026-05-20  0:11   ` Jakub Kicinski [this message]
2026-05-15 20:19 ` [PATCH net 5/5] selftests: net: add a test case for nsid in all nsid notifications Ilya Maximets

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=20260519171115.60aceb71@kernel.org \
    --to=kuba@kernel.org \
    --cc=amorenoz@redhat.com \
    --cc=davem@davemloft.net \
    --cc=donald.hunter@gmail.com \
    --cc=edumazet@google.com \
    --cc=horms@kernel.org \
    --cc=i.maximets@ovn.org \
    --cc=jbenc@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=matteo.perin@canonical.com \
    --cc=netdev@vger.kernel.org \
    --cc=nicolas.dichtel@6wind.com \
    --cc=pabeni@redhat.com \
    --cc=shuah@kernel.org \
    /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.