summaryrefslogtreecommitdiffstats
path: root/chromium/third_party/usrsctp/usrsctplib/usrsctplib/netinet/sctp_output.c
diff options
context:
space:
mode:
Diffstat (limited to 'chromium/third_party/usrsctp/usrsctplib/usrsctplib/netinet/sctp_output.c')
-rwxr-xr-xchromium/third_party/usrsctp/usrsctplib/usrsctplib/netinet/sctp_output.c55
1 files changed, 8 insertions, 47 deletions
diff --git a/chromium/third_party/usrsctp/usrsctplib/usrsctplib/netinet/sctp_output.c b/chromium/third_party/usrsctp/usrsctplib/usrsctplib/netinet/sctp_output.c
index 6ac2059b358..c7afc9f7040 100755
--- a/chromium/third_party/usrsctp/usrsctplib/usrsctplib/netinet/sctp_output.c
+++ b/chromium/third_party/usrsctp/usrsctplib/usrsctplib/netinet/sctp_output.c
@@ -34,7 +34,7 @@
#ifdef __FreeBSD__
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: head/sys/netinet/sctp_output.c 325370 2017-11-03 20:46:12Z tuexen $");
+__FBSDID("$FreeBSD: head/sys/netinet/sctp_output.c 326829 2017-12-13 17:11:57Z tuexen $");
#endif
#include <netinet/sctp_os.h>
@@ -4410,12 +4410,8 @@ sctp_lowlevel_chunk_output(struct sctp_inpcb *inp,
}
SCTP_ATTACH_CHAIN(o_pak, m, packet_length);
if (port) {
-#if defined(SCTP_WITH_NO_CSUM)
- SCTP_STAT_INCR(sctps_sendnocrc);
-#else
sctphdr->checksum = sctp_calculate_cksum(m, sizeof(struct ip) + sizeof(struct udphdr));
SCTP_STAT_INCR(sctps_sendswcrc);
-#endif
#if !defined(__Windows__) && !defined(__Userspace__)
#if defined(__FreeBSD__) && ((__FreeBSD_version > 803000 && __FreeBSD_version < 900000) || __FreeBSD_version > 900000)
if (V_udp_cksum) {
@@ -4426,9 +4422,6 @@ sctp_lowlevel_chunk_output(struct sctp_inpcb *inp,
#endif
#endif
} else {
-#if defined(SCTP_WITH_NO_CSUM)
- SCTP_STAT_INCR(sctps_sendnocrc);
-#else
#if defined(__FreeBSD__) && __FreeBSD_version >= 800000
m->m_pkthdr.csum_flags = CSUM_SCTP;
m->m_pkthdr.csum_data = offsetof(struct sctphdr, checksum);
@@ -4439,10 +4432,9 @@ sctp_lowlevel_chunk_output(struct sctp_inpcb *inp,
sctphdr->checksum = sctp_calculate_cksum(m, sizeof(struct ip));
SCTP_STAT_INCR(sctps_sendswcrc);
} else {
- SCTP_STAT_INCR(sctps_sendnocrc);
+ SCTP_STAT_INCR(sctps_sendhwcrc);
}
#endif
-#endif
}
#ifdef SCTP_PACKET_LOGGING
if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_LAST_PACKET_TRACING)
@@ -4854,12 +4846,8 @@ sctp_lowlevel_chunk_output(struct sctp_inpcb *inp,
}
SCTP_ATTACH_CHAIN(o_pak, m, packet_length);
if (port) {
-#if defined(SCTP_WITH_NO_CSUM)
- SCTP_STAT_INCR(sctps_sendnocrc);
-#else
sctphdr->checksum = sctp_calculate_cksum(m, sizeof(struct ip6_hdr) + sizeof(struct udphdr));
SCTP_STAT_INCR(sctps_sendswcrc);
-#endif
#if defined(__Windows__)
udp->uh_sum = 0;
#elif !defined(__Userspace__)
@@ -4868,9 +4856,6 @@ sctp_lowlevel_chunk_output(struct sctp_inpcb *inp,
}
#endif
} else {
-#if defined(SCTP_WITH_NO_CSUM)
- SCTP_STAT_INCR(sctps_sendnocrc);
-#else
#if defined(__FreeBSD__) && __FreeBSD_version >= 800000
#if __FreeBSD_version < 900000
sctphdr->checksum = sctp_calculate_cksum(m, sizeof(struct ip6_hdr));
@@ -4890,10 +4875,9 @@ sctp_lowlevel_chunk_output(struct sctp_inpcb *inp,
sctphdr->checksum = sctp_calculate_cksum(m, sizeof(struct ip6_hdr));
SCTP_STAT_INCR(sctps_sendswcrc);
} else {
- SCTP_STAT_INCR(sctps_sendnocrc);
+ SCTP_STAT_INCR(sctps_sendhwcrc);
}
#endif
-#endif
}
/* send it out. table id is taken from stcb */
#if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING)
@@ -5010,16 +4994,12 @@ sctp_lowlevel_chunk_output(struct sctp_inpcb *inp,
sctphdr->dest_port = dest_port;
sctphdr->v_tag = v_tag;
sctphdr->checksum = 0;
-#if defined(SCTP_WITH_NO_CSUM)
- SCTP_STAT_INCR(sctps_sendnocrc);
-#else
if (SCTP_BASE_VAR(crc32c_offloaded) == 0) {
sctphdr->checksum = sctp_calculate_cksum(m, 0);
SCTP_STAT_INCR(sctps_sendswcrc);
} else {
SCTP_STAT_INCR(sctps_sendhwcrc);
}
-#endif
if (tos_value == 0) {
tos_value = inp->ip_inp.inp.inp_ip_tos;
}
@@ -7425,11 +7405,11 @@ sctp_toss_old_cookies(struct sctp_tcb *stcb, struct sctp_association *asoc)
TAILQ_FOREACH_SAFE(chk, &asoc->control_send_queue, sctp_next, nchk) {
if (chk->rec.chunk_id.id == SCTP_COOKIE_ECHO) {
TAILQ_REMOVE(&asoc->control_send_queue, chk, sctp_next);
+ asoc->ctrl_queue_cnt--;
if (chk->data) {
sctp_m_freem(chk->data);
chk->data = NULL;
}
- asoc->ctrl_queue_cnt--;
sctp_free_a_chunk(stcb, chk, SCTP_SO_NOT_LOCKED);
}
}
@@ -7454,11 +7434,11 @@ sctp_toss_old_asconf(struct sctp_tcb *stcb)
}
}
TAILQ_REMOVE(&asoc->asconf_send_queue, chk, sctp_next);
+ asoc->ctrl_queue_cnt--;
if (chk->data) {
sctp_m_freem(chk->data);
chk->data = NULL;
}
- asoc->ctrl_queue_cnt--;
sctp_free_a_chunk(stcb, chk, SCTP_SO_NOT_LOCKED);
}
}
@@ -7582,13 +7562,14 @@ sctp_clean_up_ctl(struct sctp_tcb *stcb, struct sctp_association *asoc, int so_l
/* Stray chunks must be cleaned up */
clean_up_anyway:
TAILQ_REMOVE(&asoc->control_send_queue, chk, sctp_next);
+ asoc->ctrl_queue_cnt--;
if (chk->data) {
sctp_m_freem(chk->data);
chk->data = NULL;
}
- asoc->ctrl_queue_cnt--;
- if (chk->rec.chunk_id.id == SCTP_FORWARD_CUM_TSN)
+ if (chk->rec.chunk_id.id == SCTP_FORWARD_CUM_TSN) {
asoc->fwd_tsn_cnt--;
+ }
sctp_free_a_chunk(stcb, chk, so_locked);
} else if (chk->rec.chunk_id.id == SCTP_STREAM_RESET) {
/* special handling, we must look into the param */
@@ -11879,12 +11860,8 @@ sctp_send_resp_msg(struct sockaddr *src, struct sockaddr *dst,
ip->ip_len = htons(len);
#endif
if (port) {
-#if defined(SCTP_WITH_NO_CSUM)
- SCTP_STAT_INCR(sctps_sendnocrc);
-#else
shout->checksum = sctp_calculate_cksum(mout, sizeof(struct ip) + sizeof(struct udphdr));
SCTP_STAT_INCR(sctps_sendswcrc);
-#endif
#if !defined(__Windows__) && !defined(__Userspace__)
#if defined(__FreeBSD__) && ((__FreeBSD_version > 803000 && __FreeBSD_version < 900000) || __FreeBSD_version > 900000)
if (V_udp_cksum) {
@@ -11895,9 +11872,6 @@ sctp_send_resp_msg(struct sockaddr *src, struct sockaddr *dst,
#endif
#endif
} else {
-#if defined(SCTP_WITH_NO_CSUM)
- SCTP_STAT_INCR(sctps_sendnocrc);
-#else
#if defined(__FreeBSD__) && __FreeBSD_version >= 800000
mout->m_pkthdr.csum_flags = CSUM_SCTP;
mout->m_pkthdr.csum_data = offsetof(struct sctphdr, checksum);
@@ -11906,7 +11880,6 @@ sctp_send_resp_msg(struct sockaddr *src, struct sockaddr *dst,
shout->checksum = sctp_calculate_cksum(mout, sizeof(struct ip));
SCTP_STAT_INCR(sctps_sendswcrc);
#endif
-#endif
}
#ifdef SCTP_PACKET_LOGGING
if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_LAST_PACKET_TRACING) {
@@ -11929,12 +11902,8 @@ sctp_send_resp_msg(struct sockaddr *src, struct sockaddr *dst,
case AF_INET6:
ip6->ip6_plen = (uint16_t)(len - sizeof(struct ip6_hdr));
if (port) {
-#if defined(SCTP_WITH_NO_CSUM)
- SCTP_STAT_INCR(sctps_sendnocrc);
-#else
shout->checksum = sctp_calculate_cksum(mout, sizeof(struct ip6_hdr) + sizeof(struct udphdr));
SCTP_STAT_INCR(sctps_sendswcrc);
-#endif
#if defined(__Windows__)
udp->uh_sum = 0;
#elif !defined(__Userspace__)
@@ -11943,9 +11912,6 @@ sctp_send_resp_msg(struct sockaddr *src, struct sockaddr *dst,
}
#endif
} else {
-#if defined(SCTP_WITH_NO_CSUM)
- SCTP_STAT_INCR(sctps_sendnocrc);
-#else
#if defined(__FreeBSD__) && __FreeBSD_version >= 900000
#if __FreeBSD_version > 901000
mout->m_pkthdr.csum_flags = CSUM_SCTP_IPV6;
@@ -11958,7 +11924,6 @@ sctp_send_resp_msg(struct sockaddr *src, struct sockaddr *dst,
shout->checksum = sctp_calculate_cksum(mout, sizeof(struct ip6_hdr));
SCTP_STAT_INCR(sctps_sendswcrc);
#endif
-#endif
}
#ifdef SCTP_PACKET_LOGGING
if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_LAST_PACKET_TRACING) {
@@ -11975,16 +11940,12 @@ sctp_send_resp_msg(struct sockaddr *src, struct sockaddr *dst,
struct sockaddr_conn *sconn;
sconn = (struct sockaddr_conn *)src;
-#if defined(SCTP_WITH_NO_CSUM)
- SCTP_STAT_INCR(sctps_sendnocrc);
-#else
if (SCTP_BASE_VAR(crc32c_offloaded) == 0) {
shout->checksum = sctp_calculate_cksum(mout, 0);
SCTP_STAT_INCR(sctps_sendswcrc);
} else {
SCTP_STAT_INCR(sctps_sendhwcrc);
}
-#endif
#ifdef SCTP_PACKET_LOGGING
if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_LAST_PACKET_TRACING) {
sctp_packet_log(mout);