Changeset View
Changeset View
Standalone View
Standalone View
sys/netinet/tcp_output.c
Show First 20 Lines • Show All 68 Lines • ▼ Show 20 Lines | |||||
#ifdef INET6 | #ifdef INET6 | ||||
#include <netinet6/in6_pcb.h> | #include <netinet6/in6_pcb.h> | ||||
#include <netinet/ip6.h> | #include <netinet/ip6.h> | ||||
#include <netinet6/ip6_var.h> | #include <netinet6/ip6_var.h> | ||||
#endif | #endif | ||||
#include <netinet/tcp.h> | #include <netinet/tcp.h> | ||||
#define TCPOUTFLAGS | #define TCPOUTFLAGS | ||||
#include <netinet/tcp_fsm.h> | #include <netinet/tcp_fsm.h> | ||||
#include <netinet/tcp_log_buf.h> | |||||
#include <netinet/tcp_seq.h> | #include <netinet/tcp_seq.h> | ||||
#include <netinet/tcp_timer.h> | #include <netinet/tcp_timer.h> | ||||
#include <netinet/tcp_var.h> | #include <netinet/tcp_var.h> | ||||
#include <netinet/tcpip.h> | #include <netinet/tcpip.h> | ||||
#include <netinet/cc/cc.h> | #include <netinet/cc/cc.h> | ||||
#include <netinet/tcp_fastopen.h> | #include <netinet/tcp_fastopen.h> | ||||
#ifdef TCPPCAP | #ifdef TCPPCAP | ||||
#include <netinet/tcp_pcap.h> | #include <netinet/tcp_pcap.h> | ||||
▲ Show 20 Lines • Show All 1,220 Lines • ▼ Show 20 Lines | th->th_sum = in_pseudo(ip->ip_src.s_addr, ip->ip_dst.s_addr, | ||||
htons(sizeof(struct tcphdr) + IPPROTO_TCP + len + optlen)); | htons(sizeof(struct tcphdr) + IPPROTO_TCP + len + optlen)); | ||||
/* IP version must be set here for ipv4/ipv6 checking later */ | /* IP version must be set here for ipv4/ipv6 checking later */ | ||||
KASSERT(ip->ip_v == IPVERSION, | KASSERT(ip->ip_v == IPVERSION, | ||||
("%s: IP version incorrect: %d", __func__, ip->ip_v)); | ("%s: IP version incorrect: %d", __func__, ip->ip_v)); | ||||
} | } | ||||
#endif | #endif | ||||
/* We're getting ready to send; log now. */ | |||||
TCP_LOG_EVENT(tp, th, &so->so_rcv, &so->so_snd, TCP_LOG_OUT, ERRNO_UNK, | |||||
len, NULL, false); | |||||
/* | /* | ||||
* Enable TSO and specify the size of the segments. | * Enable TSO and specify the size of the segments. | ||||
* The TCP pseudo header checksum is always provided. | * The TCP pseudo header checksum is always provided. | ||||
*/ | */ | ||||
if (tso) { | if (tso) { | ||||
KASSERT(len > tp->t_maxseg - optlen, | KASSERT(len > tp->t_maxseg - optlen, | ||||
("%s: len <= tso_segsz", __func__)); | ("%s: len <= tso_segsz", __func__)); | ||||
m->m_pkthdr.csum_flags |= CSUM_TSO; | m->m_pkthdr.csum_flags |= CSUM_TSO; | ||||
▲ Show 20 Lines • Show All 223 Lines • ▼ Show 20 Lines | if (flags & TH_FIN) { | ||||
++xlen; | ++xlen; | ||||
tp->t_flags |= TF_SENTFIN; | tp->t_flags |= TF_SENTFIN; | ||||
} | } | ||||
if (SEQ_GT(tp->snd_nxt + xlen, tp->snd_max)) | if (SEQ_GT(tp->snd_nxt + xlen, tp->snd_max)) | ||||
tp->snd_max = tp->snd_nxt + xlen; | tp->snd_max = tp->snd_nxt + xlen; | ||||
} | } | ||||
if (error) { | if (error) { | ||||
/* Record the error. */ | |||||
TCP_LOG_EVENT(tp, NULL, &so->so_rcv, &so->so_snd, TCP_LOG_OUT, | |||||
error, 0, NULL, false); | |||||
/* | /* | ||||
* We know that the packet was lost, so back out the | * We know that the packet was lost, so back out the | ||||
* sequence number advance, if any. | * sequence number advance, if any. | ||||
* | * | ||||
* If the error is EPERM the packet got blocked by the | * If the error is EPERM the packet got blocked by the | ||||
* local firewall. Normally we should terminate the | * local firewall. Normally we should terminate the | ||||
* connection but the blocking may have been spurious | * connection but the blocking may have been spurious | ||||
▲ Show 20 Lines • Show All 343 Lines • Show Last 20 Lines |