Commit Graph

3058 Commits

Author SHA1 Message Date
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
Sylvain Rochet
4e62a88870 PPP, PPPoL2TP, fixed build with IPv6 enabled 2015-03-20 09:48:40 +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
Sylvain Rochet
36e90a1bd5 PPP, CCP, add dummy ccp_ functions in ppp.c so it builds if CCP_SUPPORT is set 2015-03-20 00:37:34 +01:00
Sylvain Rochet
9fbe900949 PPP, MPPE, replaced #ifdef MPPE to #if MPPE_SUPPORT 2015-03-20 00:20:12 +01:00
Sylvain Rochet
73f1511ac2 PPP, CORE, removed auth fields from struct ppp_pcb if auth is disabled 2015-03-20 00:00:46 +01:00
Sylvain Rochet
5937932370 PPP, CCP, various fix if MPPE is enabled 2015-03-19 21:45:19 +01:00
Sylvain Rochet
794c93b540 PPP, CCP, various compiler warnings fix 2015-03-19 21:45:19 +01:00
Sylvain Rochet
b92ac33022 PPP, CCP, updated to our utils.c function name 2015-03-19 21:45:19 +01:00
Sylvain Rochet
90bbcbf994 PPP, CCP, updated ccp_printpkt() prototype to match other *_printpkt() 2015-03-19 21:45:19 +01:00
Sylvain Rochet
151995f88c PPP, CCP, updated ANY_COMPRESS() to use ccp_options* 2015-03-19 21:45:19 +01:00
Sylvain Rochet
611b3c4c2c PPP, CCP, commented-in unused global variables used for options 2015-03-19 21:45:19 +01:00
Sylvain Rochet
2a6104ab17 PPP, CCP, added ccp.h in ppp.h 2015-03-19 21:45:19 +01:00
Sylvain Rochet
1dcd4cc220 PPP, CCP, reworked to our ppp_pcb* pointer and ppp_pcb->ccp* data field 2015-03-19 21:45:19 +01:00
Sylvain Rochet
7174578ac3 PPP, CCP, moved CCP global variables to ppp_pcb (ppp.h) 2015-03-19 21:45:19 +01:00
Sylvain Rochet
10d09049bb PPP, CCP, replaced bool to unsigned int in struct ccp_options 2015-03-19 21:45:19 +01:00
Sylvain Rochet
98c6a4e86e PPP, CCP, updated FSM state with our FSM state define PPP_FSM_x 2015-03-19 21:45:19 +01:00
Sylvain Rochet
3bd52891c5 PPP, CCP, commented-in unused PPP config file parsing 2015-03-19 21:45:19 +01:00
Sylvain Rochet
ee752ab1ce PPP, PPPoS, renamed PPP_INPROC_MULTITHREADED to PPP_INPROC_IRQ_SAFE
Follow-up of the #44565 bug fix, renamed the misnamed
PPP_INPROC_MULTITHREADED to PPP_INPROC_IRQ_SAFE because it is
IRQ safe but not thread safe.

