net: Eliminate no_check from protosw
authorTom Herbert <therbert@google.com>
Fri, 23 May 2014 15:47:09 +0000 (08:47 -0700)
committerDavid S. Miller <davem@davemloft.net>
Fri, 23 May 2014 20:28:53 +0000 (16:28 -0400)
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>
14 files changed:
include/net/protocol.h
net/dccp/ipv4.c
net/ipv4/af_inet.c
net/ipv4/udplite.c
net/ipv6/af_inet6.c
net/ipv6/ping.c
net/ipv6/raw.c
net/ipv6/tcp_ipv6.c
net/ipv6/udp.c
net/ipv6/udplite.c
net/l2tp/l2tp_ip.c
net/l2tp/l2tp_ip6.c
net/sctp/ipv6.c
net/sctp/protocol.c

index a7e986b081474a51da5011fc19b300d358b0b871..d6fcc1fcdb5b0928a0bd89279e11819a9cc3169d 100644 (file)
@@ -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? */
index 22b5d818b2001b177b765cbb67eb2551e87502ce..6ca645c4b48e8b56a88f7d549b073fb6dc82eeb7 100644 (file)
@@ -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,
 };
 
index 279132bcadd92621a3e23e382fe5f03d48dac313..0e9bb08a91e424ca1f5c0351825aaa32d0dc3734 100644 (file)
@@ -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,
        }
 };
index 2c46acd4cc3636e33fb240a963367ec629b482b5..3b3efbda48e13941b35388238508706844c043aa 100644 (file)
@@ -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,
 };
 
index dc47cc757b80b6df3fbe99f7d2ead9a335689126..7cb4392690dd614b1672ad51cc57bbe36218e34c 100644 (file)
@@ -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;
 
index a2a1d80dfe0c0e3cab9ed1eadd51bb3401797b11..5b7a1ed2aba95a837a0063b96cb9803ff8925f0c 100644 (file)
@@ -51,7 +51,6 @@ static struct inet_protosw pingv6_protosw = {
        .protocol =  IPPROTO_ICMPV6,
        .prot =      &pingv6_prot,
        .ops =       &inet6_dgram_ops,
-       .no_check =  UDP_CSUM_DEFAULT,
        .flags =     INET_PROTOSW_REUSE,
 };
 
index dddfb5fa2b7a289f80fcf81d67ff332a678ed398..b2dc60b0c76403d38a6a96c8a1c299977ecb7bad 100644 (file)
@@ -1322,7 +1322,6 @@ static struct inet_protosw rawv6_protosw = {
        .protocol       = IPPROTO_IP,   /* wild card */
        .prot           = &rawv6_prot,
        .ops            = &inet6_sockraw_ops,
-       .no_check       = UDP_CSUM_DEFAULT,
        .flags          = INET_PROTOSW_REUSE,
 };
 
index f07b2abba3592b729248dfce3c06ec34f3741c32..229239ad96b1645de84bfc5b0ad76311e295f82c 100644 (file)
@@ -1992,7 +1992,6 @@ static struct inet_protosw tcpv6_protosw = {
        .protocol       =       IPPROTO_TCP,
        .prot           =       &tcpv6_prot,
        .ops            =       &inet6_stream_ops,
-       .no_check       =       0,
        .flags          =       INET_PROTOSW_PERMANENT |
                                INET_PROTOSW_ICSK,
 };
index 7edf096867c4205342152ea8a5fba6f7ad9a4a66..c7ed47bde54b33f66566b3de1d0284b64906decf 100644 (file)
@@ -1507,7 +1507,6 @@ static struct inet_protosw udpv6_protosw = {
        .protocol =  IPPROTO_UDP,
        .prot =      &udpv6_prot,
        .ops =       &inet6_dgram_ops,
-       .no_check =  UDP_CSUM_DEFAULT,
        .flags =     INET_PROTOSW_PERMANENT,
 };
 
index dfcc4be46898281f09038bbd7638edfefa04ea3e..9cf097e206e931c6e3c184f22b8adcabedc4c03a 100644 (file)
@@ -64,7 +64,6 @@ static struct inet_protosw udplite6_protosw = {
        .protocol       = IPPROTO_UDPLITE,
        .prot           = &udplitev6_prot,
        .ops            = &inet6_dgram_ops,
-       .no_check       = 0,
        .flags          = INET_PROTOSW_PERMANENT,
 };
 
index 3397fe6897c0326d3efb2277a2824f5c2038d3c4..369a9822488c45fc10be28ca00300e9382645a9e 100644 (file)
@@ -606,7 +606,6 @@ static struct inet_protosw l2tp_ip_protosw = {
        .protocol       = IPPROTO_L2TP,
        .prot           = &l2tp_ip_prot,
        .ops            = &l2tp_ip_ops,
-       .no_check       = 0,
 };
 
 static struct net_protocol l2tp_ip_protocol __read_mostly = {
index e472d44a3b91eb74e5614d22c4c7c68811ca4a84..f3f98a156ceed8ebc5843368aa0d1988175e5fc7 100644 (file)
@@ -755,7 +755,6 @@ static struct inet_protosw l2tp_ip6_protosw = {
        .protocol       = IPPROTO_L2TP,
        .prot           = &l2tp_ip6_prot,
        .ops            = &l2tp_ip6_ops,
-       .no_check       = 0,
 };
 
 static struct inet6_protocol l2tp_ip6_protocol __read_mostly = {
index 4dc5d9e083115983595edcdf10641e78d1fdfb41..1999592ba88c9f3d574428e1ce076c10f724c13a 100644 (file)
@@ -943,7 +943,6 @@ static struct inet_protosw sctpv6_seqpacket_protosw = {
        .protocol      = IPPROTO_SCTP,
        .prot          = &sctpv6_prot,
        .ops           = &inet6_seqpacket_ops,
-       .no_check      = 0,
        .flags         = SCTP_PROTOSW_FLAG
 };
 static struct inet_protosw sctpv6_stream_protosw = {
@@ -951,7 +950,6 @@ static struct inet_protosw sctpv6_stream_protosw = {
        .protocol      = IPPROTO_SCTP,
        .prot          = &sctpv6_prot,
        .ops           = &inet6_seqpacket_ops,
-       .no_check      = 0,
        .flags         = SCTP_PROTOSW_FLAG,
 };
 
index af5afca4b85a2df42c998474fbae14c057509c13..6789d785e698325afc7c8cfd65d1b69c2e50047a 100644 (file)
@@ -1017,7 +1017,6 @@ static struct inet_protosw sctp_seqpacket_protosw = {
        .protocol   = IPPROTO_SCTP,
        .prot       = &sctp_prot,
        .ops        = &inet_seqpacket_ops,
-       .no_check   = 0,
        .flags      = SCTP_PROTOSW_FLAG
 };
 static struct inet_protosw sctp_stream_protosw = {
@@ -1025,7 +1024,6 @@ static struct inet_protosw sctp_stream_protosw = {
        .protocol   = IPPROTO_SCTP,
        .prot       = &sctp_prot,
        .ops        = &inet_seqpacket_ops,
-       .no_check   = 0,
        .flags      = SCTP_PROTOSW_FLAG
 };