diff options
author | Patrick McHardy <kaber@trash.net> | 2010-04-26 10:02:05 -0400 |
---|---|---|
committer | Patrick McHardy <kaber@trash.net> | 2010-04-26 10:13:54 -0400 |
commit | 25239cee7e8732dbdc9f5d324f1c22a3bdec1d1f (patch) | |
tree | c3f36730571a7eb185abcd973b2f4c9616bd8096 /net/core/rtnetlink.c | |
parent | 3d0c9c4eb2dbdcc461be4084abd87a9a9e70f713 (diff) |
net: rtnetlink: decouple rtnetlink address families from real address families
Decouple rtnetlink address families from real address families in socket.h to
be able to add rtnetlink interfaces to code that is not a real address family
without increasing AF_MAX/NPROTO.
This will be used to add support for multicast route dumping from all tables
as the proc interface can't be extended to support anything but the main table
without breaking compatibility.
This partialy undoes the patch to introduce independant families for routing
rules and converts ipmr routing rules to a new rtnetlink family. Similar to
that patch, values up to 127 are reserved for real address families, values
above that may be used arbitrarily.
Signed-off-by: Patrick McHardy <kaber@trash.net>
Diffstat (limited to 'net/core/rtnetlink.c')
-rw-r--r-- | net/core/rtnetlink.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c index 78c85985cb30..fd781b62fa7f 100644 --- a/net/core/rtnetlink.c +++ b/net/core/rtnetlink.c | |||
@@ -98,7 +98,7 @@ int lockdep_rtnl_is_held(void) | |||
98 | EXPORT_SYMBOL(lockdep_rtnl_is_held); | 98 | EXPORT_SYMBOL(lockdep_rtnl_is_held); |
99 | #endif /* #ifdef CONFIG_PROVE_LOCKING */ | 99 | #endif /* #ifdef CONFIG_PROVE_LOCKING */ |
100 | 100 | ||
101 | static struct rtnl_link *rtnl_msg_handlers[NPROTO]; | 101 | static struct rtnl_link *rtnl_msg_handlers[RTNL_FAMILY_MAX + 1]; |
102 | 102 | ||
103 | static inline int rtm_msgindex(int msgtype) | 103 | static inline int rtm_msgindex(int msgtype) |
104 | { | 104 | { |
@@ -118,7 +118,7 @@ static rtnl_doit_func rtnl_get_doit(int protocol, int msgindex) | |||
118 | { | 118 | { |
119 | struct rtnl_link *tab; | 119 | struct rtnl_link *tab; |
120 | 120 | ||
121 | if (protocol < NPROTO) | 121 | if (protocol <= RTNL_FAMILY_MAX) |
122 | tab = rtnl_msg_handlers[protocol]; | 122 | tab = rtnl_msg_handlers[protocol]; |
123 | else | 123 | else |
124 | tab = NULL; | 124 | tab = NULL; |
@@ -133,7 +133,7 @@ static rtnl_dumpit_func rtnl_get_dumpit(int protocol, int msgindex) | |||
133 | { | 133 | { |
134 | struct rtnl_link *tab; | 134 | struct rtnl_link *tab; |
135 | 135 | ||
136 | if (protocol < NPROTO) | 136 | if (protocol <= RTNL_FAMILY_MAX) |
137 | tab = rtnl_msg_handlers[protocol]; | 137 | tab = rtnl_msg_handlers[protocol]; |
138 | else | 138 | else |
139 | tab = NULL; | 139 | tab = NULL; |
@@ -167,7 +167,7 @@ int __rtnl_register(int protocol, int msgtype, | |||
167 | struct rtnl_link *tab; | 167 | struct rtnl_link *tab; |
168 | int msgindex; | 168 | int msgindex; |
169 | 169 | ||
170 | BUG_ON(protocol < 0 || protocol >= NPROTO); | 170 | BUG_ON(protocol < 0 || protocol > RTNL_FAMILY_MAX); |
171 | msgindex = rtm_msgindex(msgtype); | 171 | msgindex = rtm_msgindex(msgtype); |
172 | 172 | ||
173 | tab = rtnl_msg_handlers[protocol]; | 173 | tab = rtnl_msg_handlers[protocol]; |
@@ -219,7 +219,7 @@ int rtnl_unregister(int protocol, int msgtype) | |||
219 | { | 219 | { |
220 | int msgindex; | 220 | int msgindex; |
221 | 221 | ||
222 | BUG_ON(protocol < 0 || protocol >= NPROTO); | 222 | BUG_ON(protocol < 0 || protocol > RTNL_FAMILY_MAX); |
223 | msgindex = rtm_msgindex(msgtype); | 223 | msgindex = rtm_msgindex(msgtype); |
224 | 224 | ||
225 | if (rtnl_msg_handlers[protocol] == NULL) | 225 | if (rtnl_msg_handlers[protocol] == NULL) |
@@ -241,7 +241,7 @@ EXPORT_SYMBOL_GPL(rtnl_unregister); | |||
241 | */ | 241 | */ |
242 | void rtnl_unregister_all(int protocol) | 242 | void rtnl_unregister_all(int protocol) |
243 | { | 243 | { |
244 | BUG_ON(protocol < 0 || protocol >= NPROTO); | 244 | BUG_ON(protocol < 0 || protocol > RTNL_FAMILY_MAX); |
245 | 245 | ||
246 | kfree(rtnl_msg_handlers[protocol]); | 246 | kfree(rtnl_msg_handlers[protocol]); |
247 | rtnl_msg_handlers[protocol] = NULL; | 247 | rtnl_msg_handlers[protocol] = NULL; |
@@ -1384,7 +1384,7 @@ static int rtnl_dump_all(struct sk_buff *skb, struct netlink_callback *cb) | |||
1384 | 1384 | ||
1385 | if (s_idx == 0) | 1385 | if (s_idx == 0) |
1386 | s_idx = 1; | 1386 | s_idx = 1; |
1387 | for (idx = 1; idx < NPROTO; idx++) { | 1387 | for (idx = 1; idx <= RTNL_FAMILY_MAX; idx++) { |
1388 | int type = cb->nlh->nlmsg_type-RTM_BASE; | 1388 | int type = cb->nlh->nlmsg_type-RTM_BASE; |
1389 | if (idx < s_idx || idx == PF_PACKET) | 1389 | if (idx < s_idx || idx == PF_PACKET) |
1390 | continue; | 1390 | continue; |