Skip to contentSkip to conversation

Generic netlink interface

IPROUTE2 jamal 1 participant 1 message Jul 2, 2006

Subsystems (3)
lore
Share & tools
lore

jamal

author
#0 lore raw

very quiet today ..

Stephen,
I've been sitting on this for a while now; just tested against latest kernels.

Another one on top of the other i.e against iproute2-git.

Shailabh, if you have time can you try just listing things, monitoring etc; I dont think your tool fits here - but if you could try and use the framework (cutnpaste from ctrl.c) and provide feedback i would appreciate it.

cheers,
jamal

This patch adds a generic netlink controller interface. The controller is the only module using this at the moment. Thomas has a sample user of genetlink that would fit here; bug him for it.

---
commit 9cd6ca6d2a2b1b27fc3c98ecb8e081b19aa64019
tree ff513f5484e1dbe27ef8fbb6f2e31d82ffbdcb3b
parent 00f2ad46f0040769f0d4e4541fe0731f20164664
author Jamal Hadi Salim <hadi@jzny2.(none)> Sun, 02 Jul 2006 16:40:18 -0400 committer Jamal Hadi Salim <hadi@jzny2.(none)> Sun, 02 Jul 2006 16:40:18 -0400

 Makefile          |    2 
 genl/Makefile     |   22 ++++
 genl/ctrl.c       |  284 +++++++++++++++++++++++++++++++++++++++++++++++++++++
 genl/genl.c       |  162 ++++++++++++++++++++++++++++++
 genl/genl_utils.h |   22 ++++
 5 files changed, 491 insertions(+), 1 deletions(-)
Makefile +1 -1
index ac58cd9..3fc3a15 100644
@@ -27,7 +27,7 @@ YACCFLAGS = -d -t -v
 
 LDLIBS += -L../lib -lnetlink -lutil
 
-SUBDIRS=lib ip tc misc netem
+SUBDIRS=lib ip tc misc netem genl
 
 LIBNETLINK=../lib/libnetlink.a ../lib/libutil.a
 
genl/Makefile new file +22 -0
new file mode 100644
index 0000000..4436508
@@ -0,0 +1,22 @@
+GENLOBJ=genl.o
+
+include ../Config
+
+GENLMODULES :=
+GENLMODULES += ctrl.o
+
+GENLOBJ += $(GENLMODULES)
+
+GENLLIB :=
+
+LDFLAGS += -Wl,-export-dynamic -lm -ldl
+
+all: genl
+
+genl: $(GENLOBJ) $(LIBNETLINK) $(LIBUTIL) $(GENLLIB)
+
+install: all
+	install -m 0755 -s genl $(DESTDIR)$(SBINDIR)
+
+clean:
+	rm -f $(GENLOBJ) $(GENLLIB) genl
genl/ctrl.c new file +284 -0

284 lines not on this page · raw message

genl/genl.c new file +162 -0

162 lines not on this page · raw message

genl/genl_utils.h new file +22 -0
new file mode 100644
index 0000000..2f2314b
@@ -0,0 +1,22 @@
+#ifndef _TC_UTIL_H_
+#define _TC_UTIL_H_ 1
+
+#include "linux/genetlink.h"
+
+struct genl_util
+{
+	struct  genl_util *next;
+	char	name[16];
+	int	(*parse_genlopt)(struct genl_util *fu, int argc, char **argv);
+	int	(*print_genlopt)(const struct sockaddr_nl *who, struct nlmsghdr *n, void *arg);
+};
+
+extern int genl_ctrl_resolve_family(const char *family);
+
+/* seems to have dissapeared from netlink.h */
+static inline __u32 nl_mgrp(__u32 group)
+{
+	return group ? 1 << group : 0;
+}
+
+#endif