Commit Graph

6777 Commits

Author SHA1 Message Date
Erik Ekman
7807f706f3 nd6: Update RA link-local addr option length check
lwIP might support different hardware address lengths (when using
Ethernet and 6LoWPAN for instance). Match provided lladdr length
from Router Advertisement to the current network interface instead
of comparing against longest that can be stored.
2023-09-28 22:23:25 +02:00
Erik Ekman
4f78da983f ci: Bump github action version
Fix warning:
"The following actions uses node12 which is deprecated and will be forced
to run on node16: actions/checkout@v2."
2023-09-28 21:06:09 +02:00
Simon Goldschmidt
d8b97bfc5d icmp: fix bug #64211 (ICMP reply error when using bridge)
when reusing an rx pbuf for tx, its if_idx has to be reset or else bridgeif_send_to_port() might drop it
2023-09-27 21:49:24 +02:00
Simon Goldschmidt
f7fe057821 win32 pcapif: fix "heap-use-after-free" on shutdown 2023-09-27 21:28:29 +02:00
Simon Goldschmidt
3792075baf Fix bug #64637 ("iperf -n 1000 -r" does not work) 2023-09-27 21:01:52 +02:00
Maxim Uvarov
4e6dd9c576 ping: add stop function
ping in raw mode does some set up and sets timeout, but clean
up procedure is missing. That is needed for case if PING_RESULT() macro
is used for application exit.

Also implement stop functionality when using sockets.
Running ping is stopped when calling ping_init() again.

Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>
Signed-off-by: Simon Goldschmidt <goldsimon@gmx.de>
2023-09-27 20:56:46 +02:00
Simon Goldschmidt
36cb95c4d2 next release will probably be 2.2.1... 2023-09-27 20:38:41 +02:00
Simon Goldschmidt
0a0452b2c3 Prepare 2.2.0 release 2023-09-25 21:25:35 +02:00
Simon Goldschmidt
c0cf130bb7 Prepare changelog for 2.2.0 release 2023-09-22 10:02:18 +02:00
Simon Goldschmidt
3eeda139bc minor coding style/spelling fixes 2023-09-22 09:54:36 +02:00
Simon Goldschmidt
b92faffaaa LWIP_VLAN_PCP==1: initialize tci correctly (disabled); add pcb_tci_*() functions to access the tci 2023-09-22 09:53:13 +02:00
Simon Goldschmidt
84fde1ebbf release: mark 2.2.0 RC1
Signed-off-by: Simon Goldschmidt <goldsimon@gmx.de>
2023-06-29 22:22:19 +02:00
Simon Goldschmidt
2a3711a566 win32: check: adjust check config.h to run with newest check library on VS2022
Signed-off-by: Simon Goldschmidt <goldsimon@gmx.de>
2023-06-29 22:14:36 +02:00
Simon Goldschmidt
1a5dffb931 win32: pcapif: ensure we can run with npcap as well
By default, npcap keeps its DLLs not in system32 but in system32/npcap.
To load DLLs from there, mark them as "delay load DLLs" and adjust the
DLL search path before using/loading them.

Signed-off-by: Simon Goldschmidt <goldsimon@gmx.de>
2023-06-29 22:11:55 +02:00
Simon Goldschmidt
bfcbf80221 win32: msvc: fix msvc project files to compile with VS2022; add test_tcp_state
Signed-off-by: Simon Goldschmidt <goldsimon@gmx.de>
2023-06-29 22:08:45 +02:00
Simon Goldschmidt
657c9735a7 doxygen: dhcp: fix doxygen stumbling over nonexisting define 2023-06-29 21:59:05 +02:00
Simon Goldschmidt
9672405eb9 test: unit: tcp: fix tcp state tests to not break other tests
On platform where check cannot fork (win32), the tcp_state tests crashed other tests.

Signed-off-by: Simon Goldschmidt <goldsimon@gmx.de>
2023-06-29 21:32:20 +02:00
Shawn Silverman
e29870c15e Fix a printf conversion specifier in mdns.c
Use U32_F to print a u32_t.
2023-05-11 22:16:49 +02:00
Shawn Silverman
f84076b112 Add missing terminating newlines to LWIP_DEBUGF statements 2023-05-11 22:13:51 +02:00
Jonathan Neuschäfer
c2f9244137 test/fuzz: Fix use of htons vs. ntohs
Although ntohs and htons perform equivalent operations (a byte swap on
little-endian platforms), their semantic roles (as implied by the names)
are different.

