* [PATCH 01/12] [RTNL]: Message handler registration interface
2007-03-22 12:59 [PATCH 00/12] [RESEND] rtnetlink message handler registration interface Thomas Graf
@ 2007-03-22 12:59 ` Thomas Graf
2007-03-22 12:59 ` [PATCH 02/12] [NET] link: Use rtnl " Thomas Graf
` (11 subsequent siblings)
12 siblings, 0 replies; 20+ messages in thread
From: Thomas Graf @ 2007-03-22 12:59 UTC (permalink / raw)
To: davem; +Cc: netdev, Thomas Graf
[-- Attachment #1: rtnl_reg_api --]
[-- Type: text/plain, Size: 9564 bytes --]
This patch adds a new interface to register rtnetlink message
handlers replacing the exported rtnl_links[] array which
required many message handlers to be exported unnecessarly.
Signed-off-by: Thomas Graf <tgraf@suug.ch>
Index: net-2.6.22/include/net/rtnetlink.h
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ net-2.6.22/include/net/rtnetlink.h 2007-03-22 12:48:20.000000000 +0100
@@ -0,0 +1,18 @@
+#ifndef __NET_RTNETLINK_H
+#define __NET_RTNETLINK_H
+
+#include <linux/rtnetlink.h>
+#include <net/netlink.h>
+
+typedef int (*rtnl_doit_func)(struct sk_buff *, struct nlmsghdr *, void *);
+typedef int (*rtnl_dumpit_func)(struct sk_buff *, struct netlink_callback *);
+
+extern int __rtnl_register(int protocol, int msgtype,
+ rtnl_doit_func, rtnl_dumpit_func);
+extern void rtnl_register(int protocol, int msgtype,
+ rtnl_doit_func, rtnl_dumpit_func);
+extern int rtnl_unregister(int protocol, int msgtype);
+extern void rtnl_unregister_all(int protocol);
+extern int rtnl_dump_all(struct sk_buff *skb, struct netlink_callback *cb);
+
+#endif
Index: net-2.6.22/net/core/rtnetlink.c
===================================================================
--- net-2.6.22.orig/net/core/rtnetlink.c 2007-03-22 12:48:05.000000000 +0100
+++ net-2.6.22/net/core/rtnetlink.c 2007-03-22 12:48:20.000000000 +0100
@@ -50,12 +50,18 @@
#include <net/sock.h>
#include <net/pkt_sched.h>
#include <net/fib_rules.h>
-#include <net/netlink.h>
+#include <net/rtnetlink.h>
#ifdef CONFIG_NET_WIRELESS_RTNETLINK
#include <linux/wireless.h>
#include <net/iw_handler.h>
#endif /* CONFIG_NET_WIRELESS_RTNETLINK */
+struct rtnl_link
+{
+ rtnl_doit_func doit;
+ rtnl_dumpit_func dumpit;
+};
+
static DEFINE_MUTEX(rtnl_mutex);
static struct sock *rtnl;
@@ -95,7 +101,151 @@ int rtattr_parse(struct rtattr *tb[], in
return 0;
}
-struct rtnetlink_link * rtnetlink_links[NPROTO];
+struct rtnl_link *rtnl_msg_handlers[NPROTO];
+
+static inline int rtm_msgindex(int msgtype)
+{
+ int msgindex = msgtype - RTM_BASE;
+
+ /*
+ * msgindex < 0 implies someone tried to register a netlink
+ * control code. msgindex >= RTM_NR_MSGTYPES may indicate that
+ * the message type has not been added to linux/rtnetlink.h
+ */
+ BUG_ON(msgindex < 0 || msgindex >= RTM_NR_MSGTYPES);
+
+ return msgindex;
+}
+
+static rtnl_doit_func rtnl_get_doit(int protocol, int msgindex)
+{
+ struct rtnl_link *tab;
+
+ tab = rtnl_msg_handlers[protocol];
+ if (tab == NULL || tab->doit == NULL)
+ tab = rtnl_msg_handlers[PF_UNSPEC];
+
+ return tab ? tab->doit : NULL;
+}
+
+static rtnl_dumpit_func rtnl_get_dumpit(int protocol, int msgindex)
+{
+ struct rtnl_link *tab;
+
+ tab = rtnl_msg_handlers[protocol];
+ if (tab == NULL || tab->dumpit == NULL)
+ tab = rtnl_msg_handlers[PF_UNSPEC];
+
+ return tab ? tab->dumpit : NULL;
+}
+
+/**
+ * __rtnl_register - Register a rtnetlink message type
+ * @protocol: Protocol family or PF_UNSPEC
+ * @msgtype: rtnetlink message type
+ * @doit: Function pointer called for each request message
+ * @dumpit: Function pointer called for each dump request (NLM_F_DUMP) message
+ *
+ * Registers the specified function pointers (at least one of them has
+ * to be non-NULL) to be called whenever a request message for the
+ * specified protocol family and message type is received.
+ *
+ * The special protocol family PF_UNSPEC may be used to define fallback
+ * function pointers for the case when no entry for the specific protocol
+ * family exists.
+ *
+ * Returns 0 on success or a negative error code.
+ */
+int __rtnl_register(int protocol, int msgtype,
+ rtnl_doit_func doit, rtnl_dumpit_func dumpit)
+{
+ struct rtnl_link *tab;
+ int msgindex;
+
+ BUG_ON(protocol < 0 || protocol >= NPROTO);
+ msgindex = rtm_msgindex(msgtype);
+
+ tab = rtnl_msg_handlers[protocol];
+ if (tab == NULL) {
+ tab = kcalloc(RTM_NR_MSGTYPES, sizeof(*tab), GFP_KERNEL);
+ if (tab == NULL)
+ return -ENOBUFS;
+
+ rtnl_msg_handlers[protocol] = tab;
+ }
+
+ if (doit)
+ tab[msgindex].doit = doit;
+
+ if (dumpit)
+ tab[msgindex].dumpit = dumpit;
+
+ return 0;
+}
+
+EXPORT_SYMBOL_GPL(__rtnl_register);
+
+/**
+ * rtnl_register - Register a rtnetlink message type
+ *
+ * Identical to __rtnl_register() but panics on failure. This is useful
+ * as failure of this function is very unlikely, it can only happen due
+ * to lack of memory when allocating the chain to store all message
+ * handlers for a protocol. Meant for use in init functions where lack
+ * of memory implies no sense in continueing.
+ */
+void rtnl_register(int protocol, int msgtype,
+ rtnl_doit_func doit, rtnl_dumpit_func dumpit)
+{
+ if (__rtnl_register(protocol, msgtype, doit, dumpit) < 0)
+ panic("Unable to register rtnetlink message handler, "
+ "protocol = %d, message type = %d\n",
+ protocol, msgtype);
+}
+
+EXPORT_SYMBOL_GPL(rtnl_register);
+
+/**
+ * rtnl_unregister - Unregister a rtnetlink message type
+ * @protocol: Protocol family or PF_UNSPEC
+ * @msgtype: rtnetlink message type
+ *
+ * Returns 0 on success or a negative error code.
+ */
+int rtnl_unregister(int protocol, int msgtype)
+{
+ int msgindex;
+
+ BUG_ON(protocol < 0 || protocol >= NPROTO);
+ msgindex = rtm_msgindex(msgtype);
+
+ if (rtnl_msg_handlers[protocol] == NULL)
+ return -ENOENT;
+
+ rtnl_msg_handlers[protocol][msgindex].doit = NULL;
+ rtnl_msg_handlers[protocol][msgindex].dumpit = NULL;
+
+ return 0;
+}
+
+EXPORT_SYMBOL_GPL(rtnl_unregister);
+
+/**
+ * rtnl_unregister_all - Unregister all rtnetlink message type of a protocol
+ * @protocol : Protocol family or PF_UNSPEC
+ *
+ * Identical to calling rtnl_unregster() for all registered message types
+ * of a certain protocol family.
+ */
+void rtnl_unregister_all(int protocol)
+{
+ BUG_ON(protocol < 0 || protocol >= NPROTO);
+
+ kfree(rtnl_msg_handlers[protocol]);
+ rtnl_msg_handlers[protocol] = NULL;
+}
+
+EXPORT_SYMBOL_GPL(rtnl_unregister_all);
static const int rtm_min[RTM_NR_FAMILIES] =
{
@@ -647,7 +797,7 @@ errout:
return err;
}
-static int rtnl_dump_all(struct sk_buff *skb, struct netlink_callback *cb)
+int rtnl_dump_all(struct sk_buff *skb, struct netlink_callback *cb)
{
int idx;
int s_idx = cb->family;
@@ -658,12 +808,12 @@ static int rtnl_dump_all(struct sk_buff
int type = cb->nlh->nlmsg_type-RTM_BASE;
if (idx < s_idx || idx == PF_PACKET)
continue;
- if (rtnetlink_links[idx] == NULL ||
- rtnetlink_links[idx][type].dumpit == NULL)
+ if (rtnl_msg_handlers[idx] == NULL ||
+ rtnl_msg_handlers[idx][type].dumpit == NULL)
continue;
if (idx > s_idx)
memset(&cb->args[0], 0, sizeof(cb->args));
- if (rtnetlink_links[idx][type].dumpit(skb, cb))
+ if (rtnl_msg_handlers[idx][type].dumpit(skb, cb))
break;
}
cb->family = idx;
@@ -671,6 +821,8 @@ static int rtnl_dump_all(struct sk_buff
return skb->len;
}
+EXPORT_SYMBOL_GPL(rtnl_dump_all);
+
void rtmsg_ifinfo(int type, struct net_device *dev, unsigned change)
{
struct sk_buff *skb;
@@ -702,8 +854,7 @@ static int rtattr_max;
static __inline__ int
rtnetlink_rcv_msg(struct sk_buff *skb, struct nlmsghdr *nlh, int *errp)
{
- struct rtnetlink_link *link;
- struct rtnetlink_link *link_tab;
+ rtnl_doit_func doit;
int sz_idx, kind;
int min_len;
int family;
@@ -736,11 +887,6 @@ rtnetlink_rcv_msg(struct sk_buff *skb, s
return -1;
}
- link_tab = rtnetlink_links[family];
- if (link_tab == NULL)
- link_tab = rtnetlink_links[PF_UNSPEC];
- link = &link_tab[type];
-
sz_idx = type>>2;
kind = type&3;
@@ -750,14 +896,14 @@ rtnetlink_rcv_msg(struct sk_buff *skb, s
}
if (kind == 2 && nlh->nlmsg_flags&NLM_F_DUMP) {
- if (link->dumpit == NULL)
- link = &(rtnetlink_links[PF_UNSPEC][type]);
+ rtnl_dumpit_func dumpit;
- if (link->dumpit == NULL)
+ dumpit = rtnl_get_dumpit(family, type);
+ if (dumpit == NULL)
goto err_inval;
if ((*errp = netlink_dump_start(rtnl, skb, nlh,
- link->dumpit, NULL)) != 0) {
+ dumpit, NULL)) != 0) {
return -1;
}
@@ -786,11 +932,10 @@ rtnetlink_rcv_msg(struct sk_buff *skb, s
}
}
- if (link->doit == NULL)
- link = &(rtnetlink_links[PF_UNSPEC][type]);
- if (link->doit == NULL)
+ doit = rtnl_get_doit(family, type);
+ if (doit == NULL)
goto err_inval;
- err = link->doit(skb, nlh, (void *)&rta_buf[0]);
+ err = doit(skb, nlh, (void *)&rta_buf[0]);
*errp = err;
return err;
@@ -885,7 +1030,6 @@ void __init rtnetlink_init(void)
EXPORT_SYMBOL(__rta_fill);
EXPORT_SYMBOL(rtattr_strlcpy);
EXPORT_SYMBOL(rtattr_parse);
-EXPORT_SYMBOL(rtnetlink_links);
EXPORT_SYMBOL(rtnetlink_put_metrics);
EXPORT_SYMBOL(rtnl_lock);
EXPORT_SYMBOL(rtnl_trylock);
Index: net-2.6.22/include/linux/rtnetlink.h
===================================================================
--- net-2.6.22.orig/include/linux/rtnetlink.h 2007-03-22 12:48:05.000000000 +0100
+++ net-2.6.22/include/linux/rtnetlink.h 2007-03-22 12:48:20.000000000 +0100
@@ -574,13 +574,6 @@ extern int rtattr_parse(struct rtattr *t
#define rtattr_parse_nested(tb, max, rta) \
rtattr_parse((tb), (max), RTA_DATA((rta)), RTA_PAYLOAD((rta)))
-struct rtnetlink_link
-{
- int (*doit)(struct sk_buff *, struct nlmsghdr*, void *attr);
- int (*dumpit)(struct sk_buff *, struct netlink_callback *cb);
-};
-
-extern struct rtnetlink_link * rtnetlink_links[NPROTO];
extern int rtnetlink_send(struct sk_buff *skb, u32 pid, u32 group, int echo);
extern int rtnl_unicast(struct sk_buff *skb, u32 pid);
extern int rtnl_notify(struct sk_buff *skb, u32 pid, u32 group,
--
^ permalink raw reply [flat|nested] 20+ messages in thread* [PATCH 02/12] [NET] link: Use rtnl registration interface
2007-03-22 12:59 [PATCH 00/12] [RESEND] rtnetlink message handler registration interface Thomas Graf
2007-03-22 12:59 ` [PATCH 01/12] [RTNL]: Message " Thomas Graf
@ 2007-03-22 12:59 ` Thomas Graf
2007-03-22 12:59 ` [PATCH 03/12] [NEIGH]: " Thomas Graf
` (10 subsequent siblings)
12 siblings, 0 replies; 20+ messages in thread
From: Thomas Graf @ 2007-03-22 12:59 UTC (permalink / raw)
To: davem; +Cc: netdev, Thomas Graf
[-- Attachment #1: rtnl_reg_core_convert --]
[-- Type: text/plain, Size: 1287 bytes --]
Signed-off-by: Thomas Graf <tgraf@suug.ch>
Index: net-2.6.22/net/core/rtnetlink.c
===================================================================
--- net-2.6.22.orig/net/core/rtnetlink.c 2007-03-22 12:48:20.000000000 +0100
+++ net-2.6.22/net/core/rtnetlink.c 2007-03-22 12:49:31.000000000 +0100
@@ -960,9 +960,6 @@ static void rtnetlink_rcv(struct sock *s
static struct rtnetlink_link link_rtnetlink_table[RTM_NR_MSGTYPES] =
{
- [RTM_GETLINK - RTM_BASE] = { .doit = rtnl_getlink,
- .dumpit = rtnl_dump_ifinfo },
- [RTM_SETLINK - RTM_BASE] = { .doit = rtnl_setlink },
[RTM_GETADDR - RTM_BASE] = { .dumpit = rtnl_dump_all },
[RTM_GETROUTE - RTM_BASE] = { .dumpit = rtnl_dump_all },
[RTM_NEWNEIGH - RTM_BASE] = { .doit = neigh_add },
@@ -1023,8 +1020,9 @@ void __init rtnetlink_init(void)
panic("rtnetlink_init: cannot initialize rtnetlink\n");
netlink_set_nonroot(NETLINK_ROUTE, NL_NONROOT_RECV);
register_netdevice_notifier(&rtnetlink_dev_notifier);
- rtnetlink_links[PF_UNSPEC] = link_rtnetlink_table;
- rtnetlink_links[PF_PACKET] = link_rtnetlink_table;
+
+ rtnl_register(PF_UNSPEC, RTM_GETLINK, rtnl_getlink, rtnl_dump_ifinfo);
+ rtnl_register(PF_UNSPEC, RTM_SETLINK, rtnl_setlink, NULL);
}
EXPORT_SYMBOL(__rta_fill);
--
^ permalink raw reply [flat|nested] 20+ messages in thread* [PATCH 03/12] [NEIGH]: Use rtnl registration interface
2007-03-22 12:59 [PATCH 00/12] [RESEND] rtnetlink message handler registration interface Thomas Graf
2007-03-22 12:59 ` [PATCH 01/12] [RTNL]: Message " Thomas Graf
2007-03-22 12:59 ` [PATCH 02/12] [NET] link: Use rtnl " Thomas Graf
@ 2007-03-22 12:59 ` Thomas Graf
2007-03-22 12:59 ` [PATCH 04/12] [NET] rules: " Thomas Graf
` (9 subsequent siblings)
12 siblings, 0 replies; 20+ messages in thread
From: Thomas Graf @ 2007-03-22 12:59 UTC (permalink / raw)
To: davem; +Cc: netdev, Thomas Graf
[-- Attachment #1: rtnl_reg_neigh_convert --]
[-- Type: text/plain, Size: 5220 bytes --]
Signed-off-by: Thomas Graf <tgraf@suug.ch>
Index: net-2.6.22/include/net/neighbour.h
===================================================================
--- net-2.6.22.orig/include/net/neighbour.h 2007-03-22 12:48:05.000000000 +0100
+++ net-2.6.22/include/net/neighbour.h 2007-03-22 12:49:47.000000000 +0100
@@ -24,6 +24,7 @@
#include <linux/err.h>
#include <linux/sysctl.h>
+#include <net/rtnetlink.h>
#define NUD_IN_TIMER (NUD_INCOMPLETE|NUD_REACHABLE|NUD_DELAY|NUD_PROBE)
#define NUD_VALID (NUD_PERMANENT|NUD_NOARP|NUD_REACHABLE|NUD_PROBE|NUD_STALE|NUD_DELAY)
@@ -213,16 +214,7 @@ extern void pneigh_enqueue(struct neig
extern struct pneigh_entry *pneigh_lookup(struct neigh_table *tbl, const void *key, struct net_device *dev, int creat);
extern int pneigh_delete(struct neigh_table *tbl, const void *key, struct net_device *dev);
-struct netlink_callback;
-struct nlmsghdr;
-extern int neigh_dump_info(struct sk_buff *skb, struct netlink_callback *cb);
-extern int neigh_add(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg);
-extern int neigh_delete(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg);
extern void neigh_app_ns(struct neighbour *n);
-
-extern int neightbl_dump_info(struct sk_buff *skb, struct netlink_callback *cb);
-extern int neightbl_set(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg);
-
extern void neigh_for_each(struct neigh_table *tbl, void (*cb)(struct neighbour *, void *), void *cookie);
extern void __neigh_for_each_release(struct neigh_table *tbl, int (*cb)(struct neighbour *));
extern void pneigh_for_each(struct neigh_table *tbl, void (*cb)(struct pneigh_entry *));
Index: net-2.6.22/net/core/neighbour.c
===================================================================
--- net-2.6.22.orig/net/core/neighbour.c 2007-03-22 12:48:05.000000000 +0100
+++ net-2.6.22/net/core/neighbour.c 2007-03-22 12:51:12.000000000 +0100
@@ -1435,7 +1435,7 @@ int neigh_table_clear(struct neigh_table
return 0;
}
-int neigh_delete(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg)
+static int neigh_delete(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg)
{
struct ndmsg *ndm;
struct nlattr *dst_attr;
@@ -1500,7 +1500,7 @@ out:
return err;
}
-int neigh_add(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg)
+static int neigh_add(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg)
{
struct ndmsg *ndm;
struct nlattr *tb[NDA_MAX+1];
@@ -1780,7 +1780,7 @@ static struct nla_policy nl_ntbl_parm_po
[NDTPA_LOCKTIME] = { .type = NLA_U64 },
};
-int neightbl_set(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg)
+static int neightbl_set(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg)
{
struct neigh_table *tbl;
struct ndtmsg *ndtmsg;
@@ -1904,7 +1904,7 @@ errout:
return err;
}
-int neightbl_dump_info(struct sk_buff *skb, struct netlink_callback *cb)
+static int neightbl_dump_info(struct sk_buff *skb, struct netlink_callback *cb)
{
int family, tidx, nidx = 0;
int tbl_skip = cb->args[0];
@@ -2028,7 +2028,7 @@ out:
return rc;
}
-int neigh_dump_info(struct sk_buff *skb, struct netlink_callback *cb)
+static int neigh_dump_info(struct sk_buff *skb, struct netlink_callback *cb)
{
struct neigh_table *tbl;
int t, family, s_t;
@@ -2737,14 +2737,26 @@ void neigh_sysctl_unregister(struct neig
#endif /* CONFIG_SYSCTL */
+static int __init neigh_init(void)
+{
+ rtnl_register(PF_UNSPEC, RTM_NEWNEIGH, neigh_add, NULL);
+ rtnl_register(PF_UNSPEC, RTM_DELNEIGH, neigh_delete, NULL);
+ rtnl_register(PF_UNSPEC, RTM_GETNEIGH, NULL, neigh_dump_info);
+
+ rtnl_register(PF_UNSPEC, RTM_GETNEIGHTBL, NULL, neightbl_dump_info);
+ rtnl_register(PF_UNSPEC, RTM_SETNEIGHTBL, neightbl_set, NULL);
+
+ return 0;
+}
+
+subsys_initcall(neigh_init);
+
EXPORT_SYMBOL(__neigh_event_send);
EXPORT_SYMBOL(neigh_changeaddr);
EXPORT_SYMBOL(neigh_compat_output);
EXPORT_SYMBOL(neigh_connected_output);
EXPORT_SYMBOL(neigh_create);
-EXPORT_SYMBOL(neigh_delete);
EXPORT_SYMBOL(neigh_destroy);
-EXPORT_SYMBOL(neigh_dump_info);
EXPORT_SYMBOL(neigh_event_ns);
EXPORT_SYMBOL(neigh_ifdown);
EXPORT_SYMBOL(neigh_lookup);
Index: net-2.6.22/net/core/rtnetlink.c
===================================================================
--- net-2.6.22.orig/net/core/rtnetlink.c 2007-03-22 12:49:31.000000000 +0100
+++ net-2.6.22/net/core/rtnetlink.c 2007-03-22 12:49:47.000000000 +0100
@@ -962,16 +962,11 @@ static struct rtnetlink_link link_rtnetl
{
[RTM_GETADDR - RTM_BASE] = { .dumpit = rtnl_dump_all },
[RTM_GETROUTE - RTM_BASE] = { .dumpit = rtnl_dump_all },
- [RTM_NEWNEIGH - RTM_BASE] = { .doit = neigh_add },
- [RTM_DELNEIGH - RTM_BASE] = { .doit = neigh_delete },
- [RTM_GETNEIGH - RTM_BASE] = { .dumpit = neigh_dump_info },
#ifdef CONFIG_FIB_RULES
[RTM_NEWRULE - RTM_BASE] = { .doit = fib_nl_newrule },
[RTM_DELRULE - RTM_BASE] = { .doit = fib_nl_delrule },
#endif
[RTM_GETRULE - RTM_BASE] = { .dumpit = rtnl_dump_all },
- [RTM_GETNEIGHTBL - RTM_BASE] = { .dumpit = neightbl_dump_info },
- [RTM_SETNEIGHTBL - RTM_BASE] = { .doit = neightbl_set },
};
static int rtnetlink_event(struct notifier_block *this, unsigned long event, void *ptr)
--
^ permalink raw reply [flat|nested] 20+ messages in thread* [PATCH 04/12] [NET] rules: Use rtnl registration interface
2007-03-22 12:59 [PATCH 00/12] [RESEND] rtnetlink message handler registration interface Thomas Graf
` (2 preceding siblings ...)
2007-03-22 12:59 ` [PATCH 03/12] [NEIGH]: " Thomas Graf
@ 2007-03-22 12:59 ` Thomas Graf
2007-03-22 13:00 ` [PATCH 05/12] [IPv4]: " Thomas Graf
` (8 subsequent siblings)
12 siblings, 0 replies; 20+ messages in thread
From: Thomas Graf @ 2007-03-22 12:59 UTC (permalink / raw)
To: davem; +Cc: netdev, Thomas Graf
[-- Attachment #1: rtnl_reg_rules_convert --]
[-- Type: text/plain, Size: 2874 bytes --]
Signed-off-by: Thomas Graf <tgraf@suug.ch>
Index: net-2.6.22/net/core/fib_rules.c
===================================================================
--- net-2.6.22.orig/net/core/fib_rules.c 2007-03-22 12:48:05.000000000 +0100
+++ net-2.6.22/net/core/fib_rules.c 2007-03-22 12:52:34.000000000 +0100
@@ -152,7 +152,7 @@ out:
EXPORT_SYMBOL_GPL(fib_rules_lookup);
-int fib_nl_newrule(struct sk_buff *skb, struct nlmsghdr* nlh, void *arg)
+static int fib_nl_newrule(struct sk_buff *skb, struct nlmsghdr* nlh, void *arg)
{
struct fib_rule_hdr *frh = nlmsg_data(nlh);
struct fib_rules_ops *ops = NULL;
@@ -239,7 +239,7 @@ errout:
return err;
}
-int fib_nl_delrule(struct sk_buff *skb, struct nlmsghdr* nlh, void *arg)
+static int fib_nl_delrule(struct sk_buff *skb, struct nlmsghdr* nlh, void *arg)
{
struct fib_rule_hdr *frh = nlmsg_data(nlh);
struct fib_rules_ops *ops = NULL;
@@ -471,6 +471,10 @@ static struct notifier_block fib_rules_n
static int __init fib_rules_init(void)
{
+ rtnl_register(PF_UNSPEC, RTM_NEWRULE, fib_nl_newrule, NULL);
+ rtnl_register(PF_UNSPEC, RTM_DELRULE, fib_nl_delrule, NULL);
+ rtnl_register(PF_UNSPEC, RTM_GETRULE, NULL, rtnl_dump_all);
+
return register_netdevice_notifier(&fib_rules_notifier);
}
Index: net-2.6.22/include/net/fib_rules.h
===================================================================
--- net-2.6.22.orig/include/net/fib_rules.h 2007-03-22 12:48:05.000000000 +0100
+++ net-2.6.22/include/net/fib_rules.h 2007-03-22 12:51:31.000000000 +0100
@@ -5,7 +5,7 @@
#include <linux/netdevice.h>
#include <linux/fib_rules.h>
#include <net/flow.h>
-#include <net/netlink.h>
+#include <net/rtnetlink.h>
struct fib_rule
{
@@ -98,10 +98,6 @@ extern int fib_rules_lookup(struct fib
struct flowi *, int flags,
struct fib_lookup_arg *);
-extern int fib_nl_newrule(struct sk_buff *,
- struct nlmsghdr *, void *);
-extern int fib_nl_delrule(struct sk_buff *,
- struct nlmsghdr *, void *);
extern int fib_rules_dump(struct sk_buff *,
struct netlink_callback *, int);
#endif
Index: net-2.6.22/net/core/rtnetlink.c
===================================================================
--- net-2.6.22.orig/net/core/rtnetlink.c 2007-03-22 12:49:47.000000000 +0100
+++ net-2.6.22/net/core/rtnetlink.c 2007-03-22 12:51:31.000000000 +0100
@@ -962,11 +962,6 @@ static struct rtnetlink_link link_rtnetl
{
[RTM_GETADDR - RTM_BASE] = { .dumpit = rtnl_dump_all },
[RTM_GETROUTE - RTM_BASE] = { .dumpit = rtnl_dump_all },
-#ifdef CONFIG_FIB_RULES
- [RTM_NEWRULE - RTM_BASE] = { .doit = fib_nl_newrule },
- [RTM_DELRULE - RTM_BASE] = { .doit = fib_nl_delrule },
-#endif
- [RTM_GETRULE - RTM_BASE] = { .dumpit = rtnl_dump_all },
};
static int rtnetlink_event(struct notifier_block *this, unsigned long event, void *ptr)
--
^ permalink raw reply [flat|nested] 20+ messages in thread* [PATCH 05/12] [IPv4]: Use rtnl registration interface
2007-03-22 12:59 [PATCH 00/12] [RESEND] rtnetlink message handler registration interface Thomas Graf
` (3 preceding siblings ...)
2007-03-22 12:59 ` [PATCH 04/12] [NET] rules: " Thomas Graf
@ 2007-03-22 13:00 ` Thomas Graf
2007-03-22 13:00 ` [PATCH 06/12] [PKT_SCHED] qdisc: " Thomas Graf
` (7 subsequent siblings)
12 siblings, 0 replies; 20+ messages in thread
From: Thomas Graf @ 2007-03-22 13:00 UTC (permalink / raw)
To: davem; +Cc: netdev, Thomas Graf
[-- Attachment #1: rtnl_reg_ip4_convert --]
[-- Type: text/plain, Size: 6868 bytes --]
Signed-off-by: Thomas Graf <tgraf@suug.ch>
Index: net-2.6.22/include/net/ip_fib.h
===================================================================
--- net-2.6.22.orig/include/net/ip_fib.h 2007-03-22 12:48:05.000000000 +0100
+++ net-2.6.22/include/net/ip_fib.h 2007-03-22 12:53:03.000000000 +0100
@@ -215,10 +215,6 @@ extern void fib_select_default(const str
/* Exported by fib_frontend.c */
extern struct nla_policy rtm_ipv4_policy[];
extern void ip_fib_init(void);
-extern int inet_rtm_delroute(struct sk_buff *skb, struct nlmsghdr* nlh, void *arg);
-extern int inet_rtm_newroute(struct sk_buff *skb, struct nlmsghdr* nlh, void *arg);
-extern int inet_rtm_getroute(struct sk_buff *skb, struct nlmsghdr* nlh, void *arg);
-extern int inet_dump_fib(struct sk_buff *skb, struct netlink_callback *cb);
extern int fib_validate_source(__be32 src, __be32 dst, u8 tos, int oif,
struct net_device *dev, __be32 *spec_dst, u32 *itag);
extern void fib_select_multipath(const struct flowi *flp, struct fib_result *res);
@@ -235,8 +231,6 @@ extern __be32 __fib_res_prefsrc(struct
extern struct fib_table *fib_hash_init(u32 id);
#ifdef CONFIG_IP_MULTIPLE_TABLES
-extern int fib4_rules_dump(struct sk_buff *skb, struct netlink_callback *cb);
-
extern void __init fib4_rules_init(void);
#ifdef CONFIG_NET_CLS_ROUTE
Index: net-2.6.22/net/ipv4/devinet.c
===================================================================
--- net-2.6.22.orig/net/ipv4/devinet.c 2007-03-22 12:48:05.000000000 +0100
+++ net-2.6.22/net/ipv4/devinet.c 2007-03-22 12:54:49.000000000 +0100
@@ -48,7 +48,6 @@
#include <linux/netdevice.h>
#include <linux/etherdevice.h>
#include <linux/skbuff.h>
-#include <linux/rtnetlink.h>
#include <linux/init.h>
#include <linux/notifier.h>
#include <linux/inetdevice.h>
@@ -62,7 +61,7 @@
#include <net/ip.h>
#include <net/route.h>
#include <net/ip_fib.h>
-#include <net/netlink.h>
+#include <net/rtnetlink.h>
struct ipv4_devconf ipv4_devconf = {
.accept_redirects = 1,
@@ -1241,19 +1240,6 @@ errout:
rtnl_set_sk_err(RTNLGRP_IPV4_IFADDR, err);
}
-static struct rtnetlink_link inet_rtnetlink_table[RTM_NR_MSGTYPES] = {
- [RTM_NEWADDR - RTM_BASE] = { .doit = inet_rtm_newaddr, },
- [RTM_DELADDR - RTM_BASE] = { .doit = inet_rtm_deladdr, },
- [RTM_GETADDR - RTM_BASE] = { .dumpit = inet_dump_ifaddr, },
- [RTM_NEWROUTE - RTM_BASE] = { .doit = inet_rtm_newroute, },
- [RTM_DELROUTE - RTM_BASE] = { .doit = inet_rtm_delroute, },
- [RTM_GETROUTE - RTM_BASE] = { .doit = inet_rtm_getroute,
- .dumpit = inet_dump_fib, },
-#ifdef CONFIG_IP_MULTIPLE_TABLES
- [RTM_GETRULE - RTM_BASE] = { .dumpit = fib4_rules_dump, },
-#endif
-};
-
#ifdef CONFIG_SYSCTL
void inet_forward_change(void)
@@ -1636,7 +1622,10 @@ void __init devinet_init(void)
{
register_gifconf(PF_INET, inet_gifconf);
register_netdevice_notifier(&ip_netdev_notifier);
- rtnetlink_links[PF_INET] = inet_rtnetlink_table;
+
+ rtnl_register(PF_INET, RTM_NEWADDR, inet_rtm_newaddr, NULL);
+ rtnl_register(PF_INET, RTM_DELADDR, inet_rtm_deladdr, NULL);
+ rtnl_register(PF_INET, RTM_GETADDR, NULL, inet_dump_ifaddr);
#ifdef CONFIG_SYSCTL
devinet_sysctl.sysctl_header =
register_sysctl_table(devinet_sysctl.devinet_root_dir);
Index: net-2.6.22/net/ipv4/fib_rules.c
===================================================================
--- net-2.6.22.orig/net/ipv4/fib_rules.c 2007-03-22 12:48:05.000000000 +0100
+++ net-2.6.22/net/ipv4/fib_rules.c 2007-03-22 13:23:53.000000000 +0100
@@ -277,7 +277,7 @@ nla_put_failure:
return -ENOBUFS;
}
-int fib4_rules_dump(struct sk_buff *skb, struct netlink_callback *cb)
+static int fib4_rule_dump(struct sk_buff *skb, struct netlink_callback *cb)
{
return fib_rules_dump(skb, cb, AF_INET);
}
@@ -329,4 +329,6 @@ void __init fib4_rules_init(void)
list_add_tail(&default_rule.common.list, &fib4_rules);
fib_rules_register(&fib4_rules_ops);
+
+ rtnl_register(PF_INET, RTM_GETRULE, NULL, fib4_rule_dump);
}
Index: net-2.6.22/net/ipv4/fib_frontend.c
===================================================================
--- net-2.6.22.orig/net/ipv4/fib_frontend.c 2007-03-22 12:48:05.000000000 +0100
+++ net-2.6.22/net/ipv4/fib_frontend.c 2007-03-22 12:57:04.000000000 +0100
@@ -34,7 +34,6 @@
#include <linux/if_addr.h>
#include <linux/if_arp.h>
#include <linux/skbuff.h>
-#include <linux/netlink.h>
#include <linux/init.h>
#include <linux/list.h>
@@ -46,6 +45,7 @@
#include <net/icmp.h>
#include <net/arp.h>
#include <net/ip_fib.h>
+#include <net/rtnetlink.h>
#define FFprint(a...) printk(KERN_DEBUG a)
@@ -535,7 +535,7 @@ errout:
return err;
}
-int inet_rtm_delroute(struct sk_buff *skb, struct nlmsghdr* nlh, void *arg)
+static int inet_rtm_delroute(struct sk_buff *skb, struct nlmsghdr* nlh, void *arg)
{
struct fib_config cfg;
struct fib_table *tb;
@@ -556,7 +556,7 @@ errout:
return err;
}
-int inet_rtm_newroute(struct sk_buff *skb, struct nlmsghdr* nlh, void *arg)
+static int inet_rtm_newroute(struct sk_buff *skb, struct nlmsghdr* nlh, void *arg)
{
struct fib_config cfg;
struct fib_table *tb;
@@ -577,7 +577,7 @@ errout:
return err;
}
-int inet_dump_fib(struct sk_buff *skb, struct netlink_callback *cb)
+static int inet_dump_fib(struct sk_buff *skb, struct netlink_callback *cb)
{
unsigned int h, s_h;
unsigned int e = 0, s_e;
@@ -914,6 +914,10 @@ void __init ip_fib_init(void)
register_netdevice_notifier(&fib_netdev_notifier);
register_inetaddr_notifier(&fib_inetaddr_notifier);
nl_fib_lookup_init();
+
+ rtnl_register(PF_INET, RTM_NEWROUTE, inet_rtm_newroute, NULL);
+ rtnl_register(PF_INET, RTM_DELROUTE, inet_rtm_delroute, NULL);
+ rtnl_register(PF_INET, RTM_GETROUTE, NULL, inet_dump_fib);
}
EXPORT_SYMBOL(inet_addr_type);
Index: net-2.6.22/net/ipv4/route.c
===================================================================
--- net-2.6.22.orig/net/ipv4/route.c 2007-03-22 12:48:05.000000000 +0100
+++ net-2.6.22/net/ipv4/route.c 2007-03-22 12:57:26.000000000 +0100
@@ -82,7 +82,6 @@
#include <linux/proc_fs.h>
#include <linux/init.h>
#include <linux/skbuff.h>
-#include <linux/rtnetlink.h>
#include <linux/inetdevice.h>
#include <linux/igmp.h>
#include <linux/pkt_sched.h>
@@ -104,6 +103,7 @@
#include <net/xfrm.h>
#include <net/ip_mp_alg.h>
#include <net/netevent.h>
+#include <net/rtnetlink.h>
#ifdef CONFIG_SYSCTL
#include <linux/sysctl.h>
#endif
@@ -2721,7 +2721,7 @@ nla_put_failure:
return -EMSGSIZE;
}
-int inet_rtm_getroute(struct sk_buff *in_skb, struct nlmsghdr* nlh, void *arg)
+static int inet_rtm_getroute(struct sk_buff *in_skb, struct nlmsghdr* nlh, void *arg)
{
struct rtmsg *rtm;
struct nlattr *tb[RTA_MAX+1];
@@ -3194,6 +3194,8 @@ int __init ip_rt_init(void)
xfrm_init();
xfrm4_init();
#endif
+ rtnl_register(PF_INET, RTM_GETROUTE, inet_rtm_getroute, NULL);
+
return rc;
}
--
^ permalink raw reply [flat|nested] 20+ messages in thread* [PATCH 06/12] [PKT_SCHED] qdisc: Use rtnl registration interface
2007-03-22 12:59 [PATCH 00/12] [RESEND] rtnetlink message handler registration interface Thomas Graf
` (4 preceding siblings ...)
2007-03-22 13:00 ` [PATCH 05/12] [IPv4]: " Thomas Graf
@ 2007-03-22 13:00 ` Thomas Graf
2007-03-22 13:00 ` [PATCH 07/12] [PKT_SCHED] cls: " Thomas Graf
` (6 subsequent siblings)
12 siblings, 0 replies; 20+ messages in thread
From: Thomas Graf @ 2007-03-22 13:00 UTC (permalink / raw)
To: davem; +Cc: netdev, Thomas Graf
[-- Attachment #1: rtnl_reg_qdisc_convert --]
[-- Type: text/plain, Size: 2385 bytes --]
Signed-off-by: Thomas Graf <tgraf@suug.ch>
Index: net-2.6.22/include/net/sch_generic.h
===================================================================
--- net-2.6.22.orig/include/net/sch_generic.h 2007-03-22 13:23:14.000000000 +0100
+++ net-2.6.22/include/net/sch_generic.h 2007-03-22 13:23:57.000000000 +0100
@@ -5,10 +5,10 @@
#include <linux/types.h>
#include <linux/rcupdate.h>
#include <linux/module.h>
-#include <linux/rtnetlink.h>
#include <linux/pkt_sched.h>
#include <linux/pkt_cls.h>
#include <net/gen_stats.h>
+#include <net/rtnetlink.h>
struct Qdisc_ops;
struct qdisc_walker;
Index: net-2.6.22/net/sched/sch_api.c
===================================================================
--- net-2.6.22.orig/net/sched/sch_api.c 2007-03-22 13:23:14.000000000 +0100
+++ net-2.6.22/net/sched/sch_api.c 2007-03-22 13:23:57.000000000 +0100
@@ -27,7 +27,6 @@
#include <linux/interrupt.h>
#include <linux/netdevice.h>
#include <linux/skbuff.h>
-#include <linux/rtnetlink.h>
#include <linux/init.h>
#include <linux/proc_fs.h>
#include <linux/seq_file.h>
@@ -1239,29 +1238,17 @@ static const struct file_operations psch
static int __init pktsched_init(void)
{
- struct rtnetlink_link *link_p;
-
- link_p = rtnetlink_links[PF_UNSPEC];
-
- /* Setup rtnetlink links. It is made here to avoid
- exporting large number of public symbols.
- */
-
- if (link_p) {
- link_p[RTM_NEWQDISC-RTM_BASE].doit = tc_modify_qdisc;
- link_p[RTM_DELQDISC-RTM_BASE].doit = tc_get_qdisc;
- link_p[RTM_GETQDISC-RTM_BASE].doit = tc_get_qdisc;
- link_p[RTM_GETQDISC-RTM_BASE].dumpit = tc_dump_qdisc;
- link_p[RTM_NEWTCLASS-RTM_BASE].doit = tc_ctl_tclass;
- link_p[RTM_DELTCLASS-RTM_BASE].doit = tc_ctl_tclass;
- link_p[RTM_GETTCLASS-RTM_BASE].doit = tc_ctl_tclass;
- link_p[RTM_GETTCLASS-RTM_BASE].dumpit = tc_dump_tclass;
- }
-
register_qdisc(&pfifo_qdisc_ops);
register_qdisc(&bfifo_qdisc_ops);
proc_net_fops_create("psched", 0, &psched_fops);
+ rtnl_register(PF_UNSPEC, RTM_NEWQDISC, tc_modify_qdisc, NULL);
+ rtnl_register(PF_UNSPEC, RTM_DELQDISC, tc_get_qdisc, NULL);
+ rtnl_register(PF_UNSPEC, RTM_GETQDISC, tc_get_qdisc, tc_dump_qdisc);
+ rtnl_register(PF_UNSPEC, RTM_NEWTCLASS, tc_ctl_tclass, NULL);
+ rtnl_register(PF_UNSPEC, RTM_DELTCLASS, tc_ctl_tclass, NULL);
+ rtnl_register(PF_UNSPEC, RTM_GETTCLASS, tc_ctl_tclass, tc_dump_tclass);
+
return 0;
}
--
^ permalink raw reply [flat|nested] 20+ messages in thread* [PATCH 07/12] [PKT_SCHED] cls: Use rtnl registration interface
2007-03-22 12:59 [PATCH 00/12] [RESEND] rtnetlink message handler registration interface Thomas Graf
` (5 preceding siblings ...)
2007-03-22 13:00 ` [PATCH 06/12] [PKT_SCHED] qdisc: " Thomas Graf
@ 2007-03-22 13:00 ` Thomas Graf
2007-03-22 13:00 ` [PATCH 08/12] [PKT_SCHED] act: " Thomas Graf
` (5 subsequent siblings)
12 siblings, 0 replies; 20+ messages in thread
From: Thomas Graf @ 2007-03-22 13:00 UTC (permalink / raw)
To: davem; +Cc: netdev, Thomas Graf
[-- Attachment #1: rtnl_reg_cls_convert --]
[-- Type: text/plain, Size: 1284 bytes --]
Signed-off-by: Thomas Graf <tgraf@suug.ch>
Index: net-2.6.22/net/sched/cls_api.c
===================================================================
--- net-2.6.22.orig/net/sched/cls_api.c 2007-03-22 13:23:14.000000000 +0100
+++ net-2.6.22/net/sched/cls_api.c 2007-03-22 13:23:58.000000000 +0100
@@ -29,7 +29,6 @@
#include <linux/interrupt.h>
#include <linux/netdevice.h>
#include <linux/skbuff.h>
-#include <linux/rtnetlink.h>
#include <linux/init.h>
#include <linux/kmod.h>
#include <linux/netlink.h>
@@ -616,18 +615,11 @@ rtattr_failure: __attribute__ ((unused))
static int __init tc_filter_init(void)
{
- struct rtnetlink_link *link_p = rtnetlink_links[PF_UNSPEC];
+ rtnl_register(PF_UNSPEC, RTM_NEWTFILTER, tc_ctl_tfilter, NULL);
+ rtnl_register(PF_UNSPEC, RTM_DELTFILTER, tc_ctl_tfilter, NULL);
+ rtnl_register(PF_UNSPEC, RTM_GETTFILTER, tc_ctl_tfilter,
+ tc_dump_tfilter);
- /* Setup rtnetlink links. It is made here to avoid
- exporting large number of public symbols.
- */
-
- if (link_p) {
- link_p[RTM_NEWTFILTER-RTM_BASE].doit = tc_ctl_tfilter;
- link_p[RTM_DELTFILTER-RTM_BASE].doit = tc_ctl_tfilter;
- link_p[RTM_GETTFILTER-RTM_BASE].doit = tc_ctl_tfilter;
- link_p[RTM_GETTFILTER-RTM_BASE].dumpit = tc_dump_tfilter;
- }
return 0;
}
--
^ permalink raw reply [flat|nested] 20+ messages in thread* [PATCH 08/12] [PKT_SCHED] act: Use rtnl registration interface
2007-03-22 12:59 [PATCH 00/12] [RESEND] rtnetlink message handler registration interface Thomas Graf
` (6 preceding siblings ...)
2007-03-22 13:00 ` [PATCH 07/12] [PKT_SCHED] cls: " Thomas Graf
@ 2007-03-22 13:00 ` Thomas Graf
2007-03-22 13:00 ` [PATCH 09/12] [DECNet]: " Thomas Graf
` (4 subsequent siblings)
12 siblings, 0 replies; 20+ messages in thread
From: Thomas Graf @ 2007-03-22 13:00 UTC (permalink / raw)
To: davem; +Cc: netdev, Thomas Graf
[-- Attachment #1: rtnl_reg_act_convert --]
[-- Type: text/plain, Size: 1123 bytes --]
Signed-off-by: Thomas Graf <tgraf@suug.ch>
Index: net-2.6.22/net/sched/act_api.c
===================================================================
--- net-2.6.22.orig/net/sched/act_api.c 2007-03-22 13:23:13.000000000 +0100
+++ net-2.6.22/net/sched/act_api.c 2007-03-22 13:23:59.000000000 +0100
@@ -25,7 +25,6 @@
#include <linux/interrupt.h>
#include <linux/netdevice.h>
#include <linux/skbuff.h>
-#include <linux/rtnetlink.h>
#include <linux/init.h>
#include <linux/kmod.h>
#include <net/sock.h>
@@ -1077,14 +1076,9 @@ nlmsg_failure:
static int __init tc_action_init(void)
{
- struct rtnetlink_link *link_p = rtnetlink_links[PF_UNSPEC];
-
- if (link_p) {
- link_p[RTM_NEWACTION-RTM_BASE].doit = tc_ctl_action;
- link_p[RTM_DELACTION-RTM_BASE].doit = tc_ctl_action;
- link_p[RTM_GETACTION-RTM_BASE].doit = tc_ctl_action;
- link_p[RTM_GETACTION-RTM_BASE].dumpit = tc_dump_action;
- }
+ rtnl_register(PF_UNSPEC, RTM_NEWACTION, tc_ctl_action, NULL);
+ rtnl_register(PF_UNSPEC, RTM_DELACTION, tc_ctl_action, NULL);
+ rtnl_register(PF_UNSPEC, RTM_GETACTION, tc_ctl_action, tc_dump_action);
return 0;
}
--
^ permalink raw reply [flat|nested] 20+ messages in thread* [PATCH 09/12] [DECNet]: Use rtnl registration interface
2007-03-22 12:59 [PATCH 00/12] [RESEND] rtnetlink message handler registration interface Thomas Graf
` (7 preceding siblings ...)
2007-03-22 13:00 ` [PATCH 08/12] [PKT_SCHED] act: " Thomas Graf
@ 2007-03-22 13:00 ` Thomas Graf
2007-03-22 13:07 ` Steven Whitehouse
2007-03-22 13:00 ` [PATCH 10/12] [IPv6]: " Thomas Graf
` (3 subsequent siblings)
12 siblings, 1 reply; 20+ messages in thread
From: Thomas Graf @ 2007-03-22 13:00 UTC (permalink / raw)
To: davem; +Cc: netdev, Thomas Graf
[-- Attachment #1: rtnl_reg_dn_convert --]
[-- Type: text/plain, Size: 7196 bytes --]
Signed-off-by: Thomas Graf <tgraf@suug.ch>
Index: net-2.6.22/include/net/dn_fib.h
===================================================================
--- net-2.6.22.orig/include/net/dn_fib.h 2007-03-22 13:23:13.000000000 +0100
+++ net-2.6.22/include/net/dn_fib.h 2007-03-22 13:24:01.000000000 +0100
@@ -148,17 +148,8 @@ extern void dn_fib_rules_cleanup(void);
extern unsigned dnet_addr_type(__le16 addr);
extern int dn_fib_lookup(struct flowi *fl, struct dn_fib_res *res);
-/*
- * rtnetlink interface
- */
-extern int dn_fib_rtm_delroute(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg);
-extern int dn_fib_rtm_newroute(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg);
extern int dn_fib_dump(struct sk_buff *skb, struct netlink_callback *cb);
-extern int dn_fib_rtm_delrule(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg);
-extern int dn_fib_rtm_newrule(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg);
-extern int dn_fib_dump_rules(struct sk_buff *skb, struct netlink_callback *cb);
-
extern void dn_fib_free_info(struct dn_fib_info *fi);
static inline void dn_fib_info_put(struct dn_fib_info *fi)
Index: net-2.6.22/net/decnet/dn_rules.c
===================================================================
--- net-2.6.22.orig/net/decnet/dn_rules.c 2007-03-22 13:23:13.000000000 +0100
+++ net-2.6.22/net/decnet/dn_rules.c 2007-03-22 13:24:01.000000000 +0100
@@ -241,7 +241,7 @@ static u32 dn_fib_rule_default_pref(void
return 0;
}
-int dn_fib_dump_rules(struct sk_buff *skb, struct netlink_callback *cb)
+static int dn_fib_dump_rules(struct sk_buff *skb, struct netlink_callback *cb)
{
return fib_rules_dump(skb, cb, AF_DECnet);
}
@@ -265,10 +265,12 @@ void __init dn_fib_rules_init(void)
{
list_add_tail(&default_rule.common.list, &dn_fib_rules);
fib_rules_register(&dn_fib_rules_ops);
+ rtnl_register(PF_DECnet, RTM_GETRULE, NULL, dn_fib_dump_rules);
}
void __exit dn_fib_rules_cleanup(void)
{
+ rtnl_unregister(PF_DECnet, RTM_GETRULE);
fib_rules_unregister(&dn_fib_rules_ops);
}
Index: net-2.6.22/net/decnet/dn_fib.c
===================================================================
--- net-2.6.22.orig/net/decnet/dn_fib.c 2007-03-22 13:23:13.000000000 +0100
+++ net-2.6.22/net/decnet/dn_fib.c 2007-03-22 13:24:01.000000000 +0100
@@ -501,7 +501,7 @@ static int dn_fib_check_attr(struct rtms
return 0;
}
-int dn_fib_rtm_delroute(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg)
+static int dn_fib_rtm_delroute(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg)
{
struct dn_fib_table *tb;
struct rtattr **rta = arg;
@@ -517,7 +517,7 @@ int dn_fib_rtm_delroute(struct sk_buff *
return -ESRCH;
}
-int dn_fib_rtm_newroute(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg)
+static int dn_fib_rtm_newroute(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg)
{
struct dn_fib_table *tb;
struct rtattr **rta = arg;
@@ -745,11 +745,13 @@ void __exit dn_fib_cleanup(void)
void __init dn_fib_init(void)
{
-
dn_fib_table_init();
dn_fib_rules_init();
register_dnaddr_notifier(&dn_fib_dnaddr_notifier);
+
+ rtnl_register(PF_DECnet, RTM_NEWROUTE, dn_fib_rtm_newroute, NULL);
+ rtnl_register(PF_DECnet, RTM_DELROUTE, dn_fib_rtm_delroute, NULL);
}
Index: net-2.6.22/net/decnet/af_decnet.c
===================================================================
--- net-2.6.22.orig/net/decnet/af_decnet.c 2007-03-22 13:23:13.000000000 +0100
+++ net-2.6.22/net/decnet/af_decnet.c 2007-03-22 13:24:01.000000000 +0100
@@ -2413,6 +2413,7 @@ module_init(decnet_init);
static void __exit decnet_exit(void)
{
sock_unregister(AF_DECnet);
+ rtnl_unregister_all(PF_DECnet);
dev_remove_pack(&dn_dix_packet_type);
dn_unregister_sysctl();
Index: net-2.6.22/net/decnet/dn_dev.c
===================================================================
--- net-2.6.22.orig/net/decnet/dn_dev.c 2007-03-22 13:23:13.000000000 +0100
+++ net-2.6.22/net/decnet/dn_dev.c 2007-03-22 13:24:01.000000000 +0100
@@ -1447,24 +1447,6 @@ static const struct file_operations dn_d
#endif /* CONFIG_PROC_FS */
-static struct rtnetlink_link dnet_rtnetlink_table[RTM_NR_MSGTYPES] =
-{
- [RTM_NEWADDR - RTM_BASE] = { .doit = dn_nl_newaddr, },
- [RTM_DELADDR - RTM_BASE] = { .doit = dn_nl_deladdr, },
- [RTM_GETADDR - RTM_BASE] = { .dumpit = dn_nl_dump_ifaddr, },
-#ifdef CONFIG_DECNET_ROUTER
- [RTM_NEWROUTE - RTM_BASE] = { .doit = dn_fib_rtm_newroute, },
- [RTM_DELROUTE - RTM_BASE] = { .doit = dn_fib_rtm_delroute, },
- [RTM_GETROUTE - RTM_BASE] = { .doit = dn_cache_getroute,
- .dumpit = dn_fib_dump, },
- [RTM_GETRULE - RTM_BASE] = { .dumpit = dn_fib_dump_rules, },
-#else
- [RTM_GETROUTE - RTM_BASE] = { .doit = dn_cache_getroute,
- .dumpit = dn_cache_dump, },
-#endif
-
-};
-
static int __initdata addr[2];
module_param_array(addr, int, NULL, 0444);
MODULE_PARM_DESC(addr, "The DECnet address of this machine: area,node");
@@ -1485,7 +1467,9 @@ void __init dn_dev_init(void)
dn_dev_devices_on();
- rtnetlink_links[PF_DECnet] = dnet_rtnetlink_table;
+ rtnl_register(PF_DECnet, RTM_NEWADDR, dn_nl_newaddr, NULL);
+ rtnl_register(PF_DECnet, RTM_DELADDR, dn_nl_deladdr, NULL);
+ rtnl_register(PF_DECnet, RTM_GETADDR, NULL, dn_nl_dump_ifaddr);
proc_net_fops_create("decnet_dev", S_IRUGO, &dn_dev_seq_fops);
@@ -1500,8 +1484,6 @@ void __init dn_dev_init(void)
void __exit dn_dev_cleanup(void)
{
- rtnetlink_links[PF_DECnet] = NULL;
-
#ifdef CONFIG_SYSCTL
{
int i;
Index: net-2.6.22/include/net/dn_route.h
===================================================================
--- net-2.6.22.orig/include/net/dn_route.h 2007-03-22 13:23:13.000000000 +0100
+++ net-2.6.22/include/net/dn_route.h 2007-03-22 13:24:01.000000000 +0100
@@ -18,7 +18,6 @@
extern struct sk_buff *dn_alloc_skb(struct sock *sk, int size, gfp_t pri);
extern int dn_route_output_sock(struct dst_entry **pprt, struct flowi *, struct sock *sk, int flags);
extern int dn_cache_dump(struct sk_buff *skb, struct netlink_callback *cb);
-extern int dn_cache_getroute(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg);
extern void dn_rt_cache_flush(int delay);
/* Masks for flags field */
Index: net-2.6.22/net/decnet/dn_route.c
===================================================================
--- net-2.6.22.orig/net/decnet/dn_route.c 2007-03-22 13:23:13.000000000 +0100
+++ net-2.6.22/net/decnet/dn_route.c 2007-03-22 13:24:01.000000000 +0100
@@ -1522,7 +1522,7 @@ rtattr_failure:
/*
* This is called by both endnodes and routers now.
*/
-int dn_cache_getroute(struct sk_buff *in_skb, struct nlmsghdr *nlh, void *arg)
+static int dn_cache_getroute(struct sk_buff *in_skb, struct nlmsghdr *nlh, void *arg)
{
struct rtattr **rta = arg;
struct rtmsg *rtm = NLMSG_DATA(nlh);
@@ -1813,6 +1813,13 @@ void __init dn_route_init(void)
dn_dst_ops.gc_thresh = (dn_rt_hash_mask + 1);
proc_net_fops_create("decnet_cache", S_IRUGO, &dn_rt_cache_seq_fops);
+
+#ifdef CONFIG_DECNET_ROUTER
+ rtnl_register(PF_DECnet, RTM_GETROUTE, dn_cache_getroute, dn_fib_dump);
+#else
+ rtnl_register(PF_DECnet, RTM_GETROUTE, dn_cache_getroute,
+ dn_cache_dump);
+#endif
}
void __exit dn_route_cleanup(void)
--
^ permalink raw reply [flat|nested] 20+ messages in thread* Re: [PATCH 09/12] [DECNet]: Use rtnl registration interface
2007-03-22 13:00 ` [PATCH 09/12] [DECNet]: " Thomas Graf
@ 2007-03-22 13:07 ` Steven Whitehouse
2007-03-22 19:06 ` David Miller
0 siblings, 1 reply; 20+ messages in thread
From: Steven Whitehouse @ 2007-03-22 13:07 UTC (permalink / raw)
To: Thomas Graf; +Cc: davem, netdev
Hi,
On Thu, Mar 22, 2007 at 02:00:04PM +0100, Thomas Graf wrote:
> Signed-off-by: Thomas Graf <tgraf@suug.ch>
>
Acked-by: Steven Whitehouse <swhiteho@redhat.com>
for all the DECnet bits & also the DECnet changes in the other patch I saw
from you relating to the routing rules,
Steve.
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [PATCH 09/12] [DECNet]: Use rtnl registration interface
2007-03-22 13:07 ` Steven Whitehouse
@ 2007-03-22 19:06 ` David Miller
0 siblings, 0 replies; 20+ messages in thread
From: David Miller @ 2007-03-22 19:06 UTC (permalink / raw)
To: steve; +Cc: tgraf, netdev
From: Steven Whitehouse <steve@chygwyn.com>
Date: Thu, 22 Mar 2007 13:07:54 +0000
> Hi,
>
> On Thu, Mar 22, 2007 at 02:00:04PM +0100, Thomas Graf wrote:
> > Signed-off-by: Thomas Graf <tgraf@suug.ch>
> >
> Acked-by: Steven Whitehouse <swhiteho@redhat.com>
>
> for all the DECnet bits & also the DECnet changes in the other patch I saw
> from you relating to the routing rules,
Thanks for helping review Steven.
^ permalink raw reply [flat|nested] 20+ messages in thread
* [PATCH 10/12] [IPv6]: Use rtnl registration interface
2007-03-22 12:59 [PATCH 00/12] [RESEND] rtnetlink message handler registration interface Thomas Graf
` (8 preceding siblings ...)
2007-03-22 13:00 ` [PATCH 09/12] [DECNet]: " Thomas Graf
@ 2007-03-22 13:00 ` Thomas Graf
2007-03-22 13:00 ` [PATCH 11/12] [BRIDGE]: " Thomas Graf
` (2 subsequent siblings)
12 siblings, 0 replies; 20+ messages in thread
From: Thomas Graf @ 2007-03-22 13:00 UTC (permalink / raw)
To: davem; +Cc: netdev, Thomas Graf
[-- Attachment #1: rtnl_reg_ip6_convert --]
[-- Type: text/plain, Size: 7466 bytes --]
Signed-off-by: Thomas Graf <tgraf@suug.ch>
Index: net-2.6.22/include/net/ip6_fib.h
===================================================================
--- net-2.6.22.orig/include/net/ip6_fib.h 2007-03-22 13:23:12.000000000 +0100
+++ net-2.6.22/include/net/ip6_fib.h 2007-03-22 13:24:02.000000000 +0100
@@ -218,8 +218,6 @@ extern void fib6_init(void);
extern void fib6_rules_init(void);
extern void fib6_rules_cleanup(void);
-extern int fib6_rules_dump(struct sk_buff *,
- struct netlink_callback *);
#endif
#endif
Index: net-2.6.22/net/ipv6/addrconf.c
===================================================================
--- net-2.6.22.orig/net/ipv6/addrconf.c 2007-03-22 13:23:12.000000000 +0100
+++ net-2.6.22/net/ipv6/addrconf.c 2007-03-22 13:24:02.000000000 +0100
@@ -3607,23 +3607,6 @@ errout:
rtnl_set_sk_err(RTNLGRP_IPV6_PREFIX, err);
}
-static struct rtnetlink_link inet6_rtnetlink_table[RTM_NR_MSGTYPES] = {
- [RTM_GETLINK - RTM_BASE] = { .dumpit = inet6_dump_ifinfo, },
- [RTM_NEWADDR - RTM_BASE] = { .doit = inet6_rtm_newaddr, },
- [RTM_DELADDR - RTM_BASE] = { .doit = inet6_rtm_deladdr, },
- [RTM_GETADDR - RTM_BASE] = { .doit = inet6_rtm_getaddr,
- .dumpit = inet6_dump_ifaddr, },
- [RTM_GETMULTICAST - RTM_BASE] = { .dumpit = inet6_dump_ifmcaddr, },
- [RTM_GETANYCAST - RTM_BASE] = { .dumpit = inet6_dump_ifacaddr, },
- [RTM_NEWROUTE - RTM_BASE] = { .doit = inet6_rtm_newroute, },
- [RTM_DELROUTE - RTM_BASE] = { .doit = inet6_rtm_delroute, },
- [RTM_GETROUTE - RTM_BASE] = { .doit = inet6_rtm_getroute,
- .dumpit = inet6_dump_fib, },
-#ifdef CONFIG_IPV6_MULTIPLE_TABLES
- [RTM_GETRULE - RTM_BASE] = { .dumpit = fib6_rules_dump, },
-#endif
-};
-
static void __ipv6_ifa_notify(int event, struct inet6_ifaddr *ifp)
{
inet6_ifa_notify(event ? : RTM_NEWADDR, ifp);
@@ -4135,7 +4118,18 @@ int __init addrconf_init(void)
register_netdevice_notifier(&ipv6_dev_notf);
addrconf_verify(0);
- rtnetlink_links[PF_INET6] = inet6_rtnetlink_table;
+
+ err = __rtnl_register(PF_INET6, RTM_GETLINK, NULL, inet6_dump_ifinfo);
+ if (err < 0)
+ goto errout;
+
+ /* Only the first call to __rtnl_register can fail */
+ __rtnl_register(PF_INET6, RTM_NEWADDR, inet6_rtm_newaddr, NULL);
+ __rtnl_register(PF_INET6, RTM_DELADDR, inet6_rtm_deladdr, NULL);
+ __rtnl_register(PF_INET6, RTM_GETADDR, inet6_rtm_getaddr, inet6_dump_ifaddr);
+ __rtnl_register(PF_INET6, RTM_GETMULTICAST, NULL, inet6_dump_ifmcaddr);
+ __rtnl_register(PF_INET6, RTM_GETANYCAST, NULL, inet6_dump_ifacaddr);
+
#ifdef CONFIG_SYSCTL
addrconf_sysctl.sysctl_header =
register_sysctl_table(addrconf_sysctl.addrconf_root_dir);
@@ -4143,6 +4137,10 @@ int __init addrconf_init(void)
#endif
return 0;
+errout:
+ unregister_netdevice_notifier(&ipv6_dev_notf);
+
+ return err;
}
void __exit addrconf_cleanup(void)
@@ -4154,7 +4152,6 @@ void __exit addrconf_cleanup(void)
unregister_netdevice_notifier(&ipv6_dev_notf);
- rtnetlink_links[PF_INET6] = NULL;
#ifdef CONFIG_SYSCTL
addrconf_sysctl_unregister(&ipv6_devconf_dflt);
addrconf_sysctl_unregister(&ipv6_devconf);
Index: net-2.6.22/net/ipv6/fib6_rules.c
===================================================================
--- net-2.6.22.orig/net/ipv6/fib6_rules.c 2007-03-22 13:23:12.000000000 +0100
+++ net-2.6.22/net/ipv6/fib6_rules.c 2007-03-22 13:24:02.000000000 +0100
@@ -221,7 +221,7 @@ nla_put_failure:
return -ENOBUFS;
}
-int fib6_rules_dump(struct sk_buff *skb, struct netlink_callback *cb)
+static int fib6_rules_dump(struct sk_buff *skb, struct netlink_callback *cb)
{
return fib_rules_dump(skb, cb, AF_INET6);
}
@@ -259,9 +259,11 @@ void __init fib6_rules_init(void)
list_add_tail(&main_rule.common.list, &fib6_rules);
fib_rules_register(&fib6_rules_ops);
+ __rtnl_register(PF_INET6, RTM_GETRULE, NULL, fib6_rules_dump);
}
void fib6_rules_cleanup(void)
{
+ rtnl_unregister(PF_INET6, RTM_GETRULE);
fib_rules_unregister(&fib6_rules_ops);
}
Index: net-2.6.22/include/net/ip6_route.h
===================================================================
--- net-2.6.22.orig/include/net/ip6_route.h 2007-03-22 13:23:12.000000000 +0100
+++ net-2.6.22/include/net/ip6_route.h 2007-03-22 13:24:02.000000000 +0100
@@ -116,12 +116,7 @@ extern void rt6_pmtu_discovery(struct
struct net_device *dev,
u32 pmtu);
-struct nlmsghdr;
struct netlink_callback;
-extern int inet6_dump_fib(struct sk_buff *skb, struct netlink_callback *cb);
-extern int inet6_rtm_newroute(struct sk_buff *skb, struct nlmsghdr* nlh, void *arg);
-extern int inet6_rtm_delroute(struct sk_buff *skb, struct nlmsghdr* nlh, void *arg);
-extern int inet6_rtm_getroute(struct sk_buff *skb, struct nlmsghdr* nlh, void *arg);
struct rt6_rtnl_dump_arg
{
Index: net-2.6.22/net/ipv6/route.c
===================================================================
--- net-2.6.22.orig/net/ipv6/route.c 2007-03-22 13:23:12.000000000 +0100
+++ net-2.6.22/net/ipv6/route.c 2007-03-22 13:24:02.000000000 +0100
@@ -1994,7 +1994,7 @@ errout:
return err;
}
-int inet6_rtm_delroute(struct sk_buff *skb, struct nlmsghdr* nlh, void *arg)
+static int inet6_rtm_delroute(struct sk_buff *skb, struct nlmsghdr* nlh, void *arg)
{
struct fib6_config cfg;
int err;
@@ -2006,7 +2006,7 @@ int inet6_rtm_delroute(struct sk_buff *s
return ip6_route_del(&cfg);
}
-int inet6_rtm_newroute(struct sk_buff *skb, struct nlmsghdr* nlh, void *arg)
+static int inet6_rtm_newroute(struct sk_buff *skb, struct nlmsghdr* nlh, void *arg)
{
struct fib6_config cfg;
int err;
@@ -2143,7 +2143,7 @@ int rt6_dump_route(struct rt6_info *rt,
prefix, NLM_F_MULTI);
}
-int inet6_rtm_getroute(struct sk_buff *in_skb, struct nlmsghdr* nlh, void *arg)
+static int inet6_rtm_getroute(struct sk_buff *in_skb, struct nlmsghdr* nlh, void *arg)
{
struct nlattr *tb[RTA_MAX+1];
struct rt6_info *rt;
@@ -2487,6 +2487,10 @@ void __init ip6_route_init(void)
#ifdef CONFIG_IPV6_MULTIPLE_TABLES
fib6_rules_init();
#endif
+
+ __rtnl_register(PF_INET6, RTM_NEWROUTE, inet6_rtm_newroute, NULL);
+ __rtnl_register(PF_INET6, RTM_DELROUTE, inet6_rtm_delroute, NULL);
+ __rtnl_register(PF_INET6, RTM_GETROUTE, inet6_rtm_getroute, NULL);
}
void ip6_route_cleanup(void)
Index: net-2.6.22/net/ipv6/ip6_fib.c
===================================================================
--- net-2.6.22.orig/net/ipv6/ip6_fib.c 2007-03-22 13:23:12.000000000 +0100
+++ net-2.6.22/net/ipv6/ip6_fib.c 2007-03-22 13:24:02.000000000 +0100
@@ -359,7 +359,7 @@ end:
return res;
}
-int inet6_dump_fib(struct sk_buff *skb, struct netlink_callback *cb)
+static int inet6_dump_fib(struct sk_buff *skb, struct netlink_callback *cb)
{
unsigned int h, s_h;
unsigned int e = 0, s_e;
@@ -1478,6 +1478,8 @@ void __init fib6_init(void)
NULL, NULL);
fib6_tables_init();
+
+ __rtnl_register(PF_INET6, RTM_GETROUTE, NULL, inet6_dump_fib);
}
void fib6_gc_cleanup(void)
Index: net-2.6.22/net/ipv6/af_inet6.c
===================================================================
--- net-2.6.22.orig/net/ipv6/af_inet6.c 2007-03-22 13:23:12.000000000 +0100
+++ net-2.6.22/net/ipv6/af_inet6.c 2007-03-22 13:24:02.000000000 +0100
@@ -945,6 +945,8 @@ static void __exit inet6_exit(void)
{
/* First of all disallow new sockets creation. */
sock_unregister(PF_INET6);
+ /* Disallow any further netlink messages */
+ rtnl_unregister_all(PF_INET6);
/* Cleanup code parts. */
ipv6_packet_cleanup();
--
^ permalink raw reply [flat|nested] 20+ messages in thread* [PATCH 11/12] [BRIDGE]: Use rtnl registration interface
2007-03-22 12:59 [PATCH 00/12] [RESEND] rtnetlink message handler registration interface Thomas Graf
` (9 preceding siblings ...)
2007-03-22 13:00 ` [PATCH 10/12] [IPv6]: " Thomas Graf
@ 2007-03-22 13:00 ` Thomas Graf
2007-03-22 13:00 ` [PATCH 12/12] [RTNL]: Use rtnl registration interface for dump-all aliases Thomas Graf
2007-03-22 19:06 ` [PATCH 00/12] [RESEND] rtnetlink message handler registration interface David Miller
12 siblings, 0 replies; 20+ messages in thread
From: Thomas Graf @ 2007-03-22 13:00 UTC (permalink / raw)
To: davem; +Cc: netdev, Thomas Graf
[-- Attachment #1: rtnl_reg_bridge_convert --]
[-- Type: text/plain, Size: 2490 bytes --]
Signed-off-by: Thomas Graf <tgraf@suug.ch>
Index: net-2.6.22/net/bridge/br.c
===================================================================
--- net-2.6.22.orig/net/bridge/br.c 2007-03-22 13:23:11.000000000 +0100
+++ net-2.6.22/net/bridge/br.c 2007-03-22 13:24:03.000000000 +0100
@@ -47,7 +47,10 @@ static int __init br_init(void)
if (err)
goto err_out2;
- br_netlink_init();
+ err = br_netlink_init();
+ if (err)
+ goto err_out3;
+
brioctl_set(br_ioctl_deviceless_stub);
br_handle_frame_hook = br_handle_frame;
@@ -55,7 +58,8 @@ static int __init br_init(void)
br_fdb_put_hook = br_fdb_put;
return 0;
-
+err_out3:
+ unregister_netdevice_notifier(&br_device_notifier);
err_out2:
br_netfilter_fini();
err_out1:
Index: net-2.6.22/net/bridge/br_netlink.c
===================================================================
--- net-2.6.22.orig/net/bridge/br_netlink.c 2007-03-22 13:23:11.000000000 +0100
+++ net-2.6.22/net/bridge/br_netlink.c 2007-03-22 13:24:03.000000000 +0100
@@ -11,8 +11,7 @@
*/
#include <linux/kernel.h>
-#include <linux/rtnetlink.h>
-#include <net/netlink.h>
+#include <net/rtnetlink.h>
#include "br_private.h"
static inline size_t br_nlmsg_size(void)
@@ -179,18 +178,19 @@ static int br_rtm_setlink(struct sk_buff
}
-static struct rtnetlink_link bridge_rtnetlink_table[RTM_NR_MSGTYPES] = {
- [RTM_GETLINK - RTM_BASE] = { .dumpit = br_dump_ifinfo, },
- [RTM_SETLINK - RTM_BASE] = { .doit = br_rtm_setlink, },
-};
-
-void __init br_netlink_init(void)
+int __init br_netlink_init(void)
{
- rtnetlink_links[PF_BRIDGE] = bridge_rtnetlink_table;
+ if (__rtnl_register(PF_BRIDGE, RTM_GETLINK, NULL, br_dump_ifinfo))
+ return -ENOBUFS;
+
+ /* Only the first call to __rtnl_register can fail */
+ __rtnl_register(PF_BRIDGE, RTM_SETLINK, br_rtm_setlink, NULL);
+
+ return 0;
}
void __exit br_netlink_fini(void)
{
- rtnetlink_links[PF_BRIDGE] = NULL;
+ rtnl_unregister_all(PF_BRIDGE);
}
Index: net-2.6.22/net/bridge/br_private.h
===================================================================
--- net-2.6.22.orig/net/bridge/br_private.h 2007-03-22 13:23:11.000000000 +0100
+++ net-2.6.22/net/bridge/br_private.h 2007-03-22 13:24:03.000000000 +0100
@@ -235,7 +235,7 @@ extern void (*br_fdb_put_hook)(struct ne
/* br_netlink.c */
-extern void br_netlink_init(void);
+extern int br_netlink_init(void);
extern void br_netlink_fini(void);
extern void br_ifinfo_notify(int event, struct net_bridge_port *port);
--
^ permalink raw reply [flat|nested] 20+ messages in thread* [PATCH 12/12] [RTNL]: Use rtnl registration interface for dump-all aliases
2007-03-22 12:59 [PATCH 00/12] [RESEND] rtnetlink message handler registration interface Thomas Graf
` (10 preceding siblings ...)
2007-03-22 13:00 ` [PATCH 11/12] [BRIDGE]: " Thomas Graf
@ 2007-03-22 13:00 ` Thomas Graf
2007-03-22 19:06 ` [PATCH 00/12] [RESEND] rtnetlink message handler registration interface David Miller
12 siblings, 0 replies; 20+ messages in thread
From: Thomas Graf @ 2007-03-22 13:00 UTC (permalink / raw)
To: davem; +Cc: netdev, Thomas Graf
[-- Attachment #1: rtnl_reg_dump_all --]
[-- Type: text/plain, Size: 1070 bytes --]
Signed-off-by: Thomas Graf <tgraf@suug.ch>
Index: net-2.6.22/net/core/rtnetlink.c
===================================================================
--- net-2.6.22.orig/net/core/rtnetlink.c 2007-03-22 13:23:11.000000000 +0100
+++ net-2.6.22/net/core/rtnetlink.c 2007-03-22 13:24:04.000000000 +0100
@@ -958,12 +958,6 @@ static void rtnetlink_rcv(struct sock *s
} while (qlen);
}
-static struct rtnetlink_link link_rtnetlink_table[RTM_NR_MSGTYPES] =
-{
- [RTM_GETADDR - RTM_BASE] = { .dumpit = rtnl_dump_all },
- [RTM_GETROUTE - RTM_BASE] = { .dumpit = rtnl_dump_all },
-};
-
static int rtnetlink_event(struct notifier_block *this, unsigned long event, void *ptr)
{
struct net_device *dev = ptr;
@@ -1013,6 +1007,9 @@ void __init rtnetlink_init(void)
rtnl_register(PF_UNSPEC, RTM_GETLINK, rtnl_getlink, rtnl_dump_ifinfo);
rtnl_register(PF_UNSPEC, RTM_SETLINK, rtnl_setlink, NULL);
+
+ rtnl_register(PF_UNSPEC, RTM_GETADDR, NULL, rtnl_dump_all);
+ rtnl_register(PF_UNSPEC, RTM_GETROUTE, NULL, rtnl_dump_all);
}
EXPORT_SYMBOL(__rta_fill);
--
^ permalink raw reply [flat|nested] 20+ messages in thread* Re: [PATCH 00/12] [RESEND] rtnetlink message handler registration interface
2007-03-22 12:59 [PATCH 00/12] [RESEND] rtnetlink message handler registration interface Thomas Graf
` (11 preceding siblings ...)
2007-03-22 13:00 ` [PATCH 12/12] [RTNL]: Use rtnl registration interface for dump-all aliases Thomas Graf
@ 2007-03-22 19:06 ` David Miller
2007-03-22 21:27 ` Recent net-2.6.22 patches break bootup! Stephen Hemminger
12 siblings, 1 reply; 20+ messages in thread
From: David Miller @ 2007-03-22 19:06 UTC (permalink / raw)
To: tgraf; +Cc: netdev
From: Thomas Graf <tgraf@suug.ch>
Date: Thu, 22 Mar 2007 13:59:55 +0100
> The existing function names seem to have sentimental value to some
> people. Same patches but without changes to the functio names.
>
> Introduces an interface to register rtnetlink message handlers
> and converts all users of rtnl_links[].
All 12 patches applied, thanks Thomas.
^ permalink raw reply [flat|nested] 20+ messages in thread* Recent net-2.6.22 patches break bootup!
2007-03-22 19:06 ` [PATCH 00/12] [RESEND] rtnetlink message handler registration interface David Miller
@ 2007-03-22 21:27 ` Stephen Hemminger
2007-03-22 23:47 ` Thomas Graf
0 siblings, 1 reply; 20+ messages in thread
From: Stephen Hemminger @ 2007-03-22 21:27 UTC (permalink / raw)
To: David Miller; +Cc: tgraf, netdev
On Thu, 22 Mar 2007 12:06:19 -0700 (PDT)
David Miller <davem@davemloft.net> wrote:
> From: Thomas Graf <tgraf@suug.ch>
> Date: Thu, 22 Mar 2007 13:59:55 +0100
>
> > The existing function names seem to have sentimental value to some
> > people. Same patches but without changes to the functio names.
> >
> > Introduces an interface to register rtnetlink message handlers
> > and converts all users of rtnl_links[].
>
> All 12 patches applied, thanks Thomas.
>
> -
> To unsubscribe from this list: send the line "unsubscribe netdev" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
Something is broken now. If I boot the system (Fedora) it gets to:
Bringing up loopback interface: RTNETLINK answers: Invalid argument
Dump terminated
RTNETLINK answers: Invalid argument
....
tg3 device eth0 does not seem to be present, delaying initialization
then it hangs because cups won't come up without loopback
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: Recent net-2.6.22 patches break bootup!
2007-03-22 21:27 ` Recent net-2.6.22 patches break bootup! Stephen Hemminger
@ 2007-03-22 23:47 ` Thomas Graf
2007-03-23 4:41 ` David Miller
0 siblings, 1 reply; 20+ messages in thread
From: Thomas Graf @ 2007-03-22 23:47 UTC (permalink / raw)
To: Stephen Hemminger; +Cc: David Miller, netdev
* Stephen Hemminger <shemminger@linux-foundation.org> 2007-03-22 14:27
> Something is broken now. If I boot the system (Fedora) it gets to:
>
> Bringing up loopback interface: RTNETLINK answers: Invalid argument
> Dump terminated
> RTNETLINK answers: Invalid argument
> ....
>
> tg3 device eth0 does not seem to be present, delaying initialization
>
>
> then it hangs because cups won't come up without loopback
Thinko. It always returned the first message handler of a rtnl
family.
[RTNL]: Properly return rntl message handler
Signed-off-by: Thomas Graf <tgraf@suug.ch>
Index: net-2.6.22/net/core/rtnetlink.c
===================================================================
--- net-2.6.22.orig/net/core/rtnetlink.c 2007-03-23 00:31:37.000000000 +0100
+++ net-2.6.22/net/core/rtnetlink.c 2007-03-23 00:32:52.000000000 +0100
@@ -122,10 +122,10 @@ static rtnl_doit_func rtnl_get_doit(int
struct rtnl_link *tab;
tab = rtnl_msg_handlers[protocol];
- if (tab == NULL || tab->doit == NULL)
+ if (tab == NULL || tab[msgindex].doit == NULL)
tab = rtnl_msg_handlers[PF_UNSPEC];
- return tab ? tab->doit : NULL;
+ return tab ? tab[msgindex].doit : NULL;
}
static rtnl_dumpit_func rtnl_get_dumpit(int protocol, int msgindex)
@@ -133,10 +133,10 @@ static rtnl_dumpit_func rtnl_get_dumpit(
struct rtnl_link *tab;
tab = rtnl_msg_handlers[protocol];
- if (tab == NULL || tab->dumpit == NULL)
+ if (tab == NULL || tab[msgindex].dumpit == NULL)
tab = rtnl_msg_handlers[PF_UNSPEC];
- return tab ? tab->dumpit : NULL;
+ return tab ? tab[msgindex].dumpit : NULL;
}
/**
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: Recent net-2.6.22 patches break bootup!
2007-03-22 23:47 ` Thomas Graf
@ 2007-03-23 4:41 ` David Miller
2007-03-23 18:07 ` Stephen Hemminger
0 siblings, 1 reply; 20+ messages in thread
From: David Miller @ 2007-03-23 4:41 UTC (permalink / raw)
To: tgraf; +Cc: shemminger, netdev
From: Thomas Graf <tgraf@suug.ch>
Date: Fri, 23 Mar 2007 00:47:04 +0100
> * Stephen Hemminger <shemminger@linux-foundation.org> 2007-03-22 14:27
> > Something is broken now. If I boot the system (Fedora) it gets to:
> >
> > Bringing up loopback interface: RTNETLINK answers: Invalid argument
> > Dump terminated
> > RTNETLINK answers: Invalid argument
> > ....
> >
> > tg3 device eth0 does not seem to be present, delaying initialization
> >
> >
> > then it hangs because cups won't come up without loopback
>
> Thinko. It always returned the first message handler of a rtnl
> family.
>
> [RTNL]: Properly return rntl message handler
>
> Signed-off-by: Thomas Graf <tgraf@suug.ch>
Applied, thanks Thomas.
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: Recent net-2.6.22 patches break bootup!
2007-03-23 4:41 ` David Miller
@ 2007-03-23 18:07 ` Stephen Hemminger
0 siblings, 0 replies; 20+ messages in thread
From: Stephen Hemminger @ 2007-03-23 18:07 UTC (permalink / raw)
To: David Miller; +Cc: tgraf, netdev
On Thu, 22 Mar 2007 21:41:23 -0700 (PDT)
David Miller <davem@davemloft.net> wrote:
> From: Thomas Graf <tgraf@suug.ch>
> Date: Fri, 23 Mar 2007 00:47:04 +0100
>
> > * Stephen Hemminger <shemminger@linux-foundation.org> 2007-03-22 14:27
> > > Something is broken now. If I boot the system (Fedora) it gets to:
> > >
> > > Bringing up loopback interface: RTNETLINK answers: Invalid argument
> > > Dump terminated
> > > RTNETLINK answers: Invalid argument
> > > ....
> > >
> > > tg3 device eth0 does not seem to be present, delaying initialization
> > >
> > >
> > > then it hangs because cups won't come up without loopback
> >
> > Thinko. It always returned the first message handler of a rtnl
> > family.
> >
> > [RTNL]: Properly return rntl message handler
> >
> > Signed-off-by: Thomas Graf <tgraf@suug.ch>
>
> Applied, thanks Thomas.
Thanks, that fixes it
--
Stephen Hemminger <shemminger@linux-foundation.org>
^ permalink raw reply [flat|nested] 20+ messages in thread