Tim Cussins
7ac3056da9
sockets.c: Add missing lwip_select_dec_sockets_used within lwip_select.
...
Signed-off-by: goldsimon <goldsimon@gmx.de>
2017-04-18 20:50:33 +02:00
goldsimon
0952e618bd
netconn_drain(): use lwip_netconn_is_err_msg() on acceptmbox, too.
2017-04-18 10:54:40 +02:00
Axel Lin
0b2a652317
api_msg: Use lwip_netconn_is_err_msg instead of NULL test in netconn_drain()
...
The NULL test no longer work after commit e0a2472706
, it needs to test with
lwip_netconn_is_err_msg() instead.
Fixes: e0a2472706
("netconn/sockets: remove fatal error handling, fix asynchronous error handling, ensure data before RST can be received")
Signed-off-by: Axel Lin <axel.lin@ingics.com>
2017-04-18 10:47:42 +02:00
Joel Cunningham
f28c1c851b
loopif: set pbuf if_idx during poll
...
This sets the pbuf's if_idx during the loopif poll function (the
equivalent netif input function). This was found during IP_PKTINFO
development where p->if_idx is read and was uninitialized
2017-04-15 11:31:38 -05:00
goldsimon
bf01941b23
opt.h: provide LWIP_NUM_SYS_TIMEOUT_INTERNAL as default value for MEMP_NUM_SYS_TIMEOUT that can be extended by local lwipopts.h
2017-04-12 21:52:34 +02:00
goldsimon
dfc57f0289
mqtt: move struct mqtt_client_s and inner structs to new file mqtt_priv.h (to hide it from apps but provide it for tests)
2017-04-12 21:50:58 +02:00
goldsimon
5310d8f13c
event_callback: separated ++ from if
2017-04-12 12:40:50 +02:00
goldsimon
e0a2472706
netconn/sockets: remove fatal error handling, fix asynchronous error handling, ensure data before RST can be received
2017-04-12 12:37:16 +02:00
goldsimon
064044eeae
sockets: speed up event_callback: don't iterate select_cb_list for NETCONN_EVT_RCVPLUS/SENDPLUS if the socket has been readable/writable before already
2017-04-12 09:12:55 +02:00
goldsimon
58c21eb13c
sockets: speed up event_callback: don't iterate select_cb_list for NETCONN_EVT_RCVMINUS/SENDMINUS
2017-04-11 20:59:00 +02:00
goldsimon
b6fdb61654
sockets.c: refactor event_callback() a bit
2017-04-11 20:55:47 +02:00
goldsimon
b0af09ec45
select_cb_ctr no needed any more for LWIP_TCPIP_CORE_LOCKING==1
2017-04-11 12:50:25 +02:00
goldsimon
92997756d1
task #14420 (Remove sys_sem_signal from inside SYS_ARCH_PROTECT crit section) done for LWIP_TCPIP_CORE_LOCKING==1
2017-04-11 12:40:44 +02:00
goldsimon
26d3466f50
Add macro ETH_ADDR() to initialize a struct eth_addr with its 6 bytes and taking care of correct braces
2017-04-11 08:49:15 +02:00
Dirk Ziegelmeier
8695e6e6cb
Fixup BRIDGEIF_INITDATA2 macro
2017-04-07 08:59:26 +02:00
Dirk Ziegelmeier
7ba5cc3d52
Improve bridgeif doxygen docs
2017-04-07 08:01:38 +02:00
Joel Cunningham
557a11047d
Patch #9307 : Replace mem_malloc+memset with mem_calloc
...
Aside from reducing source code, on systems which use MEM_LIBC_MALLOC,
this has the potential to improve performance depending on the underlying
memory allocator
See http://stackoverflow.com/questions/2688466/why-mallocmemset-is-slower-than-calloc
2017-04-05 14:53:24 -05:00
goldsimon
b34f2d5605
altcp: allocate altcp_pcbs from a pool, not from heap (new option MEMP_NUM_ALTCP_PCB defaults to MEMP_NUM_TCP_PCB)
2017-04-05 12:18:48 +02:00
Dirk Ziegelmeier
0f4ad57033
Fix build error in bridgeif.c
2017-04-05 08:11:37 +02:00
goldsimon
9c78909857
bridgeif: sanity-check init_data->max_ports <= BRIDGEIF_MAX_PORTS
2017-04-04 22:12:38 +02:00
goldsimon
77df9ccd5a
bridgeif: fix that max_fdb_static_entries was used to init dynamic FDB
2017-04-04 22:09:31 +02:00
goldsimon
2a30fedbea
fix passing NULL to netif_set_gw & netif_set_netmask (or netif_set_addr or netif_add) (broken on 18.03.2017 by 2d9ef2215b
)
2017-04-04 22:08:37 +02:00
goldsimon
97f4033a8a
bridgeif: improve documentation
2017-04-04 21:54:52 +02:00
goldsimon
8ed2bd4771
bridgeif: gracefully handle out-of-memory in bridgeif_fdb_init
2017-04-04 21:54:30 +02:00
goldsimon
e65a0950b2
mem_calloc: check for mem_size_t overflow when multiplying 2 mem_size_t input values
2017-04-04 21:52:01 +02:00
Dirk Ziegelmeier
6559ffd848
Fix C++ style comment in altcp_tls_mbedtls.c
2017-03-31 13:05:04 +02:00
goldsimon
33466ee6a8
dhcp_parse_reply: return ERR_VAL instead of asserting on offset-out-of-pbuf
2017-03-30 22:30:27 +02:00
goldsimon
1c57c84200
vj_uncompress_uncomp: copy from/to bigger buffers (used for checks before) instead of cs->cs_ip and ip; just to help static code analysis to see this is correct ;-)
2017-03-30 21:54:42 +02:00
goldsimon
aa0601a66d
snmp_asn1_dec_tlv: explicitly check 'length_bytes > pbuf_stream->length' (for clarity, even if it would fail in pbuf_stream later)
2017-03-30 21:31:44 +02:00
goldsimon
3aa854409a
pbuf_copy_partial: remove double-check of 'buf' and 'dataptr'
2017-03-30 21:29:53 +02:00
goldsimon
4313bf2a74
altcp_tls_mbedtls: fix TX when lower write returns ERR_MEM
2017-03-30 14:55:37 +02:00
goldsimon
51dbd1a7c0
altcp: added altcp_get_port()
2017-03-30 14:19:31 +02:00
Dirk Ziegelmeier
4a7569fc2d
SNMP traps: Fix ignored return values
2017-03-30 13:01:10 +02:00
Dirk Ziegelmeier
132c285fd4
SNMP. Fix several ignored return values
2017-03-30 12:50:32 +02:00
Dirk Ziegelmeier
2673e635a3
Fix community string length copying - correctly handle long strings
2017-03-30 11:09:35 +02:00
Dirk Ziegelmeier
8d149e63a6
SNMP: strcpy -> strncpy, strlen -> strnlen
2017-03-30 08:57:53 +02:00
Joel Cunningham
c722261142
tcp: bug #50614 : move unsent queue check/pcb->snd_buf update
...
This commit corrects what looks like an ancient incorrect organization
of the logic for processing an ACK which acks new data. Once moved,
we can also change to using TCP_SEQ_LEQ on ackno instead of TCP_BETWEEN
because ackno has already been checked against snd_nxt
The work of checking the unsent queue and updating pcb->snd_buf (both
steps required for new data ACK) should be located under the conditional
that checks TCP_SEQ_BETWEEN(ackno, pcb->lastack+1, pcb->snd_nxt)
The comment following the unsent queue check/pcb->snd_buf update even
indicates "End of ACK for new data processing" when the logic is clearly
outside of this check
From what I can tell, this mis-organization isn't causing any incorrect
behavior since the unsent queue checked that ackno was between start of
segment and snd_nxt and recv_acked would be 0 during pcb->snd_buf update.
Instead this is waisted work for duplicate ACKS (can be common) and other
old ACKs
2017-03-29 16:24:54 -05:00
goldsimon
720f9b3a0b
fix compiling altcp_tls_mbedtls sources/headers if mbedtls is not available
2017-03-29 23:02:16 +02:00
goldsimon
856b49a057
lwip_sendmsg: fix check for unsupported flags
2017-03-29 22:38:16 +02:00
goldsimon
5d600f72d2
bridgeif_input: check netif != NULL before calling netif_get_client_data()
2017-03-29 22:27:00 +02:00
goldsimon
ca9f57c09f
lwip_fcntl/F_GETFL: no need to check sock->conn != NULL: already checked by get_socket()
2017-03-29 22:26:34 +02:00
goldsimon
5b6c654dd1
make F_GETFL return file access mode for !CORE_LOCKING as well
2017-03-29 20:54:24 +02:00
Joan Lledó
172dab1289
lwip_fcntl() returns access modes
2017-03-29 20:46:30 +02:00
Dirk Ziegelmeier
33e3ee0790
Clarify LWIP_ALTCP_TLS usage a bit
2017-03-29 08:52:19 +02:00
Dirk Ziegelmeier
8fd90ea136
improve mqtt documentation
2017-03-29 08:43:27 +02:00
Dirk Ziegelmeier
fbcdb4d9f1
Fix function name in altcp.c
2017-03-29 08:22:35 +02:00
Dirk Ziegelmeier
2ca717e18d
altcp_tls.h: Document ARM mbedtls port
2017-03-28 21:34:00 +02:00
Dirk Ziegelmeier
40df1474cc
SNMP: Advertise SNMPv3 support
2017-03-28 21:33:37 +02:00
Dirk Ziegelmeier
3266511ebb
Improve documentation, add TLS stuff
2017-03-28 21:25:49 +02:00
Dirk Ziegelmeier
9b6192bd65
Create smtp_opts.h and add SMTP client to doxygen docs
2017-03-28 21:14:56 +02:00
Dirk Ziegelmeier
f7ac739022
Correct a few header #include guards
2017-03-28 20:44:39 +02:00
Dirk Ziegelmeier
b9dffc5e4b
Filelists.mk: Move all mbedtls related files to own section
2017-03-28 20:42:21 +02:00
Dirk Ziegelmeier
3826bcceab
Move SMTP from contrib to main lwIP rep - with TLS support, it becomes useful again
2017-03-28 20:40:47 +02:00
Dirk Ziegelmeier
38651b8069
Cleanup #include structure of altcp_tls a bit
...
(as discussed with Simon today)
2017-03-28 20:31:25 +02:00
goldsimon
b09b3fa4e6
altcp_tcp: some more debug checks
2017-03-28 16:20:20 +02:00
goldsimon
898d3832a7
more fixes for !LWIP_ALTCP: move mqtt client struct definitions to mqtt.c
2017-03-28 14:12:22 +02:00
goldsimon
537c258efa
httpd/altcp: add forgotten functions
2017-03-28 14:04:40 +02:00
Dirk Ziegelmeier
7599706808
One more try to fix mqtt.c
2017-03-28 12:30:26 +02:00
Dirk Ziegelmeier
1c5237b6c4
Try to fix build of mqtt after ALTCP_TLS changes
2017-03-28 11:48:01 +02:00
goldsimon
8b6b270287
mqtt: clean up struct prototypes a bit
2017-03-28 09:20:59 +02:00
goldsimon
8673610f3f
mqtt: add TLS support
2017-03-28 09:19:32 +02:00
goldsimon
26a6e034fc
mqtt: convert to altcp API
2017-03-28 09:14:35 +02:00
goldsimon
1dfe916808
altcp_tcp: use 'void* state' to store tcp_pcb, not 'altcp_pcb* inner_conn'
2017-03-28 09:09:13 +02:00
goldsimon
881ab3011e
mqtt: pass client_user/client_pass to server if != NULL
2017-03-27 22:25:26 +02:00
goldsimon
ca43e64d35
minor: fixed typo in doc
2017-03-27 12:23:02 +02:00
Daniel Elstner
751ee7a534
SNTP: Implement round-trip delay compensation
...
Introduce a new configuration define SNTP_COMP_ROUNDTRIP to compensate
for network round-trip delays when setting the system clock from SNTP.
Note that this feature requires compiler support for 64-bit arithmetic.
2017-03-27 10:43:03 +02:00
Daniel Elstner
cc77b308a4
SNTP: Unify timestamp extraction from response packet
...
Avoid piecemeal invocation of pbuf_copy_partial() for each SNTP header
field. The new code may sometimes copy more than necessary, but the
complexity is reduced.
2017-03-27 10:43:02 +02:00
Daniel Elstner
2fa9cd8530
SNTP: Streamline timestamp handling
...
Generalize the NTP timestamp conversion arithmetic, and provide hooks
for using native NTP timestamps when setting or getting the system
clock time. Convert microseconds to a fraction as needed when getting
the system time.
2017-03-27 10:43:01 +02:00
Daniel Elstner
9323ad3211
arch: Optionally support 64-bit integers
2017-03-27 10:43:00 +02:00
goldsimon
596bddac47
altcp: added raw tcp fallback for altcp_get_ip() #if !LWIP_ALTCP
2017-03-26 22:29:18 +02:00
goldsimon
425b2dda61
altcp_get_ip: added altcp_get_ip(), added default functions that only defer a call to the inner_conn (moved from tls_mbedtls to generic altcp)
2017-03-26 22:26:40 +02:00
goldsimon
1ab89ed5e6
bridgeif: fixed IPv6-only build
2017-03-26 20:52:05 +02:00
goldsimon
6add16e36b
altcp_tls_mbedtls: fixed memory leak introduced by delayed deallocation
2017-03-25 20:35:46 +01:00
goldsimon
0581a77731
Prepare altcp_tls_mbedtls for TLS clients (not fully tested yet)
2017-03-24 15:25:43 +01:00
goldsimon
540b527cf4
remove LWIP_RANDOMIZE_INITIAL_LOCAL_PORTS config option (this is implicitly done via #ifdef LWIP_RAND)
2017-03-24 14:29:06 +01:00
goldsimon
a2bc02d682
altcp_tls_mbedtls: improve sent/recved handling
2017-03-23 22:04:36 +01:00
goldsimon
1ddb125e2c
altcp_tls_mbedtls_mem: fix compiling for sizeof(mem_size_t) < sizeof(size_t)
2017-03-23 12:15:54 +01:00
goldsimon
d71653f049
sockets.c: fix compiling in release mode
2017-03-23 10:44:28 +01:00
Dirk Ziegelmeier
819224f0e5
Fix bug #50618 : dhcp_remove_struct() macro does not work
...
Patch by Benjamin Silvestre
2017-03-23 09:52:13 +01:00
goldsimon
a49e040072
sockets: remove select_cb definitions #if !LWIP_SOCKET_SELECT
2017-03-23 08:34:56 +01:00
goldsimon
5149141790
altcp_tls: remove declarations #if !LWIP_ALTCP_TLS
2017-03-23 08:34:36 +01:00
goldsimon
1e26652d2e
renamed altcp_mbedtls files to altcp_tls_mbedtls
2017-03-23 08:34:02 +01:00
Dirk Ziegelmeier
ab736a4764
Add altcp to doxygen docs
2017-03-22 23:32:32 +01:00
Dirk Ziegelmeier
7e12240af3
Improve TCP documentation a bit
2017-03-22 23:32:17 +01:00
Dirk Ziegelmeier
d04dc46ccb
Add altcp_tls to Filelists.mk
...
Some compile fixes in altcp_mbedtls.c
2017-03-22 23:09:48 +01:00
Dirk Ziegelmeier
060a47f88a
Add altcp to Filelists.mk
...
Some compile fixes in altcp_tcp.c and httpd.c
2017-03-22 22:57:50 +01:00
Mikhail Lappo
7eba14cb76
Possible null-pointer dereference
...
The value should be dereferenced after
assertion is performed. This can lead
to crash
2017-03-22 22:50:16 +01:00
Mikhail Lappo
08cb949aea
Fread return value unused
...
Assert that fread was able to read
specified amount of chunks
2017-03-22 22:47:15 +01:00
goldsimon
8360054884
sanity check hdr_buf size
2017-03-22 22:46:49 +01:00
Mikhail Lappo
89b6fa479e
Possible out of bound exception
...
hdr_buf has size of 4096. Makes sense to assert that
we do not exceed this size before copying there
2017-03-22 22:45:06 +01:00
goldsimon
d386374449
httpd: add support for https
2017-03-22 22:42:09 +01:00
goldsimon
afaa7d9561
httpd: prepare for https: move initialization code to shared function
2017-03-22 22:41:24 +01:00
goldsimon
2f3b00efb4
httpd: convert to altcp API (a simple search & replace...)
2017-03-22 22:33:50 +01:00
goldsimon
967d4fc3b0
LWIP_ALTCP: default to off for maximum backwards compatibility...
2017-03-22 22:33:23 +01:00
goldsimon
c18393b52b
altcp: added 'addrinfo' and 'tcp_state' functions
2017-03-22 22:29:11 +01:00
goldsimon
a46664eab2
Add opts header for altcp_tls
2017-03-22 21:40:32 +01:00
goldsimon
82d9e45f74
Add protoypes for TLS connections for the new altcp API + an implementation doing HTTPS (server mode for now) with mbedTLS (ATTENTION: this might not be coded secure enough for productive use yet!)
2017-03-22 21:33:05 +01:00
goldsimon
e8e247f22e
Add "application layered TCP connection API (altcp)"
...
altcp is an abstraction layer that prevents applications linking against the
tcp.h functions but provides the same functionality. It is used to e.g. add
SSL/TLS or proxy-connect support to an application written for the tcp callback
API without that application knowing the protocol details.
Applications written against the altcp API are directly linked against the
tcp callback API for LWIP_ALTCP==0, but then cannot use layered protocols.
2017-03-22 21:31:14 +01:00
goldsimon
d58457de43
tcp: move some higher level definitions from tcp.h to new file tcpbase.h (in preparation for altcp API)
2017-03-22 21:15:46 +01:00
goldsimon
ee5021deb1
tftp_server: fix bogus comment lines in file header
2017-03-22 21:14:36 +01:00
goldsimon
ba20cd229e
api_msg:accept_function(): fix typo
2017-03-22 21:12:09 +01:00
Mikhail Lappo
eba1b971c0
Possible null-pointer dereference
...
In assertion the pointer that is potentialy
null is dereferenced. The check for null was
located after.
2017-03-22 15:50:34 +01:00
Dirk Ziegelmeier
9e20fe2cfb
Apply [patch #9287 ] Possible null-pointer dereference from Mikhail Lappo in a modified way
...
Moved the debug output to a location where we know that newpcb != NULL
Fixes possible NULL pointer dereferencing in debug message output
2017-03-22 14:58:13 +01:00
goldsimon
c3912e35f6
httpd: regenerate example fs (fsdata.c) with current makefsdata
2017-03-21 13:06:26 +01:00
goldsimon
ec24a2a4e8
Revert "httpd: regenerate example fs (fsdata.c) with current makefsdata"
...
This reverts commit 66fb52ff5c
.
2017-03-21 12:57:56 +01:00
goldsimon
66fb52ff5c
httpd: regenerate example fs (fsdata.c) with current makefsdata
2017-03-20 22:19:54 +01:00
goldsimon
d11292505b
httpd: use capital 'T' for content types, add more content types, provide the possibility to add more content types at compile time (HTTPD_ADDITIONAL_CONTENT_TYPES)
2017-03-20 22:19:05 +01:00
Dirk Ziegelmeier
2d9ef2215b
Fix bug #50576 : LWIP_NSC_IPV4_GATEWAY/NETMASK/SETTINGS_CHANGED should check if the setting is actually being changed
2017-03-18 15:30:20 +01:00
goldsimon
aef2accfa3
try to satisfy clang's '-Wempty-body'
2017-03-17 11:22:30 +01:00
goldsimon
3fd8440ab9
memp.h: added missing include
2017-03-17 08:55:10 +01:00
goldsimon
d9a738d85f
sockets: fix lwip_getsockname/lwip_getpeername for dual-stack: ip_addr_t type "any" (dual) has to be converted to AF_INET6
2017-03-17 08:54:51 +01:00
goldsimon
fc47f846ed
Fix and improve sockets unit test and unit test sys_arch (with a little help of tcpip.c)
2017-03-16 22:49:38 +01:00
goldsimon
8313c4d870
tried to add basic socket unit tests (nonsense only for now); made LOCK_TCPIP_CORE()/UNLOCK_TCPIP_CORE() overridable for that
2017-03-16 21:52:30 +01:00
goldsimon
2d8e17aa89
sockets: guard declaration of 'lwip_select()' with LWIP_SOCKET_SELECT==1
2017-03-16 09:18:53 +01:00
goldsimon
e71dbec587
bridgeif: fix compiling with NO_SYS==1 by changing default value of BRIDGEIF_PORT_NETIFS_OUTPUT_DIRECT
2017-03-16 09:18:28 +01:00
Dirk Ziegelmeier
d9b279d150
Cleanup documentation a bit: rename "Addons" to "NETIFs" - its a more appropriate name
2017-03-15 20:03:55 +01:00
Dirk Ziegelmeier
6328da87aa
Add bridge interface to documentation
2017-03-15 19:58:32 +01:00
goldsimon
2dcf31d6b1
bridgeif: better separation between bridgeif and fdb (todo: move fdb to contrib?), tried to fix the build for LWIP_NUM_NETIF_CLIENT_DATA==0
2017-03-15 16:50:55 +01:00
goldsimon
946b231516
lwip_init(): at least IAR warns about "LWIP_UNUSED_ARG(a)" accessing an uninitialized variable... Try to fix this by initializing it (it will be optimized away anyway)
2017-03-15 16:47:59 +01:00
goldsimon
51a07661cc
Added a simple multi-netif 802.1d bridge implementation to show that a multi-port netif works (see task #14369 )
2017-03-15 12:31:12 +01:00
Dirk Ziegelmeier
1f1f2e1c46
Try to fix line endings of tftp_server.c in git rep
2017-03-14 09:12:25 +01:00
goldsimon
754e49643f
set version to 2.0.3.dev now that 2.0.2 is released
2017-03-14 09:06:06 +01:00
goldsimon
eb1aadb218
implement udp/raw recvmsg() by moving recvfrom() into a common function taking an array of iovecs... (IP_PKTINFO/in_pktinfo still missing)
2017-03-13 22:31:17 +01:00
Dirk Ziegelmeier
59973c96e4
Fix bug #50534 : TFTP server does not copy terminating null of filename
...
Patch by David Rodgers
2017-03-13 21:26:06 +01:00
goldsimon
cb1a271c61
lwip_recvmsg: MSG_PEEK must be limited to the first iov for TCP
2017-03-11 20:42:59 +01:00
Dirk Ziegelmeier
1371400c2b
mdns_domain_add_label_base should be static
2017-03-11 10:41:47 +01:00
goldsimon
7bcb4eafec
mdns: minor(?) stack usage and performance improvement by letting mdns_readname_loop() copy from pbuf to struct (instead of pbuf->buffer->struct)
2017-03-10 23:00:46 +01:00
goldsimon
5752b24d38
fix bug #50503 : LWIP_NETCONN_FULLDUPLEX: some LWIP_ERROR paths don't call done_socket()
2017-03-10 11:52:59 +01:00
goldsimon
1b14c2e7b0
sockets: fix printf warning in gcc
2017-03-10 07:56:14 +01:00
goldsimon
2c77560870
My first try at 'recvmsg()', TCP only, for now...
2017-03-09 21:49:55 +01:00
goldsimon
7ffe5bfb3c
tcp: watch out for pcb->nrtx overflows and tcp_backoff indexing overflow
2017-03-09 13:29:41 +01:00
David van Moolenbroek
5827c168c2
tcp: do not keep sending SYNs when getting ACKs
...
If a locally generated TCP SYN packet is replied to with an ACK
packet, lwIP immediately sends a RST packet followed by resending the
SYN packet. This is expected, but on loopback interfaces the resent
SYN packet may immediately get another ACK reply, typically when the
other endpoint is in TIME_WAIT state (which ignores the RSTs). The
result is an endless loop of SYN, ACK, RST packets.
This patch applies the normal SYN retransmission limit in this
scenario, such that the endless loop is limited to a brief storm.
2017-03-09 13:22:49 +01:00
Joel Cunningham
b90a54f989
bug #50476 : initialize ssthresh to TCP_SND_BUF
...
This commit changes ssthresh to be the largest effective congestion
window (amount of in-flight data). This follows the guidance of RFC
5681 which recommends setting ssthresh arbitrarily high.
LwIP was previously using the receive window value at the end of the
3-way handshake and in the case of an active open where the receiver
used window scaling and/or window auto-tuning, this resulted in a very
small ssthresh value even though the window ramped up once the connection
was established
2017-03-08 16:36:35 -06:00
Joel Cunningham
fd9ac30062
Fix dual-stack build failure in lwip_sendmsg
...
This corrects a typo introduced in c9d0192b4a
that broke the build for dual-stack (IPv4 and IPv6)
2017-03-08 16:34:49 -06:00
Sylvain Rochet
e16d10ade6
PPP: remove unused and confusing return values other than ERR_OK for ppp_connect and ppp_listen
...
User should not use ppp_connect or ppp_listen return value to retry
later, it must wait for the callback to be called. This is primarily
done this way to have a consistent behavior with and without the
holdoff feature.
Remove returned error value from PPP link level API connect and listen
callbacks because we are not using them anymore, then make ppp_connect
or ppp_listen to always return ERR_OK, thus we are not breaking the PPP
user API.
We don't need the return code here, all PPP link level drivers can't
fail at all (e.g. PPPoS) or retry if necessary (PPPoE and PPPoL2TP).
2017-03-08 22:17:40 +01:00
goldsimon
aff1935e40
arch.h: include <limits.h> if it exists (at least INT_MAX is used)
2017-03-08 20:30:48 +01:00
goldsimon
c9efb7a72c
added missing define for MSG_NOSIGNAL
2017-03-08 19:57:10 +01:00
goldsimon
c797222407
lwip_sendmsg: implement EMSGSIZE checks
2017-03-07 21:48:59 +01:00
goldsimon
c9d0192b4a
lwip_sendmsg: small performance improvement: netbuf can be allocated on the stack as it is used internally only (see lwip_sendto)
2017-03-07 21:43:23 +01:00
goldsimon
270fdfff07
netconn_write_vectors_partly() watch out for overflow of data to send (must fit into INT_MAX for sockets)
2017-03-07 21:30:03 +01:00
goldsimon
4dd378b126
socket sendto: gracefully handle 'size' not fitting into an u16_t (return EMSGSIZE error) see task #14378
2017-03-07 20:56:37 +01:00
goldsimon
5c33efe430
minor: indentation fix
2017-03-07 20:37:52 +01:00
goldsimon
194803a3a7
netbuf: correctly reset netbuf checksum for LWIP_CHECKSUM_ON_COPY==1
2017-03-07 20:37:06 +01:00
goldsimon
c6c693923e
One more try to fix the build...
2017-03-07 09:45:01 +01:00
goldsimon
53f717338b
sockets: fixed printf format (not reported by mingw port due to -Wno-format)
2017-03-07 08:59:26 +01:00
goldsimon
b71d4477ea
socket tcp performance tweak: handle window update (call into tcpipi_thread) only once per recv for multi-segment receives
2017-03-06 22:22:22 +01:00
goldsimon
f0bc2fa968
netconn_tcp_recvd should take u32_t, not u16_t (as used in msg)
2017-03-06 22:20:41 +01:00
goldsimon
f02119af62
lwip_recvfrom: fix tcp socket error handling
2017-03-06 22:13:58 +01:00
goldsimon
04bff63f49
sockets: netconn event callback is only used for select (nonblocking sockets are now implemented at netconn layer) -> add option LWIP_SOCKET_SELECT to reflect this
2017-03-06 22:06:53 +01:00
goldsimon
c77a7fe824
lwip_recv_tcp: fix full-duplex: remove invalid calls to done_socket()
2017-03-06 22:03:02 +01:00
goldsimon
30be7b582e
sockets: remove sock->lastoffset and free unused pbufs instead (using pbuf_free_header)
2017-03-06 21:54:50 +01:00
goldsimon
49414826af
pbuf: added new function pbuf_free_header() to gradually hide bytes and free pbufs from the front of a pbuf chain
2017-03-06 21:53:48 +01:00
goldsimon
c295717ce7
sockets: clean up all the if/else in lwip_recvfrom and use new nonblocking features in netconn API: I'm OK with code duplication if it gets more readable :-/
2017-03-06 21:50:42 +01:00
goldsimon
1945582c10
netconn: added receive flag NETCONN_NOAUTORCVD and netconn_tcp_recvd() to delay rx window updates (e.g. when receiving more data as performance improvement)
2017-03-06 21:33:35 +01:00
goldsimon
b86787c39c
Improve code readability by moving tcp-specific functionality from netconn_recv_data() to new static function netconn_recv_data_tcp() since all tcp code paths are different anyway
2017-03-06 21:27:33 +01:00
Dirk Ziegelmeier
e15e504217
Some minor SNMPv3 related cleanups
2017-03-06 09:38:58 +01:00
Joel Cunningham
dd4ded3978
do_writemore: fix blocking bug
...
A bug was introduced in the atomic vector feature for blocking netconns
where if we couldn't write the entire vector due to send buffer being
full (write_more is 0), we would not update the vector state and then
when sent_tcp() is called, it would actually re-send the previous vector
and if additional calls were required to finish the write, msg.w.offset
would eventually exceed msg.w.len, This was found by testing "stats"
from the shell and hitting the LWIP_ASSERT in do_writemore() that
checks offset < len
The fix simply updates the vector state after every ERR_OK return from
tcp_write(). While not all cases (non-blocking sockets) need to update
the state in this case, it keeps the logic simple and also makes
debugging simpler because you don't have stale vector state at any
point
2017-03-04 12:34:44 -06:00
Dirk Ziegelmeier
02be2f8f42
Move snmpv3_dummy.* from main lwIP rep to contrib
2017-03-03 13:42:37 +01:00
Dirk Ziegelmeier
9719c52e62
SNMPv3: Missed two locations where the new enums can be used
2017-03-03 13:21:22 +01:00
Dirk Ziegelmeier
c961ac70b6
Fixump snmp/snmpv3_dummy.h copyright header
2017-03-03 13:17:06 +01:00
Dirk Ziegelmeier
6f485cc870
snmp/snmpv3_dummy.c: Set default configuration in snmpv3_dummy_init()
...
(Note: snmpv3_dummy.* will be moved to lwip-contrib soon)
2017-03-03 13:12:47 +01:00
Dirk Ziegelmeier
461f1fe1a9
More SNMPv3 cleanups: Create own header snmpv3_dummy.h and move functions in there
...
Decouple snmp_netconn.c from snmpv3_dummy.c (snmpv3_enginetime_timer)
Make SNMP API more type-safe using enums
2017-03-03 13:01:04 +01:00
Dirk Ziegelmeier
ecb3867803
SNMPv3: Rename tcpip_enginetime_timer to snmpv3_enginetime_timer
2017-03-03 12:32:22 +01:00
Dirk Ziegelmeier
927990d94e
One enum icmp_te_type member is not in doxygen docs - fix it.
2017-03-03 09:56:27 +01:00
Joel Cunningham
2980f7cc58
Vectorize netconn_write for TCP
...
This commit adds support to the netconn write APIs to take an input of
vectors instead of a single data pointer
This allows vectors sent on a TCP connection via sendmsg to be treated
atomically. The set of vectors is segmented into as much data as can
fit into the send buffer and then the TCP output function is called
Previously, each vector was passed to netconn_write_partly and tcp_write
segmented it into its own packet, which was then it was sent via
tcp_output (if not Nagleing)
This commit adds vector support to lwip_netconn_do_writemore() which
is the meat of the TCP write functionality from netconn/sockets layer.
A new netconn API netconn_write_vectors_partly() takes a set of vectors
as input and hooks up to do_writemore()
This commit also defines IOV_MAX because we are limited to only
supporting 65535 vectors due to choice of u16_t for the vector count
2017-03-02 16:52:14 -06:00
goldsimon
3feb748fee
Simplify lwip_accept() and lwip_ioctl() by relying on nonblocking netconn functions instead of sock->rcvevent
2017-03-02 20:47:02 +01:00
goldsimon
5c3bb19923
added nonblocking accept/recv to netconn API (task #14396 ) (also added netconn_recv_udp_raw_netbuf_flags() and netconn_recv_tcp_pbuf_flags() to pass socket-like flags to nonblock for one call only)
2017-03-02 20:38:11 +01:00
Dirk Ziegelmeier
593b211d1b
A few more SNMPv3 cleanups
2017-03-02 11:20:02 +01:00
goldsimon
1b3aaef525
lwip_sendmsg/tcp: prevent PSH until all iovecs are enqueued
2017-03-02 09:27:32 +01:00
Dirk Ziegelmeier
3fa3bf0570
Undo accidental activation of SNMPv3 code in my last commit
2017-03-02 07:50:34 +01:00
Dirk Ziegelmeier
0065cd915f
Several Win32 compile fixes in SNMP code
2017-03-02 07:49:42 +01:00
Dirk Ziegelmeier
83de16678c
SNMP: TABs -> spaces
2017-03-02 07:33:18 +01:00
goldsimon
05a595f745
httpd: LWIP_HTTPD_POST_MANUAL_WND: fixed double-free when httpd_post_data_recved is called nested from httpd_post_receive_data() (bug #50424 )
2017-03-01 22:08:05 +01:00
goldsimon
5f0fbdcde9
fixed warning about potentially unused variable 'netif' after changing ip4/6_input_accept to return in, not netif*
2017-03-01 21:46:36 +01:00
Dirk Ziegelmeier
ea41480232
Replace several C++ style comments by C-style
2017-03-01 21:25:03 +01:00
Dirk Ziegelmeier
4ef21e2597
Fix compile when SNMPv3 is disabled
2017-03-01 20:39:39 +01:00
Dirk Ziegelmeier
78cdbff1b3
Several compile fixes for Marco's patch
2017-03-01 20:39:39 +01:00
Dirk Ziegelmeier
576a8228c2
Add new files to Filelists.ml
2017-03-01 20:39:39 +01:00
Dirk Ziegelmeier
fef7ce3c0d
Some whitespace fixes to Marco's patches
2017-03-01 20:39:39 +01:00
Marco
f0605a510f
Modified the snmpv3_dummy implementation to be more functional.
...
The dummy implementation also implements the user table as a reference.
2017-03-01 20:39:39 +01:00
Marco
3b8bb580e4
Add framework MIB and USM mib if SNMPv3 is enabled.
2017-03-01 20:39:39 +01:00
Marco
4b97f2bb8e
Implemented usm mib.
2017-03-01 20:39:39 +01:00
Marco
46df850cb9
Implemented framework mib.
2017-03-01 20:39:39 +01:00
Marco
f8f3cc039a
Start a timer for enginetime handling.
...
This timer function should be implemented in the snmpv3_xxx.c file.
2017-03-01 20:39:39 +01:00
Marco
f092d09121
Added handling invalid packets in SNMPv3.
2017-03-01 20:39:39 +01:00
Marco
78806001e5
Made accepted SNMP version runtime configurable.
...
This feature can be disabled by setting LWIP_SNMP_CONFIGURE_VERSIONS to 0.
2017-03-01 20:39:39 +01:00
Marco
8fd09d4608
Added missing context specific tags.
2017-03-01 20:39:39 +01:00
Marco
ec044e826e
Replaced old LWIP_SNMPV3_GET_ENGINE_BOOTS macro.
...
Replaced old LWIP_SNMPV3_GET_ENGINE_BOOTS macro with the new snmpv3_get_engine_boots_internal function.
2017-03-01 20:39:39 +01:00
goldsimon
a9bfe7b72f
Fix compiling httpd for LWIP_HTTPD_SUPPORT_POST==1 (assigning int to u16_t)
2017-03-01 20:32:13 +01:00
goldsimon
0d585d55d3
Added LWIP_SINGLE_NETIF for small targets with only one netif (see task #13515 , there might be more optimizations to come with this option)
2017-03-01 16:10:50 +01:00
goldsimon
f978a7ed31
let ip4/6_input_accept return int instead of netif*
2017-03-01 14:16:27 +01:00
goldsimon
18c7c5d81c
fixed my last commit (NETIF_FOREACH does not yet exist :)
2017-03-01 14:12:50 +01:00
goldsimon
7c9a6317b9
refactor ip4/ip6 packet-to-netif matching to remove the ugly 'first' flag
2017-03-01 14:09:18 +01:00
Dirk Ziegelmeier
ec4f00179d
Fix bug #50242 : dhcp_release does not stop autoip (in coop mode)
...
Create new function dhcp_release_and_stop() that stops DHCP statemachine and sends release message if needed. Also stops AUTOIP if in coop mode.
Old dhcp_release() and dhcp_stop() function internally call dhcp_release_and_stop() now.
2017-03-01 13:18:37 +01:00
Dirk Ziegelmeier
d8135f9ae2
Fix bug #50427 : SNMP: ifIndex should use netif_get_index()
...
We have netif_get_index(netif) now
2017-03-01 12:34:47 +01:00
goldsimon
1741edf159
make tcp apps depend on LWIP_CALLBACK_API, too
2017-02-28 12:19:16 +01:00
goldsimon
f85eed0ab3
tcp: fixed bug #50418 : LWIP_EVENT_API: fix invalid calbacks for SYN_RCVD pcb
2017-02-28 12:13:26 +01:00
David van Moolenbroek
d3fc398580
arp/ndp: allow overriding the decision to copy pbufs
...
lwIP aims to support zero-copy TX, and thus, must internally handle
all cases that pbufs are referenced rather than copied upon low-level
output. However, in the current situation, the arp/ndp packet queuing
routines conservatively copy entire packets, even when unnecessary in
cases where lwIP is used in a zero-copy compliant manner. This patch
moves the decision whether to copy into a centralized macro, allowing
zero-copy compliant applications to override the macro to avoid the
unnecessary copies. The macro defaults to the safe behavior, though.
2017-02-28 09:37:21 +01:00
Dirk Ziegelmeier
27c835aa56
Remove netif_invoke_ext_callback() from doxygen docs, it is intended for internal use only
2017-02-27 09:36:33 +01:00
Dirk Ziegelmeier
01f9a04e4a
Add pbuf_get_contiguous() to doxygen docs
2017-02-26 09:44:16 +01:00
Dirk Ziegelmeier
9ab2eefc37
Fix documentation in sockets.c
2017-02-26 09:42:06 +01:00
Dirk Ziegelmeier
08931b33c1
Fix documentation on pbuf_get_contiguous()
2017-02-25 17:03:14 +01:00
Joel Cunningham
36b9a45c3b
netconn_write_partly cleanups
...
This commit changes netconn_write_partly to use msg.w.offset to set
bytes_written for both blocking and non-blocking connections
This is correct because msg.w.offset is the canonical output from
the do_write call and in the case that not all bytes were written,
(a bug?) returning the full size to the caller is dangerous
Lastly, this commit adds an assert for the blocking case to sanity
check that all the bytes we requested were written. This will help
catch bugs in do_write
2017-02-24 15:50:28 -06:00
Joel Cunningham
36fa1a97d4
lwip_netconn_do_writemore() cleanups
...
This commit makes a couple of cleanups discussed in patch #8882 :
1) msg.w.offset should not be set to 0 in the error case. It is
only valid when err == ERR_OK
2) Remove out-of-date comment which indicated the entire write had
completed (not true for non-blocking write)
This also updates the documentation on offset to include that offset
is only valid when err == ERR_OK
2017-02-24 15:42:07 -06:00
goldsimon
0da9cf70ea
Added pbuf_get_contiguous() to get data in one piece (either zero copy from pbuf or memcpied into a supplied buffer)
2017-02-24 21:36:49 +01:00
goldsimon
a38e937dd6
fixed close race conditions in lwip_select (for LWIP_NETCONN_FULLDUPLEX)
2017-02-24 21:29:29 +01:00
goldsimon
f4d13d52d3
fixed get_socket, fixed LWIP_SOCKET_OFFSET != 0
2017-02-24 21:23:53 +01:00
goldsimon
8bb43e7388
Added a few missing calls to done_socket()
2017-02-24 21:11:20 +01:00
goldsimon
6786c9f143
Start working on bug #44032 : added sock->fd_used that is != 0 when at least one thread is using a socket
2017-02-24 21:00:01 +01:00
goldsimon
9afe10e23d
make get_socket use tryget_socket, added tryget_socket_unconn in preparation of properly fixing bug #44032
2017-02-24 20:49:18 +01:00
goldsimon
f1f6050ad7
minor: comment, whitespace
2017-02-24 19:50:53 +01:00
goldsimon
d73e225519
lwip_select: check for correct 'maxfdp1' parameter range
2017-02-24 19:50:14 +01:00
goldsimon
3107d4a0fa
fixed that select ignored invalid/not open sockets in the fd_sets (bug #50392 )
2017-02-24 19:48:59 +01:00
goldsimon
01cc06bcb8
netif_add: ensure netif->num is unique even if more than 255 netifs have been added/removed since system startup (e.g. by ppp)
2017-02-23 20:41:54 +01:00
goldsimon
76763c9bcd
pbuf_ref: assert-check for 'ref' overflow
2017-02-23 20:16:51 +01:00
Dirk Ziegelmeier
e94e2da3ec
opt.h: Set LWIP_PBUF_REF_T back to u8_t, s8_t has no advantage any more after reverting last commit
2017-02-23 18:10:00 +01:00
Dirk Ziegelmeier
2cf3bbddd4
pbuf_free: Use correct type LWIP_PBUF_REF_T for local variable
2017-02-23 18:08:26 +01:00
Dirk Ziegelmeier
0f6d8ccd90
Revert "Improve pbuf refcount underflow check by checking the local variable on the stack that was assigned in a protected region"
...
This reverts commit 62c44138da
.
Didn't notice due to local changes the ASSERTION was already inside the locks...
2017-02-23 18:04:30 +01:00
Dirk Ziegelmeier
62c44138da
Improve pbuf refcount underflow check by checking the local variable on the stack that was assigned in a protected region
...
The old code was vulnerable to race conditions since it checked ref to be >0 without locks
2017-02-23 16:55:14 +01:00
Dirk Ziegelmeier
0a7734cf64
Preparation for task #14369 : Define ways to work with a netif having multiple ports
...
Let ethernet_input() fill in pbuf's if_idx (if not already set by driver or an L2 bridge)
2017-02-23 16:36:40 +01:00
Dirk Ziegelmeier
0eeb10d4bb
Preparation for task #14369 : Define ways to work with a netif having multiple ports
...
Add if_idx member to struct pbuf
2017-02-23 16:34:28 +01:00
Dirk Ziegelmeier
2e1b12d09f
Make pbuf refcount type an LWIP option and #define it to s8_t (to be able to check for underflow!)
2017-02-23 15:47:44 +01:00
goldsimon
5c55978f10
Revert "Added LWIP_SOCKERR_T to adapt the size of sock->err to what is needed."
...
Let's stay with the standard and accept the 4-bytes-per-socket memory increase...
This reverts commit 5d6c9ce77b
.
2017-02-20 13:29:33 +01:00
goldsimon
5d6c9ce77b
Added LWIP_SOCKERR_T to adapt the size of sock->err to what is needed.
2017-02-20 12:55:18 +01:00
goldsimon
d1049511cc
post-fixups for patch #9262 : fix SO_ERROR, fix !LWIP_TCPIP_CORE_LOCKING
2017-02-20 12:43:45 +01:00
Joan Lledó
703a22fae5
Support for 32bit errno codes
2017-02-20 12:37:29 +01:00
sg
ff3fe1f489
Fixed bug #50231 (nd6: several option size related issues in Router Advertisement message processing)
2017-02-17 21:59:08 +01:00
Joel Cunningham
4c76fd500c
Move write_offset from struct netconn to struct api_msg
...
This moves the write_offset variable from struct netconn to struct api_msg
This optimizes the storage by only having the space claimed when it is
needed (during a netconn_write_partly() call) and not throughout the
lifetime of the netconn
This also reduces code space/execution by not having to separately manage
clearing/checking write_offset from the current_msg pointer
Lastly, we also save execution by using msg.w.offset as the output
rather than marshaling the result to msg.w.len. Previously, len was used
as input length of dataptr and output for the write operation.
netconn_write_partly() also has access to msg.w.offset, so we can use
that
2017-02-17 13:26:16 -06:00
goldsimon
deaa6e9406
Improved DNS_LOCAL_HOSTLIST interface (bug #50325 )
2017-02-17 10:08:49 +01:00
goldsimon
19d63e6aa0
Fix portable initialization of non-dynamic DNS_LOCAL_HOSTLIST
2017-02-17 09:25:31 +01:00
sg
6dca664217
LWIP_NETCONN_FULLDUPLEX: fixed shutdown during write (bug #50274 )
2017-02-16 22:09:02 +01:00
Dirk Ziegelmeier
d7b51b5906
MDNS: Fix accessing wrong union member in netif ext callback
2017-02-15 14:38:57 +01:00
Dirk Ziegelmeier
3c9e05a6d9
Minor: Fix documentation in netif.h
2017-02-15 14:38:34 +01:00
Dirk Ziegelmeier
498913b982
Third draft of task #14283 : Add more detailed status callback
...
Implement Joel's idea of a union
2017-02-15 10:14:06 +01:00
Dirk Ziegelmeier
35e148e26d
MDNS: Use new netif callback, now does not need mdns_resp_netif_settings_changed() calls from user any more when LWIP_NETIF_EXT_STATUS_CALLBACK is enabled
2017-02-14 21:03:49 +01:00
Dirk Ziegelmeier
454927151d
Continue working on ext netif callback
...
Docs, better callback points (e.g. before netif is set down)
2017-02-14 21:02:38 +01:00
Dirk Ziegelmeier
d46d8bcda2
Add some asserts to netif callback functions
2017-02-14 20:35:48 +01:00
Dirk Ziegelmeier
4434762a08
Some minor documentation fixes
2017-02-14 20:28:43 +01:00
Dirk Ziegelmeier
bbedb35bf3
Fix name clash between typedef and struct definition.
...
Interesting, all three compilers in Erik Ekman's travis-ci don't complain. But my gcc at home does...
2017-02-14 20:17:27 +01:00
Dirk Ziegelmeier
f4f204b850
Implement a better way to initialize all fields in ip address than using memset() (better fix than my last commit)
2017-02-14 14:20:39 +01:00
Dirk Ziegelmeier
feba38a1f4
Fix unportable struct initializer I introcduced while working on task #14283 : Add more detailed status callback
2017-02-14 13:54:14 +01:00
Dirk Ziegelmeier
1b2c8974b8
Forgot to adapt #define in my last commit
2017-02-14 11:00:34 +01:00
Dirk Ziegelmeier
8025b85694
Second draft of task #14283 : Add more detailed status callback
2017-02-14 10:59:28 +01:00
Joel Cunningham
b2beb42c14
Remove forward declaration of struct lwip_sock
...
The forward declaration was added in commit
e2c2afbbe0
for use in struct
lwip_setgetsockopt_data, but became dead after commit
5d2e93e5f0
where the sock pointer was
removed from lwip_setgetsockopt_data
2017-02-13 17:22:52 -06:00
Dirk Ziegelmeier
7dd21e93c4
Fix my last commits (unused variable warning)
...
my gcc at home did not show this warning...
2017-02-13 22:27:59 +01:00
Dirk Ziegelmeier
3c1713406e
Work on task #14283 : Add more detailed status callback
...
Cleanups and IPv6 address status
2017-02-13 21:52:55 +01:00
Dirk Ziegelmeier
58c48af58f
Start working on task #14283 : Add more detailed status callback
...
IPv6 stuff is not implemented
2017-02-13 21:40:08 +01:00
Joel Cunningham
0b257f71e7
Fix comment typo from bug #47485
...
tcp_close_shutdown_impl() should be tcp_close_shutdown_fin()
2017-02-13 11:25:05 -06:00
Dirk Ziegelmeier
45f3c28eb2
Fix netif_find() function for many netifs (should use atoi) and move it to the bottom of the file where similar functions are located
2017-02-13 13:35:30 +01:00
Dirk Ziegelmeier
400c41ffd9
Also base netif_index_to_name function on netif_get_by_index
2017-02-13 13:26:54 +01:00