If SO_LINGER enabled and lingering close is in progress, we have to
complete the closure to release the blocked api_msg: close(). Otherwise,
it might be blocked forever, as the linked pcb is removed.
In some cases it's necessary to test more complex scenarios than single
thread unit tests. The initial socket test uses two threads to verify
basic TCP client-server communicaton.
Ref IDF-4797
This happens during quick reconnect of LTE ppp session.
When processing an input packet containing only zero's,
the pppos state machine assumes these are control fields,
so doesn't allocate any pbuf for data. So if the `PPP_FLAG` comes
(start of another valid packet) in this state and the `FCS` is valid
(which is valid as long as only zero characters are being received)
we de-reference `pppos->in_tail` in pppos.c:544.
Picked from espressif/esp-lwip@537c69d5
Patch posted https://savannah.nongnu.org/patch/?10179
Ref IDF-4847
If the packet contained FIN flag, we post a TCP_EVENT_CLOSE with null pbuf,
which could get lost if the underlying platform implementation of sys_mbox_(try)post()
returns ERR_MEM (i.e. won't fit into the recv mailbox).
Loosing this event causes trouble since the FIN initiator gets ACK'ed and
assumes the connection has closed, but the TCP state machine is stuck in its active state.
Fixed by flagging the pcb as closing if the ERR_MEM returned.
Picked from espressif/esp-lwip@d050c331
Patch posted https://savannah.nongnu.org/patch/?10013
Ref IDF-4847
Append to the linked list of pbuf objects was broken so that the second
(and subsequent) packets received in a SLIP transaction would be
appended to themselves and consequently lost.
This resulted in these packets being dropped and the system suffering
extreme memory leakage.
Picked from espressif/esp-lwip@01d0ecff
Ref IDF-4847
The TCP MSS is 1436, assuming that the received packet length is 1436,
the disordered queue will change in order because of the arrival of this packet.
Make sure that the total length of this package and the shuffled package does not exceed the window
picked from espressif/esp-lwip@7285b846
Ref IDF-4852
...and return ERR_MEM on ND6 queue full.
Issue:
When ESP32/S2 UDPv6 TX, the pkts are queued into neighbor cache queue
when MAC address is being resolved, and as a result of LwIP component's "malloc"
use C lib not the LwIP memory pool, which cause the restriction of max
nd6 queue num can't limit the memory use.
picked from espressif/esp-lwip@80d6d19a
Ref IDF-4849
Root Cause:
When the ARP cache table is filled, when a new packet comes in, the ARP cache table will be emptied.
Solution:
If the ARP cache table is full, ERR_MEM is returned.
picked from espressif/esp-lwip@602d25c5
Ref IDF-4849
`vallen` is verified to be less than `len`, therefore, it can never
be the case that `vallen >= len + sizeof(rhostname)`.
This PR fixes the check so the `rhostname` array does not overflow.
Reported-by: Github Security Lab <securitylab@github.com>
Signed-off-by: Alvaro Muñoz <pwntester@github.com>
Ref IDF-4847
ESP_LWIP supports closing socket while waiting. This fixes potential
races.
Orig: fix bug for after udp close select_waiting assert (dd3b3017)
Ref IDF-4794
These constants are defined in RFC-3927 (10 conflicts before rate
limiting and 60 seconds between attempts) and are not intended to be
configurable. We cannot pass BCT without adjusting these params, though.
Ref IDF-4843
This adds support for list of DNS servers, that could contain manually
configured server that won't be rewritten.
Also if some of the servers in the list is NULL, the algorithm continues
searching with other configured servers up to DNS_MAX_SERVERS.
Ref IDF-4839
IGMP and MLD6 timers activated only when joining groups or receiving
QUERY packets. This reduces the power consumption in applications that
do not use IGMP and MLD6.
Signed-off-by: Sachin Parekh <sachin.parekh@espressif.com>
Co-Authored-By: Axel Lin <axel.lin@gmail.com> (espressif/esp-lwip@b1eec77b)
Ref IDF-4837
The root cause of this issue is big UDP traffic consuming the buffer
so the DHCP doesn't have the bandwitdh to access the Tx buffer.
More info espressif/esp-lwip!217
Ref IDF-4817
If the hostname is not set in the DISCOVER packet, then some servers might
issue an OFFER with hostname configured and consequently reject the REQUEST
with any other hostname.
Signed-off-by: Logan Gunthorpe <logang@deltatee.com>
Ref IDF-4817
Also updates timeout type from u16 to u32
Co-Authored-By: David Cermak <cermak@espressif.com>
Co-Authored-By: ronghulin <ronghulin@espressif.com> (espressif/esp-lwip@32b1aaf2)
Ref IDF-4817
This enables embedded devices restart the DHCP state machine easily
after reset and continue directly with DHCP_BIND of previously bound
address.
Co-Authored-By: MartinValik <martin.valik@mail.com> (espressif/esp-lwip@3b88e84f)
Ref IDF-4817
* Cosmetic updates on NAPT functionality implemented by martin-ger
- moved NAPT specific code from ip4.c to ip4_napt.c
- formatting updates to keep the changes easier to review
- updated per C-90 style used for lwip upstream (fixed warning,
renaming, lwip types)
- esp_random() -> LWIP_RAND()
- drop the connection with routing err if failed to add new napt record
- prepared for lwip unit testing
* Add ip4 routing tests
- lwip native ip-forward tests
- napt feature test udp, tcp
- napt feature, test add/release of nat records
Testing configurations: lwip unit tests are executed in the following
three configurations:
- default
- IP_FORWARD=1
- IP_FORWARD=1 & IP_NAPT=1
Note that debugging option ESP_TEST_DEBUG was introduced to enable running only
IP-FORWARD/IP-NAPT tests with verbose output
* Fix checksum of UDP
- According to the UDP protocol, the checksum is optional.
so if the checksum is 0, this meaning the checksum is turn off, and no need to
correct checksum.
* Fix disbale IPv6 and enable NAPT will build error
Co-Authored-By: David Cermak <cermak@espressif.com> (4b4d6b28, 754b8d5d)
Co-Authored-By: leo chung <gewalalb@gmail.com> (bb63eed1)
Co-Authored-By: yuanjm <yuanjianmin@espressif.com> (74cf7f9f)
Ref IDF-4800
lwip/lwip/src/apps/http/makefsdata/makefsdata.c:929:56: error: ‘snprintf’ output may be truncated before the last format character [-Werror=format-truncation=]
snprintf(qualifiedName, sizeof(qualifiedName), "%s/%s", curSubdir, filename);
/home/dziegel/lwip/lwip/src/apps/http/makefsdata/makefsdata.c:929:3: note: ‘snprintf’ output 2 or more bytes (assuming 257) into a destination of size 256
snprintf(qualifiedName, sizeof(qualifiedName), "%s/%s", curSubdir, filename);
Reduce subdir string length by 3 bytes to make the warning go away. The whole file path including directory AND filename is limited to MAX_PATH_LEN - so it is reasonable to reserve 3 bytes less for directory - the filename won't fit anyway in the remaining 3 bytes.
Ref IDF-4797
Picked from lwip-tcpip/lwip@30b2d073
This patch adds a few entries in .gitattributes to specify files that
should never end up in a distribution tarball.
Signed-off-by: Hu Keping <hukeping@huawei.com>
ppp_set_* functions that set the PPP session parameters must only be
called when the session is in a dead state (i.e. disconnected),
otherwise not fatal but surprising results may happen.
We do not have equivalents in PPPAPI for ppp_set_* functions because
calling them only makes sense while session is disconnected, furthermore
they are only setting structure members of the session configuration.