mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-07-06 06:21:31 +00:00
[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:
parent
c346dca108
commit
3b1e0a655f
69 changed files with 253 additions and 215 deletions
|
@ -1486,7 +1486,7 @@ static struct sock *tcp_v4_hnd_req(struct sock *sk, struct sk_buff *skb)
|
|||
if (req)
|
||||
return tcp_check_req(sk, skb, req, prev);
|
||||
|
||||
nsk = inet_lookup_established(sk->sk_net, &tcp_hashinfo, iph->saddr,
|
||||
nsk = inet_lookup_established(sock_net(sk), &tcp_hashinfo, iph->saddr,
|
||||
th->source, iph->daddr, th->dest, inet_iif(skb));
|
||||
|
||||
if (nsk) {
|
||||
|
@ -1974,7 +1974,7 @@ static void *listening_get_next(struct seq_file *seq, void *cur)
|
|||
while (1) {
|
||||
while (req) {
|
||||
if (req->rsk_ops->family == st->family &&
|
||||
req->sk->sk_net == net) {
|
||||
sock_net(req->sk) == net) {
|
||||
cur = req;
|
||||
goto out;
|
||||
}
|
||||
|
@ -1998,7 +1998,7 @@ get_req:
|
|||
}
|
||||
get_sk:
|
||||
sk_for_each_from(sk, node) {
|
||||
if (sk->sk_family == st->family && sk->sk_net == net) {
|
||||
if (sk->sk_family == st->family && sock_net(sk) == net) {
|
||||
cur = sk;
|
||||
goto out;
|
||||
}
|
||||
|
@ -2049,7 +2049,7 @@ static void *established_get_first(struct seq_file *seq)
|
|||
read_lock_bh(lock);
|
||||
sk_for_each(sk, node, &tcp_hashinfo.ehash[st->bucket].chain) {
|
||||
if (sk->sk_family != st->family ||
|
||||
sk->sk_net != net) {
|
||||
sock_net(sk) != net) {
|
||||
continue;
|
||||
}
|
||||
rc = sk;
|
||||
|
@ -2059,7 +2059,7 @@ static void *established_get_first(struct seq_file *seq)
|
|||
inet_twsk_for_each(tw, node,
|
||||
&tcp_hashinfo.ehash[st->bucket].twchain) {
|
||||
if (tw->tw_family != st->family ||
|
||||
tw->tw_net != net) {
|
||||
twsk_net(tw) != net) {
|
||||
continue;
|
||||
}
|
||||
rc = tw;
|
||||
|
@ -2086,7 +2086,7 @@ static void *established_get_next(struct seq_file *seq, void *cur)
|
|||
tw = cur;
|
||||
tw = tw_next(tw);
|
||||
get_tw:
|
||||
while (tw && (tw->tw_family != st->family || tw->tw_net != net)) {
|
||||
while (tw && (tw->tw_family != st->family || twsk_net(tw) != net)) {
|
||||
tw = tw_next(tw);
|
||||
}
|
||||
if (tw) {
|
||||
|
@ -2107,7 +2107,7 @@ get_tw:
|
|||
sk = sk_next(sk);
|
||||
|
||||
sk_for_each_from(sk, node) {
|
||||
if (sk->sk_family == st->family && sk->sk_net == net)
|
||||
if (sk->sk_family == st->family && sock_net(sk) == net)
|
||||
goto found;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue