[NET] NETNS: Omit sock->sk_net without CONFIG_NET_NS.
Introduce per-sock inlines: sock_net(), sock_net_set() and per-inet_timewait_sock inlines: twsk_net(), twsk_net_set(). Without CONFIG_NET_NS, no namespace other than &init_net exists. Let's explicitly define them to help compiler optimizations. Signed-off-by: YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>
This commit is contained in:
@@ -1478,7 +1478,7 @@ int neigh_table_clear(struct neigh_table *tbl)
|
||||
|
||||
static int neigh_delete(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg)
|
||||
{
|
||||
struct net *net = skb->sk->sk_net;
|
||||
struct net *net = sock_net(skb->sk);
|
||||
struct ndmsg *ndm;
|
||||
struct nlattr *dst_attr;
|
||||
struct neigh_table *tbl;
|
||||
@@ -1544,7 +1544,7 @@ out:
|
||||
|
||||
static int neigh_add(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg)
|
||||
{
|
||||
struct net *net = skb->sk->sk_net;
|
||||
struct net *net = sock_net(skb->sk);
|
||||
struct ndmsg *ndm;
|
||||
struct nlattr *tb[NDA_MAX+1];
|
||||
struct neigh_table *tbl;
|
||||
@@ -1812,7 +1812,7 @@ static const struct nla_policy nl_ntbl_parm_policy[NDTPA_MAX+1] = {
|
||||
|
||||
static int neightbl_set(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg)
|
||||
{
|
||||
struct net *net = skb->sk->sk_net;
|
||||
struct net *net = sock_net(skb->sk);
|
||||
struct neigh_table *tbl;
|
||||
struct ndtmsg *ndtmsg;
|
||||
struct nlattr *tb[NDTA_MAX+1];
|
||||
@@ -1937,7 +1937,7 @@ errout:
|
||||
|
||||
static int neightbl_dump_info(struct sk_buff *skb, struct netlink_callback *cb)
|
||||
{
|
||||
struct net *net = skb->sk->sk_net;
|
||||
struct net *net = sock_net(skb->sk);
|
||||
int family, tidx, nidx = 0;
|
||||
int tbl_skip = cb->args[0];
|
||||
int neigh_skip = cb->args[1];
|
||||
@@ -2037,7 +2037,7 @@ static void neigh_update_notify(struct neighbour *neigh)
|
||||
static int neigh_dump_table(struct neigh_table *tbl, struct sk_buff *skb,
|
||||
struct netlink_callback *cb)
|
||||
{
|
||||
struct net * net = skb->sk->sk_net;
|
||||
struct net * net = sock_net(skb->sk);
|
||||
struct neighbour *n;
|
||||
int rc, h, s_h = cb->args[1];
|
||||
int idx, s_idx = idx = cb->args[2];
|
||||
|
Reference in New Issue
Block a user