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

Commit b26ba202 authored by Tom Herbert's avatar Tom Herbert Committed by David S. Miller
Browse files

net: Eliminate no_check from protosw



It doesn't seem like an protocols are setting anything other
than the default, and allowing to arbitrarily disable checksums
for a whole protocol seems dangerous. This can be done on a per
socket basis.

Signed-off-by: default avatarTom Herbert <therbert@google.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 0f8066bd
Loading
Loading
Loading
Loading
+0 −1
Original line number Diff line number Diff line
@@ -86,7 +86,6 @@ struct inet_protosw {
	struct proto	 *prot;
	const struct proto_ops *ops;
  
	char             no_check;   /* checksum on rcv/xmit/none? */
	unsigned char	 flags;      /* See INET_PROTOSW_* below.  */
};
#define INET_PROTOSW_REUSE 0x01	     /* Are ports automatically reusable? */
+0 −1
Original line number Diff line number Diff line
@@ -1024,7 +1024,6 @@ static struct inet_protosw dccp_v4_protosw = {
	.protocol	= IPPROTO_DCCP,
	.prot		= &dccp_v4_prot,
	.ops		= &inet_dccp_ops,
	.no_check	= 0,
	.flags		= INET_PROTOSW_ICSK,
};

+0 −7
Original line number Diff line number Diff line
@@ -254,7 +254,6 @@ static int inet_create(struct net *net, struct socket *sock, int protocol,
	struct inet_sock *inet;
	struct proto *answer_prot;
	unsigned char answer_flags;
	char answer_no_check;
	int try_loading_module = 0;
	int err;

@@ -312,7 +311,6 @@ lookup_protocol:

	sock->ops = answer->ops;
	answer_prot = answer->prot;
	answer_no_check = answer->no_check;
	answer_flags = answer->flags;
	rcu_read_unlock();

@@ -324,7 +322,6 @@ lookup_protocol:
		goto out;

	err = 0;
	sk->sk_no_check = answer_no_check;
	if (INET_PROTOSW_REUSE & answer_flags)
		sk->sk_reuse = SK_CAN_REUSE;

@@ -1002,7 +999,6 @@ static struct inet_protosw inetsw_array[] =
		.protocol =   IPPROTO_TCP,
		.prot =       &tcp_prot,
		.ops =        &inet_stream_ops,
		.no_check =   0,
		.flags =      INET_PROTOSW_PERMANENT |
			      INET_PROTOSW_ICSK,
	},
@@ -1012,7 +1008,6 @@ static struct inet_protosw inetsw_array[] =
		.protocol =   IPPROTO_UDP,
		.prot =       &udp_prot,
		.ops =        &inet_dgram_ops,
		.no_check =   UDP_CSUM_DEFAULT,
		.flags =      INET_PROTOSW_PERMANENT,
       },

@@ -1021,7 +1016,6 @@ static struct inet_protosw inetsw_array[] =
		.protocol =   IPPROTO_ICMP,
		.prot =       &ping_prot,
		.ops =        &inet_dgram_ops,
		.no_check =   UDP_CSUM_DEFAULT,
		.flags =      INET_PROTOSW_REUSE,
       },

@@ -1030,7 +1024,6 @@ static struct inet_protosw inetsw_array[] =
	       .protocol =   IPPROTO_IP,	/* wild card */
	       .prot =       &raw_prot,
	       .ops =        &inet_sockraw_ops,
	       .no_check =   UDP_CSUM_DEFAULT,
	       .flags =      INET_PROTOSW_REUSE,
       }
};
+0 −1
Original line number Diff line number Diff line
@@ -70,7 +70,6 @@ static struct inet_protosw udplite4_protosw = {
	.protocol	=  IPPROTO_UDPLITE,
	.prot		=  &udplite_prot,
	.ops		=  &inet_dgram_ops,
	.no_check	=  0,		/* must checksum (RFC 3828) */
	.flags		=  INET_PROTOSW_PERMANENT,
};

+0 −3
Original line number Diff line number Diff line
@@ -106,7 +106,6 @@ static int inet6_create(struct net *net, struct socket *sock, int protocol,
	struct inet_protosw *answer;
	struct proto *answer_prot;
	unsigned char answer_flags;
	char answer_no_check;
	int try_loading_module = 0;
	int err;

@@ -162,7 +161,6 @@ lookup_protocol:

	sock->ops = answer->ops;
	answer_prot = answer->prot;
	answer_no_check = answer->no_check;
	answer_flags = answer->flags;
	rcu_read_unlock();

@@ -176,7 +174,6 @@ lookup_protocol:
	sock_init_data(sock, sk);

	err = 0;
	sk->sk_no_check = answer_no_check;
	if (INET_PROTOSW_REUSE & answer_flags)
		sk->sk_reuse = SK_CAN_REUSE;

Loading