Commit Graph

6341 Commits

Author SHA1 Message Date
Jasper Verschueren
405fc4d802 Revert "mDNS: authority section of probe message needs to contain all records"
This reverts commit e959e6efaf8a1cb57e9a5d4d8e0056c7ea52179f.
2018-11-13 12:18:19 +01:00
Jasper Verschueren
ee7ed8c87d mDNS: cleanup probing and announcing sequence
The implementation was not fully to the standard. This commit adds
a nicer state machine implementation and multiple announce messages
with a minimum of 2.
2018-11-13 12:18:04 +01:00
Jasper Verschueren
65eb36b10d mDNS: ignore responses with src port != 5353 (rfc6762 section 6) 2018-11-13 12:17:38 +01:00
Jasper Verschueren
16da67bb21 mDNS: source address check added
RFC6762 section 5.5 and 11 define that we should check that all
packets originated on the local link.
2018-11-13 12:17:38 +01:00
Jasper Verschueren
331368e3aa mDNS: add new files to filelists + solve compile errors
ttl setting removed from example code.
string.h included where needed.
2018-11-13 12:17:38 +01:00
Jasper Verschueren
201e772e15 mDNS: author comment update + things left to implement update 2018-11-13 12:17:38 +01:00
Jasper Verschueren
4289293061 mDNS: add support for output delaying
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.
2018-11-13 12:17:37 +01:00
Jasper Verschueren
4ea5110662 mDNS: remove netif from mDNS structs
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.
2018-11-13 12:17:37 +01:00
Jasper Verschueren
62fb2fd749 mDNS fix TTL bug
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.
2018-11-13 12:17:37 +01:00
Jasper Verschueren
c4321330d0 mDNS: authority section of probe message needs to contain all records
see RFC 6762 section 8.2: for tiebreaking to work correctly in all
cases, the Authority section must contain all the records and
proposed rdata being probed for uniqueness.
2018-11-13 12:17:37 +01:00
Jasper Verschueren
3043d9d023 mDNS: move domain related functions and output related funtions
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.
2018-11-13 12:17:36 +01:00
Simon Goldschmidt
1a10a942f2 tcp_recved: fix overflow check
Improved fix instead of patch #9699.

Signed-off-by: Simon Goldschmidt <goldsimon@gmx.de>
(cherry picked from commit 98d1cb1c00)
2018-11-12 21:01:47 +01:00
Simon Goldschmidt
18b91b2841 Revert "tcp_recved: check for overflow and warn about too big values"
This reverts commit 684adaca29.

It changes the behaviour to assert for applications running good so far.

Signed-off-by: Simon Goldschmidt <goldsimon@gmx.de>
2018-11-12 21:01:05 +01:00
Simon Goldschmidt
a29fc52633 sync CHANGELOG after releasing 2.1.1 2018-11-09 17:23:17 +01:00
Axel Lin
292bd85db6 sockets: Trivial comment fixes
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>
2018-11-09 17:14:20 +08:00
Simon Goldschmidt
1d2567c7bf doc: update our docs for upload to savannah download area 2018-11-08 22:36:59 +01:00
Axel Lin
7bcf0d3334 sockets: Fix missing err_to_errno conversion for ERR_VAL in lwip_recvmsg
Signed-off-by: Axel Lin <axel.lin@ingics.com>
2018-11-08 22:43:51 +08:00
Dirk Ziegelmeier
7869d7c5f7 More snmp_traps.c documentation fixes 2018-11-08 08:35:39 +01:00
Dirk Ziegelmeier
98e31f7ba6 SNMP: Simplify two informs functions 2018-11-07 21:23:28 +01:00
Dirk Ziegelmeier
0e3bc53432 Fix comments in new SNMP code 2018-11-07 21:21:23 +01:00
Dirk Ziegelmeier
2e9c60b410 Fix unused variable in snmp_example.c when SNMP is disabled 2018-11-07 21:09:30 +01:00
Dirk Ziegelmeier
65033b6ba5 Apply patch for task #15072: SNMP support for notifications and informs (v2c)
Original author: Ognjen Bjelica
with minor fixes from Dirk Ziegelmeier
2018-11-07 21:04:53 +01:00
Dirk Ziegelmeier
93c3cfd2b1 Fix initialization of mqtt example IP 2018-11-07 21:04:53 +01:00
Dirk Ziegelmeier
0df1559056 Improve comments in setup-tapif 2018-11-07 21:04:53 +01:00
Simon Goldschmidt
f72227aadc fix compiling ETHARP_SUPPORT_VLAN without LWIP_HOOK_VLAN_SET and LWIP_VLAN_PCP 2018-11-07 10:49:06 +01:00
Simon Goldschmidt
153c295b6f altcp_tls_mbedtls: use mbedtls_entropy_func for mbedtls_ctr_drbg_seed
This is the default way for mbedTLS. Add entropy sources via defines (see
mbedtls_entropy_init).

