diff options
Diffstat (limited to 'net/ipv4/tcp_ipv4.c')
-rw-r--r-- | net/ipv4/tcp_ipv4.c | 21 |
1 files changed, 8 insertions, 13 deletions
diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c index a2b06d0cc26b..011478e46c40 100644 --- a/net/ipv4/tcp_ipv4.c +++ b/net/ipv4/tcp_ipv4.c | |||
@@ -618,7 +618,7 @@ static void tcp_v4_send_ack(struct sk_buff *skb, u32 seq, u32 ack, | |||
618 | ]; | 618 | ]; |
619 | } rep; | 619 | } rep; |
620 | struct ip_reply_arg arg; | 620 | struct ip_reply_arg arg; |
621 | struct net *net = dev_net(skb->dev); | 621 | struct net *net = dev_net(skb->dst->dev); |
622 | 622 | ||
623 | memset(&rep.th, 0, sizeof(struct tcphdr)); | 623 | memset(&rep.th, 0, sizeof(struct tcphdr)); |
624 | memset(&arg, 0, sizeof(arg)); | 624 | memset(&arg, 0, sizeof(arg)); |
@@ -655,8 +655,8 @@ static void tcp_v4_send_ack(struct sk_buff *skb, u32 seq, u32 ack, | |||
655 | rep.th.doff = arg.iov[0].iov_len/4; | 655 | rep.th.doff = arg.iov[0].iov_len/4; |
656 | 656 | ||
657 | tcp_v4_md5_hash_hdr((__u8 *) &rep.opt[offset], | 657 | tcp_v4_md5_hash_hdr((__u8 *) &rep.opt[offset], |
658 | key, ip_hdr(skb)->daddr, | 658 | key, ip_hdr(skb)->saddr, |
659 | ip_hdr(skb)->saddr, &rep.th); | 659 | ip_hdr(skb)->daddr, &rep.th); |
660 | } | 660 | } |
661 | #endif | 661 | #endif |
662 | arg.csum = csum_tcpudp_nofold(ip_hdr(skb)->daddr, | 662 | arg.csum = csum_tcpudp_nofold(ip_hdr(skb)->daddr, |
@@ -687,14 +687,14 @@ static void tcp_v4_timewait_ack(struct sock *sk, struct sk_buff *skb) | |||
687 | inet_twsk_put(tw); | 687 | inet_twsk_put(tw); |
688 | } | 688 | } |
689 | 689 | ||
690 | static void tcp_v4_reqsk_send_ack(struct sk_buff *skb, | 690 | static void tcp_v4_reqsk_send_ack(struct sock *sk, struct sk_buff *skb, |
691 | struct request_sock *req) | 691 | struct request_sock *req) |
692 | { | 692 | { |
693 | tcp_v4_send_ack(skb, tcp_rsk(req)->snt_isn + 1, | 693 | tcp_v4_send_ack(skb, tcp_rsk(req)->snt_isn + 1, |
694 | tcp_rsk(req)->rcv_isn + 1, req->rcv_wnd, | 694 | tcp_rsk(req)->rcv_isn + 1, req->rcv_wnd, |
695 | req->ts_recent, | 695 | req->ts_recent, |
696 | 0, | 696 | 0, |
697 | tcp_v4_md5_do_lookup(skb->sk, ip_hdr(skb)->daddr)); | 697 | tcp_v4_md5_do_lookup(sk, ip_hdr(skb)->daddr)); |
698 | } | 698 | } |
699 | 699 | ||
700 | /* | 700 | /* |
@@ -1116,18 +1116,12 @@ static int tcp_v4_inbound_md5_hash(struct sock *sk, struct sk_buff *skb) | |||
1116 | return 0; | 1116 | return 0; |
1117 | 1117 | ||
1118 | if (hash_expected && !hash_location) { | 1118 | if (hash_expected && !hash_location) { |
1119 | LIMIT_NETDEBUG(KERN_INFO "MD5 Hash expected but NOT found " | 1119 | NET_INC_STATS_BH(sock_net(sk), LINUX_MIB_TCPMD5NOTFOUND); |
1120 | "(" NIPQUAD_FMT ", %d)->(" NIPQUAD_FMT ", %d)\n", | ||
1121 | NIPQUAD(iph->saddr), ntohs(th->source), | ||
1122 | NIPQUAD(iph->daddr), ntohs(th->dest)); | ||
1123 | return 1; | 1120 | return 1; |
1124 | } | 1121 | } |
1125 | 1122 | ||
1126 | if (!hash_expected && hash_location) { | 1123 | if (!hash_expected && hash_location) { |
1127 | LIMIT_NETDEBUG(KERN_INFO "MD5 Hash NOT expected but found " | 1124 | NET_INC_STATS_BH(sock_net(sk), LINUX_MIB_TCPMD5UNEXPECTED); |
1128 | "(" NIPQUAD_FMT ", %d)->(" NIPQUAD_FMT ", %d)\n", | ||
1129 | NIPQUAD(iph->saddr), ntohs(th->source), | ||
1130 | NIPQUAD(iph->daddr), ntohs(th->dest)); | ||
1131 | return 1; | 1125 | return 1; |
1132 | } | 1126 | } |
1133 | 1127 | ||
@@ -2382,6 +2376,7 @@ static int __net_init tcp_sk_init(struct net *net) | |||
2382 | static void __net_exit tcp_sk_exit(struct net *net) | 2376 | static void __net_exit tcp_sk_exit(struct net *net) |
2383 | { | 2377 | { |
2384 | inet_ctl_sock_destroy(net->ipv4.tcp_sock); | 2378 | inet_ctl_sock_destroy(net->ipv4.tcp_sock); |
2379 | inet_twsk_purge(net, &tcp_hashinfo, &tcp_death_row, AF_INET); | ||
2385 | } | 2380 | } |
2386 | 2381 | ||
2387 | static struct pernet_operations __net_initdata tcp_sk_ops = { | 2382 | static struct pernet_operations __net_initdata tcp_sk_ops = { |