mirror of
https://git.hardenedbsd.org/hardenedbsd/HardenedBSD.git
synced 2024-11-26 10:53:39 +01:00
TCP LRO: convert TCP header fields to host byte order earlier
This is a preparation for adding dtrace hooks in a follow-up commit, which are missing in the code path, where packets are directly queued to the tcpcb. The dtrace hooks expect the fields to be in host byte order. This only applies when TCP HPTS is used. No functional change intended. Reviewed by: rscheff MFC after: 1 week Sponsored by: Netflix, Inc. Differential Revision: https://reviews.freebsd.org/D43594
This commit is contained in:
parent
a84e01f02b
commit
f30c7d5654
@ -74,15 +74,15 @@ build_ack_entry(struct tcp_ackent *ae, struct tcphdr *th, struct mbuf *m,
|
||||
ae->flags |= TSTMP_LRO;
|
||||
else if (m->m_flags & M_TSTMP)
|
||||
ae->flags |= TSTMP_HDWR;
|
||||
ae->seq = ntohl(th->th_seq);
|
||||
ae->ack = ntohl(th->th_ack);
|
||||
ae->seq = th->th_seq;
|
||||
ae->ack = th->th_ack;
|
||||
ae->flags |= tcp_get_flags(th);
|
||||
if (ts_ptr != NULL) {
|
||||
ae->ts_value = ntohl(ts_ptr[1]);
|
||||
ae->ts_echo = ntohl(ts_ptr[2]);
|
||||
ae->flags |= HAS_TSTMP;
|
||||
}
|
||||
ae->win = ntohs(th->th_win);
|
||||
ae->win = th->th_win;
|
||||
ae->codepoint = iptos;
|
||||
}
|
||||
|
||||
@ -310,6 +310,7 @@ do_bpf_strip_and_compress(struct tcpcb *tp, struct lro_ctrl *lc,
|
||||
th = tcp_lro_get_th(m);
|
||||
|
||||
th->th_sum = 0; /* TCP checksum is valid. */
|
||||
tcp_fields_to_host(th);
|
||||
|
||||
/* Check if ACK can be compressed */
|
||||
can_compress = tcp_lro_ack_valid(m, th, &ts_ptr, &other_opts);
|
||||
|
@ -415,10 +415,6 @@ skip_vnet:
|
||||
break;
|
||||
#endif
|
||||
} /* end switch */
|
||||
/*
|
||||
* Convert TCP protocol specific fields to host format.
|
||||
*/
|
||||
tcp_fields_to_host(th);
|
||||
off = th->th_off << 2;
|
||||
if (off < sizeof (struct tcphdr) || off > tlen) {
|
||||
printf("off:%d < hdrlen:%zu || > tlen:%u -- dump\n",
|
||||
|
Loading…
Reference in New Issue
Block a user