Commit Graph

2703 Commits

Author SHA1 Message Date
Jasper Verschueren
d65681a7d7 DHCP request send on reboot does not contain hostname option
When the network is changed, dhcp is rebooted.
It will send a dhcp request again to verify it's lease.

DHCP requests are send out in selecting state, rebinding, renewing
and rebooting. But in the rebooting state the hostname option is
not included. This means that after reboot, the hostname will be
unknown to the DNS.

Signed-off-by: Simon Goldschmidt <goldsimon@gmx.de>
2018-07-11 19:55:49 +02:00
Axel Lin
d73efd7d38 dhcp: Prevent NULL pointer dereference in dhcp_select
Move the code to make sure netif is not NULL before calling
netif_dhcp_data(netif).

Signed-off-by: Axel Lin <axel.lin@ingics.com>
2018-07-05 21:39:00 +08:00
Simon Goldschmidt
596f742066 etharp: fix using ARP_TABLE_SIZE >= 0x80 2018-07-05 09:13:28 +02:00
Joel Cunningham
2bd1e313b9 etharp: cast netif_addr_idx_t to u16_t to match format type
This fixes an issue seen on MacOS with Clang 9.0.0:

../../../../lwip/src/core/ipv4/etharp.c:1069:142: error: format specifies type 'unsigned short' but the argument has type 'netif_addr_idx_t'
      (aka 'unsigned char') [-Werror,-Wformat]
        LWIP_DEBUGF(ETHARP_DEBUG | LWIP_DBG_TRACE, ("etharp_query: dropped previously queued packet %p for ARP entry %"U16_F"\n", (void *)q, i));
        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~

../../../../lwip/src/core/ipv4/etharp.c:1074:120: error: format specifies type 'unsigned short' but the argument has type 'netif_addr_idx_t'
      (aka 'unsigned char') [-Werror,-Wformat]
      LWIP_DEBUGF(ETHARP_DEBUG | LWIP_DBG_TRACE, ("etharp_query: queued packet %p on ARP entry %"U16_F"\n", (void *)q, i));
      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~

By default, netif_addr_idx_t is u8_t, so cast up to u16_t to match the format type
2018-07-04 16:11:46 -05:00
Simon Goldschmidt
fd0af07d2d tcp/udp bind: small code restructuring for IPv6-only
See bug #54229
2018-07-02 20:31:38 +02:00
Simon Goldschmidt
1e24f9c9cd dhcp: 2 small code improvements
See bugs #54226 and #54228
2018-07-02 20:27:12 +02:00
Simon Goldschmidt
19a929f5fb dhcp: fix parse error with chained pbfus
If a chained pbuf starts with DHCP_OPTION_PAD, an overflow check
triggers and the packet is ignored.

Fix this by changing the way the offset is increased for PAD.
Also ignore a packet that is missing the END option.

Signed-off-by: Simon Goldschmidt <goldsimon@gmx.de>
2018-07-02 20:25:42 +02:00
Simon Goldschmidt
b1487e6480 ip4_reass: fixed duplicat NULL check
See bug #54197

Rerported-by: Andrey Vinogradov <andrey.vinogradov@teplomonitor.ru>
Signed-off-by: Simon Goldschmidt <goldsimon@gmx.de>
2018-06-27 20:56:05 +02:00
Simon Goldschmidt
f3e14585ad tcp_out: fix duplicate check of tcp snd_queuelen
Can be combined into a single check using LWIP_MIN.
See bug #54194

Reported-by: Andrey Vinogradov <andrey.vinogradov@teplomonitor.ru>
Signed-off-by: Simon Goldschmidt <goldsimon@gmx.de>
2018-06-27 20:44:01 +02:00
Simon Goldschmidt
9992b48e90 fix compiling with LWIP_NOASSERT defined
See bug #54157
2018-06-20 20:56:20 +02:00
Simon Goldschmidt
824ebbe0e9 tcp: fix RTO timer not working if link is down
... and added some test cases for this situation
See bug #54139

Signed-off-by: Simon Goldschmidt <goldsimon@gmx.de>
2018-06-19 22:48:06 +02:00
Simon Goldschmidt
3cdfc67dd8 ip4_frag: fix assertion on wrong pbuf
see bug #54117

Signed-off-by: Simon Goldschmidt <goldsimon@gmx.de>
2018-06-19 21:29:16 +02:00
Simon Goldschmidt
7577e587be lwip_itoa: fix implicit conversion warning 2018-06-18 12:15:37 +02:00
Simon Goldschmidt
dbc16e6765 minor whitespace cleanup 2018-06-15 21:19:19 +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
313664c59c ip6addr_ntoa_r: correctly generate ipv4 mapped addresses 2018-06-14 12:29:40 +02: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
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
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
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
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
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
b1ffb3a8d3 Try to fix bug #53952 (ip4_addr_debug_print_val unaligned structure reference compiler warning) 2018-05-24 23:13:27 +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
Simon Goldschmidt
0f165ff136 etharp: use generic types in external access to ARP table
This should hide the internal type used for access to the ARP table
which currently is s8_t or u8_t, depending on the use case.

Signed-off-by: Simon Goldschmidt <goldsimon@gmx.de>
2018-05-17 21:16:06 +02:00
goldsimon
8f3df7c862 tcp: fix const warning for LWIP_NETIF_HWADDRHINT==1 2018-05-17 20:57:02 +02:00
Joel Cunningham
ffaee59f3e loopif: only schedule poll when first packet is enqueued
This optimizes the netif_loop_output to only schedule a call to poll when
the first packet is enqueued. This ensures netif_poll is ran once per
burst of packets that are sent (which is typical in a TCP transfer)

