aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/linux/fib_rules.h8
-rw-r--r--include/linux/rtnetlink.h6
-rw-r--r--net/core/rtnetlink.c14
-rw-r--r--net/decnet/dn_rules.c2
-rw-r--r--net/ipv4/fib_rules.c2
-rw-r--r--net/ipv4/ipmr.c2
-rw-r--r--net/ipv6/fib6_rules.c2
7 files changed, 17 insertions, 19 deletions
diff --git a/include/linux/fib_rules.h b/include/linux/fib_rules.h
index 04a397619ebe..51da65b68b85 100644
--- a/include/linux/fib_rules.h
+++ b/include/linux/fib_rules.h
@@ -15,14 +15,6 @@
15/* try to find source address in routing lookups */ 15/* try to find source address in routing lookups */
16#define FIB_RULE_FIND_SADDR 0x00010000 16#define FIB_RULE_FIND_SADDR 0x00010000
17 17
18/* fib_rules families. values up to 127 are reserved for real address
19 * families, values above 128 may be used arbitrarily.
20 */
21#define FIB_RULES_IPV4 AF_INET
22#define FIB_RULES_IPV6 AF_INET6
23#define FIB_RULES_DECNET AF_DECnet
24#define FIB_RULES_IPMR 128
25
26struct fib_rule_hdr { 18struct fib_rule_hdr {
27 __u8 family; 19 __u8 family;
28 __u8 dst_len; 20 __u8 dst_len;
diff --git a/include/linux/rtnetlink.h b/include/linux/rtnetlink.h
index d1c7c90e9cd4..5a42c36cb6aa 100644
--- a/include/linux/rtnetlink.h
+++ b/include/linux/rtnetlink.h
@@ -7,6 +7,12 @@
7#include <linux/if_addr.h> 7#include <linux/if_addr.h>
8#include <linux/neighbour.h> 8#include <linux/neighbour.h>
9 9
10/* rtnetlink families. Values up to 127 are reserved for real address
11 * families, values above 128 may be used arbitrarily.
12 */
13#define RTNL_FAMILY_IPMR 128
14#define RTNL_FAMILY_MAX 128
15
10/**** 16/****
11 * Routing/neighbour discovery messages. 17 * Routing/neighbour discovery messages.
12 ****/ 18 ****/
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)
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;
@@ -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;
diff --git a/net/decnet/dn_rules.c b/net/decnet/dn_rules.c
index 1226bcad776b..48fdf10be7a1 100644
--- a/net/decnet/dn_rules.c
+++ b/net/decnet/dn_rules.c
@@ -217,7 +217,7 @@ static void dn_fib_rule_flush_cache(struct fib_rules_ops *ops)
217} 217}
218 218
219static const struct fib_rules_ops __net_initdata dn_fib_rules_ops_template = { 219static const struct fib_rules_ops __net_initdata dn_fib_rules_ops_template = {
220 .family = FIB_RULES_DECNET, 220 .family = AF_DECnet,
221 .rule_size = sizeof(struct dn_fib_rule), 221 .rule_size = sizeof(struct dn_fib_rule),
222 .addr_size = sizeof(u16), 222 .addr_size = sizeof(u16),
223 .action = dn_fib_rule_action, 223 .action = dn_fib_rule_action,
diff --git a/net/ipv4/fib_rules.c b/net/ipv4/fib_rules.c
index 8ab62a56701c..76daeb5ff564 100644
--- a/net/ipv4/fib_rules.c
+++ b/net/ipv4/fib_rules.c
@@ -246,7 +246,7 @@ static void fib4_rule_flush_cache(struct fib_rules_ops *ops)
246} 246}
247 247
248static const struct fib_rules_ops __net_initdata fib4_rules_ops_template = { 248static const struct fib_rules_ops __net_initdata fib4_rules_ops_template = {
249 .family = FIB_RULES_IPV4, 249 .family = AF_INET,
250 .rule_size = sizeof(struct fib4_rule), 250 .rule_size = sizeof(struct fib4_rule),
251 .addr_size = sizeof(u32), 251 .addr_size = sizeof(u32),
252 .action = fib4_rule_action, 252 .action = fib4_rule_action,
diff --git a/net/ipv4/ipmr.c b/net/ipv4/ipmr.c
index 7d3e382aed64..41e8fc0ce8b3 100644
--- a/net/ipv4/ipmr.c
+++ b/net/ipv4/ipmr.c
@@ -217,7 +217,7 @@ static int ipmr_rule_fill(struct fib_rule *rule, struct sk_buff *skb,
217} 217}
218 218
219static const struct fib_rules_ops __net_initdata ipmr_rules_ops_template = { 219static const struct fib_rules_ops __net_initdata ipmr_rules_ops_template = {
220 .family = FIB_RULES_IPMR, 220 .family = RTNL_FAMILY_IPMR,
221 .rule_size = sizeof(struct ipmr_rule), 221 .rule_size = sizeof(struct ipmr_rule),
222 .addr_size = sizeof(u32), 222 .addr_size = sizeof(u32),
223 .action = ipmr_rule_action, 223 .action = ipmr_rule_action,
diff --git a/net/ipv6/fib6_rules.c b/net/ipv6/fib6_rules.c
index 35f6949446f0..8e44f8f9c188 100644
--- a/net/ipv6/fib6_rules.c
+++ b/net/ipv6/fib6_rules.c
@@ -238,7 +238,7 @@ static size_t fib6_rule_nlmsg_payload(struct fib_rule *rule)
238} 238}
239 239
240static const struct fib_rules_ops __net_initdata fib6_rules_ops_template = { 240static const struct fib_rules_ops __net_initdata fib6_rules_ops_template = {
241 .family = FIB_RULES_IPV6, 241 .family = AF_INET6,
242 .rule_size = sizeof(struct fib6_rule), 242 .rule_size = sizeof(struct fib6_rule),
243 .addr_size = sizeof(struct in6_addr), 243 .addr_size = sizeof(struct in6_addr),
244 .action = fib6_rule_action, 244 .action = fib6_rule_action,