Commit Graph

2091 Commits

Author SHA1 Message Date
Dirk Ziegelmeier
b91e47b518 Implement portable and overridable allocation of memory buffers
Fixes bug #48300 (Private mempools allocate foreign memory), bug #48354 (Portable alignment defines/include required for static allocation) and bug #47092 (Tag memory buffers like memp_memory_xxx and ram_heap with a macro so that attributes can be attached to their definitions)

Signed-off-by: Simon Goldschmidt <goldsimon@gmx.de>
2016-07-07 13:35:13 +02:00
goldsimon
811b237bd7 dns: fixed declaration and usage of DNS_LOOKUP_LOCAL_EXTERN() 2016-07-07 13:02:47 +02:00
goldsimon
14ca418ac0 minor: coding style fixes 2016-07-05 07:36:51 +02:00
goldsimon
2fdea8b79b fixed bug #48398 (dns: entries reused during found-callback could be aborted if ttl==0) 2016-07-04 13:55:20 +02:00
Michael Brown
2e26fc9224 tcp: Avoid 3-second delay for a half-open connection
If lwIP encounters a half-open connection (e.g. due to a restarted
application reusing the same port numbers) it will correctly send a
RST but will not resend the SYN until one retransmission timeout later
(approximately three seconds).  This can increase the time taken by
lpxelinux.0 to fetch its configuration file from a few milliseconds to
around 30 seconds.

Fix by immediately retransmitting the SYN whenever a half-open
connection is detected.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
Signed-off-by: goldsimon <goldsimon@gmx.de>
2016-07-04 12:25:22 +02:00
goldsimon
fd83f4fb22 Fix bug #48359 (dns entries are not set to state DONE) 2016-07-04 10:22:20 +02:00
Sylvain Rochet
9d0546839c init: fix NO_SYS targets build
lwip/src/core/init.c:256:32: error: "LWIP_COMPAT_MUTEX" is not defined [-Werror=undef]
 #if LWIP_TCPIP_CORE_LOCKING && LWIP_COMPAT_MUTEX && !defined(LWIP_COMPAT_MUTEX_ALLOWED)
                                ^
Setting LWIP_TCPIP_CORE_LOCKING is meaningless for NO_SYS targets,
therefore checking if LWIP_COMPAT_MUTEX is set does not make sense.

Introduced by 42dfa71f97: Make LWIP_TCPIP_CORE_LOCKING==1 the default
(and warn if LWIP_COMPAT_MUTEX==1 in that case as mutexes are required
to prevent priority inversion on tcpip_thread operations)
2016-07-02 21:53:24 +02:00
sg
42dfa71f97 Make LWIP_TCPIP_CORE_LOCKING==1 the default (and warn if LWIP_COMPAT_MUTEX==1 in that case as mutexes are required to prevent priority inversion on tcpip_thread operations) 2016-06-30 22:37:37 +02:00
goldsimon
e6bc591a1e fixed bug #48170 (Vulnerable to TCP RST spoofing) (original patch by Fabian Koch) 2016-06-30 08:50:42 +02:00
goldsimon
d31d2ee882 Revert "fixed bug #48170 (patch by Fabian Koch)"
This reverts commit 236bc19422.
The fix introduced bug #48328 -> reverted
2016-06-30 08:41:50 +02:00
Erik Ekman
4047702928 Fix clang warning about unreachable code
Do check with preprocessor instead
2016-06-27 22:32:18 +02:00
Dirk Ziegelmeier
5d356c96f5 Minor: cleanup my last commit 2016-06-27 20:57:22 +02:00
Dirk Ziegelmeier
39545d2c6d Fix clang warning about unreachable code 2016-06-27 20:56:21 +02:00
goldsimon
236bc19422 fixed bug #48170 (patch by Fabian Koch) 2016-06-27 10:31:36 +02:00
Dirk Ziegelmeier
38c0255fa2 Fix a few more CLANG format string warnings (from unix check project) 2016-06-25 13:24:48 +02:00
Dirk Ziegelmeier
102f5882d5 Fix several CLANG format string warnings 2016-06-25 13:06:31 +02:00
Dirk Ziegelmeier
8dc77ef558 doxygen updates - include IPv6 in documentation. Exclude include/netif/ppp/polarssl.
Convert TODO -> @todo
2016-06-22 20:18:23 +02:00
Sylvain Rochet
cfe5182380 timers: fix wrong timings for !NO_SYS targets
issue 1:

sys_arch_sem_wait() is supposed to return an elapsed time in ms, what could
happen given a > 1 kHz calling rate for high throughput systems is that it
might always returns 0 ms. This is a problem for systems which compute the
elapsed time from a high precision clock source.

This is what is currently happening in the unix port in sys_arch_sem_wait():

start time -> 1000000000;  // ns
-- less than a ms before an event arrive --
end time   -> 1000xxxxxx;  // ns
return value -> (end time - start time)/1000000 -> 0

The return value is used to reduce the next timer interval, if
sys_arch_sem_wait() always return 0 no more timers are fired anymore

issue 2:

The current timer implementation for !NO_SYS targets only count elapsed
time while -waiting- for semaphore and doesn't count at all the time
spent by the stack to process packets. For CPU bound traffic patterns no
more timers are fired anymore.

Both are serious design issues which cannot be easily fixed without reworking
everything. This patch uses the properly implemented timers for NO_SYS targets
for !NO_SYS targets and merge them both into one single timers implementation.
2016-06-20 16:17:55 +02:00
goldsimon
6d95a34971 icmp ping response: fix invalid checksum (and possible assertion failure) when ip header contains options (is it correct that we mirror back all options) 2016-06-17 10:07:49 +02:00
goldsimon
61e067b98a Check for minimum IPv4 header length in rx packets 2016-06-17 09:36:14 +02:00
goldsimon
fda778f6b6 ip6_reass: don't crash if frag header isn't the first (or not in the first pbuf) 2016-06-16 13:51:38 +02:00
Erik Ekman
d98e25a783 nd6: Handle incorrect ICMP option length in RA
Make sure ICMPv6 options have a valid length before
parsing them.

Found with afl-fuzz.
2016-06-14 15:06:49 +02:00
sg
4e241fbf14 some minor improvements to the tcp options checking code 2016-06-13 20:41:58 +02:00
Henrik Persson
b9a2ee8aaa [PATCH] Drop instead of ASSERT in tcp_input header parsing
Since allowing input validation to trip the ASSERT handler is bad,
let's just drop the packets instead if validation fails.

Signed-off-by: sg <goldsimon@gmx.de>
2016-06-13 20:08:43 +02:00
Dirk Ziegelmeier
5e7b343d52 Fix dns_getserver to return a pointer, not a value 2016-06-13 09:00:46 +02:00
Dirk Ziegelmeier
6be7e221a5 Fix a few doxygen warnings 2016-05-24 22:29:18 +02:00
sg
631c458c55 Fixed invalid DEBUGF level SERIOUS when pbuf_header fails (it returns '1': this is not serious!) 2016-05-23 22:06:02 +02:00
Dirk Ziegelmeier
90a656ed78 Fix several doxygen errors all over the code 2016-05-23 21:18:16 +02:00
Jan Breuer
ebd103775d ipv6_addr: Render last zero in ip6addr_ntoa_r if not in first empty block 2016-05-23 09:54:54 +02:00
goldsimon
bd177ff38f added comment, fixed coding style 2016-05-23 09:47:14 +02:00
Jan Breuer
ac21a5f370 nd6: add cleanup function 2016-05-23 09:44:27 +02:00
Axel Lin
8c0f620d83 dns: Use LWIP_ARRAYSIZE instead of open coded
Signed-off-by: Axel Lin <axel.lin@ingics.com>
2016-05-11 12:20:15 +02:00
Axel Lin
7e9377a9c7 dhcp: Use LWIP_ARRAYSIZE to get the number of array entries
dhcp_discover_request_options is u8_t array, so the result is the same.
But use LWIP_ARRAYSIZE to get the number of array entries is better
because it works for all types.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
2016-05-11 12:15:12 +02:00
Sylvain Rochet
1dcd5d31d7 pbuf: fix undefined PBUF_POOL_FREE_OOSEQ if TCP_QUEUE_OOSEQ is disabled
lwip/src/core/timers.c: In function ‘sys_check_timeouts’:
lwip/src/core/timers.c:328:5: error: "PBUF_POOL_FREE_OOSEQ" is not defined [-Werror=undef]
 #if PBUF_POOL_FREE_OOSEQ