The old behavior scheduled a call to poll for every packet that was
enqueued and this lead to exhaustion of the MEMP_TCPIP_MSG_API memory pool
and tcpip_mbox (if port is using static mbox size). The extra callbacks are
wasted work because netif_poll drains the entire queue when ran

This issue presented itself when large TCP transfer go across the loopback
netif
2018-05-02 09:16:01 -05:00
Joel Cunningham
070e449690 loopif: disable checksums
This disable checksum generation and checking for the loopback netif
when LWIP_CHECKSUM_CTRL_PER_NETIF is enabled

Checksums are not needed for the loopback adapter and this will increase
performance for loopback communication
2018-05-02 09:16:01 -05:00
goldsimon
e05a96550f etharp: fix bogus ifdef regions
(after separating etharp and ethernet)
2018-04-25 21:17:47 +02:00
Axel Lin
9fd8222479 etharp: Cast the return value of etharp_find_entry to s8_t instead of err_t
etharp_find_entry() returns s8_t rather than err_t.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
2018-04-21 08:22:51 +08:00
Dirk Ziegelmeier
9980d09bc8 Add note about NETIF_FLAG_MLD6 netif flag 2018-04-20 08:59:36 +02:00
Dirk Ziegelmeier
4b3e996617 Add note to MLD6 that allnodes group multicasts must be received 2018-04-20 08:57:01 +02:00
Ben Wijen
7d1c6ba549 dhcp: Fix BOOTP_FILE bug
The comment in dhcp_handle_ack for 'offered_si_addr' states:
'boot file name copied in dhcp_parse_reply if not overloaded'
However this code was never reached if the packed was not 'overloaded'

Signed-off-by: goldsimon <goldsimon@gmx.de>
2018-04-19 22:18:56 +02:00
goldsimon
ef3073aaf9 LWIP_ALLOW_MEM_FREE_FROM_OTHER_CONTEXT: 'lfree' mus be volatile 2018-04-18 22:12:46 +02:00
Dirk Ziegelmeier
ffdd44ec74 Fix bug #53559: IPv4 to IPv6 filtering not freeing PBUFs
Add missing pbuf_free() call
2018-04-04 21:04:14 +02:00
Axel Lin
81acaf0ff1 tcp_out: Fix updating remainder_flags in tcp_split_unsent_seg
The code to migrate flags from original segment updating wrong variable
so both remainder and remainder_flags may be incorrect. Fix it.

Fixes: f582c88339 ("tcp: persist timer re-work (bug #50837)")
Signed-off-by: Axel Lin <axel.lin@ingics.com>
Acked-by: Joel Cunningham <joel.cunningham@me.com>
2018-03-31 11:20:03 +08:00
goldsimon
c881c48eed netif_add: check that the new netif is not already added 2018-03-21 09:32:39 +01:00
Axel Lin
6070a7ef6a netif: Add netif_do_ip_addr_changed function to reduce duplicated code
As the common code to call tcp/udp/raw_netif_ip_addr_changed is called
by multiple places, add netif_do_ip_addr_changed() to call them.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Acked-by: Simon Goldschmidt <goldsimon@gmx.de>
2018-03-14 22:59:17 +08:00
goldsimon
08bcfa2b29 netif: initialize netif->output with a dummy function for IPv6 only netifs 2018-03-13 20:29:37 +01:00
goldsimon
0074022bb5 minor: fix typos and spaces 2018-03-13 20:28:59 +01:00
goldsimon
e7766297de dhcp6_disable: need to set pcb_allocated to zero
See bug #53224: dhcp6_disable() pcb_allocated need set to zero.
2018-02-25 13:20:28 +01:00
Our Air Quality
59e98ccb19 tcp_output_fill_options: account for the SACKS length in assertion. 2018-02-24 14:46:44 +01:00
goldsimon
56124bf53b Add check in init.c: altcp does not work with LWIP_EVENT_API 2018-02-24 14:43:51 +01:00
Dirk Ziegelmeier
f595445ec0 Some fixes to DHCPv6 documentation 2018-02-23 12:54:51 +01:00
Dirk Ziegelmeier
aa04944ae0 Add DHCPv6 to documentation 2018-02-23 12:35:45 +01:00
goldsimon
d2ee10977f dhcp6: try to fix docs (clang complains) 2018-02-23 10:26:19 +01:00
goldsimon
7ad680c2bf Try to fix dhcp6.c on travis 2018-02-23 09:54:04 +01:00
goldsimon
8600259a78 tiny cleanup in dhcp.c 2018-02-22 22:33:48 +01:00
goldsimon
76a13054ee add initial support for stateless DHCPv6
Signed-off-by: goldsimon <goldsimon@gmx.de>
2018-02-22 22:33:16 +01:00
Axel Lin
fe3bb8bb78 etharp: Remove superfluous assert checking in free_etharp_q
The same checking is done while iterating the list in the while loop.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
2018-02-22 11:27:29 +08:00
goldsimon
a7b43dae49 altcp: default shutdown for both sides is close 2018-02-21 12:50:42 +01:00
goldsimon
bcff67b00e altcp_tls_alloc: need to close inner conn instead of freeing it 2018-02-20 17:08:00 +01:00
goldsimon
3bd87e3815 doc: altcp: keep altcp_alloc/altcp_free out of the docs
Those functions are for implementing altcp layers, not for applications
2018-02-20 14:08:04 +01:00
Dirk Ziegelmeier
fc3c186289 Improve altcp allocator documentation 2018-02-20 13:25:50 +01:00
Axel Lin
e9bd31b190 icmp6: Fix "LWIP_ICMP6_DATASIZE" redefined build warning if it was set to 0
Need to undefine LWIP_ICMP6_DATASIZE before change the setting.
While at it, also remove the unneeded #ifndef LWIP_ICMP6_DATASIZE
checking because it is set in lwip/opt.h.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
2018-02-20 17:54:49 +08:00
Axel Lin
a894140bb0 igmp: Use angle brackets for including string.h
Use angle brackets(<>) for including system header files.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
2018-02-20 15:20:14 +08:00
goldsimon
842b9f4429 altcp: simplify creating different types by adding an allocator concept
This is done with an example in the http_client