Updated PPP documentation which now clearly state when and how
this feature can be used.
2015-03-19 21:43:55 +01:00
sg
9eb900c448 fixed race conditions in assigning netconn->last_err (fixed bugs #38121 and #37676) 2015-03-19 21:20:29 +01:00
Sylvain Rochet
0e919d25e9 PPP, PPPoS, improved tcpip input path, fixed bug #44565
New input type TCPIP_MSG_INPKT_PPPOS. Removed the netif input pointer usage
which was actually broken by design.

Fixed bug #44565.
2015-03-19 21:04:21 +01:00
Sylvain Rochet
4ed34d2c6f PPP, PPPoL2TP, fixed build without IPv6 enabled 2015-03-19 20:43:04 +01:00
Sylvain Rochet
c893b44da2 PPP, PPPoS, struct pbuf *n and u8_t *cur are now unused, removed 2015-03-19 20:29:26 +01:00
Ivan Delamer
d06a736f41 fix bug #44578: Build fails for IPv6-only configuration 2015-03-19 10:08:49 -06:00
goldsimon
b135a0aa49 pppos_input_tcpip: fix pbuf leak if tcpip_input returns error, use pbuf_take instead of duplicate copy code 2015-03-19 07:14:33 +01:00
Ivan Delamer
c73daef2a1 fixed bug #43843: ip6_addr_ismulticast_ doesn't allow for transient
multicast address
2015-03-18 14:04:39 -06: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
e30823769c renamed ND6_RA_FLAG_OTHER_STATEFUL_CONFIG to ND6_RA_FLAG_OTHER_CONFIG
as explained in bug #39963 and RFCs.
2015-03-18 12:01:15 -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
5812b22662 Pending fix for bug #37993: IPv6 Does Not Subscribe to Link-Local
All-Nodes Multicast Group By Default
2015-03-18 11:20:16 -06:00
Ivan Delamer
f139b14a3c added macros for handling IPv6 multicast filter callback. 2015-03-18 11:08:40 -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
Ivan Delamer
e0fe83740a fixed bug #44565: PPPOS support in tcpip thread breaks SLIP 2015-03-18 10:16:14 -06:00
Sylvain Rochet
9012ec5310 PPP, PPPoS, changed pppos_output_append() description to match code change 2015-03-16 21:54:50 +01:00
Sylvain Rochet
c37ecb1552 PPP, cleared warnings if PPP_DEBUG is off 2015-03-15 17:57:16 +01:00
Sylvain Rochet
59d8e76081 PPP, code cleaning, u_char to u8_t
Replaced u_char to u8_t in our PPP files.
2015-03-14 14:05:33 +01:00
Sylvain Rochet
5097ac05bf PPP, fixed warnings if LWIP_SNMP is disabled 2015-03-14 14:01:29 +01:00
Sylvain Rochet
a9c154691b PPP, PPPoS, code cleaning 2015-03-14 14:01:11 +01:00
Sylvain Rochet
d628a9bc78 PPP, PPPoS, moved common FCS output code in pppos_output_last() 2015-03-14 14:01:11 +01:00
Sylvain Rochet
2fb1859732 PPP, PPPoS, moved checksum computation to pppos_output_append()
Output code is slightly smaller this way.
2015-03-14 14:01:07 +01:00
Sylvain Rochet
5f5d16c698 PPP, PPPoS, code cleaning
Reduced types that were too large, replace u_char to u8_t, u_short to u16_t.
2015-03-14 13:17:17 +01:00
Sylvain Rochet
f666e772a2 PPP, PPPoL2TP, warning fix if PPP IPv6 is enabled
lwip/src/netif/ppp/pppol2tp.c: In function ‘pppol2tp_udp_send’:
lwip/src/netif/ppp/pppol2tp.c:1229:3: warning: ‘err’ may be used uninitialized in this function [-Wmaybe-uninitialized]
   return err;
   ^
2015-03-14 12:48:38 +01:00
Sylvain Rochet
8974b12af5 PPP, PPPoE, removed redundant size check 2015-03-14 01:12:43 +01:00
Sylvain Rochet
f96d5c9633 PPP, PPPoS, code cleaning
Renamed pppos_drop() → pppos_input_drop()
Renamed pppos_free_current_input_packet() → pppos_input_free_current_packet()
Moved pppos_output_last() after pppos_output_append()
Moved pppos_input_free_current_packet() before pppos_input_drop()
2015-03-14 01:08:56 +01:00
Sylvain Rochet
50336aaedd PPP, ppp->last_xmit is only used in PPPoS, moved to PPPoS
Only PPPoS need to keep track of last transmitted packet for HDLC flag,
removed from PPPoE and PPPoL2TP and moved to PPPoS.
2015-03-14 01:03:58 +01:00
Sylvain Rochet
6a04357547 PPP, PPPoS, reworked output path, reduced serial tx pbuf buffers to 1
We actually allocated a pbuf chain only to iterate later the linked list
calling sio_write() for each pbuf, improved by calling sio_write() when
buffer is full and by recycling the pbuf, therefore only using one pbuf
for PPPoS output path.

Reworked pppos_write() and pppos_netif_output() to share more common
code into pppos_output_append() and pppos_output_last().
2015-03-14 00:37:58 +01:00
Sylvain Rochet
e27ab3a24f PPP, PPPoS, disable TCPIP API if PPP_INPROC_MULTITHREADED is true
If PPP_INPROC_MULTITHREADED is true, then user does not what to use
the TCPIP API. Disabling the TCPIP API helps the user to understand
that PPP_INPROC_MULTITHREADED must not be used if he wish to use
the TCPIP API.
2015-03-11 23:52:20 +01:00
Sylvain Rochet
121de4ef47 PPP, PPPoS, now using MEMCPY here, add #include <string.h> 2015-03-11 09:29:44 +01:00
Sylvain Rochet
77f7d99048 PPP, PPPoS, add pppos_input_tcpip() input helper function for !NO_SYS users 2015-03-11 09:28:35 +01:00
Sylvain Rochet
4b035b9902 PPP, PPPoS, PPP_INPROC_MULTITHREADED defaults to 0, explain thread safety issue with it 2015-03-11 01:20:53 +01:00
Sylvain Rochet
9778b1411c PPP, PPPoS, TCPIP: add packet input path for point to point interfaces (only PPPoS for now) through the TCPIP API
!NO_SYS users may now use as well the TCPIP API for PPPoS input data,
this way they can disable PPP_INPROC_MULTITHREADED and run pppos_input()
inside the lwIP thread, which fixes, at least for them, all the
threading issues related to PPP_INPROC_MULTITHREADED.
2015-03-11 00:58:09 +01:00
Sylvain Rochet
636ff411f1 PPP, PPPoS, improve the freeing of remaining RX pbuf if PPP_INPROC_MULTITHREADED is not enabled
If PPP_INPROC_MULTITHREADED is not enabled, we can free unfinished
RX pbuf from the pppos_disconnect() function because pppos_input()
is running in the same context. Thanks to the pppos->open flags we
now only need to free remaining pbuf in the disconnect function
if PPP_INPROC_MULTITHREADED is not enabled.
2015-03-10 23:58:16 +01:00
Sylvain Rochet
02598d1e91 PPP, PPPoS, moved pcomp and accomp only used by PPPoS to PPPoS 2015-03-10 23:51:32 +01:00
Sylvain Rochet
31aea3c996 PPP, PPPoS, moved vj_enabled flag from PPP CORE to PPPoS
Now that we have flags in PPPoS, moved vj_enabled only used for PPPoS to
PPPoS.
2015-03-10 23:42:14 +01:00
Sylvain Rochet
a60f2588d6 PPP, PPPoE and PPPoL2TP, removed ppp->pcomp usage
We refuse protocol compression in both PPPoE and PPPoL2TP, therefore
ppp->pcomp can't be true, removed.
2015-03-10 23:34:11 +01:00
Sylvain Rochet
d518f5f307 PPP, PPPoS, improve thread safety of pppos_input()
Don't process input data if PPPoS is closed, it helps using
pppos_input() from a different context to prevent pppos_input() to
modify PPPoS RX machine state on a closed PPPoS session. It also
prevents allocating pbuf (which are going to be tossed out by PPP core)
and parsing serial input on a closed session.

It only mitigates the fact that this function is actually NOT thread
safe in absolutely all cases, it does not fix it but it helps for a low
cost.

For example user application should never call pppos_input() while
pppos_connect() or pppos_listen() is currently running because both of
them are freeing any input pbuf left over from the last session before
resetting the PPPoS state, they really have to to prevent pbuf leaks.

We cannot fix that easily because we don't have spinlock with an
irqsave/irqrestore helper for IRQ contexts. Mutex cannot be used in
interrupt contexts (or again, with an IRQ mutex helper).

We are going to improve the documentation on this point.
2015-03-10 23:20:23 +01:00
Sylvain Rochet
d5cbacba50 PPP, PPPoS, don't protect pppos->in_accm if PPP_INPROC_MULTITHREADED is not enabled
If pppos_input() is used without PPP_INPROC_MULTITHREADED, then pppos_input()
is running in the lwIP context, we don't need to protect anything.
2015-03-10 22:35:04 +01:00
Sylvain Rochet
ab0f3da650 Revert "PPP, PPPoS, fixed thread safety of pppos_input()"
This reverts commit ea58a8103c.
2015-03-10 21:49:50 +01:00
Sylvain Rochet
52de24b95b Revert "PPP, PPPoS, added necessary comment about mutex"
This reverts commit b23a6172ed.
2015-03-10 21:49:50 +01:00
Sylvain Rochet
70b60bbe16 PPP, display correct pbuf size in ppp_input() debug messages 2015-03-10 21:49:50 +01:00
sg
aff890bce8 Fixed compiler error if LWIP_IPV6==0 but LWIP_IPV6_FRAG==1 2015-03-10 21:42:29 +01:00
sg
905f1609b3 fixed the IPv4 part of bug #43904 (ip_route() must detect linkup status) 2015-03-09 21:35:57 +01:00
goldsimon
c978b25f7f Enable LWIP_PPP_API by default if (PPP_SUPPORT && (NO_SYS == 0)) 2015-03-09 09:13:28 +01:00
Sylvain Rochet
2b526756f0 PPP, updated netif/FILES about PPP 2015-03-09 00:49:08 +01:00
Sylvain Rochet
8a436d5103 PPP, IPV6CP, code cleaning on VJ support 2015-03-08 23:36:28 +01:00
Sylvain Rochet
1dd050aaca PPP, IPV6CP, build out IPv6 VJ support using the existing IPV6CP_COMP define 2015-03-08 23:17:11 +01:00
Sylvain Rochet
99bcce7892 PPP, IPCP, removed proxy ARP support 2015-03-08 23:00:27 +01:00
Sylvain Rochet
0e2ea94f5e PPP, IPCP, removed WINS support 2015-03-08 22:53:12 +01:00
Sylvain Rochet
9cd7abdd6e PPP, IPCP, fully removed DNS support from IPCP if LWIP_DNS is disabled 2015-03-08 22:40:56 +01:00
Sylvain Rochet
dbacfe0a1d PPP, IPCP, fully removed VJ support from IPCP if VJ_SUPPORT is disabled 2015-03-08 22:40:53 +01:00
Sylvain Rochet
969306f0f1 API: netdb: replaced deprecated ip_ntoa() to ipaddr_ntoa() 2015-03-08 13:57:13 +01:00
Sylvain Rochet
af722a2978 PPP, IPv6, reduce size of llv6_ntoa() function
Reduced static buffer to the strict necessary (26 bytes), removed
call to eui64_ntoa(), merged eui64_ntoa() into llv6_ntoa().

272 bytes (code + static buffers) to 140 bytes on x86_64.

Improved eui64_ntoa() as well, we don't need it anymore but I'd
like to keep all eui64_* helpers functions.
2015-03-08 13:33:55 +01:00
Sylvain Rochet
7fce9346dc PPP, improved IPv6 address setting
Set IPv6 link local invalid before clearing it. Don't wait sif6up() to set
the link local valid, netif_ip6_addr_set_state() is only an accessor function
so it does not start any discovery whatsoever.
2015-03-08 12:47:09 +01:00
Sylvain Rochet
b23a6172ed PPP, PPPoS, added necessary comment about mutex 2015-03-08 12:05:13 +01:00
Sylvain Rochet
ea58a8103c PPP, PPPoS, fixed thread safety of pppos_input()
PPPoS was actually not thread safe, pppos_input() can be called from
lwIP user port at any time, whatever the PPP state is. It might even be
called during pppos_connect() and pppos_listen(), this is quite unlikely
the port do that but nothing prevent the user to since we document
pppos_input() as being thread safe.

Added a mutex if PPP_INPROC_MULTITHREADED is set and ensure pppos_input()
is safe in regard to other pppos_* functions.
2015-03-08 02:48:52 +01:00
Sylvain Rochet
b3c7e948be PPP, removed now useless struct ppp_addrs from ppp_pcb
Saved a few bytes of useless copy.
2015-03-08 00:44:47 +01:00
Sylvain Rochet
c966a538fb PPP, improved IPv6 address setting
Now setting IPv6 addresses in sif6addr() instead of sif6up(),
removed the useless copy of addresses.
2015-03-08 00:40:34 +01:00
Sylvain Rochet
3027a7d7e2 PPP, using DNS API for DNS servers
Now setting DNS addresses in sdns() using dns_setserver() instead
of keeping a local copy. This is probably the wanted PPP behavior,
we will see if users want this conditional.
2015-03-08 00:11:52 +01:00
Sylvain Rochet
dd22176935 PPP, improved IPv4 address setting
Now setting IPv4 addresses in sifaddr() instead of sifup(),
removed the useless copy of addresses.
2015-03-07 23:53:21 +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
Sylvain Rochet
b3218d45f3 PPP, make DNS a little more optional if LWIP_DNS is unset 2015-03-07 23:28:14 +01:00
Sylvain Rochet
3ca5184998 PPP, CORE, separated administrative status from link status of PPP netif
This was confusing, recent lwIP changes fixed the meaning as well as
how it is used everywhere, making the administrative status a user-only
controlled flag. Now that it's clear, updated PPP to follow lwIP
core change.

Using netif_set_link_{up,down} instead of netif_set_{up,down} when PPP
reaches/leaves running state. PPP interface is now set to administratively
UP when created with link state down.
2015-03-07 22:24:27 +01:00
sg
007ab69777 Fixed default LWIP_SUPPORT_CUSTOM_PBUF setting for IPv6/frag 2015-03-06 22:09:33 +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
b62f443be5 Fixed comment for NETIF_FLAG_UP after fixing bug #37068 2015-03-06 20:49:47 +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
Sylvain Rochet
89434f6a2f PPP, CORE, call netif_set_up() after if4_up and if6_up flags are set, to prevent dropping packets
lwIP core might send packet when calling netif_set_up(), don't drop packets
anymore in ppp_netif_output_ip4() and ppp_netif_output_ip6() because flags
are cleared.
2015-03-05 22:00:11 +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
sg
72dcdb7655 fixed bug #43784 (a host should send at least one Router Solicitation) 2015-03-04 21:21:49 +01:00
sg
db5510b866 init.c: raise an error if LWIP_PPP_API==1 but PPP_SUPPORT==0 2015-03-04 21:10:29 +01:00
sg
61e0efa0c7 fixed bug #41094 (Byte-order bug in IPv6 fragmentation header test) 2015-03-04 21:02:52 +01:00
sg
12514c09b2 Fixed bug #39956 (netif_create_ip6_linklocal_address out of bounds access of netif::hwaddr) 2015-03-04 20:58:37 +01:00
sg
90a0590de1 patch by Zach Smith: fixed bug #38153 (nd6_input() byte order issues) 2015-03-04 20:49:02 +01:00
Sylvain Rochet
b09c891290 PPP, PPPoE, removed devname variable from pppoe_disc_input()
Only used for debug, reworked in a more clever way. It was actually broken
by design: setting an interface integer into a string without formatting
was quite a dumb idea.
2015-03-02 00:45:19 +01:00