aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Documentation/networking/ip-sysctl.txt8
-rw-r--r--include/net/netns/sctp.h3
-rw-r--r--include/net/sctp/structs.h5
-rw-r--r--net/sctp/input.c4
-rw-r--r--net/sctp/output.c5
-rw-r--r--net/sctp/protocol.c5
-rw-r--r--net/sctp/sysctl.c10
7 files changed, 29 insertions, 11 deletions
diff --git a/Documentation/networking/ip-sysctl.txt b/Documentation/networking/ip-sysctl.txt
index 36be26b2ef7a..1b27b0b8687f 100644
--- a/Documentation/networking/ip-sysctl.txt
+++ b/Documentation/networking/ip-sysctl.txt
@@ -1507,6 +1507,14 @@ sack_timeout - INTEGER
1507 1507
1508 Default: 200 1508 Default: 200
1509 1509
1510checksum_disable - BOOLEAN
1511 Disable SCTP checksum computing and verification for debugging purpose.
1512
1513 1: Disable checksumming
1514 0: Enable checksumming
1515
1516 Default: 0
1517
1510valid_cookie_life - INTEGER 1518valid_cookie_life - INTEGER
1511 The default lifetime of the SCTP cookie (in milliseconds). The cookie 1519 The default lifetime of the SCTP cookie (in milliseconds). The cookie
1512 is used during association establishment. 1520 is used during association establishment.
diff --git a/include/net/netns/sctp.h b/include/net/netns/sctp.h
index 3573a81815ad..ebfdf1e7d402 100644
--- a/include/net/netns/sctp.h
+++ b/include/net/netns/sctp.h
@@ -129,6 +129,9 @@ struct netns_sctp {
129 129
130 /* Threshold for autoclose timeout, in seconds. */ 130 /* Threshold for autoclose timeout, in seconds. */
131 unsigned long max_autoclose; 131 unsigned long max_autoclose;
132
133 /* Flag to disable SCTP checksumming. */
134 int checksum_disable;
132}; 135};
133 136
134#endif /* __NETNS_SCTP_H__ */ 137#endif /* __NETNS_SCTP_H__ */
diff --git a/include/net/sctp/structs.h b/include/net/sctp/structs.h
index d9c93a77b1a9..06ebeaaaa9aa 100644
--- a/include/net/sctp/structs.h
+++ b/include/net/sctp/structs.h
@@ -141,10 +141,6 @@ extern struct sctp_globals {
141 /* This is the sctp port control hash. */ 141 /* This is the sctp port control hash. */
142 int port_hashsize; 142 int port_hashsize;
143 struct sctp_bind_hashbucket *port_hashtable; 143 struct sctp_bind_hashbucket *port_hashtable;
144
145 /* Flag to indicate whether computing and verifying checksum
146 * is disabled. */
147 bool checksum_disable;
148} sctp_globals; 144} sctp_globals;
149 145
150#define sctp_max_instreams (sctp_globals.max_instreams) 146#define sctp_max_instreams (sctp_globals.max_instreams)
@@ -156,7 +152,6 @@ extern struct sctp_globals {
156#define sctp_assoc_hashtable (sctp_globals.assoc_hashtable) 152#define sctp_assoc_hashtable (sctp_globals.assoc_hashtable)
157#define sctp_port_hashsize (sctp_globals.port_hashsize) 153#define sctp_port_hashsize (sctp_globals.port_hashsize)
158#define sctp_port_hashtable (sctp_globals.port_hashtable) 154#define sctp_port_hashtable (sctp_globals.port_hashtable)
159#define sctp_checksum_disable (sctp_globals.checksum_disable)
160 155
161/* SCTP Socket type: UDP or TCP style. */ 156/* SCTP Socket type: UDP or TCP style. */
162typedef enum { 157typedef enum {
diff --git a/net/sctp/input.c b/net/sctp/input.c
index fa91aff02388..b9a25e18bb2b 100644
--- a/net/sctp/input.c
+++ b/net/sctp/input.c
@@ -140,8 +140,8 @@ int sctp_rcv(struct sk_buff *skb)
140 __skb_pull(skb, skb_transport_offset(skb)); 140 __skb_pull(skb, skb_transport_offset(skb));
141 if (skb->len < sizeof(struct sctphdr)) 141 if (skb->len < sizeof(struct sctphdr))
142 goto discard_it; 142 goto discard_it;
143 if (!sctp_checksum_disable && !skb_csum_unnecessary(skb) && 143 if (!net->sctp.checksum_disable && !skb_csum_unnecessary(skb) &&
144 sctp_rcv_checksum(net, skb) < 0) 144 sctp_rcv_checksum(net, skb) < 0)
145 goto discard_it; 145 goto discard_it;
146 146
147 skb_pull(skb, sizeof(struct sctphdr)); 147 skb_pull(skb, sizeof(struct sctphdr));
diff --git a/net/sctp/output.c b/net/sctp/output.c
index 5a55c55d71ad..cdb5f4914e17 100644
--- a/net/sctp/output.c
+++ b/net/sctp/output.c
@@ -395,6 +395,7 @@ int sctp_packet_transmit(struct sctp_packet *packet)
395 int padding; /* How much padding do we need? */ 395 int padding; /* How much padding do we need? */
396 __u8 has_data = 0; 396 __u8 has_data = 0;
397 struct dst_entry *dst = tp->dst; 397 struct dst_entry *dst = tp->dst;
398 struct net *net;
398 unsigned char *auth = NULL; /* pointer to auth in skb data */ 399 unsigned char *auth = NULL; /* pointer to auth in skb data */
399 __u32 cksum_buf_len = sizeof(struct sctphdr); 400 __u32 cksum_buf_len = sizeof(struct sctphdr);
400 401
@@ -541,7 +542,9 @@ int sctp_packet_transmit(struct sctp_packet *packet)
541 * Note: Adler-32 is no longer applicable, as has been replaced 542 * Note: Adler-32 is no longer applicable, as has been replaced
542 * by CRC32-C as described in <draft-ietf-tsvwg-sctpcsum-02.txt>. 543 * by CRC32-C as described in <draft-ietf-tsvwg-sctpcsum-02.txt>.
543 */ 544 */
544 if (!sctp_checksum_disable) { 545 net = dev_net(dst->dev);
546
547 if (!net->sctp.checksum_disable) {
545 if (!(dst->dev->features & NETIF_F_SCTP_CSUM)) { 548 if (!(dst->dev->features & NETIF_F_SCTP_CSUM)) {
546 __u32 crc32 = sctp_start_cksum((__u8 *)sh, cksum_buf_len); 549 __u32 crc32 = sctp_start_cksum((__u8 *)sh, cksum_buf_len);
547 550
diff --git a/net/sctp/protocol.c b/net/sctp/protocol.c
index b52ec2510101..a570a6365f87 100644
--- a/net/sctp/protocol.c
+++ b/net/sctp/protocol.c
@@ -1193,6 +1193,9 @@ static int __net_init sctp_net_init(struct net *net)
1193 /* Whether Cookie Preservative is enabled(1) or not(0) */ 1193 /* Whether Cookie Preservative is enabled(1) or not(0) */
1194 net->sctp.cookie_preserve_enable = 1; 1194 net->sctp.cookie_preserve_enable = 1;
1195 1195
1196 /* Whether SCTP checksumming is disabled(1) or not(0) */
1197 net->sctp.checksum_disable = 0;
1198
1196 /* Default sctp sockets to use md5 as their hmac alg */ 1199 /* Default sctp sockets to use md5 as their hmac alg */
1197#if defined (CONFIG_SCTP_DEFAULT_COOKIE_HMAC_MD5) 1200#if defined (CONFIG_SCTP_DEFAULT_COOKIE_HMAC_MD5)
1198 net->sctp.sctp_hmac_alg = "md5"; 1201 net->sctp.sctp_hmac_alg = "md5";
@@ -1549,6 +1552,4 @@ MODULE_ALIAS("net-pf-" __stringify(PF_INET) "-proto-132");
1549MODULE_ALIAS("net-pf-" __stringify(PF_INET6) "-proto-132"); 1552MODULE_ALIAS("net-pf-" __stringify(PF_INET6) "-proto-132");
1550MODULE_AUTHOR("Linux Kernel SCTP developers <linux-sctp@vger.kernel.org>"); 1553MODULE_AUTHOR("Linux Kernel SCTP developers <linux-sctp@vger.kernel.org>");
1551MODULE_DESCRIPTION("Support for the SCTP protocol (RFC2960)"); 1554MODULE_DESCRIPTION("Support for the SCTP protocol (RFC2960)");
1552module_param_named(no_checksums, sctp_checksum_disable, bool, 0644);
1553MODULE_PARM_DESC(no_checksums, "Disable checksums computing and verification");
1554MODULE_LICENSE("GPL"); 1555MODULE_LICENSE("GPL");
diff --git a/net/sctp/sysctl.c b/net/sctp/sysctl.c
index 190674702b20..754809a7183d 100644
--- a/net/sctp/sysctl.c
+++ b/net/sctp/sysctl.c
@@ -296,7 +296,15 @@ static struct ctl_table sctp_net_table[] = {
296 .extra1 = &max_autoclose_min, 296 .extra1 = &max_autoclose_min,
297 .extra2 = &max_autoclose_max, 297 .extra2 = &max_autoclose_max,
298 }, 298 },
299 299 {
300 .procname = "checksum_disable",
301 .data = &init_net.sctp.checksum_disable,
302 .maxlen = sizeof(int),
303 .mode = 0644,
304 .proc_handler = proc_dointvec_minmax,
305 .extra1 = &zero,
306 .extra2 = &one,
307 },
300 { /* sentinel */ } 308 { /* sentinel */ }
301}; 309};
302 310