Date: Thu, 28 Oct 2010 17:02:36 +0000 (UTC) From: Michael Tuexen <tuexen@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r214464 - in stable/8/sys: netinet netinet6 Message-ID: <201010281702.o9SH2aIC017920@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: tuexen Date: Thu Oct 28 17:02:36 2010 New Revision: 214464 URL: http://svn.freebsd.org/changeset/base/214464 Log: MFC 211969: 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. Modified: stable/8/sys/netinet/sctp_crc32.c stable/8/sys/netinet/sctp_crc32.h stable/8/sys/netinet/sctp_input.c stable/8/sys/netinet/sctp_os_bsd.h stable/8/sys/netinet/sctp_output.c stable/8/sys/netinet/sctp_sysctl.c stable/8/sys/netinet/sctp_sysctl.h stable/8/sys/netinet6/sctp6_usrreq.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/netinet/sctp_crc32.c ============================================================================== --- stable/8/sys/netinet/sctp_crc32.c Thu Oct 28 17:00:31 2010 (r214463) +++ stable/8/sys/netinet/sctp_crc32.c Thu Oct 28 17:02:36 2010 (r214464) @@ -115,20 +115,15 @@ sctp_calculate_cksum(struct mbuf *m, uin 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, uint3 return; } *(uint32_t *) (m->m_data + offset) = checksum; +#endif } Modified: stable/8/sys/netinet/sctp_crc32.h ============================================================================== --- stable/8/sys/netinet/sctp_crc32.h Thu Oct 28 17:00:31 2010 (r214463) +++ stable/8/sys/netinet/sctp_crc32.h Thu Oct 28 17:02:36 2010 (r214464) @@ -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__ */ Modified: stable/8/sys/netinet/sctp_input.c ============================================================================== --- stable/8/sys/netinet/sctp_input.c Thu Oct 28 17:00:31 2010 (r214463) +++ stable/8/sys/netinet/sctp_input.c Thu Oct 28 17:02:36 2010 (r214464) @@ -3068,7 +3068,7 @@ process_chunk_drop(struct sctp_tcb *stcb 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, 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, 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, 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); Modified: stable/8/sys/netinet/sctp_os_bsd.h ============================================================================== --- stable/8/sys/netinet/sctp_os_bsd.h Thu Oct 28 17:00:31 2010 (r214463) +++ stable/8/sys/netinet/sctp_os_bsd.h Thu Oct 28 17:02:36 2010 (r214464) @@ -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); \ Modified: stable/8/sys/netinet/sctp_output.c ============================================================================== --- stable/8/sys/netinet/sctp_output.c Thu Oct 28 17:00:31 2010 (r214463) +++ stable/8/sys/netinet/sctp_output.c Thu Oct 28 17:02:36 2010 (r214464) @@ -3741,6 +3741,9 @@ sctp_lowlevel_chunk_output(struct sctp_i #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_i } 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_i #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_i } 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_i } 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 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 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 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 #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 iphl } 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 iphl #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 iphl 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 iphl #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 i } 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 i #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 i 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 i #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) Modified: stable/8/sys/netinet/sctp_sysctl.c ============================================================================== --- stable/8/sys/netinet/sctp_sysctl.c Thu Oct 28 17:00:31 2010 (r214463) +++ stable/8/sys/netinet/sctp_sysctl.c Thu Oct 28 17:02:36 2010 (r214464) @@ -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, st &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", Modified: stable/8/sys/netinet/sctp_sysctl.h ============================================================================== --- stable/8/sys/netinet/sctp_sysctl.h Thu Oct 28 17:00:31 2010 (r214463) +++ stable/8/sys/netinet/sctp_sysctl.h Thu Oct 28 17:02:36 2010 (r214464) @@ -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; Modified: stable/8/sys/netinet6/sctp6_usrreq.c ============================================================================== --- stable/8/sys/netinet6/sctp6_usrreq.c Thu Oct 28 17:00:31 2010 (r214463) +++ stable/8/sys/netinet6/sctp6_usrreq.c Thu Oct 28 17:02:36 2010 (r214464) @@ -72,7 +72,6 @@ sctp6_input(struct mbuf **i_pak, int *of 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 *of 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 *of 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 *of sh->checksum = calc_check; sctp_skip_csum: +#endif net = NULL; /* * Locate pcb and tcb for datagram sctp_findassociation_addr() wants
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201010281702.o9SH2aIC017920>