Commit Graph

6587 Commits

Author SHA1 Message Date
Erik Ekman
8fe567b86f ip6: Fix incorrect assert in ip6_frag()
New test case now passes.

Fixes bug #57374 (Found by Hiromasa Ito).
2020-06-30 01:27:37 +02:00
Erik Ekman
e2ae25d158 ip6: Add test for fragmenting special packet
Reproduces bug #57374 (Found by Hiromasa Ito).
2020-06-30 01:27:32 +02:00
Erik Ekman
90b3e45c31 pbuf: Add pbuf_copy test operating on chained pbufs
With the payload lengths not matching between source and destination.

Also remove redundant allocation check in other test, it is now done
in the test setup code.
2020-06-29 19:45:18 +02:00
Erik Ekman
a49c347b7e pbuf: Update documentation for pbuf_copy
Remove detail from when the method was called pbuf_take
which worked on packet queues.
2020-06-25 10:04:43 +02:00
Erik Ekman
488d4ad246 icmp6: Don't copy too much data
Fix of the fix for bug #58553
2020-06-24 01:09:37 +02:00
Erik Ekman
bc1da0bddb pbuf: Remove redundant tests that pbufs are freed
Already checked by lwip_check_ensure_no_alloc() in teardown function.
2020-06-24 01:00:12 +02:00
Erik Ekman
489405839a icmp6: Fix copying of chained pbuf in reply
Fixes bug #58553, and the newly added unit test.

The pbuf_take_at loop should probably be made into a pbuf library
function, which would avoid this mistake in the future and provide
a simpler implementation of pbuf_copy.
2020-06-24 01:00:12 +02:00
Erik Ekman
dd913250a9 icmp6: add test case for returning copy of chained pbufs
Currently fails due to bug #58553
2020-06-24 01:00:12 +02:00
Erik Ekman
b58e0061e0 unit: Improve message when the mem heap has usage
Show "mem heap still has 216 bytes allocated"
instead of "Assertion 'lwip_stats.mem.used == 0' failed"
2020-06-24 01:00:02 +02:00
Erik Ekman
ff67ce6e07 unit: Improve message when a memp pool has entries
Show "memp pool 'PBUF_REF/ROM' still has 2 entries allocated"
instead of "Assertion 'lwip_stats.memp[i]->used == 0' failed"
2020-06-22 00:51:09 +02:00
Daniel Pauli
0b370fbade add API function mdns_resp_netif_active() that can be used to test if an MDNS responder is active for a given network interface.
Signed-off-by: Erik Ekman <erik@kryo.se>
2020-06-19 16:23:34 +02:00
Erik Ekman
e80d4ff2cc tcp: Fix double free in tcp_split_unsent_seg()
Fixes bug #57377 (found by Hiromasa Ito).
2020-06-19 15:39:15 +02:00
Erik Ekman
ea111c511e unit: Support check v0.13.0 and later
Function name no longer needs to be fed separately when adding tests.

Also fix collision of non-static net_test variables in dhcp and netif
tests.
2020-06-19 15:39:15 +02:00
Erik Ekman
9b1056ef0e fuzz: Fix compile error in simulated glibc rand
When using LWIP_RAND_FOR_FUZZ_SIMULATE_GLIBC:

