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

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
...@@ -86,7 +86,6 @@ struct inet_protosw { ...@@ -86,7 +86,6 @@ struct inet_protosw {
struct proto *prot; struct proto *prot;
const struct proto_ops *ops; const struct proto_ops *ops;
char no_check; /* checksum on rcv/xmit/none? */
unsigned char flags; /* See INET_PROTOSW_* below. */ unsigned char flags; /* See INET_PROTOSW_* below. */
}; };
#define INET_PROTOSW_REUSE 0x01 /* Are ports automatically reusable? */ #define INET_PROTOSW_REUSE 0x01 /* Are ports automatically reusable? */
......
...@@ -1024,7 +1024,6 @@ static struct inet_protosw dccp_v4_protosw = { ...@@ -1024,7 +1024,6 @@ static struct inet_protosw dccp_v4_protosw = {
.protocol = IPPROTO_DCCP, .protocol = IPPROTO_DCCP,
.prot = &dccp_v4_prot, .prot = &dccp_v4_prot,
.ops = &inet_dccp_ops, .ops = &inet_dccp_ops,
.no_check = 0,
.flags = INET_PROTOSW_ICSK, .flags = INET_PROTOSW_ICSK,
}; };
......
...@@ -254,7 +254,6 @@ static int inet_create(struct net *net, struct socket *sock, int protocol, ...@@ -254,7 +254,6 @@ static int inet_create(struct net *net, struct socket *sock, int protocol,
struct inet_sock *inet; struct inet_sock *inet;
struct proto *answer_prot; struct proto *answer_prot;
unsigned char answer_flags; unsigned char answer_flags;
char answer_no_check;
int try_loading_module = 0; int try_loading_module = 0;
int err; int err;
...@@ -312,7 +311,6 @@ static int inet_create(struct net *net, struct socket *sock, int protocol, ...@@ -312,7 +311,6 @@ static int inet_create(struct net *net, struct socket *sock, int protocol,
sock->ops = answer->ops; sock->ops = answer->ops;
answer_prot = answer->prot; answer_prot = answer->prot;
answer_no_check = answer->no_check;
answer_flags = answer->flags; answer_flags = answer->flags;
rcu_read_unlock(); rcu_read_unlock();
...@@ -324,7 +322,6 @@ static int inet_create(struct net *net, struct socket *sock, int protocol, ...@@ -324,7 +322,6 @@ static int inet_create(struct net *net, struct socket *sock, int protocol,
goto out; goto out;
err = 0; err = 0;
sk->sk_no_check = answer_no_check;
if (INET_PROTOSW_REUSE & answer_flags) if (INET_PROTOSW_REUSE & answer_flags)
sk->sk_reuse = SK_CAN_REUSE; sk->sk_reuse = SK_CAN_REUSE;
...@@ -1002,7 +999,6 @@ static struct inet_protosw inetsw_array[] = ...@@ -1002,7 +999,6 @@ static struct inet_protosw inetsw_array[] =
.protocol = IPPROTO_TCP, .protocol = IPPROTO_TCP,
.prot = &tcp_prot, .prot = &tcp_prot,
.ops = &inet_stream_ops, .ops = &inet_stream_ops,
.no_check = 0,
.flags = INET_PROTOSW_PERMANENT | .flags = INET_PROTOSW_PERMANENT |
INET_PROTOSW_ICSK, INET_PROTOSW_ICSK,
}, },
...@@ -1012,7 +1008,6 @@ static struct inet_protosw inetsw_array[] = ...@@ -1012,7 +1008,6 @@ static struct inet_protosw inetsw_array[] =
.protocol = IPPROTO_UDP, .protocol = IPPROTO_UDP,
.prot = &udp_prot, .prot = &udp_prot,
.ops = &inet_dgram_ops, .ops = &inet_dgram_ops,
.no_check = UDP_CSUM_DEFAULT,
.flags = INET_PROTOSW_PERMANENT, .flags = INET_PROTOSW_PERMANENT,
}, },
...@@ -1021,7 +1016,6 @@ static struct inet_protosw inetsw_array[] = ...@@ -1021,7 +1016,6 @@ static struct inet_protosw inetsw_array[] =
.protocol = IPPROTO_ICMP, .protocol = IPPROTO_ICMP,
.prot = &ping_prot, .prot = &ping_prot,
.ops = &inet_dgram_ops, .ops = &inet_dgram_ops,
.no_check = UDP_CSUM_DEFAULT,
.flags = INET_PROTOSW_REUSE, .flags = INET_PROTOSW_REUSE,
}, },
...@@ -1030,7 +1024,6 @@ static struct inet_protosw inetsw_array[] = ...@@ -1030,7 +1024,6 @@ static struct inet_protosw inetsw_array[] =
.protocol = IPPROTO_IP, /* wild card */ .protocol = IPPROTO_IP, /* wild card */
.prot = &raw_prot, .prot = &raw_prot,
.ops = &inet_sockraw_ops, .ops = &inet_sockraw_ops,
.no_check = UDP_CSUM_DEFAULT,
.flags = INET_PROTOSW_REUSE, .flags = INET_PROTOSW_REUSE,
} }
}; };
......
...@@ -70,7 +70,6 @@ static struct inet_protosw udplite4_protosw = { ...@@ -70,7 +70,6 @@ static struct inet_protosw udplite4_protosw = {
.protocol = IPPROTO_UDPLITE, .protocol = IPPROTO_UDPLITE,
.prot = &udplite_prot, .prot = &udplite_prot,
.ops = &inet_dgram_ops, .ops = &inet_dgram_ops,
.no_check = 0, /* must checksum (RFC 3828) */
.flags = INET_PROTOSW_PERMANENT, .flags = INET_PROTOSW_PERMANENT,
}; };
......
...@@ -106,7 +106,6 @@ static int inet6_create(struct net *net, struct socket *sock, int protocol, ...@@ -106,7 +106,6 @@ static int inet6_create(struct net *net, struct socket *sock, int protocol,
struct inet_protosw *answer; struct inet_protosw *answer;
struct proto *answer_prot; struct proto *answer_prot;
unsigned char answer_flags; unsigned char answer_flags;
char answer_no_check;
int try_loading_module = 0; int try_loading_module = 0;
int err; int err;
...@@ -162,7 +161,6 @@ static int inet6_create(struct net *net, struct socket *sock, int protocol, ...@@ -162,7 +161,6 @@ static int inet6_create(struct net *net, struct socket *sock, int protocol,
sock->ops = answer->ops; sock->ops = answer->ops;
answer_prot = answer->prot; answer_prot = answer->prot;
answer_no_check = answer->no_check;
answer_flags = answer->flags; answer_flags = answer->flags;
rcu_read_unlock(); rcu_read_unlock();
...@@ -176,7 +174,6 @@ static int inet6_create(struct net *net, struct socket *sock, int protocol, ...@@ -176,7 +174,6 @@ static int inet6_create(struct net *net, struct socket *sock, int protocol,
sock_init_data(sock, sk); sock_init_data(sock, sk);
err = 0; err = 0;
sk->sk_no_check = answer_no_check;
if (INET_PROTOSW_REUSE & answer_flags) if (INET_PROTOSW_REUSE & answer_flags)
sk->sk_reuse = SK_CAN_REUSE; sk->sk_reuse = SK_CAN_REUSE;
......
...@@ -51,7 +51,6 @@ static struct inet_protosw pingv6_protosw = { ...@@ -51,7 +51,6 @@ static struct inet_protosw pingv6_protosw = {
.protocol = IPPROTO_ICMPV6, .protocol = IPPROTO_ICMPV6,
.prot = &pingv6_prot, .prot = &pingv6_prot,
.ops = &inet6_dgram_ops, .ops = &inet6_dgram_ops,
.no_check = UDP_CSUM_DEFAULT,
.flags = INET_PROTOSW_REUSE, .flags = INET_PROTOSW_REUSE,
}; };
......
...@@ -1322,7 +1322,6 @@ static struct inet_protosw rawv6_protosw = { ...@@ -1322,7 +1322,6 @@ static struct inet_protosw rawv6_protosw = {
.protocol = IPPROTO_IP, /* wild card */ .protocol = IPPROTO_IP, /* wild card */
.prot = &rawv6_prot, .prot = &rawv6_prot,
.ops = &inet6_sockraw_ops, .ops = &inet6_sockraw_ops,
.no_check = UDP_CSUM_DEFAULT,
.flags = INET_PROTOSW_REUSE, .flags = INET_PROTOSW_REUSE,
}; };
......
...@@ -1992,7 +1992,6 @@ static struct inet_protosw tcpv6_protosw = { ...@@ -1992,7 +1992,6 @@ static struct inet_protosw tcpv6_protosw = {
.protocol = IPPROTO_TCP, .protocol = IPPROTO_TCP,
.prot = &tcpv6_prot, .prot = &tcpv6_prot,
.ops = &inet6_stream_ops, .ops = &inet6_stream_ops,
.no_check = 0,
.flags = INET_PROTOSW_PERMANENT | .flags = INET_PROTOSW_PERMANENT |
INET_PROTOSW_ICSK, INET_PROTOSW_ICSK,
}; };
......
...@@ -1507,7 +1507,6 @@ static struct inet_protosw udpv6_protosw = { ...@@ -1507,7 +1507,6 @@ static struct inet_protosw udpv6_protosw = {
.protocol = IPPROTO_UDP, .protocol = IPPROTO_UDP,
.prot = &udpv6_prot, .prot = &udpv6_prot,
.ops = &inet6_dgram_ops, .ops = &inet6_dgram_ops,
.no_check = UDP_CSUM_DEFAULT,
.flags = INET_PROTOSW_PERMANENT, .flags = INET_PROTOSW_PERMANENT,
}; };
......
...@@ -64,7 +64,6 @@ static struct inet_protosw udplite6_protosw = { ...@@ -64,7 +64,6 @@ static struct inet_protosw udplite6_protosw = {
.protocol = IPPROTO_UDPLITE, .protocol = IPPROTO_UDPLITE,
.prot = &udplitev6_prot, .prot = &udplitev6_prot,
.ops = &inet6_dgram_ops, .ops = &inet6_dgram_ops,
.no_check = 0,
.flags = INET_PROTOSW_PERMANENT, .flags = INET_PROTOSW_PERMANENT,
}; };
......
...@@ -606,7 +606,6 @@ static struct inet_protosw l2tp_ip_protosw = { ...@@ -606,7 +606,6 @@ static struct inet_protosw l2tp_ip_protosw = {
.protocol = IPPROTO_L2TP, .protocol = IPPROTO_L2TP,
.prot = &l2tp_ip_prot, .prot = &l2tp_ip_prot,
.ops = &l2tp_ip_ops, .ops = &l2tp_ip_ops,
.no_check = 0,
}; };
static struct net_protocol l2tp_ip_protocol __read_mostly = { static struct net_protocol l2tp_ip_protocol __read_mostly = {
......
...@@ -755,7 +755,6 @@ static struct inet_protosw l2tp_ip6_protosw = { ...@@ -755,7 +755,6 @@ static struct inet_protosw l2tp_ip6_protosw = {
.protocol = IPPROTO_L2TP, .protocol = IPPROTO_L2TP,
.prot = &l2tp_ip6_prot, .prot = &l2tp_ip6_prot,
.ops = &l2tp_ip6_ops, .ops = &l2tp_ip6_ops,
.no_check = 0,
}; };
static struct inet6_protocol l2tp_ip6_protocol __read_mostly = { static struct inet6_protocol l2tp_ip6_protocol __read_mostly = {
......
...@@ -943,7 +943,6 @@ static struct inet_protosw sctpv6_seqpacket_protosw = { ...@@ -943,7 +943,6 @@ static struct inet_protosw sctpv6_seqpacket_protosw = {
.protocol = IPPROTO_SCTP, .protocol = IPPROTO_SCTP,
.prot = &sctpv6_prot, .prot = &sctpv6_prot,
.ops = &inet6_seqpacket_ops, .ops = &inet6_seqpacket_ops,
.no_check = 0,
.flags = SCTP_PROTOSW_FLAG .flags = SCTP_PROTOSW_FLAG
}; };
static struct inet_protosw sctpv6_stream_protosw = { static struct inet_protosw sctpv6_stream_protosw = {
...@@ -951,7 +950,6 @@ static struct inet_protosw sctpv6_stream_protosw = { ...@@ -951,7 +950,6 @@ static struct inet_protosw sctpv6_stream_protosw = {
.protocol = IPPROTO_SCTP, .protocol = IPPROTO_SCTP,
.prot = &sctpv6_prot, .prot = &sctpv6_prot,
.ops = &inet6_seqpacket_ops, .ops = &inet6_seqpacket_ops,
.no_check = 0,
.flags = SCTP_PROTOSW_FLAG, .flags = SCTP_PROTOSW_FLAG,
}; };
......
...@@ -1017,7 +1017,6 @@ static struct inet_protosw sctp_seqpacket_protosw = { ...@@ -1017,7 +1017,6 @@ static struct inet_protosw sctp_seqpacket_protosw = {
.protocol = IPPROTO_SCTP, .protocol = IPPROTO_SCTP,
.prot = &sctp_prot, .prot = &sctp_prot,
.ops = &inet_seqpacket_ops, .ops = &inet_seqpacket_ops,
.no_check = 0,
.flags = SCTP_PROTOSW_FLAG .flags = SCTP_PROTOSW_FLAG
}; };
static struct inet_protosw sctp_stream_protosw = { static struct inet_protosw sctp_stream_protosw = {
...@@ -1025,7 +1024,6 @@ static struct inet_protosw sctp_stream_protosw = { ...@@ -1025,7 +1024,6 @@ static struct inet_protosw sctp_stream_protosw = {
.protocol = IPPROTO_SCTP, .protocol = IPPROTO_SCTP,
.prot = &sctp_prot, .prot = &sctp_prot,
.ops = &inet_seqpacket_ops, .ops = &inet_seqpacket_ops,
.no_check = 0,
.flags = SCTP_PROTOSW_FLAG .flags = SCTP_PROTOSW_FLAG
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment