diff options
author | YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org> | 2008-04-16 23:48:12 -0400 |
---|---|---|
committer | YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org> | 2008-06-11 13:38:19 -0400 |
commit | 076fb7223357769c39f3ddf900bba6752369c76a (patch) | |
tree | db75c2af3bf71cda4d0cccd6ebcfa8d1a62c3620 | |
parent | 7d5d5525bd88313e6fd90c0659665aee5114bc2d (diff) |
tcp md5sig: Remove redundant protocol argument.
Protocol is always TCP, so remove useless protocol argument.
Signed-off-by: YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>
-rw-r--r-- | include/net/tcp.h | 2 | ||||
-rw-r--r-- | net/ipv4/tcp_ipv4.c | 20 | ||||
-rw-r--r-- | net/ipv4/tcp_output.c | 3 | ||||
-rw-r--r-- | net/ipv6/tcp_ipv6.c | 17 |
4 files changed, 16 insertions, 26 deletions
diff --git a/include/net/tcp.h b/include/net/tcp.h index b1c4b78f1cb8..ae2549c45fc7 100644 --- a/include/net/tcp.h +++ b/include/net/tcp.h | |||
@@ -1123,7 +1123,6 @@ extern int tcp_v4_calc_md5_hash(char *md5_hash, | |||
1123 | struct dst_entry *dst, | 1123 | struct dst_entry *dst, |
1124 | struct request_sock *req, | 1124 | struct request_sock *req, |
1125 | struct tcphdr *th, | 1125 | struct tcphdr *th, |
1126 | int protocol, | ||
1127 | unsigned int tcplen); | 1126 | unsigned int tcplen); |
1128 | extern struct tcp_md5sig_key *tcp_v4_md5_lookup(struct sock *sk, | 1127 | extern struct tcp_md5sig_key *tcp_v4_md5_lookup(struct sock *sk, |
1129 | struct sock *addr_sk); | 1128 | struct sock *addr_sk); |
@@ -1373,7 +1372,6 @@ struct tcp_sock_af_ops { | |||
1373 | struct dst_entry *dst, | 1372 | struct dst_entry *dst, |
1374 | struct request_sock *req, | 1373 | struct request_sock *req, |
1375 | struct tcphdr *th, | 1374 | struct tcphdr *th, |
1376 | int protocol, | ||
1377 | unsigned int len); | 1375 | unsigned int len); |
1378 | int (*md5_add) (struct sock *sk, | 1376 | int (*md5_add) (struct sock *sk, |
1379 | struct sock *addr_sk, | 1377 | struct sock *addr_sk, |
diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c index 56f550933644..f25445d21bdf 100644 --- a/net/ipv4/tcp_ipv4.c +++ b/net/ipv4/tcp_ipv4.c | |||
@@ -95,8 +95,7 @@ static struct tcp_md5sig_key *tcp_v4_md5_do_lookup(struct sock *sk, | |||
95 | __be32 addr); | 95 | __be32 addr); |
96 | static int tcp_v4_do_calc_md5_hash(char *md5_hash, struct tcp_md5sig_key *key, | 96 | static int tcp_v4_do_calc_md5_hash(char *md5_hash, struct tcp_md5sig_key *key, |
97 | __be32 saddr, __be32 daddr, | 97 | __be32 saddr, __be32 daddr, |
98 | struct tcphdr *th, int protocol, | 98 | struct tcphdr *th, unsigned int tcplen); |
99 | unsigned int tcplen); | ||
100 | #endif | 99 | #endif |
101 | 100 | ||
102 | struct inet_hashinfo __cacheline_aligned tcp_hashinfo = { | 101 | struct inet_hashinfo __cacheline_aligned tcp_hashinfo = { |
@@ -586,8 +585,7 @@ static void tcp_v4_send_reset(struct sock *sk, struct sk_buff *skb) | |||
586 | key, | 585 | key, |
587 | ip_hdr(skb)->daddr, | 586 | ip_hdr(skb)->daddr, |
588 | ip_hdr(skb)->saddr, | 587 | ip_hdr(skb)->saddr, |
589 | &rep.th, IPPROTO_TCP, | 588 | &rep.th, arg.iov[0].iov_len); |
590 | arg.iov[0].iov_len); | ||
591 | } | 589 | } |
592 | #endif | 590 | #endif |
593 | arg.csum = csum_tcpudp_nofold(ip_hdr(skb)->daddr, | 591 | arg.csum = csum_tcpudp_nofold(ip_hdr(skb)->daddr, |
@@ -680,8 +678,7 @@ static void tcp_v4_send_ack(struct tcp_timewait_sock *twsk, | |||
680 | key, | 678 | key, |
681 | ip_hdr(skb)->daddr, | 679 | ip_hdr(skb)->daddr, |
682 | ip_hdr(skb)->saddr, | 680 | ip_hdr(skb)->saddr, |
683 | &rep.th, IPPROTO_TCP, | 681 | &rep.th, arg.iov[0].iov_len); |
684 | arg.iov[0].iov_len); | ||
685 | } | 682 | } |
686 | #endif | 683 | #endif |
687 | arg.csum = csum_tcpudp_nofold(ip_hdr(skb)->daddr, | 684 | arg.csum = csum_tcpudp_nofold(ip_hdr(skb)->daddr, |
@@ -1006,7 +1003,7 @@ static int tcp_v4_parse_md5_keys(struct sock *sk, char __user *optval, | |||
1006 | 1003 | ||
1007 | static int tcp_v4_do_calc_md5_hash(char *md5_hash, struct tcp_md5sig_key *key, | 1004 | static int tcp_v4_do_calc_md5_hash(char *md5_hash, struct tcp_md5sig_key *key, |
1008 | __be32 saddr, __be32 daddr, | 1005 | __be32 saddr, __be32 daddr, |
1009 | struct tcphdr *th, int protocol, | 1006 | struct tcphdr *th, |
1010 | unsigned int tcplen) | 1007 | unsigned int tcplen) |
1011 | { | 1008 | { |
1012 | struct scatterlist sg[4]; | 1009 | struct scatterlist sg[4]; |
@@ -1039,7 +1036,7 @@ static int tcp_v4_do_calc_md5_hash(char *md5_hash, struct tcp_md5sig_key *key, | |||
1039 | bp->saddr = saddr; | 1036 | bp->saddr = saddr; |
1040 | bp->daddr = daddr; | 1037 | bp->daddr = daddr; |
1041 | bp->pad = 0; | 1038 | bp->pad = 0; |
1042 | bp->protocol = protocol; | 1039 | bp->protocol = IPPROTO_TCP; |
1043 | bp->len = htons(tcplen); | 1040 | bp->len = htons(tcplen); |
1044 | 1041 | ||
1045 | sg_init_table(sg, 4); | 1042 | sg_init_table(sg, 4); |
@@ -1099,7 +1096,7 @@ int tcp_v4_calc_md5_hash(char *md5_hash, struct tcp_md5sig_key *key, | |||
1099 | struct sock *sk, | 1096 | struct sock *sk, |
1100 | struct dst_entry *dst, | 1097 | struct dst_entry *dst, |
1101 | struct request_sock *req, | 1098 | struct request_sock *req, |
1102 | struct tcphdr *th, int protocol, | 1099 | struct tcphdr *th, |
1103 | unsigned int tcplen) | 1100 | unsigned int tcplen) |
1104 | { | 1101 | { |
1105 | __be32 saddr, daddr; | 1102 | __be32 saddr, daddr; |
@@ -1115,7 +1112,7 @@ int tcp_v4_calc_md5_hash(char *md5_hash, struct tcp_md5sig_key *key, | |||
1115 | } | 1112 | } |
1116 | return tcp_v4_do_calc_md5_hash(md5_hash, key, | 1113 | return tcp_v4_do_calc_md5_hash(md5_hash, key, |
1117 | saddr, daddr, | 1114 | saddr, daddr, |
1118 | th, protocol, tcplen); | 1115 | th, tcplen); |
1119 | } | 1116 | } |
1120 | 1117 | ||
1121 | EXPORT_SYMBOL(tcp_v4_calc_md5_hash); | 1118 | EXPORT_SYMBOL(tcp_v4_calc_md5_hash); |
@@ -1166,8 +1163,7 @@ static int tcp_v4_inbound_md5_hash(struct sock *sk, struct sk_buff *skb) | |||
1166 | genhash = tcp_v4_do_calc_md5_hash(newhash, | 1163 | genhash = tcp_v4_do_calc_md5_hash(newhash, |
1167 | hash_expected, | 1164 | hash_expected, |
1168 | iph->saddr, iph->daddr, | 1165 | iph->saddr, iph->daddr, |
1169 | th, sk->sk_protocol, | 1166 | th, skb->len); |
1170 | skb->len); | ||
1171 | 1167 | ||
1172 | if (genhash || memcmp(hash_location, newhash, 16) != 0) { | 1168 | if (genhash || memcmp(hash_location, newhash, 16) != 0) { |
1173 | if (net_ratelimit()) { | 1169 | if (net_ratelimit()) { |
diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c index ad993ecb4810..f3ffd674edde 100644 --- a/net/ipv4/tcp_output.c +++ b/net/ipv4/tcp_output.c | |||
@@ -607,7 +607,6 @@ static int tcp_transmit_skb(struct sock *sk, struct sk_buff *skb, int clone_it, | |||
607 | md5, | 607 | md5, |
608 | sk, NULL, NULL, | 608 | sk, NULL, NULL, |
609 | tcp_hdr(skb), | 609 | tcp_hdr(skb), |
610 | sk->sk_protocol, | ||
611 | skb->len); | 610 | skb->len); |
612 | } | 611 | } |
613 | #endif | 612 | #endif |
@@ -2266,7 +2265,7 @@ struct sk_buff *tcp_make_synack(struct sock *sk, struct dst_entry *dst, | |||
2266 | tp->af_specific->calc_md5_hash(md5_hash_location, | 2265 | tp->af_specific->calc_md5_hash(md5_hash_location, |
2267 | md5, | 2266 | md5, |
2268 | NULL, dst, req, | 2267 | NULL, dst, req, |
2269 | tcp_hdr(skb), sk->sk_protocol, | 2268 | tcp_hdr(skb), |
2270 | skb->len); | 2269 | skb->len); |
2271 | } | 2270 | } |
2272 | #endif | 2271 | #endif |
diff --git a/net/ipv6/tcp_ipv6.c b/net/ipv6/tcp_ipv6.c index dd4ddb30a3a9..334d21c23da9 100644 --- a/net/ipv6/tcp_ipv6.c +++ b/net/ipv6/tcp_ipv6.c | |||
@@ -736,8 +736,7 @@ static int tcp_v6_parse_md5_keys (struct sock *sk, char __user *optval, | |||
736 | static int tcp_v6_do_calc_md5_hash(char *md5_hash, struct tcp_md5sig_key *key, | 736 | static int tcp_v6_do_calc_md5_hash(char *md5_hash, struct tcp_md5sig_key *key, |
737 | struct in6_addr *saddr, | 737 | struct in6_addr *saddr, |
738 | struct in6_addr *daddr, | 738 | struct in6_addr *daddr, |
739 | struct tcphdr *th, int protocol, | 739 | struct tcphdr *th, unsigned int tcplen) |
740 | unsigned int tcplen) | ||
741 | { | 740 | { |
742 | struct scatterlist sg[4]; | 741 | struct scatterlist sg[4]; |
743 | __u16 data_len; | 742 | __u16 data_len; |
@@ -761,7 +760,7 @@ static int tcp_v6_do_calc_md5_hash(char *md5_hash, struct tcp_md5sig_key *key, | |||
761 | ipv6_addr_copy(&bp->saddr, saddr); | 760 | ipv6_addr_copy(&bp->saddr, saddr); |
762 | ipv6_addr_copy(&bp->daddr, daddr); | 761 | ipv6_addr_copy(&bp->daddr, daddr); |
763 | bp->len = htonl(tcplen); | 762 | bp->len = htonl(tcplen); |
764 | bp->protocol = htonl(protocol); | 763 | bp->protocol = htonl(IPPROTO_TCP); |
765 | 764 | ||
766 | sg_init_table(sg, 4); | 765 | sg_init_table(sg, 4); |
767 | 766 | ||
@@ -821,8 +820,7 @@ static int tcp_v6_calc_md5_hash(char *md5_hash, struct tcp_md5sig_key *key, | |||
821 | struct sock *sk, | 820 | struct sock *sk, |
822 | struct dst_entry *dst, | 821 | struct dst_entry *dst, |
823 | struct request_sock *req, | 822 | struct request_sock *req, |
824 | struct tcphdr *th, int protocol, | 823 | struct tcphdr *th, unsigned int tcplen) |
825 | unsigned int tcplen) | ||
826 | { | 824 | { |
827 | struct in6_addr *saddr, *daddr; | 825 | struct in6_addr *saddr, *daddr; |
828 | 826 | ||
@@ -835,7 +833,7 @@ static int tcp_v6_calc_md5_hash(char *md5_hash, struct tcp_md5sig_key *key, | |||
835 | } | 833 | } |
836 | return tcp_v6_do_calc_md5_hash(md5_hash, key, | 834 | return tcp_v6_do_calc_md5_hash(md5_hash, key, |
837 | saddr, daddr, | 835 | saddr, daddr, |
838 | th, protocol, tcplen); | 836 | th, tcplen); |
839 | } | 837 | } |
840 | 838 | ||
841 | static int tcp_v6_inbound_md5_hash (struct sock *sk, struct sk_buff *skb) | 839 | static int tcp_v6_inbound_md5_hash (struct sock *sk, struct sk_buff *skb) |
@@ -879,8 +877,7 @@ static int tcp_v6_inbound_md5_hash (struct sock *sk, struct sk_buff *skb) | |||
879 | genhash = tcp_v6_do_calc_md5_hash(newhash, | 877 | genhash = tcp_v6_do_calc_md5_hash(newhash, |
880 | hash_expected, | 878 | hash_expected, |
881 | &ip6h->saddr, &ip6h->daddr, | 879 | &ip6h->saddr, &ip6h->daddr, |
882 | th, sk->sk_protocol, | 880 | th, skb->len); |
883 | skb->len); | ||
884 | if (genhash || memcmp(hash_location, newhash, 16) != 0) { | 881 | if (genhash || memcmp(hash_location, newhash, 16) != 0) { |
885 | if (net_ratelimit()) { | 882 | if (net_ratelimit()) { |
886 | printk(KERN_INFO "MD5 Hash %s for " | 883 | printk(KERN_INFO "MD5 Hash %s for " |
@@ -1020,7 +1017,7 @@ static void tcp_v6_send_reset(struct sock *sk, struct sk_buff *skb) | |||
1020 | tcp_v6_do_calc_md5_hash((__u8 *)&opt[1], key, | 1017 | tcp_v6_do_calc_md5_hash((__u8 *)&opt[1], key, |
1021 | &ipv6_hdr(skb)->daddr, | 1018 | &ipv6_hdr(skb)->daddr, |
1022 | &ipv6_hdr(skb)->saddr, | 1019 | &ipv6_hdr(skb)->saddr, |
1023 | t1, IPPROTO_TCP, tot_len); | 1020 | t1, tot_len); |
1024 | } | 1021 | } |
1025 | #endif | 1022 | #endif |
1026 | 1023 | ||
@@ -1126,7 +1123,7 @@ static void tcp_v6_send_ack(struct tcp_timewait_sock *tw, | |||
1126 | tcp_v6_do_calc_md5_hash((__u8 *)topt, key, | 1123 | tcp_v6_do_calc_md5_hash((__u8 *)topt, key, |
1127 | &ipv6_hdr(skb)->daddr, | 1124 | &ipv6_hdr(skb)->daddr, |
1128 | &ipv6_hdr(skb)->saddr, | 1125 | &ipv6_hdr(skb)->saddr, |
1129 | t1, IPPROTO_TCP, tot_len); | 1126 | t1, tot_len); |
1130 | } | 1127 | } |
1131 | #endif | 1128 | #endif |
1132 | 1129 | ||