socket: call rx debug callback once per packet instead of per batch
authorFelix Fietkau <nbd@nbd.name>
Tue, 5 Dec 2023 11:46:24 +0000 (12:46 +0100)
committerFelix Fietkau <nbd@nbd.name>
Tue, 5 Dec 2023 11:46:26 +0000 (12:46 +0100)
When receiving a batch, split up calls

Signed-off-by: Felix Fietkau <nbd@nbd.name>
nl.c

diff --git a/nl.c b/nl.c
index fee0529b3a73430994ba74624b94b707af5b9f4d..b0f43e2301e747d879482daf85c87980db644762 100644 (file)
--- a/nl.c
+++ b/nl.c
@@ -472,9 +472,6 @@ retry:
                }
        }
 
-       if (sk->s_debug_rx_cb)
-               sk->s_debug_rx_cb(sk->s_debug_rx_priv, *buf, n);
-
        free(msg.msg_control);
        return n;
 
@@ -536,6 +533,9 @@ continue_reading:
                        goto out;
                }
 
+               if (sk->s_debug_rx_cb)
+                       sk->s_debug_rx_cb(sk->s_debug_rx_priv, hdr, hdr->nlmsg_len);
+
                nlmsg_set_proto(msg, sk->s_proto);
                nlmsg_set_src(msg, &nla);
                if (creds)