Commit Graph

6279 Commits

Author SHA1 Message Date
Sylvain Rochet
f31160a6cb PPP, PPPoL2TP: properly ack receipt of duplicate packets
Managed to find the spirit behind the RFC. Looks like we need to send
a ZLB packet with counters as is to the packet (ZLB or not) we
previously sent to ack the message. Luckily we don't need more than
received NS/NR counters to forge the resent ack.

Signed-off-by: Sylvain Rochet <gradator@gradator.net>
2018-06-15 17:29:50 +02:00
Sylvain Rochet
738a2fe846 PPP, PPPoL2TP: stop ICCN timeout when receiving ICCN ack
Remove spurious and hitless timeout function call once L2TP reach "data"
state.

Signed-off-by: Sylvain Rochet <gradator@gradator.net>
2018-06-15 15:45:15 +02:00
Sylvain Rochet
5278202f66 PPP: remove now unnecessary null PPP IP4 output handler
netif_null_output_ip4 dummy handler appeared in netif core, remove our
own from PPP stack.

Signed-off-by: Sylvain Rochet <gradator@gradator.net>
2018-06-15 14:41:19 +02:00
Sylvain Rochet
98008cb1ab PPP, PPPoL2TP: use expected peer NS instead of current peer NS
We never use the current peer NS value but always the next expected peer
NS value (current value plus one).

Signed-off-by: Sylvain Rochet <gradator@gradator.net>
2018-06-15 14:08:03 +02:00
Sylvain Rochet
a56519032e PPP, PPPoL2TP: drop unexpected packets from peer
Conform a little bit more to the RFC by dropping duplicate received
packets. It might help discover Ns sequence issues.

Signed-off-by: Sylvain Rochet <gradator@gradator.net>
2018-06-15 14:02:58 +02:00
Sylvain Rochet
047c3c6528 PPP, PPPoL2TP: take care of Ns/Nr wraparounds
It can't be an issue since we only send and receive a few L2TP control
packets and we don't care about anything received next other than
sending Ack packet. For the sake of correctness properly handle Ns/Nr
counters wraparounds, it doesn't add more code anyway.

Signed-off-by: Sylvain Rochet <gradator@gradator.net>
2018-06-15 01:33:07 +02:00
Sylvain Rochet
5b8760601b PPP, PPPoL2TP: wait for ICCN ack before starting PPP
L2TP tunnel is really UP only once we received the ICCN Ack packet,
generally with a ZLB packet. We actually drop all data packets until
we reach the "data" L2TP state, which is a sane thing to do, therefore
it makes no sense at all to start the PPP session a bit earlier.

Signed-off-by: Sylvain Rochet <gradator@gradator.net>
2018-06-15 00:47:29 +02:00
Sylvain Rochet
b9fe13c105 PPP, PPPoL2TP: fix ZLB packets Ns value
Our Ns counter is the current slot rather than the next to ease packet
retransmission. Therefore we increment the Ns counter before using the
next slot instead of after. The RFC is written with post-increment in
mind rather than pre-increment, thus when the RFC says that Ns in not
incremented for ZLB packets it actually means that ZLB packets are sent
with the next Ns without post-incrementing the Ns value, meaning the
ZLB packet does not take a slot. Since we are using a pre-incremented
value for real slots we need to send ZLB packets with our current Ns
value plus one.

Signed-off-by: Sylvain Rochet <gradator@gradator.net>
2018-06-14 23:42:29 +02:00
Sylvain Rochet
a48ff4aaf2 PPP, PPPoE: fix trivial build error
lwip/src/netif/ppp/pppoe.c: In function ‘pppoe_send_padt’:
lwip/src/netif/ppp/pppoe.c:1048:108: error: ‘sc’ undeclared (first use in this function)

sc is not passed to ‘pppoe_send_padt’ function because it might be
called to terminate unknown sessions.

Fixes: d4047ea1d1 ("Try to fix issues reported by coverity")
Signed-off-by: Sylvain Rochet <gradator@gradator.net>
2018-06-14 19:58:41 +02:00
Axel Lin
a51c92b617 tcp_out: Fix trivial build error
Fixes: 6ac21515ca ("Add missing null checks")
Signed-off-by: Axel Lin <axel.lin@ingics.com>
2018-06-14 22:47:28 +08:00
Matthias Hofmann
6ac21515ca Add missing null checks.
Signed-off-by: Simon Goldschmidt <goldsimon@gmx.de>
2018-06-14 16:20:47 +02:00
Simon Goldschmidt
e61b925709 try to fix compiling with gcc & clang 2018-06-14 15:01:57 +02:00
Simon Goldschmidt
944f286d87 fix bug in RA MTU validation
Also fix that RA could change IPv4 MTU.
See bug #53696

