Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 076fb722 authored by YOSHIFUJI Hideaki's avatar YOSHIFUJI Hideaki
Browse files

tcp md5sig: Remove redundant protocol argument.



Protocol is always TCP, so remove useless protocol argument.

Signed-off-by: default avatarYOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>
parent 7d5d5525
Loading
Loading
Loading
Loading
+0 −2
Original line number Diff line number Diff line
@@ -1123,7 +1123,6 @@ extern int tcp_v4_calc_md5_hash(char *md5_hash,
						     struct dst_entry *dst,
						     struct request_sock *req,
						     struct tcphdr *th,
						     int protocol,
						     unsigned int tcplen);
extern struct tcp_md5sig_key	*tcp_v4_md5_lookup(struct sock *sk,
						   struct sock *addr_sk);
@@ -1373,7 +1372,6 @@ struct tcp_sock_af_ops {
						  struct dst_entry *dst,
						  struct request_sock *req,
						  struct tcphdr *th,
						  int protocol,
						  unsigned int len);
	int			(*md5_add) (struct sock *sk,
					    struct sock *addr_sk,
+8 −12
Original line number Diff line number Diff line
@@ -95,8 +95,7 @@ static struct tcp_md5sig_key *tcp_v4_md5_do_lookup(struct sock *sk,
						   __be32 addr);
static int tcp_v4_do_calc_md5_hash(char *md5_hash, struct tcp_md5sig_key *key,
				   __be32 saddr, __be32 daddr,
				   struct tcphdr *th, int protocol,
				   unsigned int tcplen);
				   struct tcphdr *th, unsigned int tcplen);
#endif

struct inet_hashinfo __cacheline_aligned tcp_hashinfo = {
@@ -586,8 +585,7 @@ static void tcp_v4_send_reset(struct sock *sk, struct sk_buff *skb)
					key,
					ip_hdr(skb)->daddr,
					ip_hdr(skb)->saddr,
					&rep.th, IPPROTO_TCP,
					arg.iov[0].iov_len);
					&rep.th, arg.iov[0].iov_len);
	}
#endif
	arg.csum = csum_tcpudp_nofold(ip_hdr(skb)->daddr,
@@ -680,8 +678,7 @@ static void tcp_v4_send_ack(struct tcp_timewait_sock *twsk,
					key,
					ip_hdr(skb)->daddr,
					ip_hdr(skb)->saddr,
					&rep.th, IPPROTO_TCP,
					arg.iov[0].iov_len);
					&rep.th, arg.iov[0].iov_len);
	}
#endif
	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,

