Fix the the SCTP_WITH_NO_CSUM option when used in combination with

interface supporting CRC offload. While at it, make use of the
feature that the loopback interface provides CRC offloading.

MFC after: 4 weeks
This commit is contained in:
Michael Tuexen 2010-08-29 18:50:30 +00:00
parent 7eeda62ca9
commit 9c7635e18b
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=211969
8 changed files with 132 additions and 102 deletions

View File

@ -115,20 +115,15 @@ sctp_calculate_cksum(struct mbuf *m, uint32_t offset)
return (base);
}
#else
uint32_t
sctp_calculate_cksum(struct mbuf *m, uint32_t offset)
{
return (0);
}
#endif /* !defined(SCTP_WITH_NO_CSUM) */
void
sctp_delayed_cksum(struct mbuf *m, uint32_t offset)
{
#if defined(SCTP_WITH_NO_CSUM)
panic("sctp_delayed_cksum() called when using no SCTP CRC.");
#else
struct ip *ip;
uint32_t checksum;
@ -149,4 +144,5 @@ sctp_delayed_cksum(struct mbuf *m, uint32_t offset)
return;
}
*(uint32_t *) (m->m_data + offset) = checksum;
#endif
}

View File

@ -36,11 +36,12 @@ __FBSDID("$FreeBSD$");
#ifndef __crc32c_h__
#define __crc32c_h__
#if defined(_KERNEL) || defined(__Userspace__)
#if defined(_KERNEL)
#if !defined(SCTP_WITH_NO_CSUM)
uint32_t sctp_calculate_cksum(struct mbuf *, uint32_t);
#endif
void sctp_delayed_cksum(struct mbuf *, uint32_t offset);
#endif /* _KERNEL */
#endif /* __crc32c_h__ */

View File