In fuzz_common.c, we get integers from simulated network packages, and
convert them for host CPU use, so ntohs is the right variant to use.
2023-05-11 22:10:32 +02:00
Jonathan Neuschäfer
5514d8eb63 test/fuzz: Build with -O2 by default
Fuzzers should run fast by default, since the goal is to try many
variations of input data.
2023-05-11 22:08:46 +02:00
Jonathan Neuschäfer
911da26f96 test/fuzz: Fix CC default value in makefile
Unfortunately, CC ?= afl-gcc doesn't work. This is because CC has a
default value (of "cc"), and the ?= operator only assigns a value if the
variable previously had none. "make" currently compiles with cc.

In this patch, I implemented the more elaborate way to achieve what was
probably intended: "make" will use afl-gcc now, and "make CC=foo" will
compile with "foo".
2023-05-11 22:08:40 +02:00
Mingjie Shen
2e3dcf06d1 api,sockets: Fix signed overflow check
Signed overflow is undefined behaviour in C/C++.
2023-05-11 21:28:22 +02:00
Mingjie Shen
e3a20b3bc2 mdns: Add null check for pbuf_skip 2023-05-11 21:26:22 +02:00
Jan Breuer
1c5cc7bc02 snmp_v3: fix reported usmUserAuthProtocol for SHA 2023-05-11 21:05:16 +02:00
David Cermak
3aa82745c1 dhcp: Add macro for appending extra client's request options
Co-Authored-By: Liu Han <liuhan@espressif.com>
Co-Authored-By: Simon Goldschmidt <goldsimon@gmx.de>
2023-05-11 21:03:11 +02:00
Logan Gunthorpe
90b2a6b4c4 dhcp: Set hostname for DISCOVER packets
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>
Co-Authored-By: Simon Goldschmidt <goldsimon@gmx.de>
2023-05-11 20:59:15 +02:00
xueyunfei
5231c8da23 dhcp: Enable custom config for timeouts, thresholds, backoff time
Enables to configure:
* DHCP_COARSE_TIMER_SECS
* if DHCP_DEFINE_CUSTOM_TIMEOUTS defined these addtional options are
available:
  - DHCP_CALC_TIMEOUT_FROM_OFFERED_T0_LEASE to adjust the t0 lease timeout from the offered value
  - DHCP_CALC_TIMEOUT_FROM_OFFERED_T1_RENEW same for t1 renew
  - DHCP_CALC_TIMEOUT_FROM_OFFERED_T2_REBIND same for t2 rebind
  - DHCP_NEXT_TIMEOUT_THRESHOLD to adjust the period of the next timeout
  - DHCP_REQUEST_BACKOFF_SEQUENCE to adjust back-off times based on DHCP
request attempts
Also updates timeout type from u16 to u32 - eps useful when DHCP_COARSE_TIMER_SECS is a smaller number
2023-05-11 20:49:14 +02:00
David Cermak
00f5e179b5 dhcp: Move in-place timeout/threshold calculations to macros 2023-05-11 20:44:21 +02:00
Simon Goldschmidt
90c9a482a6 ci: fix compiling test_tcp_state.c; add to msvc project 2023-05-11 20:26:21 +02:00
David Cermak
724cc173ca ci: Add the default example_app config to the build step 2023-05-10 22:20:07 +02:00
David Cermak
187e4ededd contrib/addons: Add example of using DHCP extra options hooks 2023-05-10 22:16:57 +02:00
Chen Yu Dong
f50c87da6f ci: Add unit test suite to validate tcp state transitions 2023-05-10 22:02:43 +02:00
David Cermak
a6874a46c6 contrib/ports: Add semaphore per thread option for unix 2023-05-10 21:49:34 +02:00
Simon Goldschmidt
3a9c1e48dd altcp_tls_mbedtls: note which version of mbedtls we are compatible to
Signed-off-by: Simon Goldschmidt <goldsimon@gmx.de>
2023-05-10 21:00:23 +02:00
Simon Goldschmidt
59ec032fa9 pppos: add new pppos unit test to vsproj 2023-05-10 20:59:36 +02:00
Simon Goldschmidt
64f75dbd89 pppos: fix compiling new pppos unit test
Signed-off-by: Simon Goldschmidt <goldsimon@gmx.de>
2023-05-10 20:58:23 +02:00
Peter Putz
a9664395b0 pppos: fix in_tail null
happens during quick reconnect of LTE ppp session
2023-05-10 20:57:12 +02:00
David Cermak
6b734bbb2c PPP: Add test exhibiting empty packet null-deref
Also updates lcp.c to compile with PPP_AUTH_SUPPORT=0 in clang
2023-05-10 20:42:27 +02:00
Jonathan Neuschäfer
d8d1e4a015 altcp: Fix NULL pointer dereference found by fuzzing
Reproducer (in bash):

