nhorman / dropwatch

user space utility to interface to kernel dropwatch facility
GNU General Public License v2.0
632 stars 92 forks source link

use net_dropmon.h in sysroot #86

Closed chenheyun-github closed 5 months ago

chenheyun-github commented 9 months ago

Hi, when i use it in yocto. i found something that we can do it best. dropwatch tools compile with local head file,but it not matched with our real head file form kernel.(net_dropmon.h) net_dropmon.h in dropwatch local src/net_dropmon.h. linux kernel also have it in include/uapi/linux/net_dropmon.h

for example,our kernel is linux5.10: diff tmp/work/cortexa57-poky-linux/dropwatch/1.5.4+git-r0/recipe-sysroot/usr/ include/linux/net_dropmon.h tmp/work/cortexa57-poky-linux/dropwatch/1.5.4+git-r0/git/src/net_dropmon.h 1c1,3 < 95a94

  NET_DM_ATTR_REASON,                     /* string */

it will cause missmatch when we use drop watch in lower kernel version(v5.10), will cause dropwatch and kernel drop_monitor module missmatch with netlink talk. we should build it with sysroot which comes from match kernel head file.

From 4872c52f55f9cb089e6681c3f1926663145b52ae Mon Sep 17 00:00:00 2001 From: chenheyun chen_heyun@163.com Date: Sun, 18 Feb 2024 05:08:25 -0800 Subject: [PATCH] fix bug: build with sysroot head file instead of local head file:net_dropmon.h

Signed-off-by: chenheyun chen_heyun@163.com

src/main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/main.c b/src/main.c index e4746d9..81dc4da 100644 --- a/src/main.c +++ b/src/main.c @@ -26,8 +26,8 @@

include <netlink/netlink.h>

include <netlink/genl/genl.h>

include <netlink/genl/ctrl.h>

+#include

-#include "net_dropmon.h"

include "lookup.h"

/* -- 2.25.1

nhorman commented 9 months ago

please open a pull request for this. You will also need to eliminate the duplicated ennumeration from dropwatch itself