[PATCH 2/2] tools: ynl: add unicast notification receive support
From: Minxi Hou
Date: Sun May 17 2026 - 04:36:11 EST
Add ntf_listen() method to YnlFamily for binding the netlink
socket without joining a multicast group. This enables receiving
unicast notifications through the existing poll_ntf/check_ntf
path.
The OVS packet family sends MISS and ACTION upcalls via
genlmsg_unicast() to a per-vport PID rather than through a
multicast group. The existing ntf_subscribe() couples bind()
with setsockopt(ADD_MEMBERSHIP), which does not fit the unicast
case. ntf_listen() provides the bind-only alternative.
Signed-off-by: Minxi Hou <houminxi@xxxxxxxxx>
---
tools/net/ynl/pyynl/lib/ynl.py | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/tools/net/ynl/pyynl/lib/ynl.py b/tools/net/ynl/pyynl/lib/ynl.py
index f63c6f828735..8f526c683f99 100644
--- a/tools/net/ynl/pyynl/lib/ynl.py
+++ b/tools/net/ynl/pyynl/lib/ynl.py
@@ -748,6 +748,10 @@ class YnlFamily(SpecFamily):
self.sock.setsockopt(Netlink.SOL_NETLINK, Netlink.NETLINK_ADD_MEMBERSHIP,
mcast_id)
+ def ntf_listen(self):
+ """Bind socket for receiving unicast notifications."""
+ self.sock.bind((0, 0))
+
def set_recv_dbg(self, enabled):
self._recv_dbg = enabled
--
2.53.0