This removes the use of ALTCP_MBEDTLS_RNG_FN

Signed-off-by: Simon Goldschmidt <goldsimon@gmx.de>
2018-11-06 21:28:45 +01:00
Dirk Ziegelmeier
fe05be110d Unix port setup-tapif: Add bridge to TAP interface 2018-11-04 08:59:41 +01:00
Dirk Ziegelmeier
feee9d903a Unix port: Give threads a name on Linux
May also work on Darwin, but I can't test it :-)
2018-11-02 20:22:22 +01:00
Dirk Ziegelmeier
ba8d9b0018 lwipopts.h: Raise number of UDP PCBs
Was not sufficient when all apps are enabled
2018-11-02 20:21:50 +01:00
Dirk Ziegelmeier
ba705d3f7f Fix assertions in udpecho.c 2018-11-02 20:19:52 +01:00
Dirk Ziegelmeier
33325bbf3b Make setup-tapif script executable 2018-11-02 19:32:39 +01:00
Joan Lledó
284659156d Remove assertion about the end of pollfd array
See bug #54933.

Signed-off-by: Simon Goldschmidt <goldsimon@gmx.de>
2018-11-01 21:56:58 +01:00
Simon Goldschmidt
3c17c1e82e fix typo in comment 2018-11-01 21:42:09 +01:00
Dirk Ziegelmeier
7c2267b966 Fix bug #54670: 127.0.0.1 sent out to netif_default? 2018-11-01 21:36:24 +01:00
Dirk Ziegelmeier
48c2056d5b Implement unit test for bug #54670: 127.0.0.1 sent out to netif_default? 2018-11-01 21:35:46 +01:00
Dirk Ziegelmeier
0c34597b9e netif: Add getter for loopif for unit tests 2018-11-01 21:35:06 +01:00
Dirk Ziegelmeier
26a84d9307 Minor: add parenthesis for cleaner code 2018-10-28 21:08:24 +01:00
Dirk Ziegelmeier
5698e57da3 VS code workspace: add unit tests 2018-10-27 22:35:54 +02:00
Florent Matignon
ffbe075d56 bug #54700: Unexpected expiry of pending ARP table entry
New etharp queries should restart the 5 second timeout on the ARP
table entry if it is still pending.

Signed-off-by: Simon Goldschmidt <goldsimon@gmx.de>
2018-10-26 20:59:10 +02:00
Simon Goldschmidt
fa37888da2 altcp_tls_mbedtls: update list of todos
Signed-off-by: Simon Goldschmidt <goldsimon@gmx.de>
2018-10-26 20:43:06 +02:00
David GIRAULT
6e994f9df2 bug #54744: if altcp_close() called from recv() callback, there is some write to freed memory
Signed-off-by: Simon Goldschmidt <goldsimon@gmx.de>
2018-10-26 19:56:54 +02:00
Simon Goldschmidt
a352f4e11c Explicitly check for TCP_MSS to be <= ~16 kByte
See bug #54890

Signed-off-by: Simon Goldschmidt <goldsimon@gmx.de>
2018-10-26 19:43:13 +02:00
Simon Goldschmidt
a41c1fcc62 patch #9350: Sockets API: use OS's sys/socket.h instead of lwip/sock
Signed-off-by: Simon Goldschmidt <goldsimon@gmx.de>
2018-10-26 19:33:47 +02:00
Dirk Ziegelmeier
6b92dd6907 CMakeCommon.cmake: Add missing newline 2018-10-24 15:08:02 +02:00
Dirk Ziegelmeier
ec28364a2f SNMP_ERR_NOTWRITABLE is a more appropriate return value for the last two commits
The instance of the SNMP node was found, that's why the functions have been called. So if set_test() and/or set_value() do not exist, it means the SNMP node instance is not writable.
2018-10-24 09:59:06 +02:00
Dirk Ziegelmeier
ee2f5c52d1 Fix the same issue as in snmp_scalar.c in snmp_threadsync.c 2018-10-24 08:54:08 +02:00
Dirk Ziegelmeier
36e2d2255e Fix wrong return value in snmp_scalar_array_get_value() 2018-10-24 08:34:32 +02:00
Simon Goldschmidt
6a1fbc7433 snmp: fix coding style in last commit 2018-10-23 20:01:06 +02:00
Dirk Ziegelmeier
2e7b4573a5 SNMP: Avoid NULL pointer dereference in snmp_scalar.c 2018-10-23 14:26:29 +02:00
Simon Goldschmidt
ff8d1a384f httpd: SSI types should be overridable (task #15071)
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>
2018-10-23 08:17:45 +02:00