diff options
author | Daniel Borkmann <dborkman@redhat.com> | 2013-08-06 15:18:12 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2013-08-09 14:33:02 -0400 |
commit | cda5f98e36576596b9230483ec52bff3cc97eb21 (patch) | |
tree | b828a60d8b6000704d91e35d10247f322a8d3ef8 /net/sctp | |
parent | 2690048c01f32bf45d1c1e1ab3079bc10ad2aea7 (diff) |
net: sctp: convert sctp_checksum_disable module param into sctp sysctl
Get rid of the last module parameter for SCTP and make this
configurable via sysctl for SCTP like all the rest of SCTP's
configuration knobs.
Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/sctp')
-rw-r--r-- | net/sctp/input.c | 4 | ||||
-rw-r--r-- | net/sctp/output.c | 5 | ||||
-rw-r--r-- | net/sctp/protocol.c | 5 | ||||
-rw-r--r-- | net/sctp/sysctl.c | 10 |
4 files changed, 18 insertions, 6 deletions
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"); | |||
1549 | MODULE_ALIAS("net-pf-" __stringify(PF_INET6) "-proto-132"); | 1552 | MODULE_ALIAS("net-pf-" __stringify(PF_INET6) "-proto-132"); |
1550 | MODULE_AUTHOR("Linux Kernel SCTP developers <linux-sctp@vger.kernel.org>"); | 1553 | MODULE_AUTHOR("Linux Kernel SCTP developers <linux-sctp@vger.kernel.org>"); |
1551 | MODULE_DESCRIPTION("Support for the SCTP protocol (RFC2960)"); | 1554 | MODULE_DESCRIPTION("Support for the SCTP protocol (RFC2960)"); |
1552 | module_param_named(no_checksums, sctp_checksum_disable, bool, 0644); | ||
1553 | MODULE_PARM_DESC(no_checksums, "Disable checksums computing and verification"); | ||
1554 | MODULE_LICENSE("GPL"); | 1555 | MODULE_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 | ||