Signed-off-by: goldsimon <goldsimon@gmx.de>
2018-02-19 21:41:48 +01:00
goldsimon
b5448a86fd ip4_reass: free datagram entry if p == NULL 2018-02-18 08:55:11 +01:00
Joel Cunningham
618a28fc53 memp: remove include of sockets.h
Socket memory pool types have been migrated to sockets_priv.h so we
no longer need to include sockets.h
2018-02-13 14:04:01 -06:00
goldsimon
5ee77262bc mem plug_holes: fix copy& paste error 2018-02-13 12:24:10 +01:00
goldsimon
bcb6819715 dns_compare_name: change check for u16_t overflow
check upper border (0xFFFF) instead of checking for 0 after overflow
2018-02-13 12:23:50 +01:00
goldsimon
e20e9bc3d4 Try to fix issues reported by coverity 2018-02-13 12:09:18 +01:00
Dirk Ziegelmeier
d5d635cdce Minor DNS documentation improvement 2018-02-13 10:58:32 +01:00
Axel Lin
47946a29e9 memp: Remove include of lwip/netifapi.h from memp.c
struct netifapi_msg is defined in lwip/priv/api_msg.h rather than
lwip/netifapi.h. Thus remove include of lwip/netifapi.h from memp.c.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
2018-02-13 16:52:18 +08:00
goldsimon
b5e67f142a tcp: LWIP_CHECKSUM_ON_COPY: fix adding data to retx segment
See bug #50914( TCP_CHECKSUM_ON_COPY when adding data to
retransmission): when adding data to an already transmitted segment
that has an uneven length, the checksum was wrong.

To fix this, tcp_output_segment has to restore seg->chksum_swapped
before returning.
2018-02-12 12:38:17 +01:00
goldsimon
8fa55e32d2 add MEM_OVERFLOW_CHECK and combine code with MEMP_OVERFLOW_CHECK
This moves untouched memory check and defines from memp.c and memp_priv.h
to mem.c and mem_priv.h (which is new).
2018-02-09 13:44:10 +01:00
goldsimon
f9300c1fb0 netif: ext_callback: clean up netif_set_addr after last change 2018-02-07 20:37:29 +01:00
goldsimon
2a4dd0dc7b altcp: priority-based pcb/conn allocation required
altcp_tcp_new_ip_type: allocate the tcp pcb first to invoke the
priority handling code if we're out of pcbs
2018-02-04 14:00:23 +01:00
goldsimon
7edbd95b50 tcp_out: fix unused parameter when all options are off 2018-02-02 09:01:21 +01:00
goldsimon
fa9082116f tcp: add 2 hooks to add custom options to outgoing tcp segments
Signed-off-by: goldsimon <goldsimon@gmx.de>
2018-02-01 09:31:15 +01:00
goldsimon
77d0ee0961 tcp: add LWIP_HOOK_TCP_INPACKET_PCB
This hook is called from tcp_input() for all kinds of input pcbs when
selected to receive a pbuf (LISTEN, TIME_WAIT, rest). I can parse or
drop an rx pbuf.

Signed-off-by: goldsimon <goldsimon@gmx.de>
2018-02-01 09:19:16 +01:00
goldsimon
0e85582bc0 tcp: introduce ext_args per pcb
This introduces the concept of ext (external/extended) arguments per
tcp_pcb (also for listening pcbs) to store more data than just one
"void *arg" per pcb. The "arg" is for use to applications, whereas
the ext_args may be used by frameworks and leave "arg" untouched.

In addition to a void pointer, callbacks are added to help frameworks
migrate arguments from listen pcb to connection pcb and to free args
when the pcb is freed.

Signed-off-by: goldsimon <goldsimon@gmx.de>
2018-02-01 09:19:16 +01:00
goldsimon
ebe782ba16 tcp: centralize freeing tcp pcbs to memp_free
This should make it easier to add debugging messages or other hooks
to the point where tcp pcbs are deallocated.

Signed-off-by: goldsimon <goldsimon@gmx.de>
2018-02-01 09:19:15 +01:00
goldsimon
61671d6df0 tcp_out: make some more pointers const 2018-02-01 09:18:24 +01:00
goldsimon
9fb86f6e4b tcp: add a define for maximum option bytes 2018-02-01 09:14:22 +01:00
Joel Cunningham
64a351cbe0 tcp_out: remove CHECKSUM_GEN_TCP case from tcp_send_empty_ack
CHECKSUM_GEN_TCP support was moved to tcp_output_control_segment
so we can remove usage of tcphdr and the extra set of #if/#endif

