aboutsummaryrefslogtreecommitdiffstats
path: root/net/core/rtnetlink.c
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2010-04-27 15:57:39 -0400
committerDavid S. Miller <davem@davemloft.net>2010-04-27 15:57:39 -0400
commitbb611874650cff942a7466b456a791e8bfa641e7 (patch)
tree32e048e3240dd808e7787ff2b7eb50ed9f0a6182 /net/core/rtnetlink.c
parentd328bc839eac685cdd91f5d9d8ad95c070252038 (diff)
parentcb6a4e461fb427689920472bd7335f926d521747 (diff)
Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/kaber/ipmr-2.6
Diffstat (limited to 'net/core/rtnetlink.c')
-rw-r--r--net/core/rtnetlink.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c
index 455e35aefbc2..23a71cb21273 100644
--- a/net/core/rtnetlink.c
+++ b/net/core/rtnetlink.c
@@ -98,7 +98,7 @@ int lockdep_rtnl_is_held(void)
98EXPORT_SYMBOL(lockdep_rtnl_is_held); 98EXPORT_SYMBOL(lockdep_rtnl_is_held);
99#endif /* #ifdef CONFIG_PROVE_LOCKING */ 99#endif /* #ifdef CONFIG_PROVE_LOCKING */
100 100
101static struct rtnl_link *rtnl_msg_handlers[NPROTO]; 101static struct rtnl_link *rtnl_msg_handlers[RTNL_FAMILY_MAX + 1];
102 102
103static inline int rtm_msgindex(int msgtype) 103static 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 */
242void rtnl_unregister_all(int protocol) 242void 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;
@@ -1385,7 +1385,7 @@ static int rtnl_dump_all(struct sk_buff *skb, struct netlink_callback *cb)
1385 1385
1386 if (s_idx == 0) 1386 if (s_idx == 0)
1387 s_idx = 1; 1387 s_idx = 1;
1388 for (idx = 1; idx < NPROTO; idx++) { 1388 for (idx = 1; idx <= RTNL_FAMILY_MAX; idx++) {
1389 int type = cb->nlh->nlmsg_type-RTM_BASE; 1389 int type = cb->nlh->nlmsg_type-RTM_BASE;
1390 if (idx < s_idx || idx == PF_PACKET) 1390 if (idx < s_idx || idx == PF_PACKET)
1391 continue; 1391 continue;