summaryrefslogtreecommitdiffstats
path: root/sys/netinet6/sctp6_usrreq.c
diff options
context:
space:
mode:
authorrrs <rrs@FreeBSD.org>2009-02-03 11:04:03 +0000
committerrrs <rrs@FreeBSD.org>2009-02-03 11:04:03 +0000
commit520c389cb4f290b2acdcff4ed123d33cca39e0d8 (patch)
treead3c3bea4fec4c5a81ac06bbcfcfc640edc88661 /sys/netinet6/sctp6_usrreq.c
parent2688c691800f6933c6b9eeeb46cf522db6f1af5c (diff)
downloadFreeBSD-src-520c389cb4f290b2acdcff4ed123d33cca39e0d8.zip
FreeBSD-src-520c389cb4f290b2acdcff4ed123d33cca39e0d8.tar.gz
- Cleanup checksum code.
- Prepare for CRC offloading, add MIB counters (RS/MT). - Bugfix: Disable CRC computation for IPv6 addresses with local scope (MT). - Bugfix: Handle close() with SO_LINGER correctly when notifications are generated during the close() call(MT). - Bugfix: Generate DRY event when sender is dry during subscription. Only for 1-to-1 style sockets (RS/MT) - Bugfix: Put vtags for the correct amount of time into time-wait (MT). - Bugfix: Clear vtag entries correctly on expiration (MT). - Bugfix: shutdown() indicates ENOTCONN when called for unconnected 1-to-1 style sockets (MT). - Bugfix: In sctp Auth code (PL). - Add support for devices that support SCTP csum offload (igb). - Add missing sctp_associd to mib sysctl xsctp_tcb structure (RS) Obtained from: With help from Peter Lei and Michael Tuexen
Diffstat (limited to 'sys/netinet6/sctp6_usrreq.c')
-rw-r--r--sys/netinet6/sctp6_usrreq.c21
1 files changed, 17 insertions, 4 deletions
diff --git a/sys/netinet6/sctp6_usrreq.c b/sys/netinet6/sctp6_usrreq.c
index c6fc3cf..9597528 100644
--- a/sys/netinet6/sctp6_usrreq.c
+++ b/sys/netinet6/sctp6_usrreq.c
@@ -51,6 +51,7 @@ __FBSDID("$FreeBSD$");
#include <netinet/sctp_input.h>
#include <netinet/sctp_output.h>
#include <netinet/sctp_bsd_addr.h>
+#include <netinet/sctp_crc32.h>
#include <netinet/udp.h>
#ifdef IPSEC
@@ -75,7 +76,7 @@ sctp6_input(struct mbuf **i_pak, int *offp, int proto)
uint32_t vrf_id = 0;
struct inpcb *in6p_ip;
struct sctp_chunkhdr *ch;
- int length, mlen, offset, iphlen;
+ int length, offset, iphlen;
uint8_t ecn_bits;
struct sctp_tcb *stcb = NULL;
int pkt_len = 0;
@@ -126,16 +127,28 @@ sctp6_input(struct mbuf **i_pak, int *offp, int proto)
/* destination port of 0 is illegal, based on RFC2960. */
if (sh->dest_port == 0)
goto bad;
+
+ SCTPDBG(SCTP_DEBUG_CRCOFFLOAD,
+ "sctp_input(): Packet of length %d received on %s with csum_flags 0x%x.\n",
+ m->m_pkthdr.len,
+ if_name(m->m_pkthdr.rcvif),
+ m->m_pkthdr.csum_flags);
+ if (m->m_pkthdr.csum_flags & CSUM_SCTP_VALID) {
+ SCTP_STAT_INCR(sctps_recvhwcrc);
+ goto sctp_skip_csum;
+ }
check = sh->checksum; /* save incoming checksum */
if ((check == 0) && (SCTP_BASE_SYSCTL(sctp_no_csum_on_loopback)) &&
(IN6_ARE_ADDR_EQUAL(&ip6->ip6_src, &ip6->ip6_dst))) {
+ SCTP_STAT_INCR(sctps_recvnocrc);
goto sctp_skip_csum;
}
sh->checksum = 0; /* prepare for calc */
- calc_check = sctp_calculate_sum(m, &mlen, iphlen);
+ calc_check = sctp_calculate_cksum(m, iphlen);
+ SCTP_STAT_INCR(sctps_recvswcrc);
if (calc_check != check) {
- SCTPDBG(SCTP_DEBUG_INPUT1, "Bad CSUM on SCTP packet calc_check:%x check:%x m:%p mlen:%d iphlen:%d\n",
- calc_check, check, m, mlen, iphlen);
+ SCTPDBG(SCTP_DEBUG_INPUT1, "Bad CSUM on SCTP packet calc_check:%x check:%x m:%p phlen:%d\n",
+ calc_check, check, m, iphlen);
stcb = sctp_findassociation_addr(m, iphlen, offset - sizeof(*ch),
sh, ch, &in6p, &net, vrf_id);
if ((net) && (port)) {
OpenPOWER on IntegriCloud