Fix it by declaring an empty PBUF_CHECK_FREE_OOSEQ() function if feature is
not enabled.
2016-05-08 03:09:51 +02:00
Dirk Ziegelmeier
49badf39a1 Fix bug #47805: dhcp_recv can dereference NULL pointer 2016-04-29 11:16:33 +02:00
Dirk Ziegelmeier
2e05856f90 Fix bug #47641: lwIP would accept IPv6 source addresses from the network that are mapped IPv4 adresses 2016-04-27 21:35:34 +02:00
goldsimon
c981b726f8 fixed bug #47601 (wrong NS request at DAD) 2016-04-27 10:19:13 +02:00
goldsimon
afd9ee9147 fixed bug #47743 (Closing listening tcp pcb is not posible without assert) 2016-04-26 13:27:17 +02:00
Dirk Ziegelmeier
bb908366a5 More PPP cleanups 2016-04-25 20:08:29 +02:00
Dirk Ziegelmeier
73d8f14ebd Fix compile when PPP is not enabled 2016-04-25 20:08:29 +02:00
Dirk Ziegelmeier
ffa340a68c task #13907: PPP cleanups: Move PPP mempools out of lwIP core to PPP code 2016-04-25 20:08:29 +02:00
Dirk Ziegelmeier
4d1a2e6699 Fix projects without PPP do not compile any more 2016-04-22 06:24:01 +02:00
Sylvain Rochet
15fbfb7363 PPP, remove useless ppp_init function
Simon says:

ppp_init() does not seem to be used. The only thing it does is calling
magic_init(), which is not required because it its called again later
from ppp_input().

Also, the time from startup is rather constant, so calling sys_jiffies()
from ppp_init() does not create a random number.
2016-04-21 23:25:48 +02:00
Joel Cunningham
8ac1b4825a udp: use netif addr as src for multicast sockets
Sockets bound to a multicast address could not transmit multicast
packets because the pcb local address did not match the netif address
even if the outgoing netif was resolved correctly.

