Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Tom Herbert and committed by
David S. Miller
b26ba202 0f8066bd

-24
-1
include/net/protocol.h
··· 86 86 struct proto *prot; 87 87 const struct proto_ops *ops; 88 88 89 - char no_check; /* checksum on rcv/xmit/none? */ 90 89 unsigned char flags; /* See INET_PROTOSW_* below. */ 91 90 }; 92 91 #define INET_PROTOSW_REUSE 0x01 /* Are ports automatically reusable? */
-1
net/dccp/ipv4.c
··· 1024 1024 .protocol = IPPROTO_DCCP, 1025 1025 .prot = &dccp_v4_prot, 1026 1026 .ops = &inet_dccp_ops, 1027 - .no_check = 0, 1028 1027 .flags = INET_PROTOSW_ICSK, 1029 1028 }; 1030 1029
-7
net/ipv4/af_inet.c
··· 254 254 struct inet_sock *inet; 255 255 struct proto *answer_prot; 256 256 unsigned char answer_flags; 257 - char answer_no_check; 258 257 int try_loading_module = 0; 259 258 int err; 260 259 ··· 311 312 312 313 sock->ops = answer->ops; 313 314 answer_prot = answer->prot; 314 - answer_no_check = answer->no_check; 315 315 answer_flags = answer->flags; 316 316 rcu_read_unlock(); 317 317 ··· 322 324 goto out; 323 325 324 326 err = 0; 325 - sk->sk_no_check = answer_no_check; 326 327 if (INET_PROTOSW_REUSE & answer_flags) 327 328 sk->sk_reuse = SK_CAN_REUSE; 328 329 ··· 999 1002 .protocol = IPPROTO_TCP, 1000 1003 .prot = &tcp_prot, 1001 1004 .ops = &inet_stream_ops, 1002 - .no_check = 0, 1003 1005 .flags = INET_PROTOSW_PERMANENT | 1004 1006 INET_PROTOSW_ICSK, 1005 1007 }, ··· 1008 1012 .protocol = IPPROTO_UDP, 1009 1013 .prot = &udp_prot, 1010 1014 .ops = &inet_dgram_ops, 1011 - .no_check = UDP_CSUM_DEFAULT, 1012 1015 .flags = INET_PROTOSW_PERMANENT, 1013 1016 }, 1014 1017 ··· 1016 1021 .protocol = IPPROTO_ICMP, 1017 1022 .prot = &ping_prot, 1018 1023 .ops = &inet_dgram_ops, 1019 - .no_check = UDP_CSUM_DEFAULT, 1020 1024 .flags = INET_PROTOSW_REUSE, 1021 1025 }, 1022 1026 ··· 1024 1030 .protocol = IPPROTO_IP, /* wild card */ 1025 1031 .prot = &raw_prot, 1026 1032 .ops = &inet_sockraw_ops, 1027 - .no_check = UDP_CSUM_DEFAULT, 1028 1033 .flags = INET_PROTOSW_REUSE, 1029 1034 } 1030 1035 };
-1
net/ipv4/udplite.c
··· 70 70 .protocol = IPPROTO_UDPLITE, 71 71 .prot = &udplite_prot, 72 72 .ops = &inet_dgram_ops, 73 - .no_check = 0, /* must checksum (RFC 3828) */ 74 73 .flags = INET_PROTOSW_PERMANENT, 75 74 }; 76 75
-3
net/ipv6/af_inet6.c
··· 106 106 struct inet_protosw *answer; 107 107 struct proto *answer_prot; 108 108 unsigned char answer_flags; 109 - char answer_no_check; 110 109 int try_loading_module = 0; 111 110 int err; 112 111 ··· 161 162 162 163 sock->ops = answer->ops; 163 164 answer_prot = answer->prot; 164 - answer_no_check = answer->no_check; 165 165 answer_flags = answer->flags; 166 166 rcu_read_unlock(); 167 167 ··· 174 176 sock_init_data(sock, sk); 175 177 176 178 err = 0; 177 - sk->sk_no_check = answer_no_check; 178 179 if (INET_PROTOSW_REUSE & answer_flags) 179 180 sk->sk_reuse = SK_CAN_REUSE; 180 181
-1
net/ipv6/ping.c
··· 51 51 .protocol = IPPROTO_ICMPV6, 52 52 .prot = &pingv6_prot, 53 53 .ops = &inet6_dgram_ops, 54 - .no_check = UDP_CSUM_DEFAULT, 55 54 .flags = INET_PROTOSW_REUSE, 56 55 }; 57 56
-1
net/ipv6/raw.c
··· 1322 1322 .protocol = IPPROTO_IP, /* wild card */ 1323 1323 .prot = &rawv6_prot, 1324 1324 .ops = &inet6_sockraw_ops, 1325 - .no_check = UDP_CSUM_DEFAULT, 1326 1325 .flags = INET_PROTOSW_REUSE, 1327 1326 }; 1328 1327
-1
net/ipv6/tcp_ipv6.c
··· 1992 1992 .protocol = IPPROTO_TCP, 1993 1993 .prot = &tcpv6_prot, 1994 1994 .ops = &inet6_stream_ops, 1995 - .no_check = 0, 1996 1995 .flags = INET_PROTOSW_PERMANENT | 1997 1996 INET_PROTOSW_ICSK, 1998 1997 };
-1
net/ipv6/udp.c
··· 1507 1507 .protocol = IPPROTO_UDP, 1508 1508 .prot = &udpv6_prot, 1509 1509 .ops = &inet6_dgram_ops, 1510 - .no_check = UDP_CSUM_DEFAULT, 1511 1510 .flags = INET_PROTOSW_PERMANENT, 1512 1511 }; 1513 1512
-1
net/ipv6/udplite.c
··· 64 64 .protocol = IPPROTO_UDPLITE, 65 65 .prot = &udplitev6_prot, 66 66 .ops = &inet6_dgram_ops, 67 - .no_check = 0, 68 67 .flags = INET_PROTOSW_PERMANENT, 69 68 }; 70 69
-1
net/l2tp/l2tp_ip.c
··· 606 606 .protocol = IPPROTO_L2TP, 607 607 .prot = &l2tp_ip_prot, 608 608 .ops = &l2tp_ip_ops, 609 - .no_check = 0, 610 609 }; 611 610 612 611 static struct net_protocol l2tp_ip_protocol __read_mostly = {
-1
net/l2tp/l2tp_ip6.c
··· 755 755 .protocol = IPPROTO_L2TP, 756 756 .prot = &l2tp_ip6_prot, 757 757 .ops = &l2tp_ip6_ops, 758 - .no_check = 0, 759 758 }; 760 759 761 760 static struct inet6_protocol l2tp_ip6_protocol __read_mostly = {
-2
net/sctp/ipv6.c
··· 943 943 .protocol = IPPROTO_SCTP, 944 944 .prot = &sctpv6_prot, 945 945 .ops = &inet6_seqpacket_ops, 946 - .no_check = 0, 947 946 .flags = SCTP_PROTOSW_FLAG 948 947 }; 949 948 static struct inet_protosw sctpv6_stream_protosw = { ··· 950 951 .protocol = IPPROTO_SCTP, 951 952 .prot = &sctpv6_prot, 952 953 .ops = &inet6_seqpacket_ops, 953 - .no_check = 0, 954 954 .flags = SCTP_PROTOSW_FLAG, 955 955 }; 956 956
-2
net/sctp/protocol.c
··· 1017 1017 .protocol = IPPROTO_SCTP, 1018 1018 .prot = &sctp_prot, 1019 1019 .ops = &inet_seqpacket_ops, 1020 - .no_check = 0, 1021 1020 .flags = SCTP_PROTOSW_FLAG 1022 1021 }; 1023 1022 static struct inet_protosw sctp_stream_protosw = { ··· 1024 1025 .protocol = IPPROTO_SCTP, 1025 1026 .prot = &sctp_prot, 1026 1027 .ops = &inet_seqpacket_ops, 1027 - .no_check = 0, 1028 1028 .flags = SCTP_PROTOSW_FLAG 1029 1029 }; 1030 1030