diff options
author | Eric Dumazet <eric.dumazet@gmail.com> | 2011-10-24 02:46:04 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2011-10-24 02:46:04 -0400 |
commit | 318cf7aaa0a6d20ecf6be33eb771291e5ff2e3b9 (patch) | |
tree | a2a42bbea9a1351d9986690f6df2a90cdbfd1d0c | |
parent | 8f9f4668b37bcc877156dd525a856055735c8d24 (diff) |
tcp: md5: add more const attributes
Now tcp_md5_hash_header() has a const tcphdr argument, we can add more
const attributes to callers.
Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | include/net/tcp.h | 17 | ||||
-rw-r--r-- | net/ipv4/tcp_ipv4.c | 12 | ||||
-rw-r--r-- | net/ipv6/tcp_ipv6.c | 13 |
3 files changed, 22 insertions, 20 deletions
diff --git a/include/net/tcp.h b/include/net/tcp.h index 910cc29f9e97..ed0e81452827 100644 --- a/include/net/tcp.h +++ b/include/net/tcp.h | |||
@@ -1185,8 +1185,9 @@ struct tcp_md5sig_pool { | |||
1185 | 1185 | ||
1186 | /* - functions */ | 1186 | /* - functions */ |
1187 | extern int tcp_v4_md5_hash_skb(char *md5_hash, struct tcp_md5sig_key *key, | 1187 | extern int tcp_v4_md5_hash_skb(char *md5_hash, struct tcp_md5sig_key *key, |
1188 | struct sock *sk, struct request_sock *req, | 1188 | const struct sock *sk, |
1189 | struct sk_buff *skb); | 1189 | const struct request_sock *req, |
1190 | const struct sk_buff *skb); | ||
1190 | extern struct tcp_md5sig_key * tcp_v4_md5_lookup(struct sock *sk, | 1191 | extern struct tcp_md5sig_key * tcp_v4_md5_lookup(struct sock *sk, |
1191 | struct sock *addr_sk); | 1192 | struct sock *addr_sk); |
1192 | extern int tcp_v4_md5_do_add(struct sock *sk, __be32 addr, u8 *newkey, | 1193 | extern int tcp_v4_md5_do_add(struct sock *sk, __be32 addr, u8 *newkey, |
@@ -1448,9 +1449,9 @@ struct tcp_sock_af_ops { | |||
1448 | struct sock *addr_sk); | 1449 | struct sock *addr_sk); |
1449 | int (*calc_md5_hash) (char *location, | 1450 | int (*calc_md5_hash) (char *location, |
1450 | struct tcp_md5sig_key *md5, | 1451 | struct tcp_md5sig_key *md5, |
1451 | struct sock *sk, | 1452 | const struct sock *sk, |
1452 | struct request_sock *req, | 1453 | const struct request_sock *req, |
1453 | struct sk_buff *skb); | 1454 | const struct sk_buff *skb); |
1454 | int (*md5_add) (struct sock *sk, | 1455 | int (*md5_add) (struct sock *sk, |
1455 | struct sock *addr_sk, | 1456 | struct sock *addr_sk, |
1456 | u8 *newkey, | 1457 | u8 *newkey, |
@@ -1467,9 +1468,9 @@ struct tcp_request_sock_ops { | |||
1467 | struct request_sock *req); | 1468 | struct request_sock *req); |
1468 | int (*calc_md5_hash) (char *location, | 1469 | int (*calc_md5_hash) (char *location, |
1469 | struct tcp_md5sig_key *md5, | 1470 | struct tcp_md5sig_key *md5, |
1470 | struct sock *sk, | 1471 | const struct sock *sk, |
1471 | struct request_sock *req, | 1472 | const struct request_sock *req, |
1472 | struct sk_buff *skb); | 1473 | const struct sk_buff *skb); |
1473 | #endif | 1474 | #endif |
1474 | }; | 1475 | }; |
1475 | 1476 | ||
diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c index 955c9255cd98..1dad7e92f005 100644 --- a/net/ipv4/tcp_ipv4.c +++ b/net/ipv4/tcp_ipv4.c | |||
@@ -92,7 +92,7 @@ EXPORT_SYMBOL(sysctl_tcp_low_latency); | |||
92 | static struct tcp_md5sig_key *tcp_v4_md5_do_lookup(struct sock *sk, | 92 | static struct tcp_md5sig_key *tcp_v4_md5_do_lookup(struct sock *sk, |
93 | __be32 addr); | 93 | __be32 addr); |
94 | static int tcp_v4_md5_hash_hdr(char *md5_hash, struct tcp_md5sig_key *key, | 94 | static int tcp_v4_md5_hash_hdr(char *md5_hash, struct tcp_md5sig_key *key, |
95 | __be32 daddr, __be32 saddr, struct tcphdr *th); | 95 | __be32 daddr, __be32 saddr, const struct tcphdr *th); |
96 | #else | 96 | #else |
97 | static inline | 97 | static inline |
98 | struct tcp_md5sig_key *tcp_v4_md5_do_lookup(struct sock *sk, __be32 addr) | 98 | struct tcp_md5sig_key *tcp_v4_md5_do_lookup(struct sock *sk, __be32 addr) |
@@ -1090,7 +1090,7 @@ static int tcp_v4_md5_hash_pseudoheader(struct tcp_md5sig_pool *hp, | |||
1090 | } | 1090 | } |
1091 | 1091 | ||
1092 | static int tcp_v4_md5_hash_hdr(char *md5_hash, struct tcp_md5sig_key *key, | 1092 | static int tcp_v4_md5_hash_hdr(char *md5_hash, struct tcp_md5sig_key *key, |
1093 | __be32 daddr, __be32 saddr, struct tcphdr *th) | 1093 | __be32 daddr, __be32 saddr, const struct tcphdr *th) |
1094 | { | 1094 | { |
1095 | struct tcp_md5sig_pool *hp; | 1095 | struct tcp_md5sig_pool *hp; |
1096 | struct hash_desc *desc; | 1096 | struct hash_desc *desc; |
@@ -1122,12 +1122,12 @@ clear_hash_noput: | |||
1122 | } | 1122 | } |
1123 | 1123 | ||
1124 | int tcp_v4_md5_hash_skb(char *md5_hash, struct tcp_md5sig_key *key, | 1124 | int tcp_v4_md5_hash_skb(char *md5_hash, struct tcp_md5sig_key *key, |
1125 | struct sock *sk, struct request_sock *req, | 1125 | const struct sock *sk, const struct request_sock *req, |
1126 | struct sk_buff *skb) | 1126 | const struct sk_buff *skb) |
1127 | { | 1127 | { |
1128 | struct tcp_md5sig_pool *hp; | 1128 | struct tcp_md5sig_pool *hp; |
1129 | struct hash_desc *desc; | 1129 | struct hash_desc *desc; |
1130 | struct tcphdr *th = tcp_hdr(skb); | 1130 | const struct tcphdr *th = tcp_hdr(skb); |
1131 | __be32 saddr, daddr; | 1131 | __be32 saddr, daddr; |
1132 | 1132 | ||
1133 | if (sk) { | 1133 | if (sk) { |
@@ -1172,7 +1172,7 @@ clear_hash_noput: | |||
1172 | } | 1172 | } |
1173 | EXPORT_SYMBOL(tcp_v4_md5_hash_skb); | 1173 | EXPORT_SYMBOL(tcp_v4_md5_hash_skb); |
1174 | 1174 | ||
1175 | static int tcp_v4_inbound_md5_hash(struct sock *sk, struct sk_buff *skb) | 1175 | static int tcp_v4_inbound_md5_hash(struct sock *sk, const struct sk_buff *skb) |
1176 | { | 1176 | { |
1177 | /* | 1177 | /* |
1178 | * This gets called for each TCP segment that arrives | 1178 | * This gets called for each TCP segment that arrives |
diff --git a/net/ipv6/tcp_ipv6.c b/net/ipv6/tcp_ipv6.c index da2ada881cfa..c8683fcc487a 100644 --- a/net/ipv6/tcp_ipv6.c +++ b/net/ipv6/tcp_ipv6.c | |||
@@ -761,7 +761,7 @@ static int tcp_v6_md5_hash_pseudoheader(struct tcp_md5sig_pool *hp, | |||
761 | 761 | ||
762 | static int tcp_v6_md5_hash_hdr(char *md5_hash, struct tcp_md5sig_key *key, | 762 | static int tcp_v6_md5_hash_hdr(char *md5_hash, struct tcp_md5sig_key *key, |
763 | const struct in6_addr *daddr, struct in6_addr *saddr, | 763 | const struct in6_addr *daddr, struct in6_addr *saddr, |
764 | struct tcphdr *th) | 764 | const struct tcphdr *th) |
765 | { | 765 | { |
766 | struct tcp_md5sig_pool *hp; | 766 | struct tcp_md5sig_pool *hp; |
767 | struct hash_desc *desc; | 767 | struct hash_desc *desc; |
@@ -793,13 +793,14 @@ clear_hash_noput: | |||
793 | } | 793 | } |
794 | 794 | ||
795 | static int tcp_v6_md5_hash_skb(char *md5_hash, struct tcp_md5sig_key *key, | 795 | static int tcp_v6_md5_hash_skb(char *md5_hash, struct tcp_md5sig_key *key, |
796 | struct sock *sk, struct request_sock *req, | 796 | const struct sock *sk, |
797 | struct sk_buff *skb) | 797 | const struct request_sock *req, |
798 | const struct sk_buff *skb) | ||
798 | { | 799 | { |
799 | const struct in6_addr *saddr, *daddr; | 800 | const struct in6_addr *saddr, *daddr; |
800 | struct tcp_md5sig_pool *hp; | 801 | struct tcp_md5sig_pool *hp; |
801 | struct hash_desc *desc; | 802 | struct hash_desc *desc; |
802 | struct tcphdr *th = tcp_hdr(skb); | 803 | const struct tcphdr *th = tcp_hdr(skb); |
803 | 804 | ||
804 | if (sk) { | 805 | if (sk) { |
805 | saddr = &inet6_sk(sk)->saddr; | 806 | saddr = &inet6_sk(sk)->saddr; |
@@ -842,12 +843,12 @@ clear_hash_noput: | |||
842 | return 1; | 843 | return 1; |
843 | } | 844 | } |
844 | 845 | ||
845 | static int tcp_v6_inbound_md5_hash (struct sock *sk, struct sk_buff *skb) | 846 | static int tcp_v6_inbound_md5_hash(struct sock *sk, const struct sk_buff *skb) |
846 | { | 847 | { |
847 | const __u8 *hash_location = NULL; | 848 | const __u8 *hash_location = NULL; |
848 | struct tcp_md5sig_key *hash_expected; | 849 | struct tcp_md5sig_key *hash_expected; |
849 | const struct ipv6hdr *ip6h = ipv6_hdr(skb); | 850 | const struct ipv6hdr *ip6h = ipv6_hdr(skb); |
850 | struct tcphdr *th = tcp_hdr(skb); | 851 | const struct tcphdr *th = tcp_hdr(skb); |
851 | int genhash; | 852 | int genhash; |
852 | u8 newhash[16]; | 853 | u8 newhash[16]; |
853 | 854 | ||