Signed-off-by: Simon Goldschmidt <goldsimon@gmx.de>
2018-06-14 12:55:18 +02:00
Simon Goldschmidt
39faa8f61d added tests for ip6addr_ntoa_r 2018-06-14 12:30:14 +02:00
Simon Goldschmidt
313664c59c ip6addr_ntoa_r: correctly generate ipv4 mapped addresses 2018-06-14 12:29:40 +02:00
Axel Lin
7c03f4cf46 Silence lwip_tolower compiler warning
Fix gcc build warning: array subscript has type 'char' [-Wchar-subscripts].

Signed-off-by: Axel Lin <axel.lin@ingics.com>
2018-06-14 09:47:19 +08:00
Simon Goldschmidt
b0e5eeb7d2 udp: prefer correctly bound pcbs when receiving broadcast
See bug #53301

Signed-off-by: Simon Goldschmidt <goldsimon@gmx.de>
2018-06-13 22:01:18 +02:00
Simon Goldschmidt
1bdc669b45 udp: restructure udp_input uncon_pcb selection in preparation for fixing bug #53301 2018-06-13 21:59:04 +02:00
Simon Goldschmidt
47ebb2b267 dns: add a comment about case insensitivity 2018-06-13 15:10:47 +02:00
Simon Goldschmidt
a9d6ea5953 introduce 'lwip_tolower' and use it in dns.c
Signed-off-by: Simon Goldschmidt <goldsimon@gmx.de>
2018-06-13 15:08:11 +02:00
armink
66f7f06601 fix DNS resolution to not case insensitivity
See patch #9654

Signed-off-by: Simon Goldschmidt <goldsimon@gmx.de>
2018-06-13 15:04:46 +02:00
Matthias Hofmann
8e23b8d903 Correct UDP rebind check.
Signed-off-by: Simon Goldschmidt <goldsimon@gmx.de>
2018-06-13 15:00:21 +02:00
Simon Goldschmidt
a75332a407 ip4_frag: correctly refragment packets that already have MF set
see patch #9645

Signed-off-by: Simon Goldschmidt <goldsimon@gmx.de>
2018-06-13 14:56:18 +02:00
Simon Goldschmidt
25497bb387 bridgeif/slipif/zepif: check that input callback is not NULL 2018-06-13 10:53:50 +02:00
Simon Goldschmidt
38614e4f3e unit tests: remove dummy netif input function
This partly reverts a26a2e13 after removing that NULL check again.

Signed-off-by: Simon Goldschmidt <goldsimon@gmx.de>
2018-06-13 10:46:44 +02:00
Axel Lin
61e3f49f69 netif: Don't return error if pass NULL netif_input_fn to netif_add
The new NULL checking against netif_input_fn make ppp stop working
because in ppp_new() it calls netif_add with NULL netif_input_fn.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Simon Goldschmidt <goldsimon@gmx.de>
2018-06-13 10:39:38 +02:00
Simon Goldschmidt
3f2227f04c Fix pppos after changing PBUF_POOL to PBUF_RAM
This partly reverts 31bc2f9b which broke pppos tx as 'pppos_output_append'
implements a custom scheme of checking available pbuf size.
Added a comment why PBUF_POOL is ok for tx in this special case.
See bug #51908

