aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorEric Dumazet <eric.dumazet@gmail.com>2011-10-24 02:46:04 -0400
committerDavid S. Miller <davem@davemloft.net>2011-10-24 02:46:04 -0400
commit318cf7aaa0a6d20ecf6be33eb771291e5ff2e3b9 (patch)
treea2a42bbea9a1351d9986690f6df2a90cdbfd1d0c /net
parent8f9f4668b37bcc877156dd525a856055735c8d24 (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>
Diffstat (limited to 'net')
-rw-r--r--net/ipv4/tcp_ipv4.c12
-rw-r--r--net/ipv6/tcp_ipv6.c13
2 files changed, 13 insertions, 12 deletions
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);
92static struct tcp_md5sig_key *tcp_v4_md5_do_lookup(struct sock *sk, 92static struct tcp_md5sig_key *tcp_v4_md5_do_lookup(struct sock *sk,
93 __be32 addr); 93 __be32 addr);
94static int tcp_v4_md5_hash_hdr(char *md5_hash, struct tcp_md5sig_key *key, 94static 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
97static inline 97static inline
98struct tcp_md5sig_key *tcp_v4_md5_do_lookup(struct sock *sk, __be32 addr) 98struct 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
1092static int tcp_v4_md5_hash_hdr(char *md5_hash, struct tcp_md5sig_key *key, 1092static 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
1124int tcp_v4_md5_hash_skb(char *md5_hash, struct tcp_md5sig_key *key, 1124int 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}
1173EXPORT_SYMBOL(tcp_v4_md5_hash_skb); 1173EXPORT_SYMBOL(tcp_v4_md5_hash_skb);
1174 1174
1175static int tcp_v4_inbound_md5_hash(struct sock *sk, struct sk_buff *skb) 1175static 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
762static int tcp_v6_md5_hash_hdr(char *md5_hash, struct tcp_md5sig_key *key, 762static 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
795static int tcp_v6_md5_hash_skb(char *md5_hash, struct tcp_md5sig_key *key, 795static 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
845static int tcp_v6_inbound_md5_hash (struct sock *sk, struct sk_buff *skb) 846static 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