net: fib_rules: decouple address families from real address families
Decouple the address family values used for fib_rules from the real address families in socket.h. This allows to use fib_rules for code that is not a real address family without increasing AF_MAX/NPROTO. Values up to 127 are reserved for real address families and map directly to the corresponding AF value, values starting from 128 are for other uses. rtnetlink is changed to invoke the AF_UNSPEC dumpit/doit handlers for these families. Signed-off-by: Patrick McHardy <kaber@trash.net> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
committed by
David S. Miller
parent
28bb17268b
commit
0f87b1dd01
@@ -118,7 +118,11 @@ static rtnl_doit_func rtnl_get_doit(int protocol, int msgindex)
|
||||
{
|
||||
struct rtnl_link *tab;
|
||||
|
||||
tab = rtnl_msg_handlers[protocol];
|
||||
if (protocol < NPROTO)
|
||||
tab = rtnl_msg_handlers[protocol];
|
||||
else
|
||||
tab = NULL;
|
||||
|
||||
if (tab == NULL || tab[msgindex].doit == NULL)
|
||||
tab = rtnl_msg_handlers[PF_UNSPEC];
|
||||
|
||||
@@ -129,7 +133,11 @@ static rtnl_dumpit_func rtnl_get_dumpit(int protocol, int msgindex)
|
||||
{
|
||||
struct rtnl_link *tab;
|
||||
|
||||
tab = rtnl_msg_handlers[protocol];
|
||||
if (protocol < NPROTO)
|
||||
tab = rtnl_msg_handlers[protocol];
|
||||
else
|
||||
tab = NULL;
|
||||
|
||||
if (tab == NULL || tab[msgindex].dumpit == NULL)
|
||||
tab = rtnl_msg_handlers[PF_UNSPEC];
|
||||
|
||||
@@ -1444,9 +1452,6 @@ static int rtnetlink_rcv_msg(struct sk_buff *skb, struct nlmsghdr *nlh)
|
||||
return 0;
|
||||
|
||||
family = ((struct rtgenmsg *)NLMSG_DATA(nlh))->rtgen_family;
|
||||
if (family >= NPROTO)
|
||||
return -EAFNOSUPPORT;
|
||||
|
||||
sz_idx = type>>2;
|
||||
kind = type&3;
|
||||
|
||||
|
Reference in New Issue
Block a user