fuzz_common.c: In function ‘lwip_fuzz_rand’:
fuzz_common.c:683:11: error: comparison of integer expressions of different signedness: ‘int’ and ‘long unsigned int’ [-Werror=sign-compare]
  683 |   if (idx >= sizeof(rand_nrs)/sizeof((rand_nrs)[0])) {
      |           ^~
cc1: all warnings being treated as errors
2020-06-19 13:26:58 +02:00
Erik Ekman
0ed8f754c5 Restore travis-ci link in README 2020-06-07 13:59:31 +02:00
Erik Ekman
897bcb7d4e Update README
Remove text about contrib as separate git repo
Remove link to old travis-ci setup
Update links to https
2020-06-06 18:49:08 +02:00
Sylvain Rochet
3f47b04f16 PPP: add FIXME about removing netif_set_up() call later
User application code should be responsible to call netif_set_up() but
let's not break compatibility for now.

Signed-off-by: Sylvain Rochet <gradator@gradator.net>
2020-04-09 03:52:47 +02:00
Sylvain Rochet
c8fda8d46c PPP: use netif_set_up() instead of setting NETIF_FLAG_UP flag
NETIF_FLAG_UP flag is not supposed to be set by netif init callback
anymore, call netif_set_up() instead.

Sure it would be better to let user application code call netif_set_up()
by itself as it is now meant to be but let's not break compatibility for
now and add a FIXME for next release with allowed behavior break.

Signed-off-by: Sylvain Rochet <gradator@gradator.net>
2020-04-09 03:45:44 +02:00
Sylvain Rochet
cfe5ce9d49 init: raise an error if PPP CCP_SUPPORT==1 but MPPE_SUPPORT==0
Building PPP CCP support without adding any compressor support serve
no real use case. Forbid doing so instead of bloating the code with
more ifdef.

Signed-off-by: Sylvain Rochet <gradator@gradator.net>
2020-04-09 03:17:30 +02:00
Sylvain Rochet
cd140b1105 Revert "ppp: fix compiling with CCP_SUPPORT=1 but MPPE_SUPPORT=0"
This reverts commit 6e7ea92d56.

We better forbid building configurations that does not make sense instead
of bloating the code with more ifdef. Here building CCP support without
adding any compressor support serve no real use case.
2020-04-09 03:05:30 +02:00
Hannes Gredler
f36e51e9c9 tcp_out: fix tcp_output_fill_options() arguments
Signed-off-by: Simon Goldschmidt <goldsimon@gmx.de>
2020-04-02 20:15:58 +02:00
Simon Goldschmidt
003d34eebd tcp: fix sequence number comparison
This fixes both undefined behavior (see bug #51447) as well as a possible bug
where sequence numbers in 31 bit distance may come through.
2020-03-27 22:59:05 +01:00
Simon Goldschmidt
e30d50710d fuzz: allow overriding LWIP_RAND for fuzz tests
Fuzz tests need reproducible code, so we need an "unsafe" version of
LWIP_RAND() in this case...

Also, to reproduce fuzz tests cases from Linux on Windows,
LWIP_RAND_FOR_FUZZ_SIMULATE_GLIBC provides the first 20 random numbers that
glibc would have...
2020-03-27 22:42:06 +01:00
Simon Goldschmidt
003f5cc12d fuzz: whitespace fixes 2020-03-09 21:50:50 +01:00
Simon Goldschmidt
b795784832 fuzz: make CC overridable from 'afl-gcc'
e.g. for debugging crashes
2020-03-09 21:40:30 +01:00
Simon Goldschmidt
412c8d1902 fuzz: fix compiler error "missing prototype" 2020-03-08 20:41:53 +01:00
Simon Goldschmidt
34352e9649 altcp: mbedtls: no need for SYS_ARCH locking 2020-03-05 21:48:08 +01:00
Simon Goldschmidt
33f2b313c7 altcp: mbedtls: coding style fixes 2020-03-05 21:45:20 +01:00
Simon Goldschmidt
87618e2f2a Revert "altcp_tls_mbedtls: ensure configuration is properly freed"
This reverts commit d84a84e5ca.

This commit seemed to be merged in an invalid order
2020-03-05 21:40:23 +01:00
Simon Goldschmidt
21cde5dc9e altcp: mbedtls: fix compiling altcp_mbedtls_lower_sent() 2020-03-05 21:36:59 +01:00
Simon Goldschmidt
74cd9a8644 ip4: add unit test for ip4addr_aton 2020-03-05 21:28:52 +01:00
Karol Domagalski
2e175a23cb ip4: ip4addr_aton: fix parsing of the octal IP representation 2020-03-05 21:27:59 +01:00
Simon Goldschmidt
adbc5b5f71 tcp: tighten up checks for received SYN
Any malicous segment could contain a SYN up to now (no check).
A SYN in the wrong segment could break OOSEQ queueing.
Fix this by allowing SYN only in states where it is required.

See bug #56397: Assert "tcp_receive: ooseq tcplen > rcv_wnd"

Signed-off-by: Simon Goldschmidt <goldsimon@gmx.de>
2020-03-05 21:20:35 +01:00
Simon Goldschmidt
a02f34a193 fuzz: add pcap output to help debugging fuzz crashes 2020-03-05 21:00:00 +01:00
Simon Goldschmidt
a9052caf10 fuzz: add debug output to help debugging fuzz crashes 2020-03-05 20:49:41 +01:00
Harrold Spier
0192fe773e Fix allowing negative offset for snmp_pbuf_stream_seek()
Signed-off-by: Simon Goldschmidt <goldsimon@gmx.de>
2020-02-21 17:28:33 +01:00
Simon Goldschmidt
349c077feb Fix last commit for all netif loopback traffic 2020-02-21 17:25:51 +01:00
Nick Ballhorn-Wagner
349ec76ee5 fix memory leak in netif_loop_output if tcpip_try_callback fails
Signed-off-by: Simon Goldschmidt <goldsimon@gmx.de>
2020-02-21 17:17:08 +01:00
Simon Goldschmidt
d05be56a50 fuzz: add more fuzz tests
From: Hiromasa Ito <v3hertz@gmail.com>

See bugs #57374-#57380 found by this new test mode.
2020-02-20 21:55:13 +01:00
Simon Goldschmidt
a07e0a82c9 test: split fuzz into different files and binaries
This is in preparation to add more fuzzing code...
2020-02-17 22:05:46 +01:00
Simon Goldschmidt
fc85b055d7 sys: add the possibility to fuzz what sys_now() returns 2020-02-17 21:39:46 +01:00
Simon Goldschmidt
9b5a6fe1dc win32 port: fix LWIP_RAND() being called without sys_init()
This can happen in tests...
2020-02-17 21:28:04 +01:00
Simon Goldschmidt
04cf6bbe66 pcapif: add option PCAPIF_RX_READONLY to simulate readonly RX
This uses VirtualAlloc/VirtualProtect on windows to simulate RX buffers
that are readonly to lwIP (see task #14807).

Signed-off-by: Simon Goldschmidt <goldsimon@gmx.de>
2020-02-16 20:43:33 +01:00
Simon Goldschmidt
ea9726056c and another codespell fix 2020-02-15 21:54:24 +01:00
Simon Goldschmidt
1ffcc5079c Fix-more-typos-using-codespell
Committing nearly all changes done by 'codespell_check.sh -w'

Signed-off-by: Simon Goldschmidt <goldsimon@gmx.de>
2020-02-15 21:45:53 +01:00
jona
d6a6b661d9 Fix typos using codespell
Conservative strategy was used, maybe other typos remain.

Rebased: Simon Goldschmidt <goldsimon@gmx.de>
2020-02-15 21:45:41 +01:00
Simon Goldschmidt
69c4c8a074 codespell: change file names, add possibility to write changes
Signed-off-by: Simon Goldschmidt <goldsimon@gmx.de>
2020-02-15 21:45:22 +01:00
jona
8e0c6cd164 Add codespell wrappers : check.sh,changed_files.sh
Files adapted from the RIOT project : https://github.com/RIOT-OS/RIOT

Signed-off-by: Simon Goldschmidt <goldsimon@gmx.de>
2020-02-15 21:44:49 +01:00
Simon Goldschmidt
6e7ea92d56 ppp: fix compiling with CCP_SUPPORT=1 but MPPE_SUPPORT=0
Even if that might not make much sense, it still shouldn't
result in compiler warnings.

Signed-off-by: Simon Goldschmidt <goldsimon@gmx.de>
2020-02-15 20:53:47 +01:00
Paul Mackerras
d281d3e959 PPP, EAP: ignore received EAP messages when not doing EAP
This adds some basic checks to the subroutines of eap_input to check
that we have requested or agreed to doing EAP authentication before
doing any processing on the received packet.  The motivation is to
make it harder for a malicious peer to disrupt the operation of pppd
by sending unsolicited EAP packets.  Note that eap_success() already
has a check that the EAP client state is reasonable, and does nothing
(apart from possibly printing a debug message) if not.

Signed-off-by: Paul Mackerras <paulus@ozlabs.org>
Signed-off-by: Sylvain Rochet <gradator@gradator.net> (ported to lwIP PPP pcb struct)
2020-02-10 23:37:33 +01:00