To correct the issue, pcbs with a multicast local address will use
the outgoing netif address as the source address in IPv4.
2016-04-18 16:36:13 -04:00
Dirk Ziegelmeier
309e072238 Create new IP_IS_V4 macros and use them at instead of !IP_IS_V6 - since we now have an IPADDR_ANY_TYPE, just checking for !V6 does not mean it is V4 2016-04-06 22:31:31 +02:00
sg
ca1b8288de prepare for overriding current timeout implementation: all stack-internal caclic timers are avaliable in the lwip_cyclic_timers array 2016-04-05 23:01:57 +02:00
sg
8c7f513f4d patch #8358: allow more combinations of listening PCB for IPv6 2016-04-05 22:04:19 +02:00
sg
0731eda0b3 make autoip_supplied_address() take a const pointer, too 2016-04-05 20:38:11 +02:00
Dirk Ziegelmeier
12a4cae404 Apply [patch #8969] from Freddie Chopin: Constify netif in dhcp_supplied_address() 2016-04-05 13:18:27 +02:00
sg
27f03798b9 Fixed possible problems with tcp_backlog_delayed/tcp_backlog_accepted 2016-03-25 16:19:39 +01:00
goldsimon
5b0a47ca87 removed unused return values of tcp_listen_input & tcp_timewait_input; fixed unused variable warning 2016-03-24 15:06:31 +01:00
sg
7721b20179 call accept-callback with ERR_MEM when allocating a pcb fails on passive open to inform the application about this error; ATTENTION: applications have to handle NULL pcb in accept callback! 2016-03-23 21:57:38 +01:00
sg
c6b742812d fixed bug #38203: DHCP options are not recorded in all DHCP ack messages (patch by Florent Matignon) 2016-03-23 21:06:52 +01:00
Axel Lin
449fc98a55 tcp_alloc(): Remove superfluous initialization for pcb->keep_cnt_sent
It's already done by memset(0). This was missed in commit 5794ac2340
"tcp_alloc(): remove explicit =0 already done by memset(0)", fix it.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
2016-03-23 14:26:32 +01:00
Dirk Ziegelmeier
f97bf85fd6 udp.c: Allow udp_connect() on a dual-stack UDP PCB (type IPADDR_TYPE_ANY). This may be useful in some applications - no need to keep separate storage for target IP. 2016-03-22 15:12:16 +01:00
sg
dd80759bb9 tcp: changed accept handling to be done internally: the application does not have to call tcp_accepted() any more. Instead, when delaying accept (e.g. sockets do), call tcp_backlog_delayed()/tcp_backlog_accepted() (fixes bug #46696) 2016-03-22 07:30:44 +01:00
sg
a1c78ea7bf ignore dns response parsing errors, only abort resolving for correct responses or error responses from correct server (bug #47459) 2016-03-22 07:22:17 +01:00
sg
5794ac2340 tcp_alloc(): remove explicit =0 already done by memset(0) 2016-03-18 22:05:17 +01:00
sg
44e1a2d8e2 define tcp_backlog_set() as dummy-define when backlog feature is disable 2016-03-18 20:05:04 +01:00
sg
852d5b9c80 Optimize tcp_output runtime by not calling ip_route() for every segment sent 2016-03-16 22:31:33 +01:00
sg
b4d7238eb8 tcp_output_segment: don't count retransmitted segments in mib2.tcpoutsegs by detecting p->payload != tcphdr pointer; don't try to retransmit segments where p->ref != 1 (as it is invalid to mess up p->len/p->payload when we don't have exclusive access to the pbuf) 2016-03-16 22:22:20 +01:00
sg
5f8b5cbb20 reset rto timer on fast retransmission (see task #13757, patch by Joel Cunningham) 2016-03-16 21:49:37 +01:00
sg
8e8571da6a fixed bug #46384 Segment size calculation bug with MSS != TCP_MSS 2016-03-16 16:56:15 +01:00
Dirk Ziegelmeier
f3b7bca3cf Fix bug #47370: Port DNS client to IPv6 2016-03-09 19:25:06 +01:00
Dirk Ziegelmeier
a212210c35 Add missing #include in memp.c 2016-03-08 19:53:01 +01:00
sg
5cf802eda0 dns_gethostbyname: return error code if no valid server is set instead of calling the 'found' callback in this case (fixes bug #46887) 2016-03-07 19:47:39 +01:00
sg
f5fef6eebc fixed bug #45353: IPv6 router / neighbor relationship is not always consistent - patch by Stian Sebastian Skjelstad 2016-03-06 14:48:41 +01:00
sg
b00a17059a fixed icmp_send_response with LWIP_HOOK_IP4_ROUTE_SRC enabled 2016-03-05 15:57:40 +01:00
sg
d2bb569ee4 bug #46094: moved IPv4 routing hook functions down so that they implement actual routing (source-based IPv4 routing is not affected by this change) 2016-03-05 15:52:39 +01:00
sg
e0ab8c581d fixed bug #46093: Move IP6_ROUTE() hook to after LL processing 2016-03-05 14:11:24 +01:00
sg
6b405eccd0 Tried to fix bug #47270 by accepting all ipv4 multicast packets (at IP level) when LWIP_IGMP is disabled 2016-03-04 21:57:47 +01:00
Dirk Ziegelmeier
9a4c66006e Fix compile error in raw.c (possible unused arg) 2016-03-03 22:55:42 +01:00
Dirk Ziegelmeier
1dea649cff Fix comment in tcp.c 2016-03-03 22:48:10 +01:00
Dirk Ziegelmeier
7396d8818b Implement dual-stack in RAW API in the same way as in UDP and TCP 2016-03-03 22:47:27 +01:00
Dirk Ziegelmeier
2d80af1dcb Minor code cleanup in udp.c 2016-03-03 22:44:01 +01:00
Dirk Ziegelmeier
5358380c5f Apply patch from Derek Pravala: Fix segfault in ip6_route when there is no default netif 2016-03-03 16:12:20 +01:00
Dirk Ziegelmeier
e89b48d23f raw.c: Avoid NULL pointer dereference 2016-03-02 23:44:51 +01:00
Dirk Ziegelmeier
f9ce31f98b TCP: Implement dual stack support using new IP_ANY_TYPE introduced at UDP 2016-03-02 23:14:33 +01:00
Dirk Ziegelmeier
f3132c5290 udp: Fix possible NULL pointer dereference, update comments 2016-03-02 23:10:43 +01:00
Dirk Ziegelmeier
9885d5d9f5 Apply patch from Simon to fix buffer overflow handling tcp_in.c which was discovered by Coverity 2016-02-29 23:34:52 +01:00
Dirk Ziegelmeier
8e5663a32f Minor: Avoid ip_input() call indirection for when only IPv4 or IPv6 are enabled 2016-02-29 22:17:42 +01:00
Dirk Ziegelmeier
6aed6e659f Rework DHCP PCB handling: Old code registered one UDP PCB per netif where DHCP was active and there was a special case in udp_input() for this. New implementation uses one PCB for all netifs and removes special case in udp_input().
The old approach called udp_bind() on each of the PCBs, which puts them into udp_pcbs list. The PCBs were iterated on all non-DHCP udp_inputs() with no effect.
My cleanup removes the special handling in udp.c, and uses only one DHCP UDP PCB to catch all DHCP messages from all netifs. The dhcp_recv function then checks whether ip_current_input_netif() has DHCP enabled - if not, the message is ignored. The PCB is only created/registered when one or more PCBs have DHCP enabled.
2016-02-29 19:31:19 +01:00
Dirk Ziegelmeier
70f3e5ed05 Cleanup: Create new file ip.c and move dual-stack code from ipv4 and ipv6 folder in there 2016-02-26 23:04:51 +01:00
Dirk Ziegelmeier
d5778bad2f No need for dual-stack code in ip4.c and icmp.c -> use ip4 only versions 2016-02-26 22:50:20 +01:00
Dirk Ziegelmeier
a5214abd04 udp: udp_send and udp_send_chksum: Check for PCB NULL pointer and PCB must not be the new IP_ANY_TYPE, but a real IPv4 and IPv6 address 2016-02-26 09:20:50 +01:00
goldsimon
bf8bcfafe2 revert accidentally committed comment from a649a3eb50 2016-02-26 08:59:50 +01:00
Joel Cunningham
8cb64698aa Allow backlog to be updated
This commit adds support to the sockets and netconn layer to update the
backlog by calling listen when the netconn is already in the listen state.
When backlog is not enabled, the call returns successfully

This commit also introduces a macro for setting the backlog value that
prevents a 0 sized (invalid) backlog
2016-02-25 15:19:52 -06:00
sg
a649a3eb50 dual-stack fix: moved common definitions/code for ethernet used by etharp and ethip6 to new files ethernet.h/.c 2016-02-25 22:10:28 +01:00
Dirk Ziegelmeier
fd891081c4 minor: Cleanups in raw/tcp/udp code by using macros and reducing #ifdefs 2016-02-24 23:04:25 +01:00
Dirk Ziegelmeier
953b7bdd59 Implement UDP dual-stack PCB support
Create special IP address type "IPADDR_TYPE_ANY" for it.
SNMP uses new feature in non-netconn mode.

TODO: Same for TCP & RAW, adapt NETCONN to use this feature
2016-02-24 22:37:01 +01:00
sg
1dde3d6e56 Fixed bug #46524: "Device as dhcp server does not work after upgrade to lwip-1.4.1" 2016-02-24 22:13:58 +01:00
sg
ec49b68b38 minor: udp_input/local_match: coding style, added comments 2016-02-24 22:04:59 +01:00
Dirk Ziegelmeier
ac4b089b18 udp.c: Further udp_input simplifications
- Move local PCB matching code in a function that can be reused in SO_REUSE && SO_REUSE_RXTOALL case.
- Some checks have been written in the dual-stack version and then repeated with the ipv6-only version. Example:
IPv6 only: ip6_addr_ismulticast(ip6_current_dest_addr())
IPv4 AND IPv6: ip_addr_ismulticast(ip_current_dest_addr())
2016-02-24 19:57:20 +01:00
Dirk Ziegelmeier
005c196ed8 udp.c: Simplify and cleanup input PCB matching 2016-02-24 19:13:30 +01:00
Dirk Ziegelmeier
17fad79f71 Two compile fixes after eliminating isipv6 member in PCBs 2016-02-22 17:07:17 +01:00
Dirk Ziegelmeier
c805843e64 Change signature of ip_output, ip_output_if, ip_output_if_src, ip_output_hinted, ip_route, ip_netif_get_local_ip, ip_route_get_local_ip and tcp_eff_send_mss not to take an isipv6 parameter. Use the IP version of the destination address instead. 2016-02-22 13:38:40 +01:00
Dirk Ziegelmeier
880f1008d6 Together with Simon: Eliminate last instances of isipv6 member in pcbs;
Don't allow NULL pointers (IPv4 ANY) in connect() and sendto() functions as destinations since this does not make sense.
2016-02-22 13:03:51 +01:00
Dirk Ziegelmeier
be9cd800b0 Review with Simon: Init TCP/UDP/RAW PCBs with correct IP types in _new functions to make my changes work correct 2016-02-22 11:16:13 +01:00
Dirk Ziegelmeier
0106cf7ae0 Review with Simon: Remove dead code (since 2003) 2016-02-22 10:18:19 +01:00
Dirk Ziegelmeier
50303eea23 Reduce PCB_ISIPV6 macro usage some more 2016-02-21 19:59:08 +01:00
Dirk Ziegelmeier
339e82d7aa Eliminate IP_PCB_IPVER_EQ macro 2016-02-21 19:45:51 +01:00
Dirk Ziegelmeier
5a25652c21 Eliminate IP_PCB_IPVER_INPUT_MATCH macro 2016-02-21 19:21:36 +01:00
Dirk Ziegelmeier
8f675c37fc Reduce usage of PCB IP version flag in UDP code. Maybe we can figure out a good way for dual-stack UDP when we manage to remove the flag (nearly) entirely from the code. 2016-02-20 20:54:58 +01:00
Dirk Ziegelmeier
5809b01388 Reduce usage of PCB IP version flag in raw and tcp code. Maybe we can figure out a good way for dual-stack UDP when we manage to remove the flag (nearly) entirely from the code. 2016-02-20 20:40:04 +01:00
Dirk Ziegelmeier
10edba936b Fix tcp pcb access after it was freed in tcp.c - found by Coverity 2016-02-19 23:28:09 +01:00
goldsimon
e4cac595c2 Check TCP_SNDLOWAT for too high value (near u16_t overflow) - fixes bug #46948 2016-02-18 09:36:55 +01:00
Dirk Ziegelmeier
24bc77a935 Found some struct instances that can be const 2016-02-16 22:31:59 +01:00
Dirk Ziegelmeier
273d609bac mem.c: Fix unintended sign extension (found by Coverity)
sign_extension: Suspicious implicit sign extension: count with type unsigned short (16 bits, unsigned) is promoted in count * size to type int (32 bits, signed), then sign-extended to type unsigned long (64 bits, unsigned). If count * size is greater than 0x7FFFFFFF, the upper bits of the result will all be 1.
2016-02-10 21:21:08 +01:00
Dirk Ziegelmeier
288b4564e4 DNS: Fix potential array out of bounds access. Variable nanswers may contain bogus values. (found by Coverity) 2016-02-10 20:41:31 +01:00
Dirk Ziegelmeier
1c1587eef6 ICMP: Fix responses were always sent to default netif because of uninitialized source IP (found by Coverity) 2016-02-10 20:35:58 +01:00
Dirk Ziegelmeier
11b810721a ICMP: Fix unused value in icmp_input (found by Coverity) 2016-02-10 20:34:44 +01:00
Dirk Ziegelmeier
222155d7e2 pbuf: Make pbuf_skip function public, so it can be used in SNMP code 2016-02-03 08:37:04 +01:00
Axel Lin
f411a34af5 stats: Add proper #if guard to prevent unused-variable warning for memp_names
The usages of memp_names are under either LWIP_DEBUG in stats_init,
or under LWIP_STATS_DISPLAY in stats_display_memp.

Fix below build warning:
lwip/src/core/stats.c:53:21: error: 'memp_names' defined but not used [-Werror=unused-variable]
static const char * memp_names[] = {
^
cc1: all warnings being treated as errors

Reported-by: David Fernandez
Fixes: 2f2a75a6d9fd ("stats: Move memp_names table out of stats_init/stats_display_memp functions")
Signed-off-by: Axel Lin <axel.lin@ingics.com>
2016-01-31 13:48:38 +01:00
Axel Lin
515a4cad73 Clear addr_hint pointer after calling ip_output_if() in tcp_zero_window_probe()
This was missed in commit aa0e41c389
("task #12178: hardware checksum capabilities can be configured per netif"),
fix it.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
2016-01-29 09:21:58 +01:00
Stephan Linz
2c31beb6e7 IPv4: fix some meaningless debug messages
Signed-off-by: Stephan Linz <linz@li-pro.net>
2016-01-18 21:34:13 +01:00
Axel Lin
fe2cfe2dba raw: Fix build error
IP6_HLEN is only defined when LWIP_IPV6, IP_HLEN is only defined when LWIP_IPV4.
This fixes build error in !LWIP_IPV4 || !LWIP_IPV6 cases.

Fixes: f2c7e9c939 ("raw: Remove unnecessary #if guard around PCB_ISIPV6() calls")
Reported-by: Erik Ekman
Signed-off-by: Axel Lin <axel.lin@ingics.com>
2016-01-18 16:02:01 +01:00
Stephan Linz
80375e68dd ip_frag: fix compiler warnings, unused variable
In case of IP_REASS_FREE_OLDEST==0, the argument clen of
ip_reass_enqueue_new_datagram() will not used and leads
the compiler to a warning.

Signed-off-by: Stephan Linz <linz@li-pro.net>
2016-01-18 11:55:54 +01:00
Axel Lin
f2c7e9c939 raw: Remove unnecessary #if guard around PCB_ISIPV6() calls
PCB_ISIPV6() macro is well defined for all cases (LWIP_IPV4 && LWIP_IPV6,
LWIP_IPV4 only and LWIP_IPV6 only), thus remove the unnecessary #if guard
around PCB_ISIPV6() calls.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
2016-01-18 11:55:06 +01:00
Axel Lin
c221361874 stats: Move memp_names table out of stats_init/stats_display_memp functions
This makes the code simpler with better readability.
Also make memp_names static because it's only referenced by stats.c.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
2016-01-15 11:38:03 +01:00
Axel Lin
70ebeda7ed memp: Simplify implementation of memp_overflow_check_all
We don't really care the order of overflow/underflow checking because if
any checking fails we got assertion.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
2016-01-15 11:38:02 +01:00
Dirk Ziegelmeier
70487a43d4 Apply patch #8854: dns: Simplify #ifdef guard around dns_gethostbyname_addrtype from Axel Lin
+ Minor compile fix from me
Patch makes the code a tiny bit less lightweight (add a parameter in dns_gethostbyname which is then not used in dns_gethostbyname_addrtype) but it makes the code more readable.
2016-01-13 19:52:08 +01:00
Axel Lin
a93ae2558f tcp_rexmit_rto: Remove superfluous #if TCP_OVERSIZE guard
TCP_OVERSIZE_DBGCHECK already implies TCP_OVERSIZE is set.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
2016-01-13 19:07:08 +01:00
Axel Lin
c2a74b767b udp_bind: Omit checking for the same port if no port specified
No port specified means to use a random port.
udp_new_port() returns a new (free) local UDP port number on success.
So in this case we don't need iterating all lists to test if the port
number is used, udp_new_port() alreay ensures the port is not used.

Move the code checking for double bind and rebind of the same pcb earlier,
as this checking is necessary in all cases.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
2016-01-13 09:05:36 +01:00
Dirk Ziegelmeier
123c8dbd6a Fix bug #46837 Don't send dhcp_release message in dhcp_release function 2016-01-13 08:54:54 +01:00
Axel Lin
9f3aab6a62 tcp_out: Use LWIP_DBG_LEVEL_SERIOUS instead of hard coded number
Trivial clean up to avoid using hard coded number.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
2016-01-11 13:22:51 +01:00
Axel Lin
156ad0dbf5 udp_bind: Fix the logic to check both pcbs have REUSEADDR set
The code for #if SO_REUSE case does not match the comment.
By default, we don't allow to bind to a port that any other udp
PCB is already bound to, unless *all* PCBs with that port have tha
REUSEADDR flag set.

Which means we want to omit checking for the same port if both pcbs
have REUSEADDR set. Fix the logic accordingly.

Fixes: d0348e0c60 ("task #6995: Implement SO_REUSEADDR (correctly)")
Signed-off-by: Axel Lin <axel.lin@ingics.com>
2016-01-11 12:19:13 +01:00
Axel Lin
5056d375f2 tcp_bind/tcp_connect: Omit checking for the same port if no port specified
No port specified means to use a random port.
tcp_new_port() returns a new (free) local TCP port number on success.
So in this case we don't need iterating all lists to test if the port
number is used, tcp_new_port() alreay ensures the port is not used.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
2016-01-11 12:16:27 +01:00
Axel Lin
708beb4874 udp_bind: Allocate a random port earlier to correctly detect port conflict
Current code does not correctly detect port conflict if no port specified
because it checks ipcb->local_port == port before udp_new_port().
Fix it by allocating a random port earlier.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
2016-01-09 10:14:09 +01:00
Joel Cunningham
a82c6122d5 Correct comment word usage in ip4_frag.c
This corrects word usage in ip4_frag.c:

 * 'On' was used when it should have been 'one'
 * 'Whole' was used when it should have 'hole'
2015-12-08 10:13:56 -06:00
Axel Lin
2e56f2d780 igmp: Optimize the implementation of igmp_start_timer
When LWIP_RAND is defined, calling LWIP_RAND() is not necessary if max_time <= 2
because group->timer will be set to 1 anyway.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
2015-12-06 21:47:09 +01:00
Axel Lin
2562d637cd tcp_out: Use LWIP_DBG_LEVEL_SERIOUS instead of magic number
Trivial clean up to avoid using magic number.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
2015-12-06 21:38:12 +01:00
Axel Lin
a21144b834 memp: Fixup LWIP_HOOK_MEMP_AVAILABLE() hook
I got below build warning if LWIP_HOOK_MEMP_AVAILABLE is defined.

src/core/memp.c: In function 'memp_free_pool':
src/core/memp.c:352:16: warning: variable 'old_first' set but not used [-Wunused-but-set-variable]
   struct memp *old_first;
                ^
src/core/memp.c: In function 'memp_free':
src/core/memp.c:413:6: warning: 'old_first' may be used uninitialized in this function [-Wmaybe-uninitialized]
   if (old_first == NULL) {

The LWIP_HOOK_MEMP_AVAILABLE() hook does not work, fix it.

Fixes: c838e1ed5b ("Implement possibility to declare private memory pools")
Signed-off-by: Axel Lin <axel.lin@ingics.com>
2015-12-05 21:32:14 +01:00
Axel Lin
7f92660598 icmp: Fix memory leak in icmp_input() error paths
Ensure the newly allocated packet buffer is freed in error paths.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
2015-12-05 21:25:15 +01:00
Axel Lin
a709041b8b Remove unnecessary p->len checking for pbuf_alloc calls with PBUF_RAM type
pbuf_alloc() for PBUF_RAM type always return big enough memory on success.
So checking p->len is not necessary. Testing if p is NULL or not is enough.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
2015-12-05 21:21:59 +01:00
Axel Lin
bd4c4b5959 Use SYS_ARCH_SET macro at appropriate places
Use SYS_ARCH_SET to simplify the code a bit.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
2015-12-02 22:51:08 +01:00
Axel Lin
fb6d0f9006 ipaddr_aton: Avoid duplicate code to handle IPv4 address string conversion
Signed-off-by: Axel Lin <axel.lin@ingics.com>
2015-12-02 22:51:00 +01:00
Axel Lin
6e863ecb50 dns: Remove always true test in dns_alloc_random_port
The only way to exit the do-while loop is err != ERR_USE.
Thus get rid of the always true test.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
2015-12-02 22:37:26 +01:00
Axel Lin
764bf251cd igmp: Drop unneeded initialization for *group in igmp_lookup_group()
It's assigned to the return value of igmp_lookfor_group() immediately.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
2015-12-02 22:32:50 +01:00
Axel Lin
91586bc6f6 Drop #if TCP_DEBUG guard around tcp_debug_print_state calls
The #if TCP_DEBUG guard can be removed because tcp_debug_print_state()
print nothing if !TCP_DEBUG.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
2015-12-02 22:32:42 +01:00
Axel Lin
f971fb921e Simplify testing minimum priority in tcp_kill_prio()
Simplify the code a bit by setting mprio = LWIP_MIN(TCP_PRIO_MAX, prio)
before the for loop.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
2015-11-20 21:41:14 +01:00
Axel Lin
c730e45f0c Trivial comment fix about calling tcp_slowtmr
Trivial typo fix.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
2015-11-20 21:36:38 +01:00
Axel Lin
5c27429958 memp: Fix if MEMP_OVERFLOW_CHECK guard in memp_free_pool
Current code already checks memp_overflow_check_all() in memp_free() if
MEMP_OVERFLOW_CHECK >= 2. So in memp_free_pool(), it should use
MEMP_OVERFLOW_CHECK == 1 instead.

Fixes: c838e1ed5b ("Implement possibility to declare private memory pools")
Signed-off-by: Axel Lin <axel.lin@ingics.com>
2015-11-19 22:06:42 +01:00
Axel Lin
9c6708513a Drop unnecessary NULL test for h->next->next in memp_sanity
The h will point to NULL if h->next->next is NULL anyway.
So remove the unnecessary NULL test for h->next->next in each iteration.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
2015-11-19 07:23:55 +01:00
Axel Lin
21b9b5e741 Slightly improve raw_remove()/udp_remove() implementation
There should be no duplicate pcb in raw_pcbs/udp_pcbs list.
So the implementation of raw_remove()/udp_remove() can break from the for
loop once the target pcb is found and removed from the list.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
2015-11-19 07:21:00 +01:00
goldsimon
98b9d31f24 Fixed compiling with LWIP_TCP==0 2015-11-16 09:37:56 +01:00
Axel Lin
668d461104 dns: Fix dns_alloc_pcb for reuse an existing one case
The logic to use an already existing pcb is wrong because the idx never
advanced in the for loop, so it keep checking the same dns_pcbs[idx] for
each loop iteration. Fix it.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
2015-11-16 09:09:31 +01:00
Dirk Ziegelmeier
6203737093 Rename snmp_mib2.h to snmp.h so source compatibility for user netif implementations is preserved 2015-11-12 21:25:42 +01:00
Dirk Ziegelmeier
5f642eb3e3 Completely decouple SNMP stack from lwIP core by using private memory pools;
Move SNMP stack to apps;
API breaking change: Users need to call snmp_init() now!
2015-11-12 21:21:14 +01:00
goldsimon
92a241a29e Fixed bug #46365: tcp_accept_null() should call tcp_abort() 2015-11-12 10:40:49 +01:00
Dirk Ziegelmeier
c838e1ed5b Implement possibility to declare private memory pools. This is useful to decouple some apps from the core (SNMP stack) or make contrib app useage simpler (httpserver_raw) . 2015-11-12 08:45:04 +01:00
Dirk Ziegelmeier
d38db89626 Export tcp_pcb_lists from tcp.c - can be used in SNMP code to implement MIB2 tcp connection tables 2015-11-12 08:09:44 +01:00
Dirk Ziegelmeier
3f0b1e2cdc Remove global variable used in macros, it can be declared locally. 2015-11-12 08:07:22 +01:00
sg
c12fa7b4c4 started to move "private" header files containing implementation details to "lwip/priv/" include directory to seperate the API from the implementation. 2015-10-09 21:58:58 +02:00
sg
b32751a693 moved dhcp.c to src/core/ipv4/ since it is IPv4 only 2015-10-09 21:06:08 +02:00
goldsimon
65efeec4e9 fixed bug #46145 tcp_send_empty_ack() uses wrong netif with LWIP_HOOK_IP4_ROUTE_SRC (patch by Milan Cermak) 2015-10-07 14:56:25 +02:00
goldsimon
15bb334e81 SNMP: use PBUF_RAM for sending, PBUF_POOL is mostly used for RX only (if this isn't followed, tcp can get stuck when ACKs don't come through - unless some PBUF_POOL pbufs are reserved for such RX) 2015-10-07 10:41:03 +02:00
goldsimon
77f906376e minor: fixed coding style (lwip style) 2015-10-07 10:36:50 +02:00
goldsimon
9b22f167f1 minor: mib2: removed some blocks by defining common variables above the switch 2015-10-07 10:13:20 +02:00
goldsimon
b401f42520 minor: fixed coding style (lwip style) 2015-10-07 10:03:12 +02:00
goldsimon
2949449e25 minor: SNMP: fixed coding style (lwip style) 2015-10-07 10:01:23 +02:00
sg
2b971400fa minor: coding style 2015-10-06 21:57:40 +02:00
sg
22df34fc70 minor/coding style: removed spaces before line ending (from file header) 2015-10-06 21:13:15 +02:00
sg
490581a0eb minor/coding style: removed spaces before line ending 2015-10-06 21:08:28 +02:00
goldsimon
0737cfb84e Fixed bug #46128 (patch by Kerem Hadimli) 2015-10-06 12:42:25 +02:00
Erik Ekman
f80d0dab08 Remove old comments about DHCP setting netif up 2015-10-03 21:31:48 +02:00
sg
fb1ac8d766 snmp mib2: more const 2015-10-03 20:34:56 +02:00
Dirk Ziegelmeier
bc47bd28ab snmp mib2: more nodes can be const 2015-10-03 20:34:09 +02:00
Dirk Ziegelmeier
5cf4771397 snmp: eliminiate mib_ram_array_node (it is not necessary: to the agent, the nodes may be const since the actual mib implementation knows the structures behind the nodes which do not have to be const) 2015-10-03 20:27:49 +02:00
sg
8891b277c6 snmp: hopefully fixed all alignment warnings introduced today. unfortunately, gcc does not warn about them when compiling for x86 2015-10-02 21:59:40 +02:00
goldsimon
e4abd4234d removed comma before } 2015-10-02 13:26:11 +02:00
goldsimon
fe33fd6d86 snmp: cleaned up mib_* structs: "base" class 'struct mib_node' only needs the type, get/set functions are not used on array/external nodes (only on scalar/listroot nodes) 2015-10-02 12:33:45 +02:00
goldsimon
bf75ace695 snmp: combine oid and node pointers in array entries 2015-10-02 10:53:17 +02:00
goldsimon
180ed573a5 snmp_trap_dst_ip_set: ip_addr_t pointer can be const 2015-10-02 09:58:31 +02:00
goldsimon
a9b6b5b704 adapt init.c to moved declaration of snmp_init 2015-10-02 09:57:15 +02:00
goldsimon
30445712a5 snmp: make mib_scalar_node a "derived" struct like all other nodes 2015-10-02 09:56:00 +02:00
sg
3312983b27 Make LWIP_DNS_SECURE and its possible values known in opt.h, remove default initialization of DNS server 2015-10-01 21:38:39 +02:00
sg
fecd1bde83 ip4_route: fixed checking twice for a valid default_netif, fixed checking loopback traffic before checking for a valid default netif 2015-10-01 21:17:59 +02:00
goldsimon
0176e03e36 mib2: one more '};' -> '}' 2015-10-01 10:21:52 +02:00
Dirk Ziegelmeier
9957cd4a2a fixed bug #46089: snmp: race condition on length change between get_object_def() and get_value() 2015-10-01 10:08:23 +02:00
Dirk Zigelmeier
3f4d75c8d6 netif_get_ip6_addr_match/netif_add_ip6_address must take a const ip6addr to be usable 2015-09-30 20:55:08 +02:00
Dirk Ziegelmeier
7962b21c00 snmp: fixed ugly inheritance implementation by aggregating the "base class" (struct mib_node) in all derived node classes to get more type-safe code 2015-09-30 17:54:25 +02:00
goldsimon
59002d5081 mib2: only export 'internet', all other variables can be static 2015-09-30 17:42:19 +02:00
goldsimon
ce883d2041 minor: mib2.c: sys_tem_* -> system_* for everything but 'sys_tem' (without suffix) 2015-09-30 17:39:32 +02:00
goldsimon
96847c1199 snmp: added helper functions to encode/decode BITS pseudo type, added define for Counter64 type, minor layout changes 2015-09-30 17:24:53 +02:00
goldsimon
df1f12778f snmp: moved noleafs_get/set functions from mib2.c to mib_structs.c, where they belong 2015-09-30 17:19:08 +02:00
goldsimon
dff234112b minor: removed superfluous comma after '}' in mib2.c; removed superfluous comment on get-functions that follow a function typedef 2015-09-30 17:13:05 +02:00
goldsimon
e18e08ff08 minor: removed superfluous comma after '}' in msg_out.c 2015-09-30 17:09:04 +02:00
goldsimon
f3ed562983 minor: removed superfluous comma after '}' in dns.c 2015-09-30 17:01:57 +02:00
goldsimon
969fb4c981 minor: removed some trailing spaces in tcp.c 2015-09-30 17:00:57 +02:00
Erik Ekman
82fcc307ef mld6: Simplify join/leavegroup()
Use netif_get_ip6_addr_match() helper to shorten the code.
2015-09-30 16:35:15 +02:00
goldsimon
1fdab5ac0e Added/changed header of dhcp.c/.h 2015-09-30 16:33:48 +02:00
goldsimon
389831218e Finished task #13731: fix usage of "snmp_inc_*" 2015-09-30 15:54:43 +02:00
goldsimon
7b5ef3ae58 implement/remove missing IP counters in stats_mib2 (see task #13731) 2015-09-30 15:05:52 +02:00
goldsimon
9d28549f32 minor: fixed coding style in mld6.c 2015-09-30 14:48:25 +02:00
Erik Ekman
6cdea62638 Add functions to join/leave v6 multicast group by netif
Existing functions are based on IP address, but the address is used
only to look up which netif to act on. The netif-based core code is
extracted to new exported functions.

If you have a netif handle, this makes it easier to join/leave
groups, without the need to convert to IP address first only for the
mld6 code to convert back to netif.
2015-09-30 14:44:45 +02:00
goldsimon
3dd0977635 minor: fixed coding style in igmp.c 2015-09-30 14:37:37 +02:00
Erik Ekman
ba71ac78d9 Add functions to join/leave IGMP group by netif
Existing functions are based on IP address, but the address is used
only to look up which netif to act on. The netif-based core code is
extracted to new exported functions.

If you have a netif handle, this makes it easier to join/leave
groups, without the need to convert to IP address first only for the
IGMP code to convert back to netif.
2015-09-30 14:29:37 +02:00
goldsimon
373714c02f dns: improved handling 2nd server if first failed 2015-09-30 14:22:39 +02:00
goldsimon
927b72abd2 fixed bug #46072: ip4addr_aton() does not check the number range of all address parts 2015-09-30 14:15:36 +02:00
goldsimon
f89e859415 minor: fixed coding style in ip4addr_aton() 2015-09-30 14:13:05 +02:00
goldsimon
dae73e21b8 minor: fixed coding style in ip4addr_aton() 2015-09-30 14:11:50 +02:00
goldsimon
f950bf4362 ipaddr_aton(): favour ':' over '.' to decide for IPv6 first (since IPv6 mapped IPv4 addresses might contain both ':' and '.') 2015-09-30 14:06:44 +02:00
goldsimon
0621e8d1b1 ip6addr_aton(): fail on three successive colons in an IPv6 address string 2015-09-30 14:05:13 +02:00
goldsimon
5a185a0fbd minor: fixed coding style in ip6addr_aton() 2015-09-30 13:55:09 +02:00
goldsimon
45fd622491 Fixed bug #46071 Logic error in line 1473 in dns.c 2015-09-30 13:36:13 +02:00
goldsimon
94625a8fa8 MIB2_STATS: moved netif related mib2 counters into a struct (defined in stats.h), added ifInErrors/ifInUnkownProtos (now handled in etharp.c) and ifOutErrors 2015-09-28 08:50:21 +02:00
goldsimon
bc30899168 fixed compiler warnings where passing variable instance to ip_addr_isany 2015-09-28 07:56:52 +02:00
sg
bb91bd2279 fixed coding style: use more () 2015-09-24 21:04:20 +02:00
Sylvain Rochet
8b2c73de4e ip4: routing: check peer for point to point interfaces
gw netif field for point to point interfaces is the peer IP address.
Check if the destination is equals to the gw field of point to point
interfaces (broadcast flag is not set) when routing an IP packet.
2015-09-24 21:01:52 +02:00
goldsimon
b0917d987a Cleaned up using struct netif.ip_addr by creating API functions for it 2015-09-24 14:57:16 +02:00
goldsimon
99d2e5233d struct udp_pcb.multicast_ip must be an ip_addr_t, too, to completely avoid temporary storage 2015-09-24 14:55:55 +02:00
goldsimon
c71723101a Removed ip_2_ip4/6_c const macros again now that ip_2_ip4/6 macros keep the original const'ness 2015-09-24 14:38:52 +02:00
goldsimon
262a641396 eliminate temporary storage when using netif addresses for ip_addr_t* now that they have the correct type (ATTENTION: ip6_select_source_address() and ip4_netif_get_local_ip() now return ip_addr_t*!) 2015-09-24 14:34:24 +02:00
goldsimon
4d2f4ce78c udp: don't use ip4_2_ip() where not required 2015-09-24 10:39:13 +02:00
goldsimon
ed4130bd2f Fixed const errors after changing netif_ip4_addr/netif_ip6_addr to return cont pointers 2015-09-24 08:06:50 +02:00
goldsimon
0fbdd5e56e fixed compiling LWIP_HAVE_LOOPIF after changing struct netif.ip6_addr to ip_addr_t 2015-09-24 07:58:29 +02:00
sg
db76671d4d task #13729: Convert netif addresses (IPv4 & IPv6) to ip_addr_t (so they can be used without conversion/temporary storage) 2015-09-23 22:09:37 +02:00
sg
f36adac8ab fixed compiling udp.c for IPv6-only 2015-09-23 22:07:14 +02:00
sg
121268d320 Added ip_addr_set_zero_ip4() to explicitly set the type to IPv4 for dual-stack 2015-09-23 21:56:34 +02:00
goldsimon
e6b6543c33 igmp: use netif_ip4_addr() instead of directly accessing struct netif member 2015-09-23 16:26:56 +02:00
Dirk Ziegelmeier
e00e4a6c13 make netif_ip4_* get accessors return const pointers 2015-09-23 13:19:56 +02:00
sg
0454950564 fixed compiling for various config combinations 2015-09-17 22:19:37 +02:00
sg
4f9bcc5ecc fixed compiler warnings reported by mingw-64 2015-09-17 22:00:16 +02:00
sg
39e32ea7c1 fixed const warning for !IPV6_FRAG_COPYHEADER 2015-09-17 21:59:54 +02:00
sg
6f0dceee09 fixed some printf formatters (mainly for window scaling code) 2015-09-17 21:33:25 +02:00
sg
9614c60cf6 fixed constness for DNS_LOCAL_HOSTLIST_IS_DYNAMIC 2015-09-17 21:32:11 +02:00
Robert Szewczyk
52a4ca99a8 pbuf_take: make it comply with API specifications
LWIP_ERROR macro exited the function early with the return code
indicating a SUCCESS. Fix the error codes. Return the specified
error code for cases when the pbuf is too short.
2015-09-17 17:05:01 +02:00
Joel Cunningham
72b3f3f612 Hook up TCP cachehit stat
This commit hooks up the TCP cachehit stat to the PCB locality feature
so that when a PCB is moved to the head of the list and a segment comes
in, we consider this a cache hit

This also matches the usage of the cachehit stat in UDP
2015-09-17 17:02:39 +02:00
Dirk Ziegelmeier
f62022cdf3 Compiler warning fixes (mostly constness in dual-stack configurations) 2015-09-17 13:59:52 +02:00
goldsimon
726af89168 minor compiler warning fixes and coding style 2015-09-17 11:00:21 +02:00
sg
68a1ec2eb1 Fixed passing ip_input() to netif_add() for single-IP-version NO_SYS configurations 2015-09-16 22:09:54 +02:00
Joel Cunningham
7276f49f54 Fix typos from task #12243
This fixes two typos spotted during visual inspection of changes related
to task #12243
2015-09-14 20:43:21 +02:00
Sylvain Rochet
4704c9a0ad tcp: fixed CHECKSUM_GEN_TCP feature (misplaced #define) 2015-09-14 14:48:35 +02:00
goldsimon
7702ed66a0 fixed compiler warning (stray 'a ' in code) - why is this a warning only??? 2015-09-08 09:52:22 +02:00
goldsimon
8a0fb03e21 Separate mib2 counter/table callbacks from snmp agent. This both cleans up the code and should allow integration of a 3rd party agent/mib2. 2015-09-08 09:47:30 +02:00
sg
1e4f312352 fixed compiling DNS code again 2015-09-08 06:03:27 +02:00
sg
77270adb96 Changed dns_gethostbyname_addrtype() to always be a function, fixed code for C PP :-( 2015-09-07 22:33:10 +02:00
sg
42170e4e57 fixed unused variable warning 2015-09-06 14:28:41 +02:00
Sylvain Rochet
318ba1decd dns: fixed trivial compiler warning
lwip/src/core/dns.c:1471:8: warning: extra tokens at end of #endif directive [-Wendif-labels]
 #endif LWIP_IPV4 && LWIP_IPV6
2015-09-06 11:27:33 +02:00
goldsimon
196120fabd worked on task #12243 (Add support for AAAA/IPv6 records to DNS) 2015-09-04 13:57:20 +02:00
goldsimon
dd3725a452 task #12243: DNS/IPv6: added support for AAAA records 2015-09-04 12:16:14 +02:00
goldsimon
c8cd67c989 fixed pointer type of value passed for snmpenableauthentraps (broken in 2010) 2015-09-03 14:02:30 +02:00
Stian Sebastian Skjelstad
aea87a9a2f Forget addresses set up by SLAAC when prefix expires. 2015-09-02 13:12:52 -06:00
sg
aa0e41c389 task #12178: hardware checksum capabilities can be configured per netif (use NETIF_SET_CHECKSUM_CTRL() in your netif's init function) 2015-09-01 22:04:15 +02:00
goldsimon
dd8feb49aa PBUF_REF with "custom" pbufs is now supported for RX pbufs (see pcapif in contrib for an example, LWIP_SUPPORT_CUSTOM_PBUF is required) 2015-08-31 08:29:23 +02:00
sg
a01a1b4556 support IPv4 source based routing: define LWIP_HOOK_IP4_ROUTE_SRC to point to a routing function 2015-08-30 21:54:39 +02:00
sg
b9a8310f4b fixed bug #44023: TCP ssthresh value is unclear: ssthresh is set to the full send window for active open, too, and is updated once after SYN to ensure the correct send window is used 2015-08-30 20:47:17 +02:00
Sylvain Rochet
ddba4b90c3 fixed typo: IP6_FRAG_COPYHEADER -> IPV6_FRAG_COPYHEADER 2015-08-28 14:28:04 +02:00
goldsimon
98f98048bc TCP window scaling: don't parse window scaling option on retransmission 2015-08-28 11:23:24 +02:00
goldsimon
367ac04ed8 Fixed UDP multicast receive filtering (multicast should only be received when bound to ANY or the destination multicast address) 2015-08-28 10:24:02 +02:00
goldsimon
43b18b20cc fixed bug #45818: API functions should check if type of ip_addr_t parameter matches the pcb type 2015-08-28 10:15:57 +02:00
goldsimon
06d8dba4a0 fixed bug #45559: Window scaling casts u32_t to u16_t without checks 2015-08-28 09:23:10 +02:00
sg
bc8120c864 Add another sanity check for bug #41009 2015-08-27 21:43:42 +02:00
sg
413bf85dde Remove empty init functions where not required for backwards compatibility 2015-08-27 21:35:18 +02:00
sg
f649172580 fixed bug bug #41009: IPv6 reassembly broken on 64-bit platforms: define IPV6_FRAG_COPYHEADER==1 on these platforms to copy the IPv6 header instead of referencing it, which gives more room for struct ip6_reass_helper 2015-08-26 22:16:23 +02:00
sg
aad76acb68 IPV6_REASS: fix ip6_reass_remove_oldest_datagram() when the first fragment to enqueue has more pbufs than IP_REASS_MAX_PBUFS 2015-08-26 21:20:13 +02:00
sg
5eb1c411a5 LWIP_LOOPIF_MCAST -> LWIP_LOOPIF_MULTICAST 2015-08-26 20:55:51 +02:00
Joel Cunningham
0ab21da820 Add multicast support to loopif
This commit adds support to send and receive multicast on the loopback
netif by enabling IGMP via NETIF_FLAG_IGMP

This commit also introduces an LwIP configuration option,
LWIP_LOOPIF_MCAST, to control the behavior and it defaults to off
2015-08-26 20:28:03 +02:00
sg
94550682d7 more cleanup prework to fix bug #45029 2015-08-24 22:46:34 +02:00
goldsimon
ee2d01ed88 fix compiler warnings when passing u16_t to pbuf_header() 2015-08-24 08:49:51 +02:00
sg
177c06b1f1 - prework for fixing bug #45029: access IPv4 configuration of struct netif via new API (netif_ip4_addr()/netif_ip4_netmask()/netif_ip4_gw()) instead of accessing the struct member directly. This way, we can change the struct member types from ip4_addr_t to ip_addr_t;
- fixed some bugs in calls to ip4_addr*() where the cast to u8_t* did not reveal the wrong address type
2015-08-20 22:39:48 +02:00
goldsimon
cc348dcca2 LWIP_IGMP and LWIP_MULTICAST_TX_OPTIONS need LWIP_IPV4 2015-08-20 16:36:54 +02:00
goldsimon
8622af77c1 nd6: adapt to constness of IP6_ADDR_ANY6 for IPv6-only configuration 2015-08-20 16:35:49 +02:00
goldsimon
3b21f469ca fix bug #45120 in a cleaner way 2015-08-20 13:05:59 +02:00
goldsimon
da5ccbf7d1 SNMP: tiny preparation for SNMP to support more versions than just v1: store request version in struct snmp_msg_pstat so that the response can be sent with the same version (v2c might already work but getbulk is missing) 2015-08-20 09:38:17 +02:00
goldsimon
5bd262f9e9 fixed passing u16_t 'snmp_varbind->value_len' to functions taking an u8_t only 2015-08-20 08:23:34 +02:00
goldsimon
2b93ef1d75 fixed bug #43790: Sending octet string of Length >255 from SNMP agent (patch by Manoj Kumar) 2015-08-20 08:12:50 +02:00
sg
05abfc8ded Fixed icmp.c after 1.4.0-based patch #45120 2015-08-19 22:14:37 +02:00
sg
de8e810792 fixed bug #45120: Broadcast & multiple interfaces handling 2015-08-19 20:55:03 +02:00
goldsimon
d104335501 dns.c: fixed compiler warning 2015-08-19 13:28:03 +02:00
goldsimon
7263cc675b fixed bug #45004: dns response without answer might be discarded 2015-08-19 10:33:42 +02:00
goldsimon
7df2dd67bd another fix for LWIP_MULTICAST_TX_OPTIONS: without LWIP_IGMP, udp_pcb->mcast_ttl was not initialized 2015-08-19 09:19:08 +02:00
goldsimon
5be95aa377 accidentally committed debug comment // 2015-08-19 08:36:54 +02:00
sg
c2f978bd1e patch by Chrysn: patch #8704 fix sys_timeouts_sleeptime function 2015-08-18 21:38:08 +02:00
sg
21815a1427 dns: fixed assertion when dns server address is set to ANY (patch #8692) 2015-08-18 21:30:46 +02:00
chrysn
877fcb35f4 fix return type of netif_add_ip6_address mismatch
the netif_add_ip6_address function was declared err_t in
src/include/lwip/netif.h, but defined as s8_t (the default value of
err_t) in its implementation in src/core/netif.c.

this causes "conflicting types for 'netif_add_ip6_address'" errors if
err_t is defined differently in cc.h (as for example recommended in
[1]).

as it only returns error constants, it is changed to use err_t
throughout.

[1] http://lwip.wikia.com/wiki/Porting_For_Bare_Metal
2015-08-18 20:55:30 +02:00
goldsimon
2a6f31a84e fix that LWIP_MULTICAST_TX_OPTIONS must be used in ip4_route instead of LWIP_IGMP 2015-08-18 16:35:06 +02:00
sg
4edade8079 allow multicast socket options IP_MULTICAST_TTL, IP_MULTICAST_IF and IP_MULTICAST_LOOP to be used without IGMP 2015-08-05 22:52:23 +02:00
Edgar Bonet
fb456e00ac Fix documentation of TCP_WRITE_FLAG_MORE.
The description of the flag was erroneous in src/core/tcp_out.c, and
self-contradictory in doc/rawapi.txt.
2015-08-05 21:20:34 +02:00
sg
76e785dd5e Fix that pbuf_realloc() called mem_trim() for "custom" PBUF_RAM 2015-08-05 20:40:35 +02:00
Erik Ekman
145efb1a33 Fix edge case in pbuf_take_at()
Writes to offsets pointing to the start of a pbuf in the chain
did nothing and just returned ERR_OK.

Added unit tests to verify the fix, and also
that pbuf_get_at()/pbuf_put_at() handles this case.
2015-08-03 20:34:08 +02:00
goldsimon
13801ebd74 netif_find(): name parameter can be const 2015-08-03 13:47:25 +02:00
goldsimon
11f350e63f Fixed ~ warnings in a different way 2015-08-03 09:10:49 +02:00
goldsimon
4dc3c7a6a0 Fixed warnings about NULL check not required (ip_addr_isany) and implicit conversion (~) 2015-08-03 08:35:01 +02:00
goldsimon
d106053e4c Removed accidentally committed // comment 2015-08-03 08:27:33 +02:00
goldsimon
5315751dc9 init.c: fixed window scaling range check 2015-08-03 08:24:36 +02:00
Joel Cunningham
5b0d9338fd netif, loopif: set link up on loopback interface
When LWIP_HAVE_LOOPIF is enabled, a separate loopback interface is added
as a netif. A netif need to have its link state set to up to be able to be
selected as a route in ip4_route or ip6_route.

The regression appears to be when bug #43904 (ip_route() and ip6_route()
must detect linkup status) was fixed.

Furthermore, there is no point of having the loopif down by default.
2015-07-27 00:22:30 +02:00
goldsimon
d3217718a9 Reverted fix for bug #38203 since it might be wrong 2015-06-23 09:20:06 +02:00
tabascoeye
7856141fc4 icmp: fix checksum on replies of echo request with ID 0, sequence 0 and either no data or any amount of 0x00 Bytes as data (closes: #45322)
When a client sends an ICMP echo request with ID 0, sequence 0 and
either no data or any amount of 0x00 bytes as data, the checksum in the
reply is wrong (off-by-one).

Expected checksum is 0xffff in that case, observed is 0x0000.
2015-06-15 15:53:14 +02:00
goldsimon
392ef77bc5 Fixed bug #45161 tcp.c / tcp_abandon / pcb->local_port set to zero but needed later for tcp_rst (introduced some months ago when fixing bug #42299) 2015-05-21 15:45:09 +02:00
goldsimon
de83c3e9e0 fixed bugs #45140 and #45141 (dhcp was not stopped correctly after fixing bug #38204) 2015-05-19 10:56:08 +02:00
goldsimon
050d233e10 changed dhcp state name defines to include "STATE_" to prevent confusion with message types (e.g. INFORMING vs. INFORM) 2015-05-19 10:32:14 +02:00
Sylvain Rochet
8c1f834a4a fixed bug #39683 Assertion "seg->tcphdr not aligned" failed with MEM_ALIGNMENT 1 or 2
We used a static 4 instead of MEM_ALIGNMENT earlier, however it broke
things for MEM_ALIGNMENT 1 or 2, fixed using a LWIP_MIN(MEM_ALIGNMENT,
4) statement.
2015-05-11 11:21:08 +02:00
Ivan Delamer
33a51a1bdc Improved IPv6 address formatting in ip6addr_ntoa_r(). 2015-05-05 14:01:38 -06:00
Ivan Delamer
73660f779b changes to ip6addr_aton() to avoid crash with some ill-formatted
strings.
2015-05-05 13:26:17 -06:00
Ivan Delamer
2c79332de7 Only send RS messages if we have a LL address in some state other than
invalid.
2015-05-05 13:05:41 -06:00
Ivan Delamer
2aec025e16 Bug fix: properly use unspecified source address for router solicitation
if needed.
2015-05-05 13:00:17 -06:00
Edgar Bonet
cf15872b8d SNMP, Missing const qualifier on internet_nodes[] in mib2.c. 2015-05-05 13:02:30 +02:00
sg
e20a071977 added functions dhcp/autoip_supplied_address() to check for the source of address assignemnt (replacement for NETIF_FLAG_DHCP) 2015-04-24 21:23:15 +02:00
goldsimon
f01dc8cc34 more "const" fixes 2015-04-23 09:59:15 +02:00
goldsimon
00a46f104a changed IP_IS_V6_VAL() to take an instance, not a pointer (to get the _val() functions the same) 2015-04-23 07:26:29 +02:00
goldsimon
e60bc69515 added more missing casts 2015-04-23 07:24:45 +02:00
goldsimon
fbadb8354f fixed const'ness of syscontact/sysname/syslocation 2015-04-22 16:06:39 +02:00
goldsimon
02dee05c16 Fixed const'ness in snmp (design of sys contact/name/location and snmpenableauthentraps is broken!) 2015-04-22 15:39:56 +02:00
goldsimon
b16316ae37 fixed more (tiny) warnings... 2015-04-22 14:56:58 +02:00
goldsimon
f5077dc982 fixed some more missing casts... 2015-04-22 14:18:54 +02:00
goldsimon
f468c492b9 fixed missing casts found with msvc /Wall 2015-04-22 13:38:10 +02:00
goldsimon
5410838793 igmp.c: fixed -Waddress, removed dead code 2015-04-22 12:50:26 +02:00
goldsimon
beabd3c6b7 Added some macros with extension "_val" that work on actual instances and leave away the "if != NULL" check to get rid of gcc "-Waddress" warnings in the core code at least (I might not have caught all of them, yet) 2015-04-22 12:43:03 +02:00
goldsimon
a81c7bf04b fixed compiling icmp.c (variable has to be declared at the beginning of a scope) 2015-04-22 11:29:35 +02:00
goldsimon
902d190a11 Many const fixes throughout the stack (although these are not all, yet) 2015-04-22 10:29:43 +02:00
goldsimon
fe195a86cd dhcp: move declaration of "extern void dhcp_set_ntp_servers()" from dhcp.c to dhcp.h to make the function prototype known to implementers 2015-04-22 09:17:06 +02:00
Sylvain Rochet
632de523de Fixed PBUF_LINK_ENCAPSULATION_HLEN support
PBUF_LINK_ENCAPSULATION_HLEN support was introduced by 6ef7563f and
missed the fact that header size calculation/reservation using
computation like PBUF_LINK_HLEN + PBUF_IP_HLEN + ... are used all over
the source code. Hopefully fixed all of them.
2015-04-20 23:43:33 +02:00
sg
a5503df32b Fixed typo in dchp_inform (state is named DHCP_INFORMING, not DHCP_INFORM) 2015-04-19 12:30:20 +02:00
sg
e77e18f8c4 Worked on IPv6-only stack:
- prepared DNS;
- fixed compiling ppp.c
2015-04-13 21:24:40 +02:00
sg
69c337b31d Fixed ntoa/aton/ntop/pton definitions after making IPv4 optional 2015-04-13 20:52:42 +02:00
sg
c1c65777b6 worked on task #13480: added LWIP_IPV4 define - IPv4 can be disabled, leaving an IPv6-only stack (SNMP is still missing) 2015-04-12 10:43:46 +02:00
Sylvain Rochet
dcdb360a19 ip6_addr.c: fixed IPv6 ip6_addr_any value
0000:0000:0000:0000:0000:0000:0000:0000 instead of
0000:000a:0000:000b:0000:000c:0000:000d
2015-04-11 20:24:56 +02:00
goldsimon
1985579148 fixed compiler warning (signed/unsigned comparison) introduced when fixing bug #44766 2015-04-10 07:46:31 +02:00
goldsimon
d31dbc6798 Fixed constant initializer problem in ip_addr_t by having ip6 first 2015-04-10 07:41:40 +02:00
Sylvain Rochet
ffd45a2261 PPP, added new build dependencies in init.c 2015-04-10 01:00:08 +02:00
Sylvain Rochet
135631d29d fixed some obvious compiler warnings
lwip/src/include/lwip/autoip.h:52:1: error: C++ style comments are not allowed in ISO C90 [-Werror]
 //#include "lwip/udp.h"

lwip/src/core/ipv4/autoip.c:70:1: error: C++ style comments are not allowed in ISO C90 [-Werror]
 //#include "lwip/udp.h"

lwip/src/include/lwip/api.h:239:25: error: declaration of ‘lev’ shadows a previous local [-Werror=shadow]
   SYS_ARCH_DECL_PROTECT(lev); \
2015-04-09 23:27:36 +02:00
sg
ce7e31cd04 task #12722 (improve IPv4/v6 address handling): renamed ip_addr_t to ip4_addr_t, renamed ipX_addr_t to ip_addr_t and added IP version;
ip_addr_t is used for all generic IP addresses for the API, ip(4/6)_addr_t are only used internally or when initializing netifs or when calling version-related functions
2015-04-09 22:21:15 +02:00
goldsimon
4ff1eb1890 fixed bug #44766 (LWIP_WND_SCALE: tcphdr->wnd was not scaled in two places) 2015-04-08 07:29:11 +02:00
goldsimon
7c47c917b5 dhcp: start discovery with short timeouts on network change, even if already discovering 2015-04-02 11:02:16 +02:00
sg
93fa268db1 used ip6_addr_t instead of struct ip6_addr, fix const'ness in ip6_route parameters 2015-03-24 21:30:22 +01:00
sg
521c92764d loopif is not required for loopback traffic any more but passed through any netif (ENABLE_LOOPBACK has to be enabled) (task #13515) 2015-03-24 21:22:19 +01:00
sg
71d121fab2 Added input & route hooks for IPv6 to stay in line with IPv4 2015-03-24 20:33:47 +01:00
sg
33d5e646e5 fixed bug #41318 (Bad memory ref in tcp_input() after tcp_close()) 2015-03-21 21:19:10 +01:00
sg
c00a62d37f fixed bug #38468 (tcp_sent() not called on half-open connection for data ACKed with the same ack as FIN) 2015-03-21 20:56:42 +01:00
sg
4463239d6e fixed bug #38204 (DHCP lease time not handled correctly) 2015-03-21 10:09:31 +01:00
sg
45d82c8d99 dhcp.c: removed dead code (#if 0) 2015-03-20 21:03:19 +01:00
sg
3e302e8683 fixed bug #38714 (Missing option and client address in DHCPRELEASE message) 2015-03-20 21:02:41 +01:00
sg
d6620f0f3a fixed bug #38203 (DHCP options are not recorded in all DHCP ack messages) 2015-03-20 20:29:04 +01:00
Sylvain Rochet
f7a5b71dba nd6: fixed compiler warnings
nd6.c: In function ‘nd6_send_rs’:
nd6.c:997:52: warning: suggest parentheses around ‘+’ inside ‘<<’ [-Wparentheses]
   p = pbuf_alloc(PBUF_IP, sizeof(struct rs_header) + lladdr_opt_len << 3, PBUF_RAM);
                                                    ^
nd6.c:998:58: warning: suggest parentheses around ‘+’ inside ‘<<’ [-Wparentheses]
   if ((p == NULL) || (p->len < (sizeof(struct rs_header) + lladdr_opt_len << 3))) {
2015-03-20 20:11:59 +01:00
Ivan Delamer
a4d14fc987 fix bug #44586: nd6_send_rs() pbuf size error 2015-03-20 09:04:22 -06:00
Sylvain Rochet
c8587e1242 tcp_in: typo fix. Fixes bug #4458944589. 2015-03-20 13:22:47 +01:00
Clint Sbisa
32f6e7e231 tcp: Fix ooseq processing when seqno is near 2^32
An edge case in out-of-sequence TCP packet processing did not use the
appropriate macro to check if the sender overran the recieve window.

Consequently, this case sometimes evaluated to true when it shouldn't, which
resulted in various bad behavior, including trying to resize a TCP buffer to 4
gigabytes.
2015-03-20 08:32:14 +01:00
Ivan Delamer
bc08c1d2b7 fixed bug #43095. Check actual link-layer address option length, versus
maximum length defined in struct. Bug would express itself if we have a
netif with 8-byte addresses and other netifs with 6-byte-or-less
addresses.
2015-03-18 13:21:39 -06:00
Ivan Delamer
8451feaa7a fixed bug #42885 nd6_reachability_hint() accepts an address of an
unknown neighbour
2015-03-18 12:22:49 -06:00
Ivan Delamer
12e3b52f4d fixed bug #39226: Validity of netif IPv6 address is not always checked 2015-03-18 11:56:48 -06:00
Ivan Delamer
291f1382c5 fix ip6 part of bug #43904: ip_route() and ip6_route() must detect
linkup status.
2015-03-18 10:56:02 -06:00
sg
905f1609b3 fixed the IPv4 part of bug #43904 (ip_route() must detect linkup status) 2015-03-09 21:35:57 +01:00
Sylvain Rochet
dbf9d0f094 DNS, warning fix, dns_init() -> dns_init(void)
lwip/src/core/dns.c: In function ‘dns_init’:
lwip/src/core/dns.c:336:1: warning: old-style function definition [-Wold-style-definition]
 dns_init()
2015-03-07 23:28:18 +01:00
sg
12d374d4b7 Added function documentation, fixed coding style 2015-03-06 21:38:57 +01:00
sg
0ddd7de1ba patch #8359 (Provide utility function to add an IPv6 address to an interface) 2015-03-06 21:30:59 +01:00
sg
f385193a89 Patch #8207 (Don't Use ND6 Prefix Flags Field When LWIP_IPV6_AUTOCONFIG Is Deasserted) 2015-03-06 21:03:21 +01:00
Philip Gladstone
ff078920bc Patch #8360 (Speed up the acquisition of SLAAC addresses) - adapted to bug #43784 2015-03-06 20:58:30 +01:00
sg
553c4203ab tcp/udp_netif_ipv4_addr_changed(): don't change specific-address of local tcp_listen/udp_pcb to ANY on address change 2015-03-06 20:25:51 +01:00
sg
4e520cdd30 fixed bug #37068 (netif up/down handling is unclear): correclty separated administrative status of a netif (up/down) from 'valid address' status ATTENTION: netif_set_up() now always has to be called, even when dhcp/autoip is used! 2015-03-05 20:57:43 +01:00