aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv4
diff options
context:
space:
mode:
authorPavel Emelyanov <xemul@openvz.org>2008-07-16 23:20:58 -0400
committerDavid S. Miller <davem@davemloft.net>2008-07-16 23:20:58 -0400
commita86b1e3019455283a677c2485cfeda2dc36df3eb (patch)
tree452f1ec6cba2a131d189be91a6f4ec1d50092827 /net/ipv4
parentc5346fe396f5e22bbfb3ec037c43891c3c57d3e6 (diff)
inet: prepare struct net for TCP MIB accounting
This is the same as the first patch in the set, but preparing the net for TCP_XXX_STATS - save the struct net on the stack where required and possible. Signed-off-by: Pavel Emelyanov <xemul@openvz.org> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4')
-rw-r--r--net/ipv4/tcp_ipv4.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c
index 7797d528701b..db3bf9be076f 100644
--- a/net/ipv4/tcp_ipv4.c
+++ b/net/ipv4/tcp_ipv4.c
@@ -544,6 +544,7 @@ static void tcp_v4_send_reset(struct sock *sk, struct sk_buff *skb)
544#ifdef CONFIG_TCP_MD5SIG 544#ifdef CONFIG_TCP_MD5SIG
545 struct tcp_md5sig_key *key; 545 struct tcp_md5sig_key *key;
546#endif 546#endif
547 struct net *net;
547 548
548 /* Never send a reset in response to a reset. */ 549 /* Never send a reset in response to a reset. */
549 if (th->rst) 550 if (th->rst)
@@ -594,7 +595,8 @@ static void tcp_v4_send_reset(struct sock *sk, struct sk_buff *skb)
594 sizeof(struct tcphdr), IPPROTO_TCP, 0); 595 sizeof(struct tcphdr), IPPROTO_TCP, 0);
595 arg.csumoffset = offsetof(struct tcphdr, check) / 2; 596 arg.csumoffset = offsetof(struct tcphdr, check) / 2;
596 597
597 ip_send_reply(dev_net(skb->dst->dev)->ipv4.tcp_sock, skb, 598 net = dev_net(skb->dst->dev);
599 ip_send_reply(net->ipv4.tcp_sock, skb,
598 &arg, arg.iov[0].iov_len); 600 &arg, arg.iov[0].iov_len);
599 601
600 TCP_INC_STATS_BH(TCP_MIB_OUTSEGS); 602 TCP_INC_STATS_BH(TCP_MIB_OUTSEGS);
@@ -619,6 +621,7 @@ static void tcp_v4_send_ack(struct sk_buff *skb, u32 seq, u32 ack,
619 ]; 621 ];
620 } rep; 622 } rep;
621 struct ip_reply_arg arg; 623 struct ip_reply_arg arg;
624 struct net *net = dev_net(skb->dev);
622 625
623 memset(&rep.th, 0, sizeof(struct tcphdr)); 626 memset(&rep.th, 0, sizeof(struct tcphdr));
624 memset(&arg, 0, sizeof(arg)); 627 memset(&arg, 0, sizeof(arg));
@@ -668,7 +671,7 @@ static void tcp_v4_send_ack(struct sk_buff *skb, u32 seq, u32 ack,
668 if (oif) 671 if (oif)
669 arg.bound_dev_if = oif; 672 arg.bound_dev_if = oif;
670 673
671 ip_send_reply(dev_net(skb->dev)->ipv4.tcp_sock, skb, 674 ip_send_reply(net->ipv4.tcp_sock, skb,
672 &arg, arg.iov[0].iov_len); 675 &arg, arg.iov[0].iov_len);
673 676
674 TCP_INC_STATS_BH(TCP_MIB_OUTSEGS); 677 TCP_INC_STATS_BH(TCP_MIB_OUTSEGS);
@@ -1505,6 +1508,7 @@ int tcp_v4_rcv(struct sk_buff *skb)
1505 struct tcphdr *th; 1508 struct tcphdr *th;
1506 struct sock *sk; 1509 struct sock *sk;
1507 int ret; 1510 int ret;
1511 struct net *net = dev_net(skb->dev);
1508 1512
1509 if (skb->pkt_type != PACKET_HOST) 1513 if (skb->pkt_type != PACKET_HOST)
1510 goto discard_it; 1514 goto discard_it;
@@ -1539,7 +1543,7 @@ int tcp_v4_rcv(struct sk_buff *skb)
1539 TCP_SKB_CB(skb)->flags = iph->tos; 1543 TCP_SKB_CB(skb)->flags = iph->tos;
1540 TCP_SKB_CB(skb)->sacked = 0; 1544 TCP_SKB_CB(skb)->sacked = 0;
1541 1545
1542 sk = __inet_lookup(dev_net(skb->dev), &tcp_hashinfo, iph->saddr, 1546 sk = __inet_lookup(net, &tcp_hashinfo, iph->saddr,
1543 th->source, iph->daddr, th->dest, inet_iif(skb)); 1547 th->source, iph->daddr, th->dest, inet_iif(skb));
1544 if (!sk) 1548 if (!sk)
1545 goto no_tcp_socket; 1549 goto no_tcp_socket;