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/ipv4/tcp_ipv4.c | |
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/ipv4/tcp_ipv4.c')
-rw-r--r-- | net/ipv4/tcp_ipv4.c | 17 |
1 files changed, 7 insertions, 10 deletions
diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c index d339a0488f51..79d5c641688c 100644 --- a/net/ipv4/tcp_ipv4.c +++ b/net/ipv4/tcp_ipv4.c | |||
@@ -648,7 +648,7 @@ static void tcp_v4_send_reset(struct sock *sk, struct sk_buff *skb) | |||
648 | if (!key) | 648 | if (!key) |
649 | goto release_sk1; | 649 | goto release_sk1; |
650 | 650 | ||
651 | genhash = tcp_v4_md5_hash_skb(newhash, key, NULL, NULL, skb); | 651 | genhash = tcp_v4_md5_hash_skb(newhash, key, NULL, skb); |
652 | if (genhash || memcmp(hash_location, newhash, 16) != 0) | 652 | if (genhash || memcmp(hash_location, newhash, 16) != 0) |
653 | goto release_sk1; | 653 | goto release_sk1; |
654 | } else { | 654 | } else { |
@@ -1102,8 +1102,8 @@ clear_hash_noput: | |||
1102 | return 1; | 1102 | return 1; |
1103 | } | 1103 | } |
1104 | 1104 | ||
1105 | int tcp_v4_md5_hash_skb(char *md5_hash, struct tcp_md5sig_key *key, | 1105 | int tcp_v4_md5_hash_skb(char *md5_hash, const struct tcp_md5sig_key *key, |
1106 | const struct sock *sk, const struct request_sock *req, | 1106 | const struct sock *sk, |
1107 | const struct sk_buff *skb) | 1107 | const struct sk_buff *skb) |
1108 | { | 1108 | { |
1109 | struct tcp_md5sig_pool *hp; | 1109 | struct tcp_md5sig_pool *hp; |
@@ -1111,12 +1111,9 @@ int tcp_v4_md5_hash_skb(char *md5_hash, struct tcp_md5sig_key *key, | |||
1111 | const struct tcphdr *th = tcp_hdr(skb); | 1111 | const struct tcphdr *th = tcp_hdr(skb); |
1112 | __be32 saddr, daddr; | 1112 | __be32 saddr, daddr; |
1113 | 1113 | ||
1114 | if (sk) { | 1114 | if (sk) { /* valid for establish/request sockets */ |
1115 | saddr = inet_sk(sk)->inet_saddr; | 1115 | saddr = sk->sk_rcv_saddr; |
1116 | daddr = inet_sk(sk)->inet_daddr; | 1116 | daddr = sk->sk_daddr; |
1117 | } else if (req) { | ||
1118 | saddr = inet_rsk(req)->ir_loc_addr; | ||
1119 | daddr = inet_rsk(req)->ir_rmt_addr; | ||
1120 | } else { | 1117 | } else { |
1121 | const struct iphdr *iph = ip_hdr(skb); | 1118 | const struct iphdr *iph = ip_hdr(skb); |
1122 | saddr = iph->saddr; | 1119 | saddr = iph->saddr; |
@@ -1195,7 +1192,7 @@ static bool tcp_v4_inbound_md5_hash(struct sock *sk, | |||
1195 | */ | 1192 | */ |
1196 | genhash = tcp_v4_md5_hash_skb(newhash, | 1193 | genhash = tcp_v4_md5_hash_skb(newhash, |
1197 | hash_expected, | 1194 | hash_expected, |
1198 | NULL, NULL, skb); | 1195 | NULL, skb); |
1199 | 1196 | ||
1200 | if (genhash || memcmp(hash_location, newhash, 16) != 0) { | 1197 | if (genhash || memcmp(hash_location, newhash, 16) != 0) { |
1201 | net_info_ratelimited("MD5 Hash failed for (%pI4, %d)->(%pI4, %d)%s\n", | 1198 | net_info_ratelimited("MD5 Hash failed for (%pI4, %d)->(%pI4, %d)%s\n", |