base64 -d <<< "H4sIAP/9L2QCA+3WoQ2AMBSE4QoCTFHBBJfgSRF4RDfpRmgmYBpGQRBCk4ZiSfk/+fJMK+5dZRVpzSQzSs6oPierDV4y87WxLQLwE42SfNCdDyHJB9/xZwAARPbMJbUq4JJmu4JVT1cAAACfbGIqoqcMzy90eu+aBw2+N28WFgAA" | gunzip | test/fuzz/lwip_fuzz2

Crash log:

../../src/core/altcp_tcp.c:178:13: runtime error: member access within null pointer of type 'struct tcp_pcb'
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior ../../src/core/altcp_tcp.c:178:13 in
AddressSanitizer:DEADLYSIGNAL
=================================================================
==192415==ERROR: AddressSanitizer: SEGV on unknown address 0x000000000048 (pc 0x557065081703 bp 0x0aae0cb71204 sp 0x7ffd034dabc0 T0)
==192415==The signal is caused by a READ memory access.
==192415==Hint: address points to the zero page.
    #0 0x557065081703 in altcp_tcp_setup_callbacks /.../lwip/test/fuzz/../../src/core/altcp_tcp.c:178:19
    #1 0x55706508206f in altcp_tcp_setup /.../lwip/test/fuzz/../../src/core/altcp_tcp.c:189:3
    #2 0x55706508206f in altcp_tcp_accept /.../lwip/test/fuzz/../../src/core/altcp_tcp.c:84:5
    #3 0x557065095592 in tcp_input /.../lwip/test/fuzz/../../src/core/tcp_in.c:380:9
    #4 0x5570650e752f in ip4_input /.../lwip/test/fuzz/../../src/core/ipv4/ip4.c:743:9
    #5 0x55706513d4de in ethernet_input /.../lwip/test/fuzz/../../src/netif/ethernet.c:186:9
    #6 0x557064fe0959 in input_pkt /.../lwip/test/fuzz/fuzz_common.c:209:9
    #7 0x557064fdeb6a in input_pkts /.../lwip/test/fuzz/fuzz_common.c:257:9
    #8 0x557064fdeb6a in lwip_fuzztest /.../lwip/test/fuzz/fuzz_common.c:669:3
    #9 0x7ff4f578e189 in __libc_start_call_main csu/../sysdeps/nptl/libc_start_call_main.h:58:16
    #10 0x7ff4f578e244 in __libc_start_main csu/../csu/libc-start.c:381:3
    #11 0x557064f20420 in _start (/.../lwip/test/fuzz/lwip_fuzz2+0x81420) (BuildId: 8680a96430d5749c90111fe9c3a3d4f881a5dbcd)

AddressSanitizer can not provide additional info.
SUMMARY: AddressSanitizer: SEGV /.../lwip/test/fuzz/../../src/core/altcp_tcp.c:178:19 in altcp_tcp_setup_callbacks
==192415==ABORTING
Aborted
2023-04-07 22:32:18 +02:00
Jonathan Neuschäfer
95a63bc352 test/fuzz: Use HTTPS URLs and mention AFL++ 2023-04-07 22:27:30 +02:00
Jonathan Neuschäfer
e8b0324f81 test/fuzz: Don't crash with assertion failure when a packet is too big
A fuzzer may generate big packets, and it will interpret assertion
failures as bugs. Instead of asserting that the packet size is
reasonable, simply skip the packet when it's not the case.
2023-04-07 22:25:50 +02:00
Renzo Davoli
0f2de1f684 contrib/ports/unix: add vdeif 2023-04-07 22:13:55 +02:00
Renzo Davoli
427b4f9b08 add posixlib 2023-04-07 22:11:27 +02:00
Renzo Davoli
6a350a0278 contrib/port/unix/lib: exclude slipif.c source 2023-04-07 22:07:17 +02:00
Simon Goldschmidt
3fe8d2fc43 get cmake to compile under windows with ms cl compiler
Signed-off-by: Simon Goldschmidt <goldsimon@gmx.de>
2023-01-03 21:34:05 +01:00
Simon Goldschmidt
eaf4926239 UPGRADING: added a not about merging contrib 2022-12-22 22:07:16 +01:00
Simon Goldschmidt
e6341a6081 some documentation fixes after merging contrib and example apps
Signed-off-by: Simon Goldschmidt <goldsimon@gmx.de>
2022-12-22 21:42:42 +01:00
Simon Goldschmidt
790b914fea pbuf_copy_partial_pbuf: fix warning about assigning to smaller type when using '-=' operator
Signed-off-by: Simon Goldschmidt <goldsimon@gmx.de>
2022-12-22 20:43:18 +01:00
Steven Wartik
4b7a54c06c Added warning to cmake instructions when lwipcfg.h isn't present.
Signed-off-by: Simon Goldschmidt <goldsimon@gmx.de>
2022-12-22 20:42:25 +01:00