This fixes https://travis-ci.org/yarrick/lwip-merged/builds/335348098
2018-01-30 17:35:40 -06:00
goldsimon
424c33bcb7 tcp_out: combine the tx path of the 4 direct tx functions
tcp_rst, tcp_send_empty_ack, tcp_keepalive and tcp_zero_window_probe
all execute the same instructions to send a segment pbuf.
Combined into tcp_output_control_segment().
2018-01-30 21:50:41 +01:00
goldsimon
9128a51944 tcp_out: make tcp_output_alloc_header generic enough for tcp_rst 2018-01-30 21:46:48 +01:00
goldsimon
1570dd8ad1 tcp_abandon: no need to buffer pcb->local_port 2018-01-30 21:43:18 +01:00
goldsimon
fdbc9f9b32 tcp_out: move around functions to group them together
This file has been a mess regarding the order of the functions.
By moving them around, they can be grouped into functions taking
part in normal data transmission (via unsent/unacked) and control
segments (which are allocated, directly sent and freed).

Signed-off-by: goldsimon <goldsimon@gmx.de>
2018-01-30 21:06:44 +01:00
goldsimon
dd6c43ecbd tcp_out: documentation update 2018-01-30 20:49:47 +01:00
goldsimon
ad3937df58 tcp: tiny doc update (mention tcp_output) 2018-01-30 20:20:22 +01:00
goldsimon
c597cfd6ca tcp_create_segment: rename arg 'flags' to 'hdrflags'
The argument name 'flags' is too unspecific because there is another
argument named 'optflags'.
2018-01-30 12:26:13 +01:00
goldsimon
83ff2014ae tcp_enqueue_flags: no need to check pcb->snd_queuelen
We only allow SYN or FIN in this functions and FIN shall always come
through, so no need to check pcb->snd_queuelen
2018-01-28 20:57:53 +01:00
goldsimon
d6cf8a3e38 tcp_out: improved some comments 2018-01-28 20:56:52 +01:00
goldsimon
6606c4013f bug #52893: Add 'old_stat' save in LWIP_NSC_IPV6_ADDR_STATE_CHANGED callback message 2018-01-25 13:05:33 +01:00
goldsimon
fe2c249fb7 bug #52937: raw_input() must tell ip4/6_input() if protocol has been received
This also moves "raw_input" and "raw_netif_ip_addr_changed" to a new file
raw_priv.h
2018-01-25 12:51:46 +01:00
goldsimon
5b75ad9019 Fix bug #52949: udp_input() checksum error for LWIP_CHECKSUM_CTRL_PER_NETIF 2018-01-22 19:51:45 +01:00
goldsimon
4a99721751 netif: try to fix gcc error (-Werror=c++-compat) 2018-01-13 09:38:18 +01:00
goldsimon
734b6ab57a netif: ensure netif_set_addr() only results in one "ext_status_callback"
This can be used e.g. in mdns to create one, not multiple "changed" triggers
if IP address and netmask change at the same time.
2018-01-12 23:11:38 +01:00
goldsimon
452c6a5378 netif: add netif_remove_ext_callback() (counterpart to netif_add_ext_callback()) 2018-01-12 22:25:34 +01:00
Dirk Ziegelmeier
653313cb37 Work on task #14780: Add debug helper asserts to ensure threading/locking requirements are met
Add LWIP_ASSERT_CORE_LOCKED() to several more places
2018-01-12 13:15:36 +01:00
Dirk Ziegelmeier
67ad6e45db Add assertion that checks for a maximum msecs value for sys_timeout() 2018-01-12 12:38:25 +01:00
Dirk Ziegelmeier
b6b14438b7 Rename lwip_sys_timers_get_next_timout() to sys_timeouts_get_next_timeout() 2018-01-11 09:53:07 +01:00
goldsimon
c257b56a39 move sys_timeouts_mbox_fetch() to tcpip_timeouts_mbox_fetch()
This cleans up the code: sys_timeouts_mbox_fetch() was only used from
tcpip.c anyway, so let's move it there.

Signed-off-by: goldsimon <goldsimon@gmx.de>
2018-01-11 09:39:36 +01:00
goldsimon
2d06483d8e ip4_frag: don't use LWIP_ERROR where we might depend in input data
fuzz test revealed that an ip header with options might land in ip4_frag() via ICMP. In this case, we can't use LWIP_ERROR() to check for not having ip options as that might be defined to assert
2018-01-09 10:25:41 +01:00
Axel Lin
deab51c36d netif: Remove unnecessary NULL checking in netif_do_set_{ipaddr|netmask|gw}
The callers already ensure the ipaddr/netmask/gw won't be NULL, so remove
the duplicated NULL checking in these static functions.
While at it, also move the code saving old_address for netmask/gw as
it's only used when address is actually being changed.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Dirk Ziegelmeier <dirk@ziegelmeier.net>
2018-01-09 08:45:37 +01:00
goldsimon
0795e289eb ip4_reass: fix double-free of pbuf and wrong ip_reass_pbufcount
This was broken by commit f1072fee8a on 07/28/17 when trying to fix bug #51595
2018-01-09 08:19:43 +01:00
Axel Lin
efa90d4294 netif: Add LWIP_ASSERT_CORE_LOCKED() to netif_set_remove_callback
Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Dirk Ziegelmeier <dirk@ziegelmeier.net>
2018-01-09 07:51:18 +01:00
Dirk Ziegelmeier
05ded5516d Apply patch #9536: netif: Prevent possible NULL pointer dereference in netif_set_addr in a modified version
Replace NULL pointers by IP4_ADDR_ANY4 - at sometime in the future, we make the NULL pointer handling obsolete and we can remove all the NULL pointer checks in the code
2018-01-09 07:51:09 +01:00
David Girault
8801cbdb30 core: fix lwip_itoa()
See discussion in bug #51729