@ -3068,7 +3068,7 @@ process_chunk_drop(struct sctp_tcb *stcb, struct sctp_chunk_desc *desc,
struct sctp_nets *net, uint8_t flg)
{
switch (desc->chunk_type) {
case SCTP_DATA:
case SCTP_DATA:
/* find the tsn to resend (possibly */
{
uint32_t tsn;
@ -5717,14 +5717,17 @@ sctp_input_with_port(struct mbuf *i_pak, int off, uint16_t port)
struct ip *ip;
struct sctphdr *sh;
struct sctp_inpcb *inp = NULL;
uint32_t check, calc_check;
struct sctp_nets *net;
struct sctp_tcb *stcb = NULL;
struct sctp_chunkhdr *ch;
int refcount_up = 0;
int length, mlen, offset;
#if !defined(SCTP_WITH_NO_CSUM)
uint32_t check, calc_check;
#endif
if (SCTP_GET_PKT_VRFID(i_pak, vrf_id)) {
SCTP_RELEASE_PKT(i_pak);
return;
@ -5799,18 +5802,14 @@ sctp_input_with_port(struct mbuf *i_pak, int off, uint16_t port)
m->m_pkthdr.len,
if_name(m->m_pkthdr.rcvif),
m->m_pkthdr.csum_flags);
#if defined(SCTP_WITH_NO_CSUM)
SCTP_STAT_INCR(sctps_recvnocrc);
#else
if (m->m_pkthdr.csum_flags & CSUM_SCTP_VALID) {
SCTP_STAT_INCR(sctps_recvhwcrc);
goto sctp_skip_csum_4;
}
check = sh->checksum; /* save incoming checksum */
if ((check == 0) && (SCTP_BASE_SYSCTL(sctp_no_csum_on_loopback)) &&
((ip->ip_src.s_addr == ip->ip_dst.s_addr) ||
(SCTP_IS_IT_LOOPBACK(m)))
) {
SCTP_STAT_INCR(sctps_recvnocrc);
goto sctp_skip_csum_4;
}
sh->checksum = 0; /* prepare for calc */
calc_check = sctp_calculate_cksum(m, iphlen);
sh->checksum = check;
@ -5840,6 +5839,7 @@ sctp_input_with_port(struct mbuf *i_pak, int off, uint16_t port)
goto bad;
}
sctp_skip_csum_4:
#endif
/* destination port of 0 is illegal, based on RFC2960. */
if (sh->dest_port == 0) {
SCTP_STAT_INCR(sctps_hdrops);

View File

@ -433,20 +433,21 @@ typedef struct rtentry sctp_rtentry_t;
*/
#define SCTP_IP_OUTPUT(result, o_pak, ro, stcb, vrf_id) \
{ \
int o_flgs = 0; \
if (stcb && stcb->sctp_ep && stcb->sctp_ep->sctp_socket) { \
o_flgs = IP_RAWOUTPUT | (stcb->sctp_ep->sctp_socket->so_options & SO_DONTROUTE); \
} else { \
o_flgs = IP_RAWOUTPUT; \
} \
int o_flgs = IP_RAWOUTPUT; \
struct sctp_tcb *local_stcb = stcb; \
if (local_stcb && \
local_stcb->sctp_ep && \
local_stcb->sctp_ep->sctp_socket) \
o_flgs |= local_stcb->sctp_ep->sctp_socket->so_options & SO_DONTROUTE; \
result = ip_output(o_pak, NULL, ro, o_flgs, 0, NULL); \
}
#define SCTP_IP6_OUTPUT(result, o_pak, ro, ifp, stcb, vrf_id) \
{ \
if (stcb && stcb->sctp_ep) \
struct sctp_tcb *local_stcb = stcb; \
if (local_stcb && local_stcb->sctp_ep) \
result = ip6_output(o_pak, \
((struct in6pcb *)(stcb->sctp_ep))->in6p_outputopts, \
((struct in6pcb *)(local_stcb->sctp_ep))->in6p_outputopts, \
(ro), 0, 0, ifp, NULL); \
else \
result = ip6_output(o_pak, NULL, (ro), 0, 0, ifp, NULL); \

View File

@ -3741,6 +3741,9 @@ sctp_lowlevel_chunk_output(struct sctp_inpcb *inp,
#endif
SCTP_ATTACH_CHAIN(o_pak, m, packet_length);
if (port) {
#if defined(SCTP_WITH_NO_CSUM)
SCTP_STAT_INCR(sctps_sendnocrc);
#else
if (!(SCTP_BASE_SYSCTL(sctp_no_csum_on_loopback) &&
(stcb) &&
(stcb->asoc.loopback_scope))) {
@ -3749,17 +3752,16 @@ sctp_lowlevel_chunk_output(struct sctp_inpcb *inp,
} else {
SCTP_STAT_INCR(sctps_sendnocrc);
}
#endif
SCTP_ENABLE_UDP_CSUM(o_pak);
} else {
if (!(SCTP_BASE_SYSCTL(sctp_no_csum_on_loopback) &&
(stcb) &&
(stcb->asoc.loopback_scope))) {
m->m_pkthdr.csum_flags = CSUM_SCTP;
m->m_pkthdr.csum_data = 0;
SCTP_STAT_INCR(sctps_sendhwcrc);
} else {
SCTP_STAT_INCR(sctps_sendnocrc);
}
#if defined(SCTP_WITH_NO_CSUM)
SCTP_STAT_INCR(sctps_sendnocrc);
#else
m->m_pkthdr.csum_flags = CSUM_SCTP;
m->m_pkthdr.csum_data = 0;
SCTP_STAT_INCR(sctps_sendhwcrc);
#endif
}
/* send it out. table id is taken from stcb */
#if defined (__APPLE__) || defined(SCTP_SO_LOCK_TESTING)
@ -4051,6 +4053,9 @@ sctp_lowlevel_chunk_output(struct sctp_inpcb *inp,
#endif
SCTP_ATTACH_CHAIN(o_pak, m, packet_length);
if (port) {
#if defined(SCTP_WITH_NO_CSUM)
SCTP_STAT_INCR(sctps_sendnocrc);
#else
if (!(SCTP_BASE_SYSCTL(sctp_no_csum_on_loopback) &&
(stcb) &&
(stcb->asoc.loopback_scope))) {
@ -4059,10 +4064,14 @@ sctp_lowlevel_chunk_output(struct sctp_inpcb *inp,
} else {
SCTP_STAT_INCR(sctps_sendnocrc);
}
#endif
if ((udp->uh_sum = in6_cksum(o_pak, IPPROTO_UDP, sizeof(struct ip6_hdr), packet_length - sizeof(struct ip6_hdr))) == 0) {
udp->uh_sum = 0xffff;
}
} else {
#if defined(SCTP_WITH_NO_CSUM)
SCTP_STAT_INCR(sctps_sendnocrc);
#else
if (!(SCTP_BASE_SYSCTL(sctp_no_csum_on_loopback) &&
(stcb) &&
(stcb->asoc.loopback_scope))) {
@ -4072,6 +4081,7 @@ sctp_lowlevel_chunk_output(struct sctp_inpcb *inp,
} else {
SCTP_STAT_INCR(sctps_sendnocrc);
}
#endif
}
/* send it out. table id is taken from stcb */
#if defined (__APPLE__) || defined(SCTP_SO_LOCK_TESTING)
@ -10571,7 +10581,6 @@ sctp_send_shutdown_complete2(struct mbuf *m, int iphlen, struct sctphdr *sh,
if (iph_out != NULL) {
sctp_route_t ro;
int ret;
struct sctp_tcb *stcb = NULL;
mlen = SCTP_BUF_LEN(mout);
bzero(&ro, sizeof ro);
@ -10582,17 +10591,25 @@ sctp_send_shutdown_complete2(struct mbuf *m, int iphlen, struct sctphdr *sh,
sctp_packet_log(mout, mlen);
#endif
if (port) {
#if defined(SCTP_WITH_NO_CSUM)
SCTP_STAT_INCR(sctps_sendnocrc);
#else
comp_cp->sh.checksum = sctp_calculate_cksum(mout, offset_out);
SCTP_STAT_INCR(sctps_sendswcrc);
#endif
SCTP_ENABLE_UDP_CSUM(mout);
} else {
#if defined(SCTP_WITH_NO_CSUM)
SCTP_STAT_INCR(sctps_sendnocrc);
#else
mout->m_pkthdr.csum_flags = CSUM_SCTP;
mout->m_pkthdr.csum_data = 0;
SCTP_STAT_INCR(sctps_sendhwcrc);
#endif
}
SCTP_ATTACH_CHAIN(o_pak, mout, mlen);
/* out it goes */
SCTP_IP_OUTPUT(ret, o_pak, &ro, stcb, vrf_id);
SCTP_IP_OUTPUT(ret, o_pak, &ro, NULL, vrf_id);
/* Free the route if we got one back */
if (ro.ro_rt)
@ -10602,7 +10619,6 @@ sctp_send_shutdown_complete2(struct mbuf *m, int iphlen, struct sctphdr *sh,
if (ip6_out != NULL) {
struct route_in6 ro;
int ret;
struct sctp_tcb *stcb = NULL;
struct ifnet *ifp = NULL;
bzero(&ro, sizeof(ro));
@ -10613,29 +10629,25 @@ sctp_send_shutdown_complete2(struct mbuf *m, int iphlen, struct sctphdr *sh,
#endif
SCTP_ATTACH_CHAIN(o_pak, mout, mlen);
if (port) {
if (!(SCTP_BASE_SYSCTL(sctp_no_csum_on_loopback) &&
(stcb) &&
(stcb->asoc.loopback_scope))) {
comp_cp->sh.checksum = sctp_calculate_cksum(mout, sizeof(struct ip6_hdr) + sizeof(struct udphdr));
SCTP_STAT_INCR(sctps_sendswcrc);
} else {
SCTP_STAT_INCR(sctps_sendnocrc);
}
#if defined(SCTP_WITH_NO_CSUM)
SCTP_STAT_INCR(sctps_sendnocrc);
#else
comp_cp->sh.checksum = sctp_calculate_cksum(mout, sizeof(struct ip6_hdr) + sizeof(struct udphdr));
SCTP_STAT_INCR(sctps_sendswcrc);
#endif
if ((udp->uh_sum = in6_cksum(o_pak, IPPROTO_UDP, sizeof(struct ip6_hdr), mlen - sizeof(struct ip6_hdr))) == 0) {
udp->uh_sum = 0xffff;
}
} else {
if (!(SCTP_BASE_SYSCTL(sctp_no_csum_on_loopback) &&
(stcb) &&
(stcb->asoc.loopback_scope))) {
mout->m_pkthdr.csum_flags = CSUM_SCTP;
mout->m_pkthdr.csum_data = 0;
SCTP_STAT_INCR(sctps_sendhwcrc);
} else {
SCTP_STAT_INCR(sctps_sendnocrc);
}
#if defined(SCTP_WITH_NO_CSUM)
SCTP_STAT_INCR(sctps_sendnocrc);
#else
mout->m_pkthdr.csum_flags = CSUM_SCTP;
mout->m_pkthdr.csum_data = 0;
SCTP_STAT_INCR(sctps_sendhwcrc);
#endif
}
SCTP_IP6_OUTPUT(ret, o_pak, &ro, &ifp, stcb, vrf_id);
SCTP_IP6_OUTPUT(ret, o_pak, &ro, &ifp, NULL, vrf_id);
/* Free the route if we got one back */
if (ro.ro_rt)
@ -11632,7 +11644,6 @@ sctp_send_abort(struct mbuf *m, int iphlen, struct sctphdr *sh, uint32_t vtag,
}
if (iph_out != NULL) {
sctp_route_t ro;
struct sctp_tcb *stcb = NULL;
int ret;
/* zap the stack pointer to the route */
@ -11652,15 +11663,23 @@ sctp_send_abort(struct mbuf *m, int iphlen, struct sctphdr *sh, uint32_t vtag,
#endif
SCTP_ATTACH_CHAIN(o_pak, mout, len);
if (port) {
#if defined(SCTP_WITH_NO_CSUM)
SCTP_STAT_INCR(sctps_sendnocrc);
#else
abm->sh.checksum = sctp_calculate_cksum(mout, iphlen_out);
SCTP_STAT_INCR(sctps_sendswcrc);
#endif
SCTP_ENABLE_UDP_CSUM(o_pak);
} else {
#if defined(SCTP_WITH_NO_CSUM)
SCTP_STAT_INCR(sctps_sendnocrc);
#else
mout->m_pkthdr.csum_flags = CSUM_SCTP;
mout->m_pkthdr.csum_data = 0;
SCTP_STAT_INCR(sctps_sendhwcrc);
#endif
}
SCTP_IP_OUTPUT(ret, o_pak, &ro, stcb, vrf_id);
SCTP_IP_OUTPUT(ret, o_pak, &ro, NULL, vrf_id);
/* Free the route if we got one back */
if (ro.ro_rt)
@ -11670,7 +11689,6 @@ sctp_send_abort(struct mbuf *m, int iphlen, struct sctphdr *sh, uint32_t vtag,
if (ip6_out != NULL) {
struct route_in6 ro;
int ret;
struct sctp_tcb *stcb = NULL;
struct ifnet *ifp = NULL;
/* zap the stack pointer to the route */
@ -11687,29 +11705,25 @@ sctp_send_abort(struct mbuf *m, int iphlen, struct sctphdr *sh, uint32_t vtag,
#endif
SCTP_ATTACH_CHAIN(o_pak, mout, len);
if (port) {
if (!(SCTP_BASE_SYSCTL(sctp_no_csum_on_loopback) &&
(stcb) &&
(stcb->asoc.loopback_scope))) {
abm->sh.checksum = sctp_calculate_cksum(mout, sizeof(struct ip6_hdr) + sizeof(struct udphdr));
SCTP_STAT_INCR(sctps_sendswcrc);
} else {
SCTP_STAT_INCR(sctps_sendnocrc);
}
#if defined(SCTP_WITH_NO_CSUM)
SCTP_STAT_INCR(sctps_sendnocrc);
#else
abm->sh.checksum = sctp_calculate_cksum(mout, sizeof(struct ip6_hdr) + sizeof(struct udphdr));
SCTP_STAT_INCR(sctps_sendswcrc);
#endif
if ((udp->uh_sum = in6_cksum(o_pak, IPPROTO_UDP, sizeof(struct ip6_hdr), len - sizeof(struct ip6_hdr))) == 0) {
udp->uh_sum = 0xffff;
}
} else {
if (!(SCTP_BASE_SYSCTL(sctp_no_csum_on_loopback) &&
(stcb) &&
(stcb->asoc.loopback_scope))) {
mout->m_pkthdr.csum_flags = CSUM_SCTP;
mout->m_pkthdr.csum_data = 0;
SCTP_STAT_INCR(sctps_sendhwcrc);
} else {
SCTP_STAT_INCR(sctps_sendnocrc);
}
#if defined(SCTP_WITH_NO_CSUM)
SCTP_STAT_INCR(sctps_sendnocrc);
#else
mout->m_pkthdr.csum_flags = CSUM_SCTP;
mout->m_pkthdr.csum_data = 0;
SCTP_STAT_INCR(sctps_sendhwcrc);
#endif
}
SCTP_IP6_OUTPUT(ret, o_pak, &ro, &ifp, stcb, vrf_id);
SCTP_IP6_OUTPUT(ret, o_pak, &ro, &ifp, NULL, vrf_id);
/* Free the route if we got one back */
if (ro.ro_rt)
@ -11872,7 +11886,6 @@ sctp_send_operr_to(struct mbuf *m, int iphlen, struct mbuf *scm, uint32_t vtag,
}
if (iph_out != NULL) {
sctp_route_t ro;
struct sctp_tcb *stcb = NULL;
int ret;
/* zap the stack pointer to the route */
@ -11890,15 +11903,23 @@ sctp_send_operr_to(struct mbuf *m, int iphlen, struct mbuf *scm, uint32_t vtag,
#endif
SCTP_ATTACH_CHAIN(o_pak, mout, len);
if (port) {
#if defined(SCTP_WITH_NO_CSUM)
SCTP_STAT_INCR(sctps_sendnocrc);
#else
sh_out->checksum = sctp_calculate_cksum(mout, iphlen_out);
SCTP_STAT_INCR(sctps_sendswcrc);
#endif
SCTP_ENABLE_UDP_CSUM(o_pak);
} else {
#if defined(SCTP_WITH_NO_CSUM)
SCTP_STAT_INCR(sctps_sendnocrc);
#else
mout->m_pkthdr.csum_flags = CSUM_SCTP;
mout->m_pkthdr.csum_data = 0;
SCTP_STAT_INCR(sctps_sendhwcrc);
#endif
}
SCTP_IP_OUTPUT(ret, o_pak, &ro, stcb, vrf_id);
SCTP_IP_OUTPUT(ret, o_pak, &ro, NULL, vrf_id);
/* Free the route if we got one back */
if (ro.ro_rt)
@ -11908,7 +11929,6 @@ sctp_send_operr_to(struct mbuf *m, int iphlen, struct mbuf *scm, uint32_t vtag,
if (ip6_out != NULL) {
struct route_in6 ro;
int ret;
struct sctp_tcb *stcb = NULL;
struct ifnet *ifp = NULL;
/* zap the stack pointer to the route */
@ -11923,29 +11943,25 @@ sctp_send_operr_to(struct mbuf *m, int iphlen, struct mbuf *scm, uint32_t vtag,
#endif
SCTP_ATTACH_CHAIN(o_pak, mout, len);
if (port) {
if (!(SCTP_BASE_SYSCTL(sctp_no_csum_on_loopback) &&
(stcb) &&
(stcb->asoc.loopback_scope))) {
sh_out->checksum = sctp_calculate_cksum(mout, sizeof(struct ip6_hdr) + sizeof(struct udphdr));
SCTP_STAT_INCR(sctps_sendswcrc);
} else {
SCTP_STAT_INCR(sctps_sendnocrc);
}
#if defined(SCTP_WITH_NO_CSUM)
SCTP_STAT_INCR(sctps_sendnocrc);
#else
sh_out->checksum = sctp_calculate_cksum(mout, sizeof(struct ip6_hdr) + sizeof(struct udphdr));
SCTP_STAT_INCR(sctps_sendswcrc);
#endif
if ((udp->uh_sum = in6_cksum(o_pak, IPPROTO_UDP, sizeof(struct ip6_hdr), len - sizeof(struct ip6_hdr))) == 0) {
udp->uh_sum = 0xffff;
}
} else {
if (!(SCTP_BASE_SYSCTL(sctp_no_csum_on_loopback) &&
(stcb) &&
(stcb->asoc.loopback_scope))) {
mout->m_pkthdr.csum_flags = CSUM_SCTP;
mout->m_pkthdr.csum_data = 0;
SCTP_STAT_INCR(sctps_sendhwcrc);
} else {
SCTP_STAT_INCR(sctps_sendnocrc);
}
#if defined(SCTP_WITH_NO_CSUM)
SCTP_STAT_INCR(sctps_sendnocrc);
#else
mout->m_pkthdr.csum_flags = CSUM_SCTP;
mout->m_pkthdr.csum_data = 0;
SCTP_STAT_INCR(sctps_sendhwcrc);
#endif
}
SCTP_IP6_OUTPUT(ret, o_pak, &ro, &ifp, stcb, vrf_id);
SCTP_IP6_OUTPUT(ret, o_pak, &ro, &ifp, NULL, vrf_id);
/* Free the route if we got one back */
if (ro.ro_rt)

View File

@ -54,7 +54,9 @@ sctp_init_sysctls()
SCTP_BASE_SYSCTL(sctp_ecn_enable) = SCTPCTL_ECN_ENABLE_DEFAULT;
SCTP_BASE_SYSCTL(sctp_ecn_nonce) = SCTPCTL_ECN_NONCE_DEFAULT;
SCTP_BASE_SYSCTL(sctp_strict_sacks) = SCTPCTL_STRICT_SACKS_DEFAULT;
#if !defined(SCTP_WITH_NO_CSUM)
SCTP_BASE_SYSCTL(sctp_no_csum_on_loopback) = SCTPCTL_LOOPBACK_NOCSUM_DEFAULT;
#endif
SCTP_BASE_SYSCTL(sctp_strict_init) = SCTPCTL_STRICT_INIT_DEFAULT;
SCTP_BASE_SYSCTL(sctp_peer_chunk_oh) = SCTPCTL_PEER_CHKOH_DEFAULT;
SCTP_BASE_SYSCTL(sctp_max_burst_default) = SCTPCTL_MAXBURST_DEFAULT;
@ -568,7 +570,9 @@ sysctl_sctp_check(SYSCTL_HANDLER_ARGS)
RANGECHK(SCTP_BASE_SYSCTL(sctp_ecn_enable), SCTPCTL_ECN_ENABLE_MIN, SCTPCTL_ECN_ENABLE_MAX);
RANGECHK(SCTP_BASE_SYSCTL(sctp_ecn_nonce), SCTPCTL_ECN_NONCE_MIN, SCTPCTL_ECN_NONCE_MAX);
RANGECHK(SCTP_BASE_SYSCTL(sctp_strict_sacks), SCTPCTL_STRICT_SACKS_MIN, SCTPCTL_STRICT_SACKS_MAX);
#if !defined(SCTP_WITH_NO_CSUM)
RANGECHK(SCTP_BASE_SYSCTL(sctp_no_csum_on_loopback), SCTPCTL_LOOPBACK_NOCSUM_MIN, SCTPCTL_LOOPBACK_NOCSUM_MAX);
#endif
RANGECHK(SCTP_BASE_SYSCTL(sctp_strict_init), SCTPCTL_STRICT_INIT_MIN, SCTPCTL_STRICT_INIT_MAX);
RANGECHK(SCTP_BASE_SYSCTL(sctp_peer_chunk_oh), SCTPCTL_PEER_CHKOH_MIN, SCTPCTL_PEER_CHKOH_MAX);
RANGECHK(SCTP_BASE_SYSCTL(sctp_max_burst_default), SCTPCTL_MAXBURST_MIN, SCTPCTL_MAXBURST_MAX);
@ -829,9 +833,11 @@ SYSCTL_PROC(_net_inet_sctp, OID_AUTO, strict_sacks, CTLTYPE_INT | CTLFLAG_RW,
&SCTP_BASE_SYSCTL(sctp_strict_sacks), 0, sysctl_sctp_check, "IU",
SCTPCTL_STRICT_SACKS_DESC);
#if !defined(SCTP_WITH_NO_CSUM)
SYSCTL_PROC(_net_inet_sctp, OID_AUTO, loopback_nocsum, CTLTYPE_INT | CTLFLAG_RW,
&SCTP_BASE_SYSCTL(sctp_no_csum_on_loopback), 0, sysctl_sctp_check, "IU",
SCTPCTL_LOOPBACK_NOCSUM_DESC);
#endif
SYSCTL_PROC(_net_inet_sctp, OID_AUTO, strict_init, CTLTYPE_INT | CTLFLAG_RW,
&SCTP_BASE_SYSCTL(sctp_strict_init), 0, sysctl_sctp_check, "IU",

View File

@ -45,7 +45,9 @@ struct sctp_sysctl {
uint32_t sctp_ecn_enable;
uint32_t sctp_ecn_nonce;
uint32_t sctp_strict_sacks;
#if !defined(SCTP_WITH_NO_CSUM)
uint32_t sctp_no_csum_on_loopback;
#endif
uint32_t sctp_strict_init;
uint32_t sctp_peer_chunk_oh;
uint32_t sctp_max_burst_default;

View File

@ -72,7 +72,6 @@ sctp6_input(struct mbuf **i_pak, int *offp, int proto)
struct sctp_inpcb *in6p = NULL;
struct sctp_nets *net;
int refcount_up = 0;
uint32_t check, calc_check;
uint32_t vrf_id = 0;
struct inpcb *in6p_ip;
struct sctp_chunkhdr *ch;
@ -80,6 +79,11 @@ sctp6_input(struct mbuf **i_pak, int *offp, int proto)
uint8_t ecn_bits;
struct sctp_tcb *stcb = NULL;
int pkt_len = 0;
#if !defined(SCTP_WITH_NO_CSUM)
uint32_t check, calc_check;
#endif
int off = *offp;
uint16_t port = 0;
@ -133,6 +137,9 @@ sctp6_input(struct mbuf **i_pak, int *offp, int proto)
m->m_pkthdr.len,
if_name(m->m_pkthdr.rcvif),
m->m_pkthdr.csum_flags);
#if defined(SCTP_WITH_NO_CSUM)
SCTP_STAT_INCR(sctps_recvnocrc);
#else
if (m->m_pkthdr.csum_flags & CSUM_SCTP_VALID) {
SCTP_STAT_INCR(sctps_recvhwcrc);
goto sctp_skip_csum;
@ -171,6 +178,7 @@ sctp6_input(struct mbuf **i_pak, int *offp, int proto)
sh->checksum = calc_check;
sctp_skip_csum:
#endif
net = NULL;
/*
* Locate pcb and tcb for datagram sctp_findassociation_addr() wants