diff options
author | Eric Dumazet <edumazet@google.com> | 2015-03-24 18:58:55 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2015-03-24 21:16:30 -0400 |
commit | 39f8e58e53be32ab758d30536e0bd2e6ce766462 (patch) | |
tree | 2256b441433a11337077f2f82534903c9e52fefa /net/ipv6 | |
parent | ff74e23f7edb3759d1290b10f80222e3bbb6304b (diff) |
tcp: md5: remove request sock argument of calc_md5_hash()
Since request and established sockets now have same base,
there is no need to pass two pointers to tcp_v4_md5_hash_skb()
or tcp_v6_md5_hash_skb()
Also add a const qualifier to their struct tcp_md5sig_key argument.
Signed-off-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv6')
-rw-r--r-- | net/ipv6/tcp_ipv6.c | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/net/ipv6/tcp_ipv6.c b/net/ipv6/tcp_ipv6.c index 078e7d0f4cd8..57d1c41404ec 100644 --- a/net/ipv6/tcp_ipv6.c +++ b/net/ipv6/tcp_ipv6.c | |||
@@ -582,9 +582,9 @@ clear_hash_noput: | |||
582 | return 1; | 582 | return 1; |
583 | } | 583 | } |
584 | 584 | ||
585 | static int tcp_v6_md5_hash_skb(char *md5_hash, struct tcp_md5sig_key *key, | 585 | static int tcp_v6_md5_hash_skb(char *md5_hash, |
586 | const struct tcp_md5sig_key *key, | ||
586 | const struct sock *sk, | 587 | const struct sock *sk, |
587 | const struct request_sock *req, | ||
588 | const struct sk_buff *skb) | 588 | const struct sk_buff *skb) |
589 | { | 589 | { |
590 | const struct in6_addr *saddr, *daddr; | 590 | const struct in6_addr *saddr, *daddr; |
@@ -592,12 +592,9 @@ static int tcp_v6_md5_hash_skb(char *md5_hash, struct tcp_md5sig_key *key, | |||
592 | struct hash_desc *desc; | 592 | struct hash_desc *desc; |
593 | const struct tcphdr *th = tcp_hdr(skb); | 593 | const struct tcphdr *th = tcp_hdr(skb); |
594 | 594 | ||
595 | if (sk) { | 595 | if (sk) { /* valid for establish/request sockets */ |
596 | saddr = &inet6_sk(sk)->saddr; | 596 | saddr = &sk->sk_v6_rcv_saddr; |
597 | daddr = &sk->sk_v6_daddr; | 597 | daddr = &sk->sk_v6_daddr; |
598 | } else if (req) { | ||
599 | saddr = &inet_rsk(req)->ir_v6_loc_addr; | ||
600 | daddr = &inet_rsk(req)->ir_v6_rmt_addr; | ||
601 | } else { | 598 | } else { |
602 | const struct ipv6hdr *ip6h = ipv6_hdr(skb); | 599 | const struct ipv6hdr *ip6h = ipv6_hdr(skb); |
603 | saddr = &ip6h->saddr; | 600 | saddr = &ip6h->saddr; |
@@ -662,7 +659,7 @@ static bool tcp_v6_inbound_md5_hash(struct sock *sk, const struct sk_buff *skb) | |||
662 | /* check the signature */ | 659 | /* check the signature */ |
663 | genhash = tcp_v6_md5_hash_skb(newhash, | 660 | genhash = tcp_v6_md5_hash_skb(newhash, |
664 | hash_expected, | 661 | hash_expected, |
665 | NULL, NULL, skb); | 662 | NULL, skb); |
666 | 663 | ||
667 | if (genhash || memcmp(hash_location, newhash, 16) != 0) { | 664 | if (genhash || memcmp(hash_location, newhash, 16) != 0) { |
668 | net_info_ratelimited("MD5 Hash %s for [%pI6c]:%u->[%pI6c]:%u\n", | 665 | net_info_ratelimited("MD5 Hash %s for [%pI6c]:%u->[%pI6c]:%u\n", |
@@ -880,7 +877,7 @@ static void tcp_v6_send_reset(struct sock *sk, struct sk_buff *skb) | |||
880 | if (!key) | 877 | if (!key) |
881 | goto release_sk1; | 878 | goto release_sk1; |
882 | 879 | ||
883 | genhash = tcp_v6_md5_hash_skb(newhash, key, NULL, NULL, skb); | 880 | genhash = tcp_v6_md5_hash_skb(newhash, key, NULL, skb); |
884 | if (genhash || memcmp(hash_location, newhash, 16) != 0) | 881 | if (genhash || memcmp(hash_location, newhash, 16) != 0) |
885 | goto release_sk1; | 882 | goto release_sk1; |
886 | } else { | 883 | } else { |