Signed-off-by: goldsimon <goldsimon@gmx.de>
2018-01-08 21:37:31 +01:00
Dirk Ziegelmeier
bb0ba64fb0 Work on bug #52748: the bug in timeouts.c - apply Douglas' patch for absolute timeouts with modification to avoid cyclic timer overload situation 2018-01-08 12:48:48 +01:00
Dirk Ziegelmeier
5eced48869 Apply timeouts.c simplification from Douglas
Use TIME_LESS_THAN() macro instead of TIME_LESS_OR_EQUAL_THAN, it is more readable and results equivalent
2018-01-08 11:16:51 +01:00
Dirk Ziegelmeier
b6c0c52d66 Fix that one of Douglas' optimizations broke the timers
The unit tests failed and I didn't notice it :-(
2018-01-08 09:19:57 +01:00
Dirk Ziegelmeier
bbb2e50327 Fix variable shadowing warning in my last commit 2018-01-08 08:12:33 +01:00
Dirk Ziegelmeier
a31f8837b5 Partly apply patch from "Douglas" provided in bug #52748: the bug in timeouts.c
- Fix sys_untimeout implementation should not modify timer values since we are now using absolute timeouts.c
- Cleanup and simplify sys_check_timeouts() implementation
- Implement sys_restart_timeouts to rebase all timeouts based on next timer to expire

Changes by me:
- Rename TIME_LESS_THAN to TIME_LESS_OR_EQUAL_THAN
2018-01-08 07:33:40 +01:00
Dirk Ziegelmeier
eaca067c7d Make _cyclic_ timers interval more deterministic - next timeout is calculated from last due time instead of relative to current time
This eliminates the cyclic timer jitter
2018-01-08 07:16:49 +01:00
Dirk Ziegelmeier
2b4dde84e3 Apply modified patch #9533: sys_check_timeouts: recalculate the time diff after each handler call
Adapted to new timer implementation
2018-01-08 07:16:48 +01:00
Dirk Ziegelmeier
dd3861720f Fix bug #52748: the bug in timeouts.c by reimplementing timer logic to use absolute instead of relative timeout values 2018-01-08 07:16:47 +01:00
Dirk Ziegelmeier
756b7431a7 Start implementing unit tests for timers 2018-01-04 13:37:05 +01:00
Axel Lin
2cb220d7fe netif: Move LWIP_ASSERT_CORE_LOCKED out of static functions
The netif_do_set_{ipaddr|netmask|gw} are static functions what won't be called
directly, thus move LWIP_ASSERT_CORE_LOCKED to netif_set_{ipaddr|netmask|gw}.
This avoid duplicated LWIP_ASSERT_CORE_LOCKED checking by netif_set_addr().

