[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[lwip-devel] [bug #59638] Calling tcp_write() without TCP_WRITE_FLAG_COP
From: |
Oleg Kobrin |
Subject: |
[lwip-devel] [bug #59638] Calling tcp_write() without TCP_WRITE_FLAG_COPY does in fact copy data |
Date: |
Tue, 8 Dec 2020 02:27:59 -0500 (EST) |
User-agent: |
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.183 Safari/537.36 |
URL:
<https://savannah.nongnu.org/bugs/?59638>
Summary: Calling tcp_write() without TCP_WRITE_FLAG_COPY does
in fact copy data
Project: lwIP - A Lightweight TCP/IP stack
Submitted by: kiabrin
Submitted on: Вт 08 дек 2020 07:27:57
Category: TCP
Severity: 3 - Normal
Item Group: Faulty Behaviour
Status: None
Privacy: Public
Assigned to: None
Open/Closed: Open
Discussion Lock: Any
Planned Release: None
lwIP version: git head
_______________________________________________________
Details:
Hello!
Debugging my code on TivaC MCU, NO_OS configuration, I realized after call to
tcp_write() with no TCP_WRITE_FLAG_COPY flag that pcb->snd_buf was decreased
and real pcb->unsent->p->payload points not to my data, but somewhere inside
lwip memory pool.
This is not good, as at high output traffic I experience tcp send buffer
overflows, causing data loss.
Previous ticket was incorrectly marked as invalid, quote:
"So where's the bug?
pcb->unsent->p->payload points to a small pbuf containing the packet headers.
This needs to be allocated for every packet, regardless of whether the
packet's payload is copied or not."
But it is not correct.
pcb->unsent->tcphdr points to header,
pcb->unsent->p->payload points to contents.
In my case: I checked again, writing a packet of 12 bytes without
TCP_WRITE_FLAG_COPY set decreases pcb->snd_buf by 12.
Another try:
calling err_t Err = tcp_write(Connects[Sock].pcb, Data, Len, 0);
Len = 2404, pcb->snd_buf = 23722.
After call:
pcb->snd_buf = 21318.
23722 - 21318 = 2404.
_______________________________________________________
Reply to this item at:
<https://savannah.nongnu.org/bugs/?59638>
_______________________________________________
Сообщение отправлено по Savannah
https://savannah.nongnu.org/
- [lwip-devel] [bug #59638] Calling tcp_write() without TCP_WRITE_FLAG_COPY does in fact copy data,
Oleg Kobrin <=