netifd: add netlink udebug ring
[project/netifd.git] / system-linux.c
index 96cc99397100b2c7a2412f23e112c38203e912c4..4d2527908815589535fd84cc7d9bdd351c9c948b 100644 (file)
@@ -203,6 +203,14 @@ abort:
        return;
 }
 
+static void
+nl_udebug_cb(void *priv, struct nl_msg *msg)
+{
+       struct nlmsghdr *nlh = nlmsg_hdr(msg);
+
+       udebug_netlink_msg(priv, nlmsg_get_proto(msg), nlh, nlh->nlmsg_len);
+}
+
 static struct nl_sock *
 create_socket(int protocol, int groups)
 {
@@ -220,6 +228,9 @@ create_socket(int protocol, int groups)
                return NULL;
        }
 
+       nl_socket_set_tx_debug_cb(sock, nl_udebug_cb, &udb_nl);
+       nl_socket_set_rx_debug_cb(sock, nl_udebug_cb, &udb_nl);
+
        return sock;
 }