Signed-off-by: Axel Lin <axel.lin@ingics.com>
2018-01-03 12:22:36 +01:00
Dirk Ziegelmeier
01e227d2c0 netif.c: Fix that when using LWIP_NETIF_EXT_STATUS_CALLBACK multiple callbacks instead of only one are fired when netif_set_addr() is used 2018-01-03 07:47:49 +01:00
Our Air Quality
1c7a024297 timers: add core locking assertion to tcp_timer_needed (task #14780) 2018-01-02 12:13:35 -06:00
Our Air Quality
53499f5e9f timers: rework the core locking around timers (bug #52719)
Want the core lock held while working on the timer data structures.
2018-01-02 11:54:40 -06:00
Joel Cunningham
04b983b4f3 tcp: handle pcb->snd_queuelen and chained pbufs during segment split (bug #52692)
This fixes a bug in tcp_split_unsent_seg() where a chained pbuf was
not correctly updating pcb->snd_queuelen during trimming and snd_queuelen
would desynchronize if pbuf_realloc() freed some of the chain

Also, use pbuf_clen() for adding the new remaining segment rather than ++.
The new remaining segment should always be one pbuf due to the semantics
of PBUF_RAM, but this follows the best practice of using pbuf_clen()
2018-01-02 09:16:10 -06:00
Dirk Ziegelmeier
f334ac68b6 Work on task #14780: Add debug helper asserts to ensure threading/locking requirements are met
Add LWIP_ASSERT_CORE_LOCKED() in several places
2018-01-02 15:44:08 +01:00
Dirk Ziegelmeier
b33b3bb8bb Start working on task #14780: Add debug helper asserts to ensure threading/locking requirements are met 2018-01-02 13:44:38 +01:00
Dirk Ziegelmeier
6c7e7153bc Fix bug #52704: DHCP and bad OFFER
Stop timeout only if offer is accepted
2017-12-30 12:17:24 +01:00
Axel Lin
61e90d9fc0 Use pbuf_clone to replace pbuf_alloc+pbuf_copy
Use pbuf_clone() to simplify the code a bit.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
2017-12-24 12:50:30 +01:00
Dirk Ziegelmeier
4cfef8acab Apply part from patch 9525: fix lwip_strnicmp in a modified way:
Move side effect out of boolean expression
2017-12-24 12:49:28 +01:00
goldsimon
c6887522fe Fixed lwip_itoa (bug #51729) and added unit tests for it 2017-12-23 20:35:18 +01:00
Joel Cunningham
50a5d85f45 tcp: handle segmentation oversize during segment split (bug #52676)
This fixes a bug in tcp_split_unsent_seg where oversized segments were not
handled during the split, leading to pcb->unsent_oversized and
useg->oversize_left getting out of sync with the split segment

This would result in over-writing the pbuf if another call to tcp_write()
happened after the split, but before the remainder of the split was sent in
tcp_output

Now pcb->unsent_oversized is explicitly cleared (because the remainder at
the tail is never oversized) and useg->oversized_left is cleared after it is
trimmed

This also updates the test_tcp_persist_split unit test to explicitly check for
this case
2017-12-18 11:42:13 -06:00
Axel Lin
892e30d8c1 ip4_reass: Use IPH_HL_BYTES instead of open coded
Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: goldsimon <goldsimon@gmx.de>
2017-12-17 22:14:27 +01:00
Axel Lin
4c90858482 ip4_reass: Fix build error when IP_REASS_CHECK_OVERLAP=0
The goto freepbuf code path is also used when IP_REASS_CHECK_OVERLAP=0.
Thus remove #if IP_REASS_CHECK_OVERLAP around the freepbuf label to fix
below build error:

cc -g -Wall -DLWIP_DEBUG -pedantic -Werror -Wparentheses -Wsequence-point -Wswitch-default -Wextra -Wundef -Wshadow -Wpointer-arith -Wcast-qual -Wc++-compat -Wwrite-strings -Wold-style-definition -Wcast-align -Wmissing-prototypes -Wredundant-decls -Wnested-externs -Wunreachable-code -Wuninitialized -Wlogical-op -I. -I../../.. -I../../../../lwip/src/include -I../../../ports/unix/port/include -I../../../../mbedtls/include -Wno-redundant-decls -DLWIP_HAVE_MBEDTLS=1 -c ../../../../lwip/src/core/ipv4/ip4_frag.c
../../../../lwip/src/core/ipv4/ip4_frag.c: In function
‘ip_reass_chain_frag_into_datagram_and_validate’: ../../../../lwip/src/core/ipv4/ip4_frag.c:412:7: error: label ‘freepbuf’ used but not defined
       goto freepbuf;
       ^~~~

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: goldsimon <goldsimon@gmx.de>
2017-12-17 22:13:59 +01:00
goldsimon
5500a36b29 ... and fix DEBUG string 2017-11-21 12:55:07 +01:00
goldsimon
444dfeada8 task #14600: tcp_alloc(): kill TF_CLOSEPEND connections before other ESTABLISHED 2017-11-21 12:53:33 +01:00
Axel Lin
d99144eef1 tcp: Remove superfluous variable in tcp_netif_ip_addr_changed()
Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: goldsimon <goldsimon@gmx.de>
2017-11-17 22:12:09 +01:00
Axel Lin
2ff0ef027e Use NETIF_FOREACH macro at appropriate places
Use NETIF_FOREACH macro to get some optimizations for LWIP_SINGLE_NETIF case.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: goldsimon <goldsimon@gmx.de>
2017-11-17 22:09:40 +01:00
goldsimon
8c6884b2db tcp_close_shutdown: always deallocate the pcb if there is unread data on close (see bug #52403)
We preserved the TIME_WAIT handling before, but it seems this is not correct: we want to issue
a RST later again if someone wants to talk to this port. With TIME_WAIT, this might not always
the case.
2017-11-17 22:04:52 +01:00
goldsimon
fa73f130f1 tcp: fix bug #36167 again (fixed in 2014, but when calling shutdown(WR) followed by recv(), this still happened) 2017-11-17 21:06:49 +01:00
Axel Lin
40a563cdd3 dns: Use dns_backupserver_available() instead of open-coded
Slightly better readability by calling dns_backupserver_available()
instead of open-coded. Also move dns_backupserver_available() function
up to avoid forward declaration.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: goldsimon <goldsimon@gmx.de>
2017-11-16 19:48:35 +01:00
Axel Lin
d20a7aba0c netif: Use ip6_addr_isvalid() at appropriate places
Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: goldsimon <goldsimon@gmx.de>
2017-11-16 19:48:24 +01:00
goldsimon
a73eb7ae72 pbuf.c: fix that pbuf_skip_const() was not prototyped for some configurations 2017-11-16 11:37:34 +01:00
Dirk Ziegelmeier
1fdc7571e0 Move DNS_MAX_RETRIES option from dns.c to opt.h 2017-11-13 22:52:39 +01:00
Dirk Ziegelmeier
2c1a152880 Fix bug #52239: if a DNS request is denied by a DNS server, this DNS request shouldn't be stopped if there is another DNS server to try
Apply improved version of Xiaodong Sun's patch
2017-11-13 22:51:08 +01:00
Dirk Ziegelmeier
a56ea1b19f dns.c: Rename goto label memerr to ignore_packet
Label is more descriptive this way
2017-11-13 22:37:38 +01:00
Dirk Ziegelmeier
a82054d24f Follow-up to patch #9472: tcp_kill_prio: Don't kill active connection that has the same priority
Correctly search for connection with lowest prio AND longest inactivity time
2017-11-13 22:13:11 +01:00
Joel Cunningham
637bce91b4 netif: ensure link and admin states are up in issue reports (bug #52353)
This fixes a bug where some callers of netif_issue_reports were not
checking that both link and admin states were up, leading to extraneous
reports when calling one of the following

 1) netif_set_ipaddr
 2) netif_ip6_addr_set_parts
 3) netif_ip6_addr_set_state

The bug has been fixed by placing link and admin state checks in
netif_issue_reports and not requiring the callers to perform this
checking
2017-11-08 13:38:48 -06:00
Dirk Ziegelmeier
d864f8c3a3 Fix bug #52368: Minor typo in comment
I think "Internet checksum functions" is OK
2017-11-08 19:52:40 +01:00
Axel Lin
a8acca5902 Trivial typo fix
s/chekc/check/g

Signed-off-by: Axel Lin <axel.lin@ingics.com>
2017-11-07 13:44:43 +01:00
Joel Cunningham
a78dbb25c5 docs: small clean ups for last couple of commits:
* Fix typos in LWIP_NO_CTYPE_H comment block
 * Update comment around caller of tcp_kill_prio()
2017-11-06 09:37:10 -06:00
Dirk Ziegelmeier
d8b6cdffcb Apply patch #9472: tcp_kill_prio: Don't kill active connection that has the same priority
in a modified, IMHO more readable way.
2017-11-06 12:53:08 +01:00
Axel Lin
41cf4012af pbuf: Simplify pbuf_get_contiguous implementation
Use pbuf_skip_const() to simplify the implementation.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
2017-11-06 12:22:32 +01:00
Axel Lin
c1efb9e296 pbuf: Make pbuf_add_header/pbuf_remove_header return error if invalid parameters
It does not make sense to return success in p == NULL or
invalid header_size_increment/header_size_decrement cases. Fix it.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
2017-11-06 12:22:30 +01:00
Dirk Ziegelmeier
849dfb17c7 The macros in ip6_addr.c are duplicated from ip4_addr.c, so move them to lwIPs portability layer
...didn't see that in the first place...
2017-11-05 10:27:46 +01:00
Dirk Ziegelmeier
93f4245e89 ip6_addr.c: Convert several macros to private #defines
The macros are functions from ctype.h, but ctype.h declares them as functions, not as #defines
It makes no sense to abstract them in lwIPs portability layer, the functions are of low complexity and they are only used in this file.
2017-11-05 10:13:24 +01:00
Dirk Ziegelmeier
a9a3d473ac Make xchar() a private #define of ip6_addr.c, it is not standardized in any C header 2017-11-05 10:06:25 +01:00
Joel Cunningham
472f7985b5 Introduce LWIP_PACKED_CAST to fix error issue with ARMCC
ARMCC when using __packed structures will not implicitly convert a
pointer to a member of a packed structure to something which does not
have __packed. This results in a compiler error and was found with calls
to icmp6_param_problem

While there is a #pragma pack mode in ARMCC that disables this error, it
does require existing ports to switch over their packing mode and
perform integration
2017-11-01 09:05:06 -05:00
Dirk Ziegelmeier
08ec234127 Related to patch #9471: pbuf: Drop casting to u8_t for increment the reference count
Cast to correct type: Needed to avoid warnings about integer cast (-Wconversion)
SYS_ARCH_SET cannot be used here
2017-10-28 15:41:15 +02:00
Joel Cunningham
b953bd0393 docs: fix minor mis-spelling in sys.c 2017-10-27 15:33:18 -05:00
Joel Cunningham
b296d2c7bb docs: update tcp_kill_prio same priority comments
tcp_kill_prio will kill the oldest active connection of same/lower
priority. Update all comments so that it's clear the same priority
can be killed
2017-10-25 09:08:23 -05:00
Dirk Ziegelmeier
ddcf9cc764 Move all rawapi.txt to appropriate doxygen docs 2017-10-20 21:40:23 +02:00
Dirk Ziegelmeier
a8edee8268 Move all text from sys_arch.txt to appropriate doxygen places 2017-10-20 18:23:06 +02:00
Dirk Ziegelmeier
8a46a853d2 Improve system abstraction layer doxygen docs by moving documentation from sys_arch.txt to sys.c 2017-10-17 22:38:18 +02:00
Dirk Ziegelmeier
84b2a0f55b Remove raw API TCP/UDP function documentation from rawapi.txt - it is now integrated in doxygen docs.
This avoid having a second description for the same stuff that is "bit-rotting" because noone remembers to update this file.
Also remove outdated and misleading zero-copy TX information.
2017-10-17 21:59:34 +02:00
Dirk Ziegelmeier
d020bfc0df Improve UDP documentation using rawapi.txt texts 2017-10-17 21:50:18 +02:00
Dirk Ziegelmeier
001e1f1127 Improve lwIP doxygen documentation by copying several passages from rawapi.txt to the corresponding doxygen places 2017-10-16 23:24:52 +02:00
Dirk Ziegelmeier
921f601b5d Improve lwIP doxygen documentation by copying several passages from rawapi.txt to the corresponding function documentation 2017-10-16 23:14:28 +02:00
Joel Cunningham
de531131c5 Fix compiler warnings seen with clang 8.1.0 on MacOS
This fixes the following warnings:

test_tcp.c:266:5: error: code will never be executed [-Werror,-Wunreachable-code]
    pbuf_free(p);
    ^~~~~~~~~
 - The check API 'fail' aborts the test, thus pbuf_free(p) will never be executed

pbuf.c:783:111: error: format specifies type 'unsigned short' but the argument has type 'u8_t' (aka 'unsigned char') [-Werror,-Wformat]
      LWIP_DEBUGF( PBUF_DEBUG | LWIP_DBG_TRACE, ("pbuf_free: %p has ref %"U16_F", ending here.\n", (void *)p, ref));
      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~
 - LWIP_PBUF_REF_T is u8_t by default and doesn't match U16_F, so cast to u16_t. The cast and formatter will need to be changed
   if ref is larger than 16 bits

ethernet.c:105:16: error: format specifies type 'unsigned char' but the argument has type 'unsigned int' [-Werror,-Wformat]
               (unsigned)ethhdr->dest.addr[0], (unsigned)ethhdr->dest.addr[1], (unsigned)ethhdr->dest.addr[2],
~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 - addr[] is type u8_t, formatter is X8_F which should be 8 bits. 'unsigned' is an int, so cast to unsighed char instead
2017-10-13 07:52:34 -05:00
goldsimon
8fc69c9858 Revert changes of 07434aa73a (accidentally committed local changes) 2017-10-06 11:45:10 +02:00
goldsimon
ad4358592a add MEM_SANITY_CHECK (behaves like MEMP_SANITY_CHECK) and ensure 'ram_end->prev' does not get changed 2017-09-26 22:30:18 +02:00
goldsimon
a61aee337b mem.c: beautify converting between struct mem and heap index (add ptr_to_mem/mem_to_ptr) 2017-09-26 22:13:44 +02:00
goldsimon
1710fc1a89 Fix a corner case of double-free in the heap 2017-09-25 22:29:02 +02:00
goldsimon
f058364d7f Added two simple unit tests for illegal calls to mem_free() 2017-09-25 21:38:00 +02:00
goldsimon
5e187bb8bc Tiny typo fix 2017-09-25 20:24:47 +02:00
Jens Nielsen
7115384b15 Clear seg->oversize_left after sending OK
Signed-off-by: goldsimon <goldsimon@gmx.de>
2017-09-25 20:21:17 +02:00
Our Air Quality
dbd726959c [PATCH] Replace the OOSEQ max bytes and pbufs constants with functions.
Some systems need to take into account an RX buffer pool size when
advising an appropriate number of RX pbufs to queue on the ooseq
list. For some systems there is a practical hard limit beyond which
the rx pool becomes exhausted blocking reception of further buffers
until some are freed.

It also helps to be able to consider the available dynamic memory when
advising an appropriate maximum number of bytes to buffer on the ooseq
list.

These decisions can also benefit from knowing the number already
allocated on a particular pcb, so the ooseq tcp segement is passed to
these functions. For example, if the system only wants to allow the
total number of rx pbufs queued on all the ooseq lists to grow by one
and a pcb already has two then it can return three for this call, but
might return one for another call - supporting a greedy allocation
strategy.

Signed-off-by: goldsimon <goldsimon@gmx.de>
2017-09-21 10:36:21 +02:00
goldsimon
7dcc407c53 tcp_in: favour local variables over ifdef blocks 2017-09-21 10:12:36 +02:00
goldsimon
8f459cc242 Make TCP_OOSEQ_MAX_BYTES and TCP_OOSEQ_MAX_PBUFS work independently 2017-09-21 09:52:51 +02:00
goldsimon
6d2b181cc0 tcp_in: favour code block over #ifdef blocks for local variables only used in TCP_OOSEQ_MAX_BYTES || TCP_OOSEQ_MAX_PBUFS configs 2017-09-21 09:50:47 +02:00
David Girault
f48c71e17f altcp_tcp: free altcp_pcb struct in altcp_tcp_close()
Signed-off-by: goldsimon <goldsimon@gmx.de>
2017-09-20 20:50:03 +02:00
Jisu Kim
6447a583e2 ipv6 ready: When there are more fragments(Mbit is not zero), payload_length field in IPV6 header must be the multiple of 8 (see patch #9455)
Signed-off-by: goldsimon <goldsimon@gmx.de>
2017-09-19 14:29:27 +02:00
Jisu Kim
fa11461f84 ipv6 ready: Added exception handling to parse a routing header (see patch #9455)
Signed-off-by: goldsimon <goldsimon@gmx.de>
2017-09-19 14:21:10 +02:00
Jisu Kim
675c6e4428 ipv6 ready: Hop-by-Hop and destination option header must be checked more detailed (see patch #9455)
Hop-by-Hop, Destination option header structures consist of 2 unsigned char; next option type and header length field.
And TLV(Type-Length-Value) option headers come by the number in header length field.
If the option type in TLV option header is not recognized and 2 MSB is not 0, it is handled as an exception.

Signed-off-by: goldsimon <goldsimon@gmx.de>
2017-09-19 14:18:38 +02:00
Jisu Kim
72171c12b5 ipv6 ready: Hop-by-Hop and destination option header must be checked more detailed (see patch #9455)
Hop-by-Hop, Destination option header structures consist of 2 unsigned char; next option type and header length field.
And TLV(Type-Length-Value) option headers come by the number in header length field.
If the option type in TLV option header is not recognized and 2 MSB is not 0, it is handled as an exception.

Signed-off-by: goldsimon <goldsimon@gmx.de>
2017-09-19 14:12:10 +02:00
Jisu Kim
acb4b60517 ipv6 ready: icmp6_param_problem() should send an exact offset to point to the error (see patch #9455)
For this, convert 'u8_t nexth' to a pointer and change 'icmp6_param_problem()' to take a pointer, not an offset number

Signed-off-by: goldsimon <goldsimon@gmx.de>
2017-09-19 14:11:30 +02:00
Jisu Kim
7b27df1b83 ipv6 ready: clean up ipv6 header structs and add more header types & defines (see patch #9455)
Signed-off-by: goldsimon <goldsimon@gmx.de>
2017-09-19 14:08:16 +02:00
Dirk Ziegelmeier
931b5e643c Reformat core code using astylerc 2017-09-17 20:38:38 +02:00
Dirk Ziegelmeier
8c59be74c1 Reformat IPv4 code using astylerc 2017-09-17 20:33:27 +02:00
Jisu Kim
bd94297115 icmp6_send_response() sends the pointer in network byte order (see patch #9455: IPv6 ready test on RFC2460)
Signed-off-by: goldsimon <goldsimon@gmx.de>
2017-09-16 22:46:42 +02:00
Jisu Kim
27b7ed17fc First step to passing IPV6 Ready test: time out IPv6 fragments after 60 seconds
(added IPV6_REASS_MAXAGE as an option that is independent of the IPv4 setting)

Signed-off-by: goldsimon <goldsimon@gmx.de>
2017-09-16 22:41:35 +02:00