Signed-off-by: Simon Goldschmidt <goldsimon@gmx.de>
2018-06-13 09:38:04 +02:00
Simon Goldschmidt
392c676ef5 fix bug #53273: IPv6 link-local address generation for non-ethernet type netif does not convert byte order 2018-06-13 08:57:17 +02:00
Simon Goldschmidt
0c5133d7cf fix ip6addr_aton for non-shortened ipv4 mapped addresses 2018-06-12 21:48:32 +02:00
Simon Goldschmidt
eb91fdd861 httpd: fix missing null termination when searching for a default file in file system folder 2018-06-12 20:14:04 +02:00
Simon Goldschmidt
a26a2e1340 adapt unit tests to additional NULL checks 2018-06-12 13:47:13 +02:00
Simon Goldschmidt
1bf323e12f remove 2 NULL checks which are wrong 2018-06-12 13:46:44 +02:00
Simon Goldschmidt
e7c0619189 fix NULL checks (compiler error, tcp_rst allows pcb==NULL) 2018-06-12 13:32:12 +02:00
Simon Goldschmidt
31bc2f9b20 fixed bug #51908: PPPOS uses PBUF_POOL in transmit pathway
Signed-off-by: Simon Goldschmidt <goldsimon@gmx.de>
2018-06-12 10:39:46 +02:00
Matthias Hofmann
342d0eadfb Add null pointer checks for TCP, UDP and netif
Signed-off-by: Simon Goldschmidt <goldsimon@gmx.de>
2018-06-12 10:24:08 +02:00
Simon Goldschmidt
6ea2483546 ip4_canforward(): don't route multicast packets
Added LWIP_HOOK_IP4_CANFORWARD to still implement multicast routing.
See bug #52914

Signed-off-by: Simon Goldschmidt <goldsimon@gmx.de>
2018-06-12 06:45:30 +02:00
Axel Lin
1fd145fbc9 Fix trivial copy-n-paste mistake in ip4_debug_print
Fixes: 288d3c2802 ("fixed bug #54006: Two compiler warnings on IAR when debug is enabled")
Signed-off-by: Axel Lin <axel.lin@ingics.com>
2018-06-12 11:36:05 +08:00
Simon Goldschmidt
2837bb310c fix ip6addr_aton handling IPv4-mapped addresses
... and added a unit test for it

Signed-off-by: Simon Goldschmidt <goldsimon@gmx.de>
2018-06-11 22:21:31 +02:00
Simon Goldschmidt
288d3c2802 fixed bug #54006: Two compiler warnings on IAR when debug is enabled 2018-06-11 20:11:47 +02:00
Simon Goldschmidt
f8e7cccf21 add new ip6 tests to (c)make list files 2018-06-10 19:23:02 +02:00
Simon Goldschmidt
31e07f90bd send router solicitations every 4 seconds
See bug #53973

Signed-off-by: Simon Goldschmidt <goldsimon@gmx.de>
2018-06-08 23:09:13 +02:00
Simon Goldschmidt
4fa33c17bc add reference to the RFC for the last commit... 2018-06-08 22:54:02 +02:00
Simon Goldschmidt
1a294622d0 ipv6 router solicitation: "ensure at least one solicitation is sent"
Fix the case where nd6_send_rs() fails: send one solicitation here,
not LWIP_ND6_MAX_MULTICAST_SOLICIT.

Signed-off-by: Simon Goldschmidt <goldsimon@gmx.de>
2018-06-08 22:45:55 +02:00
Simon Goldschmidt
fd050b8a97 fix bug #53971 Lwip sends Router Solicitation on address changes
... and add a unit test for it.

Moved resetting netif->rs_count from all reports to link-up and netif-up only.
While at it, clean up the interface a bit so that netif->rs_count is touched
from nd6.c only.

Signed-off-by: Simon Goldschmidt <goldsimon@gmx.de>
2018-06-08 22:18:50 +02:00
Simon Goldschmidt
d4845abac6 test_etharp: fix compiler warning 2018-06-08 20:03:51 +02:00
Simon Goldschmidt
ab922582dc docs: use ETH_HWADDR_LEN, not sizeof(netif->hwaddr) 2018-06-07 20:48:18 +02:00
Simon Goldschmidt
b1ffb3a8d3 Try to fix bug #53952 (ip4_addr_debug_print_val unaligned structure reference compiler warning) 2018-05-24 23:13:27 +02:00
Dirk Ziegelmeier
d996d0f486 Apply patch #9629: tftp_cleanup() should clean up more
By Jens Nielsen
2018-05-21 09:27:31 +02:00
Simon Goldschmidt
11c294e973 fix type conversion errors introduced with last commit 2018-05-17 22:35:12 +02:00
Simon Goldschmidt
0c2fdfcf42 Fix bug #53667: ARP table max size is to small
arp table functions, nd6 destination cache and struct netif_hint
can now be u16_t or u8_t depending on table size, so up to 32K
entries can be used in these tables (s16_t)

Signed-off-by: Simon Goldschmidt <goldsimon@gmx.de>
2018-05-17 21:52:01 +02:00