diff options
author | Tom Herbert <therbert@google.com> | 2014-05-23 11:47:09 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2014-05-23 16:28:53 -0400 |
commit | b26ba202e0500eb852e89499ece1b2deaa64c3a7 (patch) | |
tree | 82f9ca0dbc861e11b79d4bdb594638a6c94f127f | |
parent | 0f8066bd48785058c339061fef05be0dcfa8dc08 (diff) |
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: Tom Herbert <therbert@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | include/net/protocol.h | 1 | ||||
-rw-r--r-- | net/dccp/ipv4.c | 1 | ||||
-rw-r--r-- | net/ipv4/af_inet.c | 7 | ||||
-rw-r--r-- | net/ipv4/udplite.c | 1 | ||||
-rw-r--r-- | net/ipv6/af_inet6.c | 3 | ||||
-rw-r--r-- | net/ipv6/ping.c | 1 | ||||
-rw-r--r-- | net/ipv6/raw.c | 1 | ||||
-rw-r--r-- | net/ipv6/tcp_ipv6.c | 1 | ||||
-rw-r--r-- | net/ipv6/udp.c | 1 | ||||
-rw-r--r-- | net/ipv6/udplite.c | 1 | ||||
-rw-r--r-- | net/l2tp/l2tp_ip.c | 1 | ||||
-rw-r--r-- | net/l2tp/l2tp_ip6.c | 1 | ||||
-rw-r--r-- | net/sctp/ipv6.c | 2 | ||||
-rw-r--r-- | net/sctp/protocol.c | 2 |
14 files changed, 0 insertions, 24 deletions
diff --git a/include/net/protocol.h b/include/net/protocol.h index a7e986b08147..d6fcc1fcdb5b 100644 --- a/include/net/protocol.h +++ b/include/net/protocol.h | |||
@@ -86,7 +86,6 @@ struct inet_protosw { | |||
86 | struct proto *prot; | 86 | struct proto *prot; |
87 | const struct proto_ops *ops; | 87 | const struct proto_ops *ops; |
88 | 88 | ||
89 | char no_check; /* checksum on rcv/xmit/none? */ | ||
90 | unsigned char flags; /* See INET_PROTOSW_* below. */ | 89 | unsigned char flags; /* See INET_PROTOSW_* below. */ |
91 | }; | 90 | }; |
92 | #define INET_PROTOSW_REUSE 0x01 /* Are ports automatically reusable? */ | 91 | #define INET_PROTOSW_REUSE 0x01 /* Are ports automatically reusable? */ |
diff --git a/net/dccp/ipv4.c b/net/dccp/ipv4.c index 22b5d818b200..6ca645c4b48e 100644 --- a/net/dccp/ipv4.c +++ b/net/dccp/ipv4.c | |||
@@ -1024,7 +1024,6 @@ static struct inet_protosw dccp_v4_protosw = { | |||
1024 | .protocol = IPPROTO_DCCP, | 1024 | .protocol = IPPROTO_DCCP, |
1025 | .prot = &dccp_v4_prot, | 1025 | .prot = &dccp_v4_prot, |
1026 | .ops = &inet_dccp_ops, | 1026 | .ops = &inet_dccp_ops, |
1027 | .no_check = 0, | ||
1028 | .flags = INET_PROTOSW_ICSK, | 1027 | .flags = INET_PROTOSW_ICSK, |
1029 | }; | 1028 | }; |
1030 | 1029 | ||
diff --git a/net/ipv4/af_inet.c b/net/ipv4/af_inet.c index 279132bcadd9..0e9bb08a91e4 100644 --- a/net/ipv4/af_inet.c +++ b/net/ipv4/af_inet.c | |||
@@ -254,7 +254,6 @@ static int inet_create(struct net *net, struct socket *sock, int protocol, | |||
254 | struct inet_sock *inet; | 254 | struct inet_sock *inet; |
255 | struct proto *answer_prot; | 255 | struct proto *answer_prot; |
256 | unsigned char answer_flags; | 256 | unsigned char answer_flags; |
257 | char answer_no_check; | ||
258 | int try_loading_module = 0; | 257 | int try_loading_module = 0; |
259 | int err; | 258 | int err; |
260 | 259 | ||
@@ -312,7 +311,6 @@ lookup_protocol: | |||
312 | 311 | ||
313 | sock->ops = answer->ops; | 312 | sock->ops = answer->ops; |
314 | answer_prot = answer->prot; | 313 | answer_prot = answer->prot; |
315 | answer_no_check = answer->no_check; | ||
316 | answer_flags = answer->flags; | 314 | answer_flags = answer->flags; |
317 | rcu_read_unlock(); | 315 | rcu_read_unlock(); |
318 | 316 | ||
@@ -324,7 +322,6 @@ lookup_protocol: | |||
324 | goto out; | 322 | goto out; |
325 | 323 | ||
326 | err = 0; | 324 | err = 0; |
327 | sk->sk_no_check = answer_no_check; | ||
328 | if (INET_PROTOSW_REUSE & answer_flags) | 325 | if (INET_PROTOSW_REUSE & answer_flags) |
329 | sk->sk_reuse = SK_CAN_REUSE; | 326 | sk->sk_reuse = SK_CAN_REUSE; |
330 | 327 | ||
@@ -1002,7 +999,6 @@ static struct inet_protosw inetsw_array[] = | |||
1002 | .protocol = IPPROTO_TCP, | 999 | .protocol = IPPROTO_TCP, |
1003 | .prot = &tcp_prot, | 1000 | .prot = &tcp_prot, |
1004 | .ops = &inet_stream_ops, | 1001 | .ops = &inet_stream_ops, |
1005 | .no_check = 0, | ||
1006 | .flags = INET_PROTOSW_PERMANENT | | 1002 | .flags = INET_PROTOSW_PERMANENT | |
1007 | INET_PROTOSW_ICSK, | 1003 | INET_PROTOSW_ICSK, |
1008 | }, | 1004 | }, |
@@ -1012,7 +1008,6 @@ static struct inet_protosw inetsw_array[] = | |||
1012 | .protocol = IPPROTO_UDP, | 1008 | .protocol = IPPROTO_UDP, |
1013 | .prot = &udp_prot, | 1009 | .prot = &udp_prot, |
1014 | .ops = &inet_dgram_ops, | 1010 | .ops = &inet_dgram_ops, |
1015 | .no_check = UDP_CSUM_DEFAULT, | ||
1016 | .flags = INET_PROTOSW_PERMANENT, | 1011 | .flags = INET_PROTOSW_PERMANENT, |
1017 | }, | 1012 | }, |
1018 | 1013 | ||
@@ -1021,7 +1016,6 @@ static struct inet_protosw inetsw_array[] = | |||
1021 | .protocol = IPPROTO_ICMP, | 1016 | .protocol = IPPROTO_ICMP, |
1022 | .prot = &ping_prot, | 1017 | .prot = &ping_prot, |
1023 | .ops = &inet_dgram_ops, | 1018 | .ops = &inet_dgram_ops, |
1024 | .no_check = UDP_CSUM_DEFAULT, | ||
1025 | .flags = INET_PROTOSW_REUSE, | 1019 | .flags = INET_PROTOSW_REUSE, |
1026 | }, | 1020 | }, |
1027 | 1021 | ||
@@ -1030,7 +1024,6 @@ static struct inet_protosw inetsw_array[] = | |||
1030 | .protocol = IPPROTO_IP, /* wild card */ | 1024 | .protocol = IPPROTO_IP, /* wild card */ |
1031 | .prot = &raw_prot, | 1025 | .prot = &raw_prot, |
1032 | .ops = &inet_sockraw_ops, | 1026 | .ops = &inet_sockraw_ops, |
1033 | .no_check = UDP_CSUM_DEFAULT, | ||
1034 | .flags = INET_PROTOSW_REUSE, | 1027 | .flags = INET_PROTOSW_REUSE, |
1035 | } | 1028 | } |
1036 | }; | 1029 | }; |
diff --git a/net/ipv4/udplite.c b/net/ipv4/udplite.c index 2c46acd4cc36..3b3efbda48e1 100644 --- a/net/ipv4/udplite.c +++ b/net/ipv4/udplite.c | |||
@@ -70,7 +70,6 @@ static struct inet_protosw udplite4_protosw = { | |||
70 | .protocol = IPPROTO_UDPLITE, | 70 | .protocol = IPPROTO_UDPLITE, |
71 | .prot = &udplite_prot, | 71 | .prot = &udplite_prot, |
72 | .ops = &inet_dgram_ops, | 72 | .ops = &inet_dgram_ops, |
73 | .no_check = 0, /* must checksum (RFC 3828) */ | ||
74 | .flags = INET_PROTOSW_PERMANENT, | 73 | .flags = INET_PROTOSW_PERMANENT, |
75 | }; | 74 | }; |
76 | 75 | ||
diff --git a/net/ipv6/af_inet6.c b/net/ipv6/af_inet6.c index dc47cc757b80..7cb4392690dd 100644 --- a/net/ipv6/af_inet6.c +++ b/net/ipv6/af_inet6.c | |||
@@ -106,7 +106,6 @@ static int inet6_create(struct net *net, struct socket *sock, int protocol, | |||
106 | struct inet_protosw *answer; | 106 | struct inet_protosw *answer; |
107 | struct proto *answer_prot; | 107 | struct proto *answer_prot; |
108 | unsigned char answer_flags; | 108 | unsigned char answer_flags; |
109 | char answer_no_check; | ||
110 | int try_loading_module = 0; | 109 | int try_loading_module = 0; |
111 | int err; | 110 | int err; |
112 | 111 | ||
@@ -162,7 +161,6 @@ lookup_protocol: | |||
162 | 161 | ||
163 | sock->ops = answer->ops; | 162 | sock->ops = answer->ops; |
164 | answer_prot = answer->prot; | 163 | answer_prot = answer->prot; |
165 | answer_no_check = answer->no_check; | ||
166 | answer_flags = answer->flags; | 164 | answer_flags = answer->flags; |
167 | rcu_read_unlock(); | 165 | rcu_read_unlock(); |
168 | 166 | ||
@@ -176,7 +174,6 @@ lookup_protocol: | |||
176 | sock_init_data(sock, sk); | 174 | sock_init_data(sock, sk); |
177 | 175 | ||
178 | err = 0; | 176 | err = 0; |
179 | sk->sk_no_check = answer_no_check; | ||
180 | if (INET_PROTOSW_REUSE & answer_flags) | 177 | if (INET_PROTOSW_REUSE & answer_flags) |
181 | sk->sk_reuse = SK_CAN_REUSE; | 178 | sk->sk_reuse = SK_CAN_REUSE; |
182 | 179 | ||
diff --git a/net/ipv6/ping.c b/net/ipv6/ping.c index a2a1d80dfe0c..5b7a1ed2aba9 100644 --- a/net/ipv6/ping.c +++ b/net/ipv6/ping.c | |||
@@ -51,7 +51,6 @@ static struct inet_protosw pingv6_protosw = { | |||
51 | .protocol = IPPROTO_ICMPV6, | 51 | .protocol = IPPROTO_ICMPV6, |
52 | .prot = &pingv6_prot, | 52 | .prot = &pingv6_prot, |
53 | .ops = &inet6_dgram_ops, | 53 | .ops = &inet6_dgram_ops, |
54 | .no_check = UDP_CSUM_DEFAULT, | ||
55 | .flags = INET_PROTOSW_REUSE, | 54 | .flags = INET_PROTOSW_REUSE, |
56 | }; | 55 | }; |
57 | 56 | ||
diff --git a/net/ipv6/raw.c b/net/ipv6/raw.c index dddfb5fa2b7a..b2dc60b0c764 100644 --- a/net/ipv6/raw.c +++ b/net/ipv6/raw.c | |||
@@ -1322,7 +1322,6 @@ static struct inet_protosw rawv6_protosw = { | |||
1322 | .protocol = IPPROTO_IP, /* wild card */ | 1322 | .protocol = IPPROTO_IP, /* wild card */ |
1323 | .prot = &rawv6_prot, | 1323 | .prot = &rawv6_prot, |
1324 | .ops = &inet6_sockraw_ops, | 1324 | .ops = &inet6_sockraw_ops, |
1325 | .no_check = UDP_CSUM_DEFAULT, | ||
1326 | .flags = INET_PROTOSW_REUSE, | 1325 | .flags = INET_PROTOSW_REUSE, |
1327 | }; | 1326 | }; |
1328 | 1327 | ||
diff --git a/net/ipv6/tcp_ipv6.c b/net/ipv6/tcp_ipv6.c index f07b2abba359..229239ad96b1 100644 --- a/net/ipv6/tcp_ipv6.c +++ b/net/ipv6/tcp_ipv6.c | |||
@@ -1992,7 +1992,6 @@ static struct inet_protosw tcpv6_protosw = { | |||
1992 | .protocol = IPPROTO_TCP, | 1992 | .protocol = IPPROTO_TCP, |
1993 | .prot = &tcpv6_prot, | 1993 | .prot = &tcpv6_prot, |
1994 | .ops = &inet6_stream_ops, | 1994 | .ops = &inet6_stream_ops, |
1995 | .no_check = 0, | ||
1996 | .flags = INET_PROTOSW_PERMANENT | | 1995 | .flags = INET_PROTOSW_PERMANENT | |
1997 | INET_PROTOSW_ICSK, | 1996 | INET_PROTOSW_ICSK, |
1998 | }; | 1997 | }; |
diff --git a/net/ipv6/udp.c b/net/ipv6/udp.c index 7edf096867c4..c7ed47bde54b 100644 --- a/net/ipv6/udp.c +++ b/net/ipv6/udp.c | |||
@@ -1507,7 +1507,6 @@ static struct inet_protosw udpv6_protosw = { | |||
1507 | .protocol = IPPROTO_UDP, | 1507 | .protocol = IPPROTO_UDP, |
1508 | .prot = &udpv6_prot, | 1508 | .prot = &udpv6_prot, |
1509 | .ops = &inet6_dgram_ops, | 1509 | .ops = &inet6_dgram_ops, |
1510 | .no_check = UDP_CSUM_DEFAULT, | ||
1511 | .flags = INET_PROTOSW_PERMANENT, | 1510 | .flags = INET_PROTOSW_PERMANENT, |
1512 | }; | 1511 | }; |
1513 | 1512 | ||
diff --git a/net/ipv6/udplite.c b/net/ipv6/udplite.c index dfcc4be46898..9cf097e206e9 100644 --- a/net/ipv6/udplite.c +++ b/net/ipv6/udplite.c | |||
@@ -64,7 +64,6 @@ static struct inet_protosw udplite6_protosw = { | |||
64 | .protocol = IPPROTO_UDPLITE, | 64 | .protocol = IPPROTO_UDPLITE, |
65 | .prot = &udplitev6_prot, | 65 | .prot = &udplitev6_prot, |
66 | .ops = &inet6_dgram_ops, | 66 | .ops = &inet6_dgram_ops, |
67 | .no_check = 0, | ||
68 | .flags = INET_PROTOSW_PERMANENT, | 67 | .flags = INET_PROTOSW_PERMANENT, |
69 | }; | 68 | }; |
70 | 69 | ||
diff --git a/net/l2tp/l2tp_ip.c b/net/l2tp/l2tp_ip.c index 3397fe6897c0..369a9822488c 100644 --- a/net/l2tp/l2tp_ip.c +++ b/net/l2tp/l2tp_ip.c | |||
@@ -606,7 +606,6 @@ static struct inet_protosw l2tp_ip_protosw = { | |||
606 | .protocol = IPPROTO_L2TP, | 606 | .protocol = IPPROTO_L2TP, |
607 | .prot = &l2tp_ip_prot, | 607 | .prot = &l2tp_ip_prot, |
608 | .ops = &l2tp_ip_ops, | 608 | .ops = &l2tp_ip_ops, |
609 | .no_check = 0, | ||
610 | }; | 609 | }; |
611 | 610 | ||
612 | static struct net_protocol l2tp_ip_protocol __read_mostly = { | 611 | static struct net_protocol l2tp_ip_protocol __read_mostly = { |
diff --git a/net/l2tp/l2tp_ip6.c b/net/l2tp/l2tp_ip6.c index e472d44a3b91..f3f98a156cee 100644 --- a/net/l2tp/l2tp_ip6.c +++ b/net/l2tp/l2tp_ip6.c | |||
@@ -755,7 +755,6 @@ static struct inet_protosw l2tp_ip6_protosw = { | |||
755 | .protocol = IPPROTO_L2TP, | 755 | .protocol = IPPROTO_L2TP, |
756 | .prot = &l2tp_ip6_prot, | 756 | .prot = &l2tp_ip6_prot, |
757 | .ops = &l2tp_ip6_ops, | 757 | .ops = &l2tp_ip6_ops, |
758 | .no_check = 0, | ||
759 | }; | 758 | }; |
760 | 759 | ||
761 | static struct inet6_protocol l2tp_ip6_protocol __read_mostly = { | 760 | static struct inet6_protocol l2tp_ip6_protocol __read_mostly = { |
diff --git a/net/sctp/ipv6.c b/net/sctp/ipv6.c index 4dc5d9e08311..1999592ba88c 100644 --- a/net/sctp/ipv6.c +++ b/net/sctp/ipv6.c | |||
@@ -943,7 +943,6 @@ static struct inet_protosw sctpv6_seqpacket_protosw = { | |||
943 | .protocol = IPPROTO_SCTP, | 943 | .protocol = IPPROTO_SCTP, |
944 | .prot = &sctpv6_prot, | 944 | .prot = &sctpv6_prot, |
945 | .ops = &inet6_seqpacket_ops, | 945 | .ops = &inet6_seqpacket_ops, |
946 | .no_check = 0, | ||
947 | .flags = SCTP_PROTOSW_FLAG | 946 | .flags = SCTP_PROTOSW_FLAG |
948 | }; | 947 | }; |
949 | static struct inet_protosw sctpv6_stream_protosw = { | 948 | static struct inet_protosw sctpv6_stream_protosw = { |
@@ -951,7 +950,6 @@ static struct inet_protosw sctpv6_stream_protosw = { | |||
951 | .protocol = IPPROTO_SCTP, | 950 | .protocol = IPPROTO_SCTP, |
952 | .prot = &sctpv6_prot, | 951 | .prot = &sctpv6_prot, |
953 | .ops = &inet6_seqpacket_ops, | 952 | .ops = &inet6_seqpacket_ops, |
954 | .no_check = 0, | ||
955 | .flags = SCTP_PROTOSW_FLAG, | 953 | .flags = SCTP_PROTOSW_FLAG, |
956 | }; | 954 | }; |
957 | 955 | ||
diff --git a/net/sctp/protocol.c b/net/sctp/protocol.c index af5afca4b85a..6789d785e698 100644 --- a/net/sctp/protocol.c +++ b/net/sctp/protocol.c | |||
@@ -1017,7 +1017,6 @@ static struct inet_protosw sctp_seqpacket_protosw = { | |||
1017 | .protocol = IPPROTO_SCTP, | 1017 | .protocol = IPPROTO_SCTP, |
1018 | .prot = &sctp_prot, | 1018 | .prot = &sctp_prot, |
1019 | .ops = &inet_seqpacket_ops, | 1019 | .ops = &inet_seqpacket_ops, |
1020 | .no_check = 0, | ||
1021 | .flags = SCTP_PROTOSW_FLAG | 1020 | .flags = SCTP_PROTOSW_FLAG |
1022 | }; | 1021 | }; |
1023 | static struct inet_protosw sctp_stream_protosw = { | 1022 | static struct inet_protosw sctp_stream_protosw = { |
@@ -1025,7 +1024,6 @@ static struct inet_protosw sctp_stream_protosw = { | |||
1025 | .protocol = IPPROTO_SCTP, | 1024 | .protocol = IPPROTO_SCTP, |
1026 | .prot = &sctp_prot, | 1025 | .prot = &sctp_prot, |
1027 | .ops = &inet_seqpacket_ops, | 1026 | .ops = &inet_seqpacket_ops, |
1028 | .no_check = 0, | ||
1029 | .flags = SCTP_PROTOSW_FLAG | 1027 | .flags = SCTP_PROTOSW_FLAG |
1030 | }; | 1028 | }; |
1031 | 1029 | ||