See below commit messages for more information
mDNS: support for direct and delayed sends
There are two ways to send a response, directly and after a delay.
A probe or an announce msg are now send via the direct way and
all responses are send via the delayed way.
mDNS improved delay vs direct send behavior on questions
All multicast answers are delayed at the moment. While all unicast
answers are send out directly. A unicast answer is send when this
is requested by the QU bit, when a unicast question was send or
when the question originated from a legacy querier.
mDNS: add probe query detection.
If a probe query is detected a direct unicast respond is send.
Independent of the QU/QM bit.
mDNS split delayed multicast msgs into ipv4 and ipv6 buffers.
We are implementing a two resolvers in one (IPv6 and IPv4 together).
For directly send answers, this does not matter. But for delayed
answers, we need to make a separate buffer for both.
mDNS: addr bug, we should not clear full outmsg
memset deleted also the dest_addr and dest_port, which should remain
and is constant. This commit contains a function that resets only the
needed parts of the outmsg struct.
mDNS: do not multicast a rr within one second.
RFC6762 section 6: prevent network flooding. When a multicast packet
is send out, we start a timeout of 1s within this 1 second all
multicast requests are ignored. We do not make a difference between
the records, we set the delay for all records.
mDNS: improved split for unicast vs multicast and direct vs delayed
unicast delayed message are now possible and multicast direct msgs to.
MDNS: changed printfs to lwip debug messages
MDNS: change timeouts from max time to random time
mDNS: send multicast response on QU questions if not multicasted recently.
If a QU question is received, the responder should multicast the
answer if it did not multicast that record within 25% of it's ttl.
we implemented a stripped down version, meaning that we look at the
records as one set and use one timer for all records. So if the
responder multicasted a record within 30s of the QU question it
will respond with a unicast answer. if not, it will respond
multicast.
mDNS: timeouts -> create function for mdns timeout handling
mdns_set_timeout will check if the timer is running or not and will
update the flag to running after starting the timer.
Multicast timeouts were not set everywhere they needed to be. This
is solved.
mulit <-> multi typo fixed.
mDNS: solve commenting and style issues
mDNS: add #if LWIP_IPVx to new code
LWIP_IPV4/6 can be enabled or disabled, all combination should work.
it's more practical to use netif as a wrapper instead of wrapping
netif in the mdns packets. netif contains all information.
Netif is passed along were needed.
MDNS_TTL changed to MDNS_IP_TTL for clarity.
The mDNS RR ttl does not need to be settalbe, this is against the
RFC. RFC6762 states that for rr's with the hostname in them
somewhere, the ttl should be 120s. If it's not in their it should
be 75 minutes and if the answer is send to a legacy dns querier,
it should be no more then 10s.
This patch corrects the ttl behavior to the RFC.
mDNS.c needed to become cleaner. Domain related functions are
moved to the mdns_domain.c util module. The output related
functions are split off (clear separation between defining the
packet and generating the packet). The output functions can
now be found in mdns_out.c.
mDNS move probe question packet generation to mdns_send_outpacket
The probe any questions were added to the pbuf in the send_probe
routine. It is better if we move all pbuf generation to the output
function so later on packets can be delayed etc. keep it all in
one place.
mDNS: move legacy question generation to mdns_send_outpacket
It's better to do the pbuf generation in one place.
Especially important for message delaying etc.
mDNS take out domain related functionality and put in other file.
The mDNS file is getting very big and a lot still needs to be added.
For clarity reasons it's better to split these domain functions
from the main mDNS file.
mDNS split off output related functionality and put in other file
A lot of functions are only needed for the generation of the pbuf,
by separating them into another file we clean up the mdns file.
We only need the mdns_send_outpacket function as interface.
Packet definition is now completely separated from packet
generation.
lwip_getsockopt_internal/lwip_setsockopt_internal were renamed to
lwip_getsockopt_impl/lwip_setsockopt_impl. Update the comment accordingly.
Signed-off-by: Axel Lin <axel.lin@ingics.com>
Add define LWIP_HTTPD_SSI_EXTENSIONS to make the extension list
overridable, clarify documentation of LWIP_HTTPD_SSI_BY_FILE_EXTENSION
a bit.
Signed-off-by: Simon Goldschmidt <goldsimon@gmx.de>
This reverts commit 413b26a7e1.
It breaks the build if LWIP_SOCKET is disabled.
Plus it breaks git history for inet.h and sockets.h for no real reason.
Signed-off-by: Simon Goldschmidt <goldsimon@gmx.de>
New macro LWIP_SOCKET_HEADERS can be used to replace
LwIP sockets headers by OS's headers.
By default LWIP_SOCKET_HEADERS==LWIP_SOCKET, when LWIP_SOCKET==1
and LWIP_SOCKET_HEADERS==0, user must provide their custom headers
by setting LWIP_INCLUDE_SOCKETS and LWIP_INCLUDE_INET.
- implement server/client mode (API is nicer to use)
- Increase TFTP_MAX_MODE_LEN to be able to contain "netascii" transfer mode
- Adapt tftp_example to changes
Squashed commit of the following:
commit 2d98d8e2ef1941c3824ffb874f1e529d284667fc
Author: Jasper Verschueren <jasper.verschueren@apart-audio.com>
Date: Thu Sep 13 16:15:06 2018 +0200
AUTOIP: correct functionality autoip_supplied_address
It does not mean that if autoip is bound, it also supplied the
netif address. A check is added.
commit 2ca0a2183991ef73860c4207d95799b37acc64cc
Author: Jasper Verschueren <jasper.verschueren@apart-audio.com>
Date: Thu Sep 13 16:06:49 2018 +0200
AUTOIP: keep using the same link local address as much as possible
Only calculate a new link local address at start up or when a
conflict occured. On link up or down -> keep same address.
TODO: in the future a function for persistent storage should be
added.
commit aa70a693351e4c898aa28d8521308794614838f1
Author: Jasper Verschueren <jasper.verschueren@apart-audio.com>
Date: Thu Sep 13 14:43:14 2018 +0200
ACD, AUTOIP & DHCP: make link up & down functions where needed
When the link goes down or up the approriate functions should be
stopped or started again. To accomodate this, network_changed is
adjusted to network_changed_link_up and network_changed_link_down.
DHCP does not need to control AUTOIP. AUTOIP can take care of
itself. The only thing DHCP needs to do is starting it when
discovering is failing. The AUTOIP state variable is removed from
DHCP.
commit ad469eb006b47f8a8c37f7c0de0216f47a8c19c7
Author: Jasper Verschueren <jasper.verschueren@apart-audio.com>
Date: Thu Sep 13 11:25:58 2018 +0200
ACD: add address change listener + passive conflict detection mode
In the case their previously was a LL address on a netif that
is now configured with a routable address, we want the LL
address to be able to keep receiving packets.
for as long as the LL address is available on the interface it
should do ongoing conflict detection. But we cannot defend when
the LL address is not the netif address any more.
An address change listener is added to detect when an ACD module
needs to go from active ongoing conflict detection to passive.
When a conflict is detected autoip is stopped and will not be able
to receive packets any more. Because we have a valid routable
address on the netif, autoip is not restarted.
commit 07c4ec20cea78e2b4a6f5599569abaf075619c62
Author: Jasper Verschueren <jasper.verschueren@apart-audio.com>
Date: Tue Sep 11 16:25:37 2018 +0200
ACD: make module reusable within a netif
DHCP and AUTOIP both have ACD running simultaniously. The ACD
struct is added to the DHCP and AUTOIP structs. In the netif a list
of ACD modules is kept to loop over if functions need to perform
some action on all ACD modules (for example tmr function). With
acd_add a module can be added to the list. ACD_FOREACH loops over
the list similar to NETIF_FOREACH.
commit ee3b4585b7768f5353dd80190a2929bad45f7ff4
Author: Jasper Verschueren <jasper.verschueren@apart-audio.com>
Date: Mon Sep 10 16:36:18 2018 +0200
etharp & acd: add probe and announce functions to etharp.
The new probe and announce functions are independent of
netif->ip_addr. This means we can keep the LL address working
while we start to probe for the newly received routable address.
The netif->ip_addr does not need to be any for probing to work
with this patch.
commit 7d3032bae8f1b8081368a807682388eb642729e0
Author: Jasper Verschueren <jasper.verschueren@apart-audio.com>
Date: Mon Sep 3 13:35:51 2018 +0200
autoip -> unused random function removed + small comment update
commit be749ba4eb26ddc69233c85d532dc035741275c5
Author: Jasper Verschueren <jasper.verschueren@apart-audio.com>
Date: Fri Aug 31 16:37:36 2018 +0200
ACD: update comment in header
commit 4491842991c90b3a58fa327f70aa42f04174546b
Author: Jasper Verschueren <jasper.verschueren@apart-audio.com>
Date: Fri Aug 31 15:44:45 2018 +0200
ACD: subscribe to link down messages to stop the acd process
When the link goes down the acd process should be stopped
independent of the acd client. Otherwise the acd will keep probing
or announcing while their simply is no connection.
commit 71f668aa7583354e132c20b3b50ba2c86bf08738
Author: Jasper Verschueren <jasper.verschueren@apart-audio.com>
Date: Fri Aug 31 13:59:44 2018 +0200
DHCP coop autoip bug fix: wait after last discovery before starting autoip
After the last dhcp discovery we need to give the dhcp server the
time to respond. Currently the discovery message is send and autoip
is started simultaniously. This is changed. Autoip will now be started
after the next discovery timeout.
commit 0da16604ec079195533f2591f0d0f04bdf212a72
Author: Jasper Verschueren <jasper.verschueren@apart-audio.com>
Date: Fri Aug 31 11:23:31 2018 +0200
ACD: rate limit interval bug solved -> first decline then wait then restart.
According the the ACD RFC we need to limit the rate of acquiring
and probing addresses after MAX_CONFLICTS. It is important to first
decline the address and stop the netif from using the address before
the time is started. After this rate limit time, the address acquiring
process can be started again.
To make this possible we had to change the callback function and
the location in the process were the rate limiting is done.
commit a89a0601a251acb14abe270116f38c6d25c2d7a9
Author: Jasper Verschueren <jasper.verschueren@apart-audio.com>
Date: Thu Aug 30 17:27:10 2018 +0200
DHCP: after a succesful dhcp_reboot, the address should be probed.
Reboot means that the connection was gone for some amount of time.
This is seen as a new connection for the ACD module so should be
the address should be probed before use.
commit 853afb448ba35c6e2b35e8238c9c367c599dece7
Author: Jasper Verschueren <jasper.verschueren@apart-audio.com>
Date: Thu Aug 30 17:19:12 2018 +0200
DHCP_DOES_ARP_CHECK changed to DHCP_DOES_ACD_CHECK
small update in opt.h to add the correct dependencies.
commit e28b4766bdef69e76f6170c470c93f5b251c579a
Author: Jasper Verschueren <jasper.verschueren@apart-audio.com>
Date: Thu Aug 30 17:05:43 2018 +0200
DHCP check code replaced by ACD module.
when DHCP_DOES_ARP_CHECK is enabled, the ACD module will take care
of address conflict detection. Via a call back function the DHCP
state machine will continue and bind to an address if no conflicts
are found.
dhcp_arp_reply is obsolete because the ACD module replaces its
function.
commit 52193a0f5d13e8786a4db2fff1f1a8f1367a4eba
Author: Jasper Verschueren <jasper.verschueren@apart-audio.com>
Date: Mon Aug 27 16:05:22 2018 +0200
Issue 2 + 3 from Comment #5, task #13508 solved
Removed C++ comments and // ----... marks as requested.
commit 7faaf61275d67ccfb88ea7e26c249428c3088536
Author: Jasper Verschueren <jasper.verschueren@apart-audio.com>
Date: Mon Aug 27 15:55:24 2018 +0200
Issue 1 from Comment #5, task #13508 solved
Comments added to clarify how arp messages are handled.
commit 9348aea22623b705759fd30b873f06a50a104d16
Author: Jasper Verschueren <jasper.verschueren@apart-audio.com>
Date: Tue Jul 24 11:45:35 2018 +0200
acd: add comment for callback function
commit 49fdd1177c05b74d49fa179564dcaa5e650adbcc
Author: Jasper Verschueren <jasper.verschueren@apart-audio.com>
Date: Tue Jul 24 11:42:59 2018 +0200
autoip: Add debugging output and complete comments
commit 591856b82c029687a657a1b1ccc674522e6f4be0
Author: Jasper Verschueren <jasper.verschueren@apart-audio.com>
Date: Tue Jul 24 11:25:18 2018 +0200
Removed autoip from timeouts.c
We do not need a timer anymore. All timing is part of acd.
commit 3b3272fdd14015cfca0b3b6d149505b1cf0e36b6
Author: Jasper Verschueren <jasper.verschueren@apart-audio.com>
Date: Tue Jul 24 11:22:32 2018 +0200
autoip_network_changed -> first bring down the netif and then acd
Make it do what it says in the comment
commit 77b0ccf96efd22774279c6f9b5bade18c5e42c59
Author: Jasper Verschueren <jasper.verschueren@apart-audio.com>
Date: Tue Jul 24 11:21:23 2018 +0200
Simplified the autoIP states + update autoip_start()
commit 96e0581d36857f8b70c4b4cce4fb323fd3dd51ab
Author: Jasper Verschueren <jasper.verschueren@apart-audio.com>
Date: Tue Jul 24 11:10:48 2018 +0200
Deleted unused variables, functions and defines from autoip module
The functionality is now embedded in the acd module so can be
removed from autoip.
commit 9296e2ebb4b51019aaccfc47e8b9f51b265d37cd
Author: Jasper Verschueren <jasper.verschueren@apart-audio.com>
Date: Tue Jul 24 11:07:34 2018 +0200
Bug fix acd -> rate limiting needs to be after MAX conflicts
It was only after MAX conflicts + 1.
commit c55e16903c045d0ea84336b50eccbf24d3d097e9
Author: Jasper Verschueren <jasper.verschueren@apart-audio.com>
Date: Mon Jul 23 17:52:45 2018 +0200
Small intruduction to module added
commit d1498a37293bd9f97f6b938b48e5980ab0a01bd1
Author: Jasper Verschueren <jasper.verschueren@apart-audio.com>
Date: Mon Jul 23 17:49:58 2018 +0200
Copyright information added
I based the copyright text on the other files. I'm not sure this
is how its done. I kept Dominik in their because I copied quite
some code from the autoip module.
commit 359a845ef5e73061832069f364b370634ee0b071
Author: Jasper Verschueren <jasper.verschueren@apart-audio.com>
Date: Mon Jul 23 17:08:44 2018 +0200
Fixing comments in acd.c
commit 100d72549d0ef44157143d031848a727f5dfbe69
Author: Jasper Verschueren <jasper.verschueren@apart-audio.com>
Date: Mon Jul 23 15:43:40 2018 +0200
Probe wait time and Probe interval time made random via lwip_rand
According to the RFC a random amount of time needs to be waited
before probing can be started also a random amount of time
needs to be waited between the probes.
The random time is calculated via the LWIP_RAND function (see
lwipopts and sys_arch).
commit f7f037c32e9416f8b803c3c7af617b871b55ee35
Author: Jasper Verschueren <jasper.verschueren@apart-audio.com>
Date: Tue Jul 17 16:56:48 2018 +0200
autoip will start probing again when the network has changed
commit 1f40f6274195f24aa1b05caf82b79285ad189c2a
Author: Jasper Verschueren <jasper.verschueren@apart-audio.com>
Date: Tue Jul 17 16:55:47 2018 +0200
Duplicate code removed -> already present in autoip_start
commit be59431271da862a8ca330dbca638842c87765bc
Author: Jasper Verschueren <jasper.verschueren@apart-audio.com>
Date: Tue Jul 17 16:52:49 2018 +0200
add rate limiting to acd when too many conflicts are detected.
When more then max conflicts are detected during device on time,
the rate at which probing for a new address starts is limited.
For clarity we combined the conflict counting and the callback into
a new function acd_restart.
commit 91448455e95edb24c1f418c341b6fb306391f4f1
Author: Jasper Verschueren <jasper.verschueren@apart-audio.com>
Date: Tue Jul 17 15:50:01 2018 +0200
ARP packet conflict detection added.
If a conflict is detected between the begin until after announce
wait, a new address needs to be chosen immediatly.
This can occur in two situations:
1) another host already has this ip address
2) another host is also probing for the same address.
If a conflict is detected during announcing or during the ongoing
conflict detection, we defend our ip address once. If a second
conflict occurs during defend interval, we take another ip address.
If not we can keep our address and connections.
When a conflict occurs and it's decided we need a new address,
autoip is simply restarted. To do: test if a acd stop is needed.
This will become more important when DHCP is added I believe.
commit 65f47ba9444d8b9f767dc908319579323eeb8664
Author: Jasper Verschueren <jasper.verschueren@apart-audio.com>
Date: Tue Jul 17 15:33:44 2018 +0200
Update ACD state machine with PROBE_WAIT and and ANNOUNCE_WAIT
By adding the ANNOUNCE_WAIT state, we could remove duplicate code
that was present in the original autoip state implementation.
But because we cannot directly go to ANNOUNCING we needed this
extra state during the wait period. It also makes the different
states clearer.
Their is no need to number the enum because the compiler takes
care of this standard numbering.
Also a indent issue on the state machine code is solved here.
commit 2d9f4414c7b1f2ed35c0b5cea78dabb9c9afee77
Author: Jasper Verschueren <jasper.verschueren@apart-audio.com>
Date: Tue Jul 17 15:28:33 2018 +0200
Added an extra check for etharp responses.
Their is no need to answer a request that is initiated by ourselves.
In my test case, a conflicting request would be seen here as a
request needing a reply. Which off course isn't needed at all.
The acd module will let the requester know that it is using our
ip address.
I could not think of a reason not to add this extra check but please
check if this doesn't break other functionality.
commit f84cc1dba4061219bd1aadb97bd340278db07cd7
Author: Jasper Verschueren <jasper.verschueren@apart-audio.com>
Date: Tue Jul 17 15:27:13 2018 +0200
Redirect all incoming ARP messages to the ACD module.
The ACD module will scan the packets and react on conflicts.
autoip does not need the arp packets any more.
commit 9faf266993cc2df0b9434720b59b5922f17d7d33
Author: Jasper Verschueren <jasper.verschueren@apart-audio.com>
Date: Tue Jul 17 10:08:39 2018 +0200
Initiate acd from autoip implementation.
The state machine in autoip is now replaced by the acd module.
commit 40a5a40d911c98e6ee8566c0adce7716f26f20e0
Author: Jasper Verschueren <jasper.verschueren@apart-audio.com>
Date: Tue Jul 17 10:05:59 2018 +0200
Add simple acd state machine to timer function.
This state machine will be started from acd_start and will go
through the probing and the announcing state. At this moment the
timings are made fixed for easy debugging. Will be made variable
afterwards.
commit 0a2629bf1f7942e80ec11bcc3e163ac1a2b9a580
Author: Jasper Verschueren <jasper.verschueren@apart-audio.com>
Date: Tue Jul 17 09:44:19 2018 +0200
Disable gratuitous ARP send from netif_issue_report when acd is enabled
The acd module needs to be fully under control on what arp messages are
send. It wouldn't be a clean solution if we kept this announce as one
of the announce messages.
So when ACD is enabled, this message will not be send.
commit a7b9a4d5039168723c2043677176c5c8fc69f8df
Author: Jasper Verschueren <jasper.verschueren@apart-audio.com>
Date: Tue Jul 17 09:42:46 2018 +0200
ARP probe and announce functions added.
Both use etharp_requests to send out an arp message.
commit e2f1ce3fa84e2ce01bc944d8049412e156cd7cc7
Author: Jasper Verschueren <jasper.verschueren@apart-audio.com>
Date: Tue Jul 17 09:26:07 2018 +0200
Add conflict callback mechanism to acd module
When starting the acd with acd_start, a conflict callback has to be
provided. After probing when no conflict is detected, the callback
is called with the conflict variable on 0. From the moment a conflict
is detected, it will be called set to 1.
By not making a fixed link between acd, autoip and dhcp but working
with callback functions the user (caller) can easily use it for
fixed ip too. This keeps the acd module completely independent from
the other application layer protocols.
commit 21e7995888d2941601e99873ee129d1ea927e3f7
Author: Jasper Verschueren <jasper.verschueren@apart-audio.com>
Date: Mon Jul 16 14:41:52 2018 +0200
acd_stop function added.
When calling this function the acd state machine will be put in
ACD_STATE_OFF. This will disable the acd functionality until
acd_start is called.
commit 503037fb462504e46a14ce7486bc763dbc6a8690
Author: Jasper Verschueren <jasper.verschueren@apart-audio.com>
Date: Mon Jul 16 14:35:48 2018 +0200
acd_start function added
This function will allocate a struct for the acd module if one wasn't
added with acd_set_struct. It will then initialize the acd struct
and start the probe wait timer (for now fixed).
commit e439f6dffc44e93078a2976783bdebfe17304d8c
Author: Jasper Verschueren <jasper.verschueren@apart-audio.com>
Date: Mon Jul 16 14:22:39 2018 +0200
ACD_DEBUG define added for enabling / disabling debug messages.
commit 80d33e1eaf092934ace1045fac096464cd5be5e9
Author: Jasper Verschueren <jasper.verschueren@apart-audio.com>
Date: Mon Jul 16 11:39:37 2018 +0200
ACD struct added together with set struct function
ACD needs some variables: state, timing, probe counter etc.
We added the struct as netif data. For now one ACD module per netif
is enough. We found some unclarities about ACD with multiple IP
address on one interface. For now, ACD will only be implemented for
the IP address that is going to be used / is being used on the netif.
commit 2c4cca36744973318c3efe7cbae6384b52dc71a8
Author: Jasper Verschueren <jasper.verschueren@apart-audio.com>
Date: Mon Jul 16 11:35:06 2018 +0200
Add acd timer to timeouts.c with interval of 100ms.
This timer will be used for time to wait counting etc.
Very similar to the auto ip timer.
commit e2ed447e00c4df790df21509acb4ab09b5b79e66
Author: Jasper Verschueren <jasper.verschueren@apart-audio.com>
Date: Fri Jul 13 16:56:39 2018 +0200
Add ACD protocol definitions
commit 445733214460eae18817556439bed979e9b3747c
Author: Jasper Verschueren <jasper.verschueren@apart-audio.com>
Date: Fri Jul 13 16:07:58 2018 +0200
Add c++ option (to use C code module in c++)
commit 63d78bc1f77ac6698c3d663a1c67b40a0c297125
Author: Jasper Verschueren <jasper.verschueren@apart-audio.com>
Date: Fri Jul 13 15:57:34 2018 +0200
Added on off option for ACD module
commit d5ec4b69eb4175d4dd569bcfc80ae0e192780015
Author: Jasper Verschueren <jasper.verschueren@apart-audio.com>
Date: Fri Jul 13 15:09:40 2018 +0200
ACD IPv4 module files added
The files for IPv4 ACD or Address Conflict Detection are added
to the lwip source.
TLS clients that need 2-way authentication (e.g. Amazon AWS IoT cloud mqtt)
need to pass a certificate and private key when creating the tls altcp_pcb.
Added a new function altcp_tls_create_config_client_2wayauth() for this that
replaces altcp_tls_create_config_client() for such clients.
See bug #54601.
e.g. if the calling stack should not invoke the mdns functions due
to high stack usage, disable the option and trigger it yourself.
Signed-off-by: Simon Goldschmidt <goldsimon@gmx.de>
Fix below build error:
In file included from
../../../../lwip/src/../test/unit/tcp/test_tcp.c:3:0:
../../../../lwip/src/../test/unit/tcp/test_tcp.c: In function
‘test_tcp_rto_timeout_syn_sent_impl’:
../../../../lwip/src/../test/unit/tcp/test_tcp.c:1246:113: error: suggest parentheses around arithmetic in operand of ‘|’ [-Werror=parentheses]
const u16_t tcp_syn_opts_len = LWIP_TCP_OPT_LENGTH(TF_SEG_OPTS_MSS|TF_SEG_OPTS_WND_SCALE|TF_SEG_OPTS_SACK_PERM|TF_SEG_OPTS_TS);
^
../../../../lwip/src/include/lwip/priv/tcp_priv.h:305:4: note: in definition of macro ‘LWIP_TCP_OPT_LENGTH’
(flags & TF_SEG_OPTS_MSS ? LWIP_TCP_OPT_LEN_MSS : 0) + \
^~~~~
Signed-off-by: Axel Lin <axel.lin@ingics.com>
Fail to build if PPP_SUPPORT is disabled because PPP_NUM_TIMEOUTS
references defines that are unknown if PPP_SUPPORT == 0. Move
PPP_NUM_TIMEOUTS to PPP_SUPPORT block and set a default value to 0
if PPP_NUM_TIMEOUTS is still not defined at the end of ppp_opts.h.
Fixes: e4e0fc4193 ("PPP: set PPP_NUM_TIMEOUTS_PER_PCB value to computed number of simultaneous timers")
Signed-off-by: Sylvain Rochet <gradator@gradator.net>
A deep analysis of simultaneously running timers showed we can use a
slightly smaller value for PPP_NUM_TIMEOUTS_PER_PCB, value which was
arbitrarily chosen to a safe value based on the number of enabled PPP
features. Add the boring and long analysis to the end of our internal
header file and use the result in ppp_opts.h.
Signed-off-by: Sylvain Rochet <gradator@gradator.net>
Only the transmission side works for now (todo: dual and tradeoff mode).
Also, only a 10 second timeout mode is implemented for now.
Signed-off-by: Simon Goldschmidt <goldsimon@gmx.de>
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>
... 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>
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>
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>
This timeout is used to measure TFTP_TIMEOUT_MSECS fine enough.
Calling tftp_tmr at a 50ms interval to handle a 1 seconds timeout
produces way too much cpu load (and prevents sleep).
Signed-off-by: goldsimon <goldsimon@gmx.de>
Threads blocked on the rx mbox are counted and on close,
one "netconn closed" message per thread is posted to the mbox
to ensure all threads are woken.
The netconn can then be safely deleted. In socket API, "fd_used"
and "fd_free_pending" help with auto-deleting the netconn.
Signed-off-by: goldsimon <goldsimon@gmx.de>
This is necessary to implement fullduplex sockets that are closed asynchronously:
the netconn in the socket must not be freed before all threads have given up
using it.
We now call the first part of 'netconn_delete()' (moved to 'netconn_prepare_delete()')
from lwip_close() and only actually end up calling 'netconn_free()' from
'free_socket()', which might be called later if LWIP_NETCONN_FULLDUPLEX is enabled.
Signed-off-by: goldsimon <goldsimon@gmx.de>
netifapi related lwIP internal definitions should be guarded
by #if LWIP_NETIF_API rather than #if LWIP_NETCONN || LWIP_SOCKET.
Fix below build errors:
cc -g -DLWIP_DEBUG -Wall -pedantic -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 -Wmissing-prototypes -Wredundant-decls -Waggregate-return -Wlogical-not-parentheses -Wlogical-op -Wc90-c99-compat -Wtrampolines -I. -I../../.. -I../../../../lwip/src/include -I../../../ports/unix/port/include -I../../../../mbedtls/include -Wno-redundant-decls -DLWIP_HAVE_MBEDTLS=1 -c ../../../../lwip/src/api/netifapi.c In file included from ../../../../lwip/src/api/netifapi.c:46:0:
../../../../lwip/src/include/lwip/netifapi.h:76:50: error: unknown type name 'netifapi_void_fn'; did you mean 'netif_init_fn'?
err_t netifapi_netif_common(struct netif *netif, netifapi_void_fn voidfunc,
^~~~~~~~~~~~~~~~
netif_init_fn
../../../../lwip/src/include/lwip/netifapi.h:77:29: error: unknown type name 'netifapi_errt_fn'; did you mean 'netif_input_fn'?
netifapi_errt_fn errtfunc);
^~~~~~~~~~~~~~~~
netif_input_fn
../../../../lwip/src/api/netifapi.c: In function 'netifapi_do_netif_add':
../../../../lwip/src/api/netifapi.c:67:22: error: dereferencing pointer to incomplete type 'struct netifapi_msg'
if (!netif_add( msg->netif,
^~
Fixes: 30a2283993 ("Move netifapi private definitions to priv/api_msg.h")
Signed-off-by: Axel Lin <axel.lin@ingics.com>
This protocol is sent over a 2nd netif via UDP/IP and can used to analyze
6LoWPAN with a Wireshark dissector.
Signed-off-by: goldsimon <goldsimon@gmx.de>
This simply wasn't the case until 6LoWPAN. However, since tcpip_input is like this, we
should stay with that pattern.
Adapted documentation in netif.h
Signed-off-by: goldsimon <goldsimon@gmx.de>
Avoid "LWIP_RFC7668_LINUX_WORKAROUND_PUBLIC_ADDRESS" redefined build
warning if it's set to 0 by lwipopts.h.
Signed-off-by: Axel Lin <axel.lin@ingics.com>
Works as expected, but some features are not implemented yet.
(See patch #9364: RFC7668 - 6lowpan over Bluetooth Low Energy -- a new netif)
(I've change the file names only; sg)
Signed-off-by: goldsimon <goldsimon@gmx.de>
In contrast to netif_get_client_data, netif_alloc_client_data_id() is only
available if LWIP_NUM_NETIF_CLIENT_DATA > 0, not for DHCP etc.
This is correct in netif.c but wrong in netif.h
enum tcpip_msg_type and struct tcpip_msg have members which are only
used when core locking and/or core locking input are disabled. Remove
these from the union to reduce the size. Remove from enum to prevent
usage when these are options are disabled
A quick sizeof test with MSVC 2013 showed a 4 byte size reduction for
struct tcpip_msg (16 bytes -> 12bytes) for the following configuration:
LWIP_TCPIP_CORE_LOCKING 1
LWIP_TCPIP_CORE_LOCKING_INPUT 1
LWIP_TCPIP_TIMEOUT 0
FIN should only be reported once (as '0' for sockets, as 'ERR_CLSD' for
netconns). Before this change, ERR_CLSD was returned forever...
This is the 2nd try. First try (commit ebcae98ae6)
was buggy in that it could drop the FIN if it was read together with data
(reverted in commit ebcae98ae6).
This version fixes this by adding an apiflag and a netconn flag to keep
track of this.
clang failed to build:
../../../../lwip/src/include/lwip/tcp.h:180:11: error: parameter 'ERR_OK' not found in the function declaration [-Werror,-Wdocumentation]
* @param ERR_OK if OK, any error if connection should be dropped
^~~~~~
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>
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>
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>
LWIP_HOOK_SOCKETS_SETSOCKOPT() and LWIP_HOOK_SOCKETS_GETSOCKOPT()
are introduced to implement additional socket options. The hooks
are always called first and report back if they handled the option
or not.
Signed-off-by: goldsimon <goldsimon@gmx.de>
The LWIP_PBUF_MEMPOOL define used MEMP_ALIGN_SIZE instead of
LWIP_MEM_ALIGN_SIZE to calculate the element size of PBUF_POOL pbufs.
This is wrong for MEMP_OVERFLOW_CHECK, since MEMP_ALIGN_SIZE adds
MEMP_SANITY_REGION_AFTER_ALIGNED. This should be only added during
pool_base buffer allocation but for PBUF_POOL, it changed the size
of the pool elements.