From 08738713c94ed06b84ec673621e396eb339fbbce Mon Sep 17 00:00:00 2001 From: Jarrod Johnson Date: Thu, 15 May 2025 08:39:45 -0400 Subject: [PATCH] Handle NLMSG_DONE wherever it may appear in reply Some kernels may bundle the NLMSG_DONE in the last useful system call, unlike the previous norm of sending it as a single message in a terminating system call. --- confluent_server/confluent/neighutil.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/confluent_server/confluent/neighutil.py b/confluent_server/confluent/neighutil.py index cd08e8bd..d1713f31 100644 --- a/confluent_server/confluent/neighutil.py +++ b/confluent_server/confluent/neighutil.py @@ -48,14 +48,15 @@ def _update_neigh(): ndmsg= b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' s.sendall(nlhdr + ndmsg) neightable = {} + inprogress = True try: - while True: + while inprogress: pdata = s.recv(65536) v = memoryview(pdata) - if struct.unpack('H', v[4:6])[0] == 3: - break while len(v): length, typ = struct.unpack('IH', v[:6]) + if typ == 3: + inprogress = False if typ == 28: hlen = struct.calcsize('BIHBB') _, idx, state, flags, typ = struct.unpack('BIHBB', v[16:16+hlen])