mirror of
https://github.com/lwip-tcpip/lwip.git
synced 2025-03-12 13:13:21 +00:00
tcp_output_segment: don't count retransmitted segments in mib2.tcpoutsegs by detecting p->payload != tcphdr pointer; don't try to retransmit segments where p->ref != 1 (as it is invalid to mess up p->len/p->payload when we don't have exclusive access to the pbuf)
This commit is contained in:
parent
ee87d28252
commit
b4d7238eb8
@ -1134,8 +1134,12 @@ tcp_output_segment(struct tcp_seg *seg, struct tcp_pcb *pcb)
|
|||||||
u32_t *opts;
|
u32_t *opts;
|
||||||
struct netif *netif;
|
struct netif *netif;
|
||||||
|
|
||||||
/** @bug Exclude retransmitted segments from this count. */
|
if (seg->p->ref != 1) {
|
||||||
MIB2_STATS_INC(mib2.tcpoutsegs);
|
/* This can happen if the pbuf of this segment is still referenced by the
|
||||||
|
netif driver due to deferred transmission. Since this function modifies
|
||||||
|
p->len, we must not continue in this case. */
|
||||||
|
return ERR_OK;
|
||||||
|
}
|
||||||
|
|
||||||
/* The TCP header has already been constructed, but the ackno and
|
/* The TCP header has already been constructed, but the ackno and
|
||||||
wnd fields remain. */
|
wnd fields remain. */
|
||||||
@ -1214,6 +1218,10 @@ tcp_output_segment(struct tcp_seg *seg, struct tcp_pcb *pcb)
|
|||||||
seg->len));
|
seg->len));
|
||||||
|
|
||||||
len = (u16_t)((u8_t *)seg->tcphdr - (u8_t *)seg->p->payload);
|
len = (u16_t)((u8_t *)seg->tcphdr - (u8_t *)seg->p->payload);
|
||||||
|
if (len == 0) {
|
||||||
|
/** Exclude retransmitted segments from this count. */
|
||||||
|
MIB2_STATS_INC(mib2.tcpoutsegs);
|
||||||
|
}
|
||||||
|
|
||||||
seg->p->len -= len;
|
seg->p->len -= len;
|
||||||
seg->p->tot_len -= len;
|
seg->p->tot_len -= len;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user