diff options
-rw-r--r-- | include/net/tcp.h | 2 | ||||
-rw-r--r-- | net/ipv4/tcp.c | 14 |
2 files changed, 9 insertions, 7 deletions
diff --git a/include/net/tcp.h b/include/net/tcp.h index 3edef0bebdd1..910cc29f9e97 100644 --- a/include/net/tcp.h +++ b/include/net/tcp.h | |||
@@ -1209,7 +1209,7 @@ extern void tcp_free_md5sig_pool(void); | |||
1209 | extern struct tcp_md5sig_pool *tcp_get_md5sig_pool(void); | 1209 | extern struct tcp_md5sig_pool *tcp_get_md5sig_pool(void); |
1210 | extern void tcp_put_md5sig_pool(void); | 1210 | extern void tcp_put_md5sig_pool(void); |
1211 | 1211 | ||
1212 | extern int tcp_md5_hash_header(struct tcp_md5sig_pool *, struct tcphdr *); | 1212 | extern int tcp_md5_hash_header(struct tcp_md5sig_pool *, const struct tcphdr *); |
1213 | extern int tcp_md5_hash_skb_data(struct tcp_md5sig_pool *, const struct sk_buff *, | 1213 | extern int tcp_md5_hash_skb_data(struct tcp_md5sig_pool *, const struct sk_buff *, |
1214 | unsigned header_len); | 1214 | unsigned header_len); |
1215 | extern int tcp_md5_hash_key(struct tcp_md5sig_pool *hp, | 1215 | extern int tcp_md5_hash_key(struct tcp_md5sig_pool *hp, |
diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c index 704adad8f07f..eefc61e3d0e4 100644 --- a/net/ipv4/tcp.c +++ b/net/ipv4/tcp.c | |||
@@ -2994,17 +2994,19 @@ void tcp_put_md5sig_pool(void) | |||
2994 | EXPORT_SYMBOL(tcp_put_md5sig_pool); | 2994 | EXPORT_SYMBOL(tcp_put_md5sig_pool); |
2995 | 2995 | ||
2996 | int tcp_md5_hash_header(struct tcp_md5sig_pool *hp, | 2996 | int tcp_md5_hash_header(struct tcp_md5sig_pool *hp, |
2997 | struct tcphdr *th) | 2997 | const struct tcphdr *th) |
2998 | { | 2998 | { |
2999 | struct scatterlist sg; | 2999 | struct scatterlist sg; |
3000 | struct tcphdr hdr; | ||
3000 | int err; | 3001 | int err; |
3001 | 3002 | ||
3002 | __sum16 old_checksum = th->check; | 3003 | /* We are not allowed to change tcphdr, make a local copy */ |
3003 | th->check = 0; | 3004 | memcpy(&hdr, th, sizeof(hdr)); |
3005 | hdr.check = 0; | ||
3006 | |||
3004 | /* options aren't included in the hash */ | 3007 | /* options aren't included in the hash */ |
3005 | sg_init_one(&sg, th, sizeof(struct tcphdr)); | 3008 | sg_init_one(&sg, &hdr, sizeof(hdr)); |
3006 | err = crypto_hash_update(&hp->md5_desc, &sg, sizeof(struct tcphdr)); | 3009 | err = crypto_hash_update(&hp->md5_desc, &sg, sizeof(hdr)); |
3007 | th->check = old_checksum; | ||
3008 | return err; | 3010 | return err; |
3009 | } | 3011 | } |
3010 | EXPORT_SYMBOL(tcp_md5_hash_header); | 3012 | EXPORT_SYMBOL(tcp_md5_hash_header); |