mirror of https://gitee.com/openkylin/linux.git
rtnetlink: Remove passing of attributes into rtnl_doit functions
With decnet converted, we can finally get rid of rta_buf and its computations around it. It also gets rid of the minimal header length verification since all message handlers do that explicitly anyway. Signed-off-by: Thomas Graf <tgraf@suug.ch> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
58d7d8f9b2
commit
661d2967b3
|
@ -4,7 +4,7 @@
|
||||||
#include <linux/rtnetlink.h>
|
#include <linux/rtnetlink.h>
|
||||||
#include <net/netlink.h>
|
#include <net/netlink.h>
|
||||||
|
|
||||||
typedef int (*rtnl_doit_func)(struct sk_buff *, struct nlmsghdr *, void *);
|
typedef int (*rtnl_doit_func)(struct sk_buff *, struct nlmsghdr *);
|
||||||
typedef int (*rtnl_dumpit_func)(struct sk_buff *, struct netlink_callback *);
|
typedef int (*rtnl_dumpit_func)(struct sk_buff *, struct netlink_callback *);
|
||||||
typedef u16 (*rtnl_calcit_func)(struct sk_buff *, struct nlmsghdr *);
|
typedef u16 (*rtnl_calcit_func)(struct sk_buff *, struct nlmsghdr *);
|
||||||
|
|
||||||
|
|
|
@ -382,7 +382,7 @@ static int __br_mdb_add(struct net *net, struct net_bridge *br,
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int br_mdb_add(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg)
|
static int br_mdb_add(struct sk_buff *skb, struct nlmsghdr *nlh)
|
||||||
{
|
{
|
||||||
struct net *net = sock_net(skb->sk);
|
struct net *net = sock_net(skb->sk);
|
||||||
struct br_mdb_entry *entry;
|
struct br_mdb_entry *entry;
|
||||||
|
@ -458,7 +458,7 @@ static int __br_mdb_del(struct net_bridge *br, struct br_mdb_entry *entry)
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int br_mdb_del(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg)
|
static int br_mdb_del(struct sk_buff *skb, struct nlmsghdr *nlh)
|
||||||
{
|
{
|
||||||
struct net_device *dev;
|
struct net_device *dev;
|
||||||
struct br_mdb_entry *entry;
|
struct br_mdb_entry *entry;
|
||||||
|
|
|
@ -778,8 +778,7 @@ static int cgw_parse_attr(struct nlmsghdr *nlh, struct cf_mod *mod,
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int cgw_create_job(struct sk_buff *skb, struct nlmsghdr *nlh,
|
static int cgw_create_job(struct sk_buff *skb, struct nlmsghdr *nlh)
|
||||||
void *arg)
|
|
||||||
{
|
{
|
||||||
struct rtcanmsg *r;
|
struct rtcanmsg *r;
|
||||||
struct cgw_job *gwj;
|
struct cgw_job *gwj;
|
||||||
|
@ -868,7 +867,7 @@ static void cgw_remove_all_jobs(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static int cgw_remove_job(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg)
|
static int cgw_remove_job(struct sk_buff *skb, struct nlmsghdr *nlh)
|
||||||
{
|
{
|
||||||
struct cgw_job *gwj = NULL;
|
struct cgw_job *gwj = NULL;
|
||||||
struct hlist_node *nx;
|
struct hlist_node *nx;
|
||||||
|
|
|
@ -266,7 +266,7 @@ static int validate_rulemsg(struct fib_rule_hdr *frh, struct nlattr **tb,
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
static 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)
|
||||||
{
|
{
|
||||||
struct net *net = sock_net(skb->sk);
|
struct net *net = sock_net(skb->sk);
|
||||||
struct fib_rule_hdr *frh = nlmsg_data(nlh);
|
struct fib_rule_hdr *frh = nlmsg_data(nlh);
|
||||||
|
@ -415,7 +415,7 @@ static int fib_nl_newrule(struct sk_buff *skb, struct nlmsghdr* nlh, void *arg)
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
static 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)
|
||||||
{
|
{
|
||||||
struct net *net = sock_net(skb->sk);
|
struct net *net = sock_net(skb->sk);
|
||||||
struct fib_rule_hdr *frh = nlmsg_data(nlh);
|
struct fib_rule_hdr *frh = nlmsg_data(nlh);
|
||||||
|
|
|
@ -1613,7 +1613,7 @@ int neigh_table_clear(struct neigh_table *tbl)
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL(neigh_table_clear);
|
EXPORT_SYMBOL(neigh_table_clear);
|
||||||
|
|
||||||
static int neigh_delete(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg)
|
static int neigh_delete(struct sk_buff *skb, struct nlmsghdr *nlh)
|
||||||
{
|
{
|
||||||
struct net *net = sock_net(skb->sk);
|
struct net *net = sock_net(skb->sk);
|
||||||
struct ndmsg *ndm;
|
struct ndmsg *ndm;
|
||||||
|
@ -1677,7 +1677,7 @@ static int neigh_delete(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg)
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int neigh_add(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg)
|
static int neigh_add(struct sk_buff *skb, struct nlmsghdr *nlh)
|
||||||
{
|
{
|
||||||
struct net *net = sock_net(skb->sk);
|
struct net *net = sock_net(skb->sk);
|
||||||
struct ndmsg *ndm;
|
struct ndmsg *ndm;
|
||||||
|
@ -1955,7 +1955,7 @@ static const struct nla_policy nl_ntbl_parm_policy[NDTPA_MAX+1] = {
|
||||||
[NDTPA_LOCKTIME] = { .type = NLA_U64 },
|
[NDTPA_LOCKTIME] = { .type = NLA_U64 },
|
||||||
};
|
};
|
||||||
|
|
||||||
static int neightbl_set(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg)
|
static int neightbl_set(struct sk_buff *skb, struct nlmsghdr *nlh)
|
||||||
{
|
{
|
||||||
struct net *net = sock_net(skb->sk);
|
struct net *net = sock_net(skb->sk);
|
||||||
struct neigh_table *tbl;
|
struct neigh_table *tbl;
|
||||||
|
|
|
@ -515,32 +515,6 @@ static int rtnl_link_fill(struct sk_buff *skb, const struct net_device *dev)
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
static const int rtm_min[RTM_NR_FAMILIES] =
|
|
||||||
{
|
|
||||||
[RTM_FAM(RTM_NEWLINK)] = NLMSG_LENGTH(sizeof(struct ifinfomsg)),
|
|
||||||
[RTM_FAM(RTM_NEWADDR)] = NLMSG_LENGTH(sizeof(struct ifaddrmsg)),
|
|
||||||
[RTM_FAM(RTM_NEWROUTE)] = NLMSG_LENGTH(sizeof(struct rtmsg)),
|
|
||||||
[RTM_FAM(RTM_NEWRULE)] = NLMSG_LENGTH(sizeof(struct fib_rule_hdr)),
|
|
||||||
[RTM_FAM(RTM_NEWQDISC)] = NLMSG_LENGTH(sizeof(struct tcmsg)),
|
|
||||||
[RTM_FAM(RTM_NEWTCLASS)] = NLMSG_LENGTH(sizeof(struct tcmsg)),
|
|
||||||
[RTM_FAM(RTM_NEWTFILTER)] = NLMSG_LENGTH(sizeof(struct tcmsg)),
|
|
||||||
[RTM_FAM(RTM_NEWACTION)] = NLMSG_LENGTH(sizeof(struct tcamsg)),
|
|
||||||
[RTM_FAM(RTM_GETMULTICAST)] = NLMSG_LENGTH(sizeof(struct rtgenmsg)),
|
|
||||||
[RTM_FAM(RTM_GETANYCAST)] = NLMSG_LENGTH(sizeof(struct rtgenmsg)),
|
|
||||||
};
|
|
||||||
|
|
||||||
static const int rta_max[RTM_NR_FAMILIES] =
|
|
||||||
{
|
|
||||||
[RTM_FAM(RTM_NEWLINK)] = IFLA_MAX,
|
|
||||||
[RTM_FAM(RTM_NEWADDR)] = IFA_MAX,
|
|
||||||
[RTM_FAM(RTM_NEWROUTE)] = RTA_MAX,
|
|
||||||
[RTM_FAM(RTM_NEWRULE)] = FRA_MAX,
|
|
||||||
[RTM_FAM(RTM_NEWQDISC)] = TCA_MAX,
|
|
||||||
[RTM_FAM(RTM_NEWTCLASS)] = TCA_MAX,
|
|
||||||
[RTM_FAM(RTM_NEWTFILTER)] = TCA_MAX,
|
|
||||||
[RTM_FAM(RTM_NEWACTION)] = TCAA_MAX,
|
|
||||||
};
|
|
||||||
|
|
||||||
int rtnetlink_send(struct sk_buff *skb, struct net *net, u32 pid, unsigned int group, int echo)
|
int rtnetlink_send(struct sk_buff *skb, struct net *net, u32 pid, unsigned int group, int echo)
|
||||||
{
|
{
|
||||||
struct sock *rtnl = net->rtnl;
|
struct sock *rtnl = net->rtnl;
|
||||||
|
@ -1537,7 +1511,7 @@ static int do_setlink(struct net_device *dev, struct ifinfomsg *ifm,
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int rtnl_setlink(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg)
|
static int rtnl_setlink(struct sk_buff *skb, struct nlmsghdr *nlh)
|
||||||
{
|
{
|
||||||
struct net *net = sock_net(skb->sk);
|
struct net *net = sock_net(skb->sk);
|
||||||
struct ifinfomsg *ifm;
|
struct ifinfomsg *ifm;
|
||||||
|
@ -1578,7 +1552,7 @@ static int rtnl_setlink(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg)
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int rtnl_dellink(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg)
|
static int rtnl_dellink(struct sk_buff *skb, struct nlmsghdr *nlh)
|
||||||
{
|
{
|
||||||
struct net *net = sock_net(skb->sk);
|
struct net *net = sock_net(skb->sk);
|
||||||
const struct rtnl_link_ops *ops;
|
const struct rtnl_link_ops *ops;
|
||||||
|
@ -1709,7 +1683,7 @@ static int rtnl_group_changelink(struct net *net, int group,
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int rtnl_newlink(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg)
|
static int rtnl_newlink(struct sk_buff *skb, struct nlmsghdr *nlh)
|
||||||
{
|
{
|
||||||
struct net *net = sock_net(skb->sk);
|
struct net *net = sock_net(skb->sk);
|
||||||
const struct rtnl_link_ops *ops;
|
const struct rtnl_link_ops *ops;
|
||||||
|
@ -1864,7 +1838,7 @@ static int rtnl_newlink(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static int rtnl_getlink(struct sk_buff *skb, struct nlmsghdr* nlh, void *arg)
|
static int rtnl_getlink(struct sk_buff *skb, struct nlmsghdr* nlh)
|
||||||
{
|
{
|
||||||
struct net *net = sock_net(skb->sk);
|
struct net *net = sock_net(skb->sk);
|
||||||
struct ifinfomsg *ifm;
|
struct ifinfomsg *ifm;
|
||||||
|
@ -2081,7 +2055,7 @@ int ndo_dflt_fdb_add(struct ndmsg *ndm,
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL(ndo_dflt_fdb_add);
|
EXPORT_SYMBOL(ndo_dflt_fdb_add);
|
||||||
|
|
||||||
static int rtnl_fdb_add(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg)
|
static int rtnl_fdb_add(struct sk_buff *skb, struct nlmsghdr *nlh)
|
||||||
{
|
{
|
||||||
struct net *net = sock_net(skb->sk);
|
struct net *net = sock_net(skb->sk);
|
||||||
struct ndmsg *ndm;
|
struct ndmsg *ndm;
|
||||||
|
@ -2179,7 +2153,7 @@ int ndo_dflt_fdb_del(struct ndmsg *ndm,
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL(ndo_dflt_fdb_del);
|
EXPORT_SYMBOL(ndo_dflt_fdb_del);
|
||||||
|
|
||||||
static int rtnl_fdb_del(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg)
|
static int rtnl_fdb_del(struct sk_buff *skb, struct nlmsghdr *nlh)
|
||||||
{
|
{
|
||||||
struct net *net = sock_net(skb->sk);
|
struct net *net = sock_net(skb->sk);
|
||||||
struct ndmsg *ndm;
|
struct ndmsg *ndm;
|
||||||
|
@ -2478,8 +2452,7 @@ static int rtnl_bridge_notify(struct net_device *dev, u16 flags)
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int rtnl_bridge_setlink(struct sk_buff *skb, struct nlmsghdr *nlh,
|
static int rtnl_bridge_setlink(struct sk_buff *skb, struct nlmsghdr *nlh)
|
||||||
void *arg)
|
|
||||||
{
|
{
|
||||||
struct net *net = sock_net(skb->sk);
|
struct net *net = sock_net(skb->sk);
|
||||||
struct ifinfomsg *ifm;
|
struct ifinfomsg *ifm;
|
||||||
|
@ -2549,8 +2522,7 @@ static int rtnl_bridge_setlink(struct sk_buff *skb, struct nlmsghdr *nlh,
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int rtnl_bridge_dellink(struct sk_buff *skb, struct nlmsghdr *nlh,
|
static int rtnl_bridge_dellink(struct sk_buff *skb, struct nlmsghdr *nlh)
|
||||||
void *arg)
|
|
||||||
{
|
{
|
||||||
struct net *net = sock_net(skb->sk);
|
struct net *net = sock_net(skb->sk);
|
||||||
struct ifinfomsg *ifm;
|
struct ifinfomsg *ifm;
|
||||||
|
@ -2620,10 +2592,6 @@ static int rtnl_bridge_dellink(struct sk_buff *skb, struct nlmsghdr *nlh,
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Protected by RTNL sempahore. */
|
|
||||||
static struct rtattr **rta_buf;
|
|
||||||
static int rtattr_max;
|
|
||||||
|
|
||||||
/* Process one rtnetlink message. */
|
/* Process one rtnetlink message. */
|
||||||
|
|
||||||
static int rtnetlink_rcv_msg(struct sk_buff *skb, struct nlmsghdr *nlh)
|
static int rtnetlink_rcv_msg(struct sk_buff *skb, struct nlmsghdr *nlh)
|
||||||
|
@ -2631,7 +2599,6 @@ static int rtnetlink_rcv_msg(struct sk_buff *skb, struct nlmsghdr *nlh)
|
||||||
struct net *net = sock_net(skb->sk);
|
struct net *net = sock_net(skb->sk);
|
||||||
rtnl_doit_func doit;
|
rtnl_doit_func doit;
|
||||||
int sz_idx, kind;
|
int sz_idx, kind;
|
||||||
int min_len;
|
|
||||||
int family;
|
int family;
|
||||||
int type;
|
int type;
|
||||||
int err;
|
int err;
|
||||||
|
@ -2679,32 +2646,11 @@ static int rtnetlink_rcv_msg(struct sk_buff *skb, struct nlmsghdr *nlh)
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
memset(rta_buf, 0, (rtattr_max * sizeof(struct rtattr *)));
|
|
||||||
|
|
||||||
min_len = rtm_min[sz_idx];
|
|
||||||
if (nlh->nlmsg_len < min_len)
|
|
||||||
return -EINVAL;
|
|
||||||
|
|
||||||
if (nlh->nlmsg_len > min_len) {
|
|
||||||
int attrlen = nlh->nlmsg_len - NLMSG_ALIGN(min_len);
|
|
||||||
struct rtattr *attr = (void *)nlh + NLMSG_ALIGN(min_len);
|
|
||||||
|
|
||||||
while (RTA_OK(attr, attrlen)) {
|
|
||||||
unsigned int flavor = attr->rta_type & NLA_TYPE_MASK;
|
|
||||||
if (flavor) {
|
|
||||||
if (flavor > rta_max[sz_idx])
|
|
||||||
return -EINVAL;
|
|
||||||
rta_buf[flavor-1] = attr;
|
|
||||||
}
|
|
||||||
attr = RTA_NEXT(attr, attrlen);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
doit = rtnl_get_doit(family, type);
|
doit = rtnl_get_doit(family, type);
|
||||||
if (doit == NULL)
|
if (doit == NULL)
|
||||||
return -EOPNOTSUPP;
|
return -EOPNOTSUPP;
|
||||||
|
|
||||||
return doit(skb, nlh, (void *)&rta_buf[0]);
|
return doit(skb, nlh);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void rtnetlink_rcv(struct sk_buff *skb)
|
static void rtnetlink_rcv(struct sk_buff *skb)
|
||||||
|
@ -2774,16 +2720,6 @@ static struct pernet_operations rtnetlink_net_ops = {
|
||||||
|
|
||||||
void __init rtnetlink_init(void)
|
void __init rtnetlink_init(void)
|
||||||
{
|
{
|
||||||
int i;
|
|
||||||
|
|
||||||
rtattr_max = 0;
|
|
||||||
for (i = 0; i < ARRAY_SIZE(rta_max); i++)
|
|
||||||
if (rta_max[i] > rtattr_max)
|
|
||||||
rtattr_max = rta_max[i];
|
|
||||||
rta_buf = kmalloc(rtattr_max * sizeof(struct rtattr *), GFP_KERNEL);
|
|
||||||
if (!rta_buf)
|
|
||||||
panic("rtnetlink_init: cannot allocate rta_buf\n");
|
|
||||||
|
|
||||||
if (register_pernet_subsys(&rtnetlink_net_ops))
|
if (register_pernet_subsys(&rtnetlink_net_ops))
|
||||||
panic("rtnetlink_init: cannot initialize rtnetlink\n");
|
panic("rtnetlink_init: cannot initialize rtnetlink\n");
|
||||||
|
|
||||||
|
|
|
@ -1658,7 +1658,7 @@ static const struct reply_func reply_funcs[DCB_CMD_MAX+1] = {
|
||||||
[DCB_CMD_CEE_GET] = { RTM_GETDCB, dcbnl_cee_get },
|
[DCB_CMD_CEE_GET] = { RTM_GETDCB, dcbnl_cee_get },
|
||||||
};
|
};
|
||||||
|
|
||||||
static int dcb_doit(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg)
|
static int dcb_doit(struct sk_buff *skb, struct nlmsghdr *nlh)
|
||||||
{
|
{
|
||||||
struct net *net = sock_net(skb->sk);
|
struct net *net = sock_net(skb->sk);
|
||||||
struct net_device *netdev;
|
struct net_device *netdev;
|
||||||
|
|
|
@ -563,7 +563,7 @@ static const struct nla_policy dn_ifa_policy[IFA_MAX+1] = {
|
||||||
.len = IFNAMSIZ - 1 },
|
.len = IFNAMSIZ - 1 },
|
||||||
};
|
};
|
||||||
|
|
||||||
static int dn_nl_deladdr(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg)
|
static int dn_nl_deladdr(struct sk_buff *skb, struct nlmsghdr *nlh)
|
||||||
{
|
{
|
||||||
struct net *net = sock_net(skb->sk);
|
struct net *net = sock_net(skb->sk);
|
||||||
struct nlattr *tb[IFA_MAX+1];
|
struct nlattr *tb[IFA_MAX+1];
|
||||||
|
@ -607,7 +607,7 @@ static int dn_nl_deladdr(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg)
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int dn_nl_newaddr(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg)
|
static int dn_nl_newaddr(struct sk_buff *skb, struct nlmsghdr *nlh)
|
||||||
{
|
{
|
||||||
struct net *net = sock_net(skb->sk);
|
struct net *net = sock_net(skb->sk);
|
||||||
struct nlattr *tb[IFA_MAX+1];
|
struct nlattr *tb[IFA_MAX+1];
|
||||||
|
|
|
@ -511,7 +511,7 @@ static inline u32 rtm_get_table(struct nlattr *attrs[], u8 table)
|
||||||
return table;
|
return table;
|
||||||
}
|
}
|
||||||
|
|
||||||
static 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)
|
||||||
{
|
{
|
||||||
struct net *net = sock_net(skb->sk);
|
struct net *net = sock_net(skb->sk);
|
||||||
struct dn_fib_table *tb;
|
struct dn_fib_table *tb;
|
||||||
|
@ -536,7 +536,7 @@ static int dn_fib_rtm_delroute(struct sk_buff *skb, struct nlmsghdr *nlh, void *
|
||||||
return tb->delete(tb, r, attrs, nlh, &NETLINK_CB(skb));
|
return tb->delete(tb, r, attrs, nlh, &NETLINK_CB(skb));
|
||||||
}
|
}
|
||||||
|
|
||||||
static 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)
|
||||||
{
|
{
|
||||||
struct net *net = sock_net(skb->sk);
|
struct net *net = sock_net(skb->sk);
|
||||||
struct dn_fib_table *tb;
|
struct dn_fib_table *tb;
|
||||||
|
|
|
@ -1616,7 +1616,7 @@ static int dn_rt_fill_info(struct sk_buff *skb, u32 portid, u32 seq,
|
||||||
/*
|
/*
|
||||||
* This is called by both endnodes and routers now.
|
* This is called by both endnodes and routers now.
|
||||||
*/
|
*/
|
||||||
static 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)
|
||||||
{
|
{
|
||||||
struct net *net = sock_net(in_skb->sk);
|
struct net *net = sock_net(in_skb->sk);
|
||||||
struct rtmsg *rtm = nlmsg_data(nlh);
|
struct rtmsg *rtm = nlmsg_data(nlh);
|
||||||
|
|
|
@ -536,7 +536,7 @@ struct in_ifaddr *inet_ifa_byprefix(struct in_device *in_dev, __be32 prefix,
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int inet_rtm_deladdr(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg)
|
static int inet_rtm_deladdr(struct sk_buff *skb, struct nlmsghdr *nlh)
|
||||||
{
|
{
|
||||||
struct net *net = sock_net(skb->sk);
|
struct net *net = sock_net(skb->sk);
|
||||||
struct nlattr *tb[IFA_MAX+1];
|
struct nlattr *tb[IFA_MAX+1];
|
||||||
|
@ -775,7 +775,7 @@ static struct in_ifaddr *find_matching_ifa(struct in_ifaddr *ifa)
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int inet_rtm_newaddr(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg)
|
static int inet_rtm_newaddr(struct sk_buff *skb, struct nlmsghdr *nlh)
|
||||||
{
|
{
|
||||||
struct net *net = sock_net(skb->sk);
|
struct net *net = sock_net(skb->sk);
|
||||||
struct in_ifaddr *ifa;
|
struct in_ifaddr *ifa;
|
||||||
|
@ -1730,8 +1730,7 @@ static const struct nla_policy devconf_ipv4_policy[NETCONFA_MAX+1] = {
|
||||||
};
|
};
|
||||||
|
|
||||||
static int inet_netconf_get_devconf(struct sk_buff *in_skb,
|
static int inet_netconf_get_devconf(struct sk_buff *in_skb,
|
||||||
struct nlmsghdr *nlh,
|
struct nlmsghdr *nlh)
|
||||||
void *arg)
|
|
||||||
{
|
{
|
||||||
struct net *net = sock_net(in_skb->sk);
|
struct net *net = sock_net(in_skb->sk);
|
||||||
struct nlattr *tb[NETCONFA_MAX+1];
|
struct nlattr *tb[NETCONFA_MAX+1];
|
||||||
|
|
|
@ -604,7 +604,7 @@ static int rtm_to_fib_config(struct net *net, struct sk_buff *skb,
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
static 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)
|
||||||
{
|
{
|
||||||
struct net *net = sock_net(skb->sk);
|
struct net *net = sock_net(skb->sk);
|
||||||
struct fib_config cfg;
|
struct fib_config cfg;
|
||||||
|
@ -626,7 +626,7 @@ static int inet_rtm_delroute(struct sk_buff *skb, struct nlmsghdr *nlh, void *ar
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
static 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)
|
||||||
{
|
{
|
||||||
struct net *net = sock_net(skb->sk);
|
struct net *net = sock_net(skb->sk);
|
||||||
struct fib_config cfg;
|
struct fib_config cfg;
|
||||||
|
|
|
@ -2311,7 +2311,7 @@ static int rt_fill_info(struct net *net, __be32 dst, __be32 src,
|
||||||
return -EMSGSIZE;
|
return -EMSGSIZE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static 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)
|
||||||
{
|
{
|
||||||
struct net *net = sock_net(in_skb->sk);
|
struct net *net = sock_net(in_skb->sk);
|
||||||
struct rtmsg *rtm;
|
struct rtmsg *rtm;
|
||||||
|
|
|
@ -544,8 +544,7 @@ static const struct nla_policy devconf_ipv6_policy[NETCONFA_MAX+1] = {
|
||||||
};
|
};
|
||||||
|
|
||||||
static int inet6_netconf_get_devconf(struct sk_buff *in_skb,
|
static int inet6_netconf_get_devconf(struct sk_buff *in_skb,
|
||||||
struct nlmsghdr *nlh,
|
struct nlmsghdr *nlh)
|
||||||
void *arg)
|
|
||||||
{
|
{
|
||||||
struct net *net = sock_net(in_skb->sk);
|
struct net *net = sock_net(in_skb->sk);
|
||||||
struct nlattr *tb[NETCONFA_MAX+1];
|
struct nlattr *tb[NETCONFA_MAX+1];
|
||||||
|
@ -3578,7 +3577,7 @@ static const struct nla_policy ifa_ipv6_policy[IFA_MAX+1] = {
|
||||||
};
|
};
|
||||||
|
|
||||||
static int
|
static int
|
||||||
inet6_rtm_deladdr(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg)
|
inet6_rtm_deladdr(struct sk_buff *skb, struct nlmsghdr *nlh)
|
||||||
{
|
{
|
||||||
struct net *net = sock_net(skb->sk);
|
struct net *net = sock_net(skb->sk);
|
||||||
struct ifaddrmsg *ifm;
|
struct ifaddrmsg *ifm;
|
||||||
|
@ -3644,7 +3643,7 @@ static int inet6_addr_modify(struct inet6_ifaddr *ifp, u8 ifa_flags,
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
inet6_rtm_newaddr(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg)
|
inet6_rtm_newaddr(struct sk_buff *skb, struct nlmsghdr *nlh)
|
||||||
{
|
{
|
||||||
struct net *net = sock_net(skb->sk);
|
struct net *net = sock_net(skb->sk);
|
||||||
struct ifaddrmsg *ifm;
|
struct ifaddrmsg *ifm;
|
||||||
|
@ -3983,8 +3982,7 @@ static int inet6_dump_ifacaddr(struct sk_buff *skb, struct netlink_callback *cb)
|
||||||
return inet6_dump_addr(skb, cb, type);
|
return inet6_dump_addr(skb, cb, type);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int inet6_rtm_getaddr(struct sk_buff *in_skb, struct nlmsghdr *nlh,
|
static int inet6_rtm_getaddr(struct sk_buff *in_skb, struct nlmsghdr *nlh)
|
||||||
void *arg)
|
|
||||||
{
|
{
|
||||||
struct net *net = sock_net(in_skb->sk);
|
struct net *net = sock_net(in_skb->sk);
|
||||||
struct ifaddrmsg *ifm;
|
struct ifaddrmsg *ifm;
|
||||||
|
|
|
@ -414,8 +414,7 @@ static const struct nla_policy ifal_policy[IFAL_MAX+1] = {
|
||||||
[IFAL_LABEL] = { .len = sizeof(u32), },
|
[IFAL_LABEL] = { .len = sizeof(u32), },
|
||||||
};
|
};
|
||||||
|
|
||||||
static int ip6addrlbl_newdel(struct sk_buff *skb, struct nlmsghdr *nlh,
|
static int ip6addrlbl_newdel(struct sk_buff *skb, struct nlmsghdr *nlh)
|
||||||
void *arg)
|
|
||||||
{
|
{
|
||||||
struct net *net = sock_net(skb->sk);
|
struct net *net = sock_net(skb->sk);
|
||||||
struct ifaddrlblmsg *ifal;
|
struct ifaddrlblmsg *ifal;
|
||||||
|
@ -530,8 +529,7 @@ static inline int ip6addrlbl_msgsize(void)
|
||||||
+ nla_total_size(4); /* IFAL_LABEL */
|
+ nla_total_size(4); /* IFAL_LABEL */
|
||||||
}
|
}
|
||||||
|
|
||||||
static int ip6addrlbl_get(struct sk_buff *in_skb, struct nlmsghdr* nlh,
|
static int ip6addrlbl_get(struct sk_buff *in_skb, struct nlmsghdr* nlh)
|
||||||
void *arg)
|
|
||||||
{
|
{
|
||||||
struct net *net = sock_net(in_skb->sk);
|
struct net *net = sock_net(in_skb->sk);
|
||||||
struct ifaddrlblmsg *ifal;
|
struct ifaddrlblmsg *ifal;
|
||||||
|
|
|
@ -2355,7 +2355,7 @@ static int ip6_route_multipath(struct fib6_config *cfg, int add)
|
||||||
return last_err;
|
return last_err;
|
||||||
}
|
}
|
||||||
|
|
||||||
static 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)
|
||||||
{
|
{
|
||||||
struct fib6_config cfg;
|
struct fib6_config cfg;
|
||||||
int err;
|
int err;
|
||||||
|
@ -2370,7 +2370,7 @@ static int inet6_rtm_delroute(struct sk_buff *skb, struct nlmsghdr* nlh, void *a
|
||||||
return ip6_route_del(&cfg);
|
return ip6_route_del(&cfg);
|
||||||
}
|
}
|
||||||
|
|
||||||
static 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)
|
||||||
{
|
{
|
||||||
struct fib6_config cfg;
|
struct fib6_config cfg;
|
||||||
int err;
|
int err;
|
||||||
|
@ -2562,7 +2562,7 @@ int rt6_dump_route(struct rt6_info *rt, void *p_arg)
|
||||||
prefix, 0, NLM_F_MULTI);
|
prefix, 0, NLM_F_MULTI);
|
||||||
}
|
}
|
||||||
|
|
||||||
static 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)
|
||||||
{
|
{
|
||||||
struct net *net = sock_net(in_skb->sk);
|
struct net *net = sock_net(in_skb->sk);
|
||||||
struct nlattr *tb[RTA_MAX+1];
|
struct nlattr *tb[RTA_MAX+1];
|
||||||
|
|
|
@ -61,7 +61,7 @@ static const struct nla_policy ifa_phonet_policy[IFA_MAX+1] = {
|
||||||
[IFA_LOCAL] = { .type = NLA_U8 },
|
[IFA_LOCAL] = { .type = NLA_U8 },
|
||||||
};
|
};
|
||||||
|
|
||||||
static int addr_doit(struct sk_buff *skb, struct nlmsghdr *nlh, void *attr)
|
static int addr_doit(struct sk_buff *skb, struct nlmsghdr *nlh)
|
||||||
{
|
{
|
||||||
struct net *net = sock_net(skb->sk);
|
struct net *net = sock_net(skb->sk);
|
||||||
struct nlattr *tb[IFA_MAX+1];
|
struct nlattr *tb[IFA_MAX+1];
|
||||||
|
@ -224,7 +224,7 @@ static const struct nla_policy rtm_phonet_policy[RTA_MAX+1] = {
|
||||||
[RTA_OIF] = { .type = NLA_U32 },
|
[RTA_OIF] = { .type = NLA_U32 },
|
||||||
};
|
};
|
||||||
|
|
||||||
static int route_doit(struct sk_buff *skb, struct nlmsghdr *nlh, void *attr)
|
static int route_doit(struct sk_buff *skb, struct nlmsghdr *nlh)
|
||||||
{
|
{
|
||||||
struct net *net = sock_net(skb->sk);
|
struct net *net = sock_net(skb->sk);
|
||||||
struct nlattr *tb[RTA_MAX+1];
|
struct nlattr *tb[RTA_MAX+1];
|
||||||
|
|
|
@ -982,7 +982,7 @@ tcf_action_add(struct net *net, struct nlattr *nla, struct nlmsghdr *n,
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int tc_ctl_action(struct sk_buff *skb, struct nlmsghdr *n, void *arg)
|
static int tc_ctl_action(struct sk_buff *skb, struct nlmsghdr *n)
|
||||||
{
|
{
|
||||||
struct net *net = sock_net(skb->sk);
|
struct net *net = sock_net(skb->sk);
|
||||||
struct nlattr *tca[TCA_ACT_MAX + 1];
|
struct nlattr *tca[TCA_ACT_MAX + 1];
|
||||||
|
|
|
@ -118,7 +118,7 @@ static inline u32 tcf_auto_prio(struct tcf_proto *tp)
|
||||||
|
|
||||||
/* Add/change/delete/get a filter node */
|
/* Add/change/delete/get a filter node */
|
||||||
|
|
||||||
static int tc_ctl_tfilter(struct sk_buff *skb, struct nlmsghdr *n, void *arg)
|
static int tc_ctl_tfilter(struct sk_buff *skb, struct nlmsghdr *n)
|
||||||
{
|
{
|
||||||
struct net *net = sock_net(skb->sk);
|
struct net *net = sock_net(skb->sk);
|
||||||
struct nlattr *tca[TCA_MAX + 1];
|
struct nlattr *tca[TCA_MAX + 1];
|
||||||
|
|
|
@ -971,7 +971,7 @@ check_loop_fn(struct Qdisc *q, unsigned long cl, struct qdisc_walker *w)
|
||||||
* Delete/get qdisc.
|
* Delete/get qdisc.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static int tc_get_qdisc(struct sk_buff *skb, struct nlmsghdr *n, void *arg)
|
static int tc_get_qdisc(struct sk_buff *skb, struct nlmsghdr *n)
|
||||||
{
|
{
|
||||||
struct net *net = sock_net(skb->sk);
|
struct net *net = sock_net(skb->sk);
|
||||||
struct tcmsg *tcm = nlmsg_data(n);
|
struct tcmsg *tcm = nlmsg_data(n);
|
||||||
|
@ -1038,7 +1038,7 @@ static int tc_get_qdisc(struct sk_buff *skb, struct nlmsghdr *n, void *arg)
|
||||||
* Create/change qdisc.
|
* Create/change qdisc.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static int tc_modify_qdisc(struct sk_buff *skb, struct nlmsghdr *n, void *arg)
|
static int tc_modify_qdisc(struct sk_buff *skb, struct nlmsghdr *n)
|
||||||
{
|
{
|
||||||
struct net *net = sock_net(skb->sk);
|
struct net *net = sock_net(skb->sk);
|
||||||
struct tcmsg *tcm;
|
struct tcmsg *tcm;
|
||||||
|
@ -1372,7 +1372,7 @@ static int tc_dump_qdisc(struct sk_buff *skb, struct netlink_callback *cb)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
static int tc_ctl_tclass(struct sk_buff *skb, struct nlmsghdr *n, void *arg)
|
static int tc_ctl_tclass(struct sk_buff *skb, struct nlmsghdr *n)
|
||||||
{
|
{
|
||||||
struct net *net = sock_net(skb->sk);
|
struct net *net = sock_net(skb->sk);
|
||||||
struct tcmsg *tcm = nlmsg_data(n);
|
struct tcmsg *tcm = nlmsg_data(n);
|
||||||
|
|
Loading…
Reference in New Issue