static int tcp_v4_do_calc_md5_hash(char *md5_hash, struct tcp_md5sig_key *key,
				   __be32 saddr, __be32 daddr,
				   struct tcphdr *th, int protocol,
				   struct tcphdr *th,
				   unsigned int tcplen)
{
	struct scatterlist sg[4];
@@ -1039,7 +1036,7 @@ static int tcp_v4_do_calc_md5_hash(char *md5_hash, struct tcp_md5sig_key *key,
	bp->saddr = saddr;
	bp->daddr = daddr;
	bp->pad = 0;
	bp->protocol = protocol;
	bp->protocol = IPPROTO_TCP;
	bp->len = htons(tcplen);

	sg_init_table(sg, 4);
@@ -1099,7 +1096,7 @@ int tcp_v4_calc_md5_hash(char *md5_hash, struct tcp_md5sig_key *key,
			 struct sock *sk,
			 struct dst_entry *dst,
			 struct request_sock *req,
			 struct tcphdr *th, int protocol,
			 struct tcphdr *th,
			 unsigned int tcplen)
{
	__be32 saddr, daddr;
@@ -1115,7 +1112,7 @@ int tcp_v4_calc_md5_hash(char *md5_hash, struct tcp_md5sig_key *key,
	}
	return tcp_v4_do_calc_md5_hash(md5_hash, key,
				       saddr, daddr,
				       th, protocol, tcplen);
				       th, tcplen);
}

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)
	genhash = tcp_v4_do_calc_md5_hash(newhash,
					  hash_expected,
					  iph->saddr, iph->daddr,
					  th, sk->sk_protocol,
					  skb->len);
					  th, skb->len);

	if (genhash || memcmp(hash_location, newhash, 16) != 0) {
		if (net_ratelimit()) {
+1 −2
Original line number Diff line number Diff line
@@ -607,7 +607,6 @@ static int tcp_transmit_skb(struct sock *sk, struct sk_buff *skb, int clone_it,
					       md5,
					       sk, NULL, NULL,
					       tcp_hdr(skb),
					       sk->sk_protocol,
					       skb->len);
	}
#endif
@@ -2266,7 +2265,7 @@ struct sk_buff *tcp_make_synack(struct sock *sk, struct dst_entry *dst,
		tp->af_specific->calc_md5_hash(md5_hash_location,
					       md5,
					       NULL, dst, req,
					       tcp_hdr(skb), sk->sk_protocol,
					       tcp_hdr(skb),
					       skb->len);
	}
#endif
+7 −10
Original line number Diff line number Diff line
@@ -736,8 +736,7 @@ static int tcp_v6_parse_md5_keys (struct sock *sk, char __user *optval,
static int tcp_v6_do_calc_md5_hash(char *md5_hash, struct tcp_md5sig_key *key,
				   struct in6_addr *saddr,
				   struct in6_addr *daddr,
				   struct tcphdr *th, int protocol,
				   unsigned int tcplen)
				   struct tcphdr *th, unsigned int tcplen)
{
	struct scatterlist sg[4];
	__u16 data_len;
@@ -761,7 +760,7 @@ static int tcp_v6_do_calc_md5_hash(char *md5_hash, struct tcp_md5sig_key *key,
	ipv6_addr_copy(&bp->saddr, saddr);
	ipv6_addr_copy(&bp->daddr, daddr);
	bp->len = htonl(tcplen);
	bp->protocol = htonl(protocol);
	bp->protocol = htonl(IPPROTO_TCP);

	sg_init_table(sg, 4);

@@ -821,8 +820,7 @@ static int tcp_v6_calc_md5_hash(char *md5_hash, struct tcp_md5sig_key *key,
				struct sock *sk,
				struct dst_entry *dst,
				struct request_sock *req,
				struct tcphdr *th, int protocol,
				unsigned int tcplen)
				struct tcphdr *th, unsigned int tcplen)
{
	struct in6_addr *saddr, *daddr;

@@ -835,7 +833,7 @@ static int tcp_v6_calc_md5_hash(char *md5_hash, struct tcp_md5sig_key *key,
	}
	return tcp_v6_do_calc_md5_hash(md5_hash, key,
				       saddr, daddr,
				       th, protocol, tcplen);
				       th, tcplen);
}

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)
	genhash = tcp_v6_do_calc_md5_hash(newhash,
					  hash_expected,
					  &ip6h->saddr, &ip6h->daddr,
					  th, sk->sk_protocol,
					  skb->len);
					  th, skb->len);
	if (genhash || memcmp(hash_location, newhash, 16) != 0) {
		if (net_ratelimit()) {
			printk(KERN_INFO "MD5 Hash %s for "
@@ -1020,7 +1017,7 @@ static void tcp_v6_send_reset(struct sock *sk, struct sk_buff *skb)
		tcp_v6_do_calc_md5_hash((__u8 *)&opt[1], key,
					&ipv6_hdr(skb)->daddr,
					&ipv6_hdr(skb)->saddr,
					t1, IPPROTO_TCP, tot_len);
					t1, tot_len);
	}
#endif

@@ -1126,7 +1123,7 @@ static void tcp_v6_send_ack(struct tcp_timewait_sock *tw,
		tcp_v6_do_calc_md5_hash((__u8 *)topt, key,
					&ipv6_hdr(skb)->daddr,
					&ipv6_hdr(skb)->saddr,
					t1, IPPROTO_TCP, tot_len);
					t1, tot_len);
	}
#endif