Commit Graph

3787 Commits

Author SHA1 Message Date
Sylvain Rochet
b55412a0c4 PPP, PPPoS, replaced static sio_write() calls to a user defined callback
The overall lwIP design on data flows (netif,udp,tcp) is to use a user
defined callback to get data from stack and a static function to send
data to stack, which makes perfect sense. The SIO port was an exception,
the PPP stack never really used the SIO port by only using the
sio_send() function (and the ignominious sio_read_abort() function a
while back).

The way the SIO port is currently designed adds a tight coupling between
the lwIP port and the user code if the user need to do specific user
code if the current uart used is the PPPoS uart, which is not nice,
especially because all the lwIP stack is quite clean at this subject.

While we are at stabilizing the PPP API, change this behavior before
it's too late by replacing the static sio_write() calls to a user
defined callback.
2015-09-13 17:53:16 +02:00
Sylvain Rochet
41ee45d9f7 PPP: fix constness in PPP related files when PRINTPKT_SUPPORT is enabled 2015-09-09 20:28:01 +02:00
Dirk Ziegelmeier
79e7201854 PPP: fix constness in PPP related files (GCC -Wcast-qual)
Signed-off-by: Dirk Ziegelmeier <dirk@ziegelmeier.net>
2015-09-09 14:05: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
b8d7a2b8e6 fixed comment, fixed unused parameter in mppe_compress() 2015-09-08 09:50:30 +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
sg
1fbbf0e837 lwip_getaddrinfo: check max name length 2015-09-04 21:12:39 +02:00
sg
6795590603 fixed missing #endif 2015-09-04 21:02:24 +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
Sylvain Rochet
c4a1cad81b PPP, magic, build-out useless code when LWIP_RAND is defined 2015-09-01 10:29:53 +02:00
Sylvain Rochet
0f3fbb267b PPP, magic, call magic_randomize() for all packets
magic_randomize() wasn't actually called for IP4/IP6 packets, fixed
2015-08-31 10:20:12 +02:00
Sylvain Rochet
a17b3fc838 PPP, magic, improved magic_randomize() when using PPP_MD5_RANDM
Added the random seed already used without PPP_MD5_RANDM
as an entropy source when PPP_MD5_RANDM feature is enabled.

(And a little bit of code cleaning for both)
2015-08-31 10:20:12 +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
goldsimon
b572028e95 ethernet_input: pass IPv4 packets to ip4_input, not to ip_input 2015-08-31 08:26:44 +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
Sylvain Rochet
36305e5bd8 PPP, magic, use LWIP_RAND() if available
If LWIP_RAND() is available, it is used instead of libc srand()/rand()
if PPP_MD5_RANDM is disabled and it is added as a source of randomness
if PPP_MD5_RANDM is enabled.
2015-08-30 21:09:39 +02:00
Sylvain Rochet
541e3b6eb4 PPP, magic, improved magic_randomize() for PPP_MD5_RANDM is not enabled
A disabled PPP_MD5_RANDM should not be used when challenge are used, but
anyway, improved magic_randomize() so magic_randomseed is not equals to
sys_jiffies() which is pretty useless because that's fully predicable.
2015-08-30 21:09:39 +02:00
Sylvain Rochet
a24f4421d6 PPP, magic, using magic_random_bytes() for CHAP/MSCHAP/EAP instead of for-loop byte where possible 2015-08-30 21:09:39 +02:00
Sylvain Rochet
e8399416ae PPP, magic, renamed random_bytes() to magic_random_bytes() for API coherency 2015-08-30 21:09:39 +02:00
Sylvain Rochet
d0fa8acf86 PPP, magic, enables building without PPP_MD5_RANDM support
The only API difference with and without the PPP_MD5_RANDM support is the
availability of the random_bytes() function. Added a random_bytes()
function on top of magic() when PPP_MD5_RANDM support is not enabled,
thus allowing builds for both cases.

PPP_MD5_RANDM is still enabled by default (it was mandatory) if a protocol
using encryption is enabled, such as CHAP, EAP, or L2TP auth support.
2015-08-30 21:09:39 +02:00
Sylvain Rochet
ced7bef274 PPP, magic, MD5 random pool size cannot be anything else than MD5 hash size, code cleaning to make it clear 2015-08-30 21:09:39 +02:00
Sylvain Rochet
311644f39b PPP, PPPoS, remove magic_randomize() from PPPoS, it is already called in ppp_input()
There is no point of calling magic_randomize() for each pppos_input()
call, making magic_randomize() potentially called for each serial input
byte which is quite a bad idea since magic_randomize() is quite
intensive in processing time (MD5 computation) compared to HDLC frame
parsing. There is no entropy added when being called for each input byte
rather than for each valid input packet because byte input is a
monotonic event at the packet level. Well, if packet arrival time is a
valid entropy source even so, which I doubt a lot, but we don't really
have anything else and we really need random for PPP authentication
layers.
2015-08-30 21:09:38 +02:00
Sylvain Rochet
91e40e668c PPP, minor coding style fix 2015-08-30 21:09:38 +02:00
Sylvain Rochet
987f6237c4 PPP, MPPE, drop input/output packets if we couldn't find the chosen decompressor/compressor
Drop input/output packets if we couldn't find a decompressor/compressor,
it can't really happen because we only negotiate what we are able to
compress/decompress, but for the sake of code consistency it makes much
more sense to do so.
2015-08-30 21:09:38 +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
Sylvain Rochet
b79c3aadd2 PPP, MPPE, improve dropping of unencrypted received packet
Improve dropping of unencrypted received packet by taking into account
all other data protocols (such as VJ packets) in a generic way.
2015-08-28 00:19:32 +02:00
Sylvain Rochet
46985bf750 PPP, explain better why we don't need protp->datainput callback 2015-08-27 22:42:42 +02:00
Sylvain Rochet
36b3878a45 PPP, PPPoS, fixed copy/paste typo in pppos_send_config() out accm debug message 2015-08-27 22:24:27 +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
Sylvain Rochet
97ef85c9aa PPP, MPPE, fixed TCP over MPPE
We used to modify in place the packet payload during encryption, it works
well for UDP and ICMP but TCP stack requires that we don't change the
packet payload, therefore we now copy the whole packet before encryption.
2015-08-27 01:58:35 +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
sg
0d6001a196 fix comment indentation 2015-08-26 20:29:38 +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
204bd29e52 fixed bug #45827: recvfrom: TCP window is updated with MSG_PEEK 2015-08-25 22:25:51 +02:00
goldsimon
fd8b37dc14 fixed bug #45029 (Several macros use ip6_2_ip() without supplying a storage address): removed netconn_*_ip6() macros 2015-08-25 07:33:24 +02:00
sg
94550682d7 more cleanup prework to fix bug #45029 2015-08-24 22:46:34 +02:00
sg
7754f96549 Change IP6_ADDR/IP_ADDR6 to initialize a full IPv6 address (e.g. use with PP_HTONL) - renamed old IP6_ADDR() to IP6_ADDR_PART() 2015-08-24 20:30:48 +02:00
goldsimon
ee2d01ed88 fix compiler warnings when passing u16_t to pbuf_header() 2015-08-24 08:49:51 +02:00
goldsimon
e97f9fca22 netdb: fix debug output when IPv6 is enabled 2015-08-24 08:02:23 +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
82033d5029 Clarify comment for MEMP_NUM_SNMP_VARBIND/MEMP_NUM_SNMP_VALUE 2015-08-20 11:43:36 +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
a22a92b481 Fixed compiler warning when window scaling is enabled (tcp_sndbuf() should still return u16_t since that value can directly be passed to tcp_write()) 2015-08-20 09:18:20 +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
Joel Cunningham
d850efdd08 IPv6 sockaddr clean ups
This commit address two issues with sockaddr struct implementations for
IPv6:

  1) struct sockaddr_in6 should have 32-bit unsigned field sin6_scope_id
     as specified in Section 3.4 of RFC 3493 (Basic Socket Interface
	 Extensions for IPv6)
  2) struct sockaddr is not extended in IPv6 to contain space for
     struct sockaddr_in6.  Applications should be using struct
	 sockaddr_storage when needing generic storage.  This removes the
	 extra bytes added when LWIP_IPV6 is defined
2015-08-19 10:15:47 +02:00
goldsimon
a6bd0944db LWIP_NETCONN_SEM_PER_THREAD: ensure sys_sem_valid() is only called for non-NULL pointers (not all ports might check this) 2015-08-19 09:57:59 +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
sg
c2f7e166a0 fixed bug #45723 netconn_delete unconditionally uses macro TCP_SLOW_INTERVAL 2015-08-18 20:32:09 +02:00
sg
e171b4e3f0 Fixed usages of SYS_SEM_NULL after using pointers everywhere 2015-08-18 20:29:16 +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
goldsimon
bc4473b275 Fixed that netconn_thread_cleanup() did not call LWIP_NETCONN_THREAD_SEM_FREE() (!= vs ==) 2015-08-18 11:13:38 +02:00
sg
6e5ff1dbe8 Enable LWIP_HAVE_LOOPIF by default when LWIP_NETIF_LOOPBACK==1 to not make loopback traffic depend on the only netif's link state 2015-08-05 22:56:10 +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
sg
9352988c44 Tried to improve pbuf_type, LWIP_SUPPORT_CUSTOM_PBUF and PBUF_FLAG_IS_CUSTOM documentation 2015-08-05 22:26:57 +02:00
sg
e5e0a21fc6 LWIP_COMPAT_SOCKETS==2: special setting to help code parsers/code completion to show argument names/types for posix socket functions 2015-08-05 21:41:50 +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
22d2af2a29 we are moving towards 1.5.0 -> set LWIP_VERSION accordingly 2015-08-03 13:58:48 +02:00
goldsimon
13801ebd74 netif_find(): name parameter can be const 2015-08-03 13:47:25 +02:00
goldsimon
614fa7b853 ... and one more change to those nasty ~ operator warnings :-( 2015-08-03 11:12:53 +02:00
goldsimon
4b815eece9 added lwip_socket_thread_init/cleanup to use LWIP_NETCONN_SEM_PER_THREAD/LWIP_NETCONN_FULLDUPLEX without including anything but sockets.h 2015-08-03 10:15:29 +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
Erik Ekman
e448a9a4a9 err, debug: add missing ERR_ALREADY to lwip_strerr()
When ERR_ALREADY was added other error codes were renumbered.
The strerr function was not updated so it returned incorrect data
for ERR_CONN - ERR_IF.
2015-07-27 00:49:18 +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
sg
409d7a99f9 Minor coding style fix 2015-07-14 22:17:49 +02:00
Joel Cunningham
f77e581468 Fix netbuf_destport() when LWIP_CHECKSUM_ON_COPY is not enabled
This commit fixes a bug in netbuf_destport() where LWIP_NETBUF_RECVINFO is
enabled, but not LWIP_CHECKSUM_ON_COPY is enabled

The flags field is only available when LWIP_CHECKSUM_ON_COPY is enabled. In
this mode, the toport_chksum is dual functioning as storage for port and
checksum
2015-07-14 22:17:06 +02:00
goldsimon
d3217718a9 Reverted fix for bug #38203 since it might be wrong 2015-06-23 09:20:06 +02:00
Stian Skjelstad
7e76480db4 udp: multicast, fix udp_set_multicast_ttl() parameter and structure member conflict
Macro-parameter name can not be the same as the structure member to
dereference.
2015-06-16 12:00:00 +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
232cf8c28b Fixed bug #45098 ip_addr_t type field not populated for socket address copies (patch by James Smith) 2015-05-21 15:51:47 +02:00
goldsimon
b51805b87e fixed bug #45135 getsockopt SO_SNDTIMEO, SO_RCVTIMEO broken 2015-05-21 15:47:21 +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
cbeb5ab960 Remove 6LowPAN flag that will not be used. 2015-05-05 14:43:58 -06: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
Ivan Delamer
24f486261a Small bug fix in ipaddr_ntoa_r when IPv4 and IPv6 are enabled. 2015-05-05 11:57:23 -06:00
Edgar Bonet
f0c4944e2c sockets: do not assume defined(FD_SET) implies defined(FD_SET_VAL). 2015-05-05 14:08:42 +02:00
Edgar Bonet
cf15872b8d SNMP, Missing const qualifier on internet_nodes[] in mib2.c. 2015-05-05 13:02:30 +02:00
Sylvain Rochet
78e1b9b7c1 PPP, don't store the name by which the peer authenticated itself to us if multilink support is disabled
pcb->peer_authname is only used by multilink support (which we don't
support), don't store the useless peer authname.
2015-05-01 22:51:09 +02:00
Sylvain Rochet
967a8d0678 PPP, opt.h: fixed coding style 2015-05-01 01:01:42 +02:00
Sylvain Rochet
fa44cef27b PPP, L2TP, added configurable L2TP MRU using opt.h 2015-05-01 00:49:19 +02:00
Sylvain Rochet
29ba3df717 PPP, re-enabled MRU defines in opt.h 2015-05-01 00:08:34 +02:00
Sylvain Rochet
aacc222b7d PPP, display MTU set through netif_set_mtu() if debug is enabled 2015-04-30 23:41:47 +02:00
Sylvain Rochet
341f0bf9e3 PPP, assert if ppp_fatal() is called 2015-04-30 13:48:08 +02:00
Sylvain Rochet
091c6a3bda PPP, cleanup unused/redefined/useless limits in ppp_impl.h 2015-04-30 01:07:11 +02:00
Sylvain Rochet
fd53cad208 PPP, sifnpmode() is only useful if on demand is supported, build out if not
We don't support PPP on demand, don't build sifnpmode() which is only
useful for on demand if on demand is not supported.
2015-04-30 00:06:24 +02:00
Sylvain Rochet
1b6d6d0dc0 PPP, removed unnecessary memset()
Everything is cleared in ppp_clear(), we don't need to clear all
structures twice.
2015-04-29 23:55:23 +02:00
Sylvain Rochet
40c671b1a5 PPP, PPPoS, also clear last_xmit when resetting PPPoS control block 2015-04-29 23:41:23 +02:00
Sylvain Rochet
0a8b1c199d PPP, added missing cast on pbuf_header() 2015-04-26 23:42:18 +02:00
Sylvain Rochet
3a3c823ddb PPP, MPPE, try to use pbuf_header() in mppe_compress()
If there is enough space in front of the buffer, use it instead of
allocating a new pbuf.
2015-04-26 23:27:31 +02:00
Sylvain Rochet
900f3c9a09 PPP, MPPE, don't issue CCP reset request in stateless mode
This is useless, flushed bit is always true in stateless mode, we
don't need to issue a CCP reset request in this case.
2015-04-26 22:13:11 +02:00
Sylvain Rochet
8fe2f747f4 PPP, MPPE, issue CCP reset request if synchronization is lost
If MPPE synchronization is lost, it is advised to send a CCP reset
request in order to recover to a clean state.
2015-04-26 22:04:21 +02:00
Sylvain Rochet
adaeff5540 PPP, MPPE, discard late packet in stateless mode
When PPP is used over a link which does not guarantee packet ordering,
we might get late MPPE packets. This is a problem because MPPE must be
kept synchronized and the current implementation does not drop them and
rekey 4095 times instead of 0, which is wrong.

In order to prevent rekeying about a whole count space times (~ 4095
times), drop packets which are not within the forward 4096/2 window and
increase sanity error counter.
2015-04-26 20:59:09 +02:00
Sylvain Rochet
d0f91c00cb PPP, MPPE, sanity error path rework
We are going to need sanity error path a little further, rework to be
able to use the sanity error path anywhere in decompressor.
2015-04-26 20:57:01 +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
Sylvain Rochet
737a6921c3 PPP, place print packet debug codenames in ROM 2015-04-24 00:13:25 +02:00
Sylvain Rochet
44af6978db netconn: api_msg.c, fixed warning about unused state variable by using it a little more 2015-04-23 23:31:41 +02:00
Sylvain Rochet
acbdf63a48 debug.h: fixed LWIP_PLATFORM_ERROR macro if LWIP_DEBUG and LWIP_NOASSERT are defined 2015-04-23 23:07:06 +02:00
goldsimon
e59beeb625 fixed "missing braces around initializer" for IN6ADDR_*_INIT macros 2015-04-23 10:08:30 +02:00
goldsimon
f01dc8cc34 more "const" fixes 2015-04-23 09:59:15 +02:00
goldsimon
89f0e45b50 fixed ip_addr_islinklocal macro definition 2015-04-23 09:35:20 +02:00
goldsimon
3f83556128 sockets: IPPROTO_RAW/IPV6_CHECKSUM must be disabled for LWIP_RAW==0;
help msvc to not warn about uninitialized variables
2015-04-23 09:14:42 +02:00
goldsimon
1cdafabc7c added missing braces around macro parameters 2015-04-23 09:04:45 +02:00
goldsimon
f9965b4967 some more compiler warning fixes 2015-04-23 08:44:44 +02:00
goldsimon
0de0942f9c fixed pppol2tp (IP_IS_V6_L -> IP_IS_V6_VAL) 2015-04-23 07:46:06 +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
009755ba01 fixed broken ip6_addr_debug_print_parts() (broken yesterday) 2015-04-23 07:25:48 +02:00
goldsimon
53a96f69ef ppp_free: fixed type of local 'err' 2015-04-23 07:25:10 +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
634c438b50 sockets.c: added missing casts after changing storage type of 'err' member in sockets 2015-04-22 13:52:21 +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
91c2618f21 fixed typo in sockets.h 2015-04-22 12:50:13 +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
a6c3bb4c6d revert accidentally committed snmp header files 2015-04-22 10:54:07 +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
0142f113a3 fixed compiling netdb.c after LWIP_IPV4 changes 2015-04-22 09:17:31 +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
goldsimon
11845cedd6 Added version-independent ip_addr_islinklocal() 2015-04-22 09:16:05 +02:00
Sylvain Rochet
5e43e2d333 PPP, L2TP, minor fixes
Check tot_len for ZLB instead of len, it might happens we are just
between 2 pbuf, although almost impossible.

Check buffer is at least 2 byte long before checking address & flags
header.
2015-04-22 00:50:08 +02:00
Sylvain Rochet
15cc47334e PPP, don't assert if we receive a too short packet in ppp_input(), just drop
We might actually receive too short packets through PPPoE or PPPoL2TP,
don't assert on unusal packets, just drop them.
2015-04-22 00:31:14 +02:00
Sylvain Rochet
5989c1883e PPP, removed useless padding in bitfields
Most of them were wrong actually. We have to use unsigned int because
C90 only allows int types for bitfields, so we are stuck to 32-bit
bitfields in most cases.
2015-04-21 22:43:53 +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
Sylvain Rochet
2db7513590 PPP, VJ, improved opt.h comment about VJ 2015-04-20 21:14:05 +02:00
Sylvain Rochet
ced24f9215 PPP, MPPE, drop unencrypted input packet if MPPE is required 2015-04-20 21:13:34 +02:00
Sylvain Rochet
b302cad46d PPP, VJ, CCP: rework to fix protocol order
We need to do VJ compression before CCP/MPPE compression and VJ
decompression after CCP/MPPE decompression. This leads to a massive
rewrite of how we currently handled VJ only in the PPPoS lower protocol
handler.

Moved VJ structures from pppos to ppp_pcb because we need them back in
PPP core. This is a bit unfortunate because that's not necessary for
PPPoE or PPPoL2TP, but, hey!. Fixed CCP+MPPE+VJ order.
2015-04-20 00:10:35 +02:00
Sylvain Rochet
33838b8c1c PPP, MPPE, compile-out unused mppe_incomp() function 2015-04-19 22:06:59 +02:00
Sylvain Rochet
42fb74ce22 PPP, CCP, MPPE, handle CCP Reset-Request and Reset-Ack for MPPE 2015-04-19 22:01:58 +02:00
Sylvain Rochet
74670ec07f PPP, MPPE, MPPE also requires MSCHAP support (therefore CHAP support as well) 2015-04-19 17:06:23 +02:00
Sylvain Rochet
3450a78992 PPP, change ppp_write() return type from int to err_t
ppp_write() callback returns err_t, makes ppp_write() consistent with
the callback it is calling.
2015-04-19 16:34:34 +02:00
Sylvain Rochet
f4ef6180b8 PPP, MPPE: allow users to enable CCP and MPPE support in opt.h
We are new ready to process CCP and MPPE packets, allow lwIP users to benefit
from those features.
2015-04-19 16:28:48 +02:00
Sylvain Rochet
f0c25aaa60 PPP, MSCHAP, fixed compiler warnings if MPPE support is disabled 2015-04-19 16:28:11 +02:00
Sylvain Rochet
0f63c1ef8f PPP, CORE, reworked ppp_netif_output* functions to process CCP on all protocols
Both IPv4 and IPv6 should be proccessed by CCP, reworked ppp_netif_output*
in a generic way for CCP.
2015-04-19 16:22:20 +02:00
Sylvain Rochet
b27966860e PPP, CCP, MPPE: added packet plumbing in ppp.c to process MPPE packets 2015-04-19 15:52:46 +02:00
Sylvain Rochet
51566d43bd PPP, normalized debug messages 2015-04-19 14:24:30 +02:00
Sylvain Rochet
71d085bd13 PPP, CCP, added data packet configuration in ppp_pcb 2015-04-19 14:17:34 +02:00
Sylvain Rochet
ffb10e7aac PPP, CCP, added receive and transmit chosen protocols in ccp_flags_set() (renamed ccp_set())
We need to know which methods were chosen when CCP is up, this used to be done
using ccp_test() which we are in the process of removing.

Using non-existing method 0 instead of -1 in CCP for unset method, allowing
type change from s16_t to u8_t for method.
2015-04-19 13:51:35 +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
Sylvain Rochet
c8db96705f PPP, MPPE, close current session using lcp_close() if something went wrong 2015-04-19 02:27:40 +02:00
Sylvain Rochet
f94efab6c3 PPP, CCP, added MPPE user configuration flags 2015-04-19 02:17:43 +02:00
Sylvain Rochet
4c0af0f79e PPP, MPPE, reworked MPPE debug, using ppp_pcb metadata 2015-04-19 01:49:04 +02:00
Sylvain Rochet
fc7e327d19 PPP, MSCHAP, CCP, MPPE: reworked key passing from CCP to MPPE
Removed mutiple copies of keys by pre-setting MPPE keys during MSCHAP
negotiation.

Improved MPPE init so we don't need to pass a buffer formatted in a
special way to MPPE, this is necessary for pppd to talk to the kernel,
we don't need that here.
2015-04-19 01:20:43 +02:00
Sylvain Rochet
045f44c7f9 PPP, MSCHAP, merged mppe_set_keys() to Set_Start_Key(), merged mppe_set_keys2() to SetMasterKeys() 2015-04-19 00:26:25 +02:00
Sylvain Rochet
867d13b007 PPP, CCP, MPPE: calling mppe_init() in ccp.c instead of using ccp_test()
We don't need this ccp_test() stuff which is used to test if kernel have
the ability to process MPPE packets. Reworked MPPE so we don't need it.
2015-04-18 23:51:10 +02:00
Sylvain Rochet
40991b93a2 PPP, CCP, reworked ppp_pcb ccp_localstate and all_rejected fields 2015-04-18 19:47:21 +02:00
Sylvain Rochet
949d76b328 PPP, MSCHAP: ensure magic tables are not copied and initialized on stack 2015-04-18 19:14:39 +02:00
Sylvain Rochet
210a2ccfdf PPP, MSCHAP, MPPE: shared identical mppe_sha1_pad* between MSCHAP and MPPE 2015-04-18 18:51:45 +02:00
Sylvain Rochet
3862aad2f7 PPP, MSCHAP, reworked local functions and constants
MSCHAP was written the old-way, with all functions declared non static in
header, independent of their local or global scope status. Same for local
constants. Reworked in a more mordern way.
2015-04-18 17:56:35 +02:00
Sylvain Rochet
2a005c2f11 PPP, MPPE, moved MPPE global variables from MSCHAP to ppp_pcb 2015-04-18 17:41:44 +02:00
Sylvain Rochet
ab46ac9bd8 PPP, CHAP, reworked to pass ppp_pcb pointer to CHAP childs (MD5, MSCHAP, MSCHAPv2)
We are going to need ppp_pcb* in MSCHAP and MSCHAPv2 for MPPE for
int mppe_keys_set, u_char mppe_send_key and u_char mppe_recv_key
which are currently global variable which must be moved to ppp_pcb.
2015-04-18 17:29:55 +02:00
Sylvain Rochet
c51ed84fd8 PPP, MPPE, added ppp_mppe_state comp and decomp to ppp.h 2015-04-18 16:13:44 +02:00
Sylvain Rochet
74054ea907 PPP, MPPE, struct ppp_mppe_state to typedef
We usually handle "typedefed" struct in lwIP, and I agree this is a cleaner
approach. Replaced struct ppp_mppe_state to ppp_mppe_state.
2015-04-18 14:54:25 +02:00
Sylvain Rochet
f79bc03360 PPP, MPPE, optimized struct ppp_mppe_state size 2015-04-18 13:41:38 +02:00
Sylvain Rochet
b553df860c PPP, CCP, deflate, BSD compress, predictor 1 & 2 are now optional at compile time 2015-04-18 02:02:00 +02:00
Sylvain Rochet
f753a728dd PPP, CCP, compile-out a bit more MPPE code if MPPE is disabled 2015-04-18 01:10:25 +02:00
Sylvain Rochet
3f2e8ebcdf PPP, MPPE, merged mppe_comp_init() and mppe_decomp_init() into mppe_init()
Removing a bit of redundancy and previous artefact of a generic kernel
interface. Exporting mppe_init() instead of mppe_comp_init() plus
mppe_decomp_init().
2015-04-18 00:48:26 +02:00
Sylvain Rochet
a1fe83c070 PPP, MPPE, remove dead code 2015-04-18 00:43:24 +02:00
Sylvain Rochet
879c94b01e PPP, MPPE, removed mppe_alloc() and mppe_free()
We are going to use statically allocated struct ppp_mppe_state through PPP PCB,
removed now useless mppe_alloc() and mppe_free().

Merged mppe_alloc() key copy to mppe_init().
2015-04-18 00:33:57 +02:00
Sylvain Rochet
da40445d75 PPP, MPPE, changed API to use struct ppp_mppe_state* instead of void*
Now that struct ppp_mppe_state is exported, change MPPE API to use
struct ppp_mppe_state* instead of void*, we don't need that to be generic.
2015-04-18 00:26:15 +02:00
Sylvain Rochet
6235e1ae57 PPP, MPPE, moved struct ppp_mppe_state from mppe.c to mppe.h
In order to be able to use struct ppp_mppe_state statically allocated,
export struct ppp_mppe_state.
2015-04-18 00:15:52 +02:00
Sylvain Rochet
3618432107 PPP, MPPE, reworked mppe_rekey()
Moved sha1_context from struct ppp_mppe_state to stack, we don't need it past
mppe_rekey(). Moved shared MEMCPY() outside initial_key if block.
2015-04-18 00:02:49 +02:00
Sylvain Rochet
f1cba8a0ea PPP, MPPE, merged get_new_key_from_sha() to mppe_rekey()
get_new_key_from_sha() is only used in mppe_rekey(), merged
2015-04-17 23:53:22 +02:00
Sylvain Rochet
489760d2e3 PPP, CCP, re-added missing ccp_test()
ccp_test() is not only used to test kernel support, but also to set MPPE keys,
we will change that further, but for now, re-add the necessary ccp_test()
2015-04-17 23:21:13 +02:00
Sylvain Rochet
caf9fc5687 PPP, MPPE, adapt compressor to use pbuf
mppe_compress() now takes a pointer to a pbuf pointer and re-use the
passed buffer for MPPE "compression".
2015-04-16 22:23:57 +02:00
Sylvain Rochet
dc93c2afec PPP, MPPE, removed address, control and protocol from compressor input
Our PPP stack deals with packet without address and control byte nor 2-byte
protocol field, improved mppe_compress() so we don't have to worry about
them.
2015-04-14 22:56:46 +02:00
Sylvain Rochet
9164c4f309 PPP, MPPE, removed address, control and protocol from compressor output
Our PPP stack deals with packet without address and control byte nor 2-byte
protocol field, improved mppe_compress() so we don't have to worry about
them.
2015-04-14 22:56:41 +02:00
Sylvain Rochet
e241f880e8 PPP, code cleaning, fixed ppp_input() indentation 2015-04-13 23:19:43 +02:00
Sylvain Rochet
662f1355de PPP, fixed LWIP_IPV4=1 and PPP_IPV4_SUPPORT=0 support
If LWIP_IPV4 is true but PPP_IPV4_SUPPORT is false, we need
a dummy ppp_netif_output_ip4() callback because we don't have
a netif_null_output_ip4() by default like we have for IPv6 with
netif_null_output_ip6().
2015-04-13 23:07:42 +02:00
Sylvain Rochet
c865211c2f PPP, get_mask() is only used for IPCP, moved to PPP_IPV4_SUPPORT functions group 2015-04-13 22:58:45 +02:00
sg
6324068d34 Worked on IPv6-only stack: netdb should work 2015-04-13 21:29:04 +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
Sylvain Rochet
bc99f75b53 PPP, PPPoL2TP, removed unnecessary single pbuf
Removed ppp_singlebuf() in pppol2tp_input(), chained pbuf are perfectly
acceptable for IP data and we are currently supporting them perfectly
for PPPoS. The PPP stack itself (LCP, IPCP et al.) does not support
chained pbuf and is already calling ppp_singlebuf() just before passing
packet to the protocol handler.

Added ppp_singlebuf() in pppol2tp_dispatch_control_packet() because we
do not support chained pbuf in L2TP control packet.
2015-04-12 22:00:43 +02:00
Sylvain Rochet
421582d747 PPP, MPPE, using err_t return for mppe_decompress 2015-04-12 21:09:15 +02:00
Sylvain Rochet
ab1606a0f6 PPP, MPPE, adapt decompressor to use pbuf
mppe_decompress() now takes a pointer to a pbuf pointer and re-use the
passed buffer for MPPE "decompression". Removed sub protocol handling
which can be shared among all decompressors in ppp.c
2015-04-12 21:04:22 +02:00
Sylvain Rochet
bcfaeca373 PPP, PPPoE, removed unnecessary single pbuf
Removed ppp_singlebuf() in pppoe_data_input(), chained pbuf are
perfectly acceptable for IP data and we are currently supporting them
perfectly for PPPoS. The PPP stack itself (LCP, IPCP et al.) does not
support chained pbuf and is already calling ppp_singlebuf() just before
passing packet to the protocol handler.
2015-04-12 20:08:01 +02:00
Sylvain Rochet
5f0e261f2d PPP, MPPE, handle packets in decompressor without address and control nor protocol
Our PPP stack deals with packet without address and control byte nor 2-byte
protocol field, improved mppe_decompress() so we don't have to worry about
them.
2015-04-12 18:41:21 +02:00
Sylvain Rochet
0e1aec4348 PPP, using ip4_input() instead of ip_input()
In PPP, we previously know if we are dealing with a IPv4 or a IPv6 packet,
we don't need to use the ip_input() dispatch function, removing a useless
if and reducing call stack by one.
2015-04-12 13:53:53 +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
89d666155d PPP, MPPE, fixed mppe_rekey()
Oops, it was introduced when porting to PolarSSL ARC4.
2015-04-12 01:27:05 +02:00
Sylvain Rochet
4d6d65ee33 PPP, MPPE, fixed SHA1 padding
SHA1 padding is 40 byte, not 256 byte. Rekeying is done for each
packet in stateless mode, ensure speedness using static table for padding.
2015-04-11 23:57:47 +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
Sylvain Rochet
8a73990f51 PPP, PPPoL2TP, improved pppol2tp_create() error path 2015-04-11 14:06:06 +02:00
Sylvain Rochet
efe229a54b PPP, PPPoL2TP, merged pppol2tp_input_ip() to pppol2tp_input()
We don't need anymore an input function for ip4 and an input function
for ip6, work to achieve that was partially done by ce7e31cd.
pppol2tp_input() is now only called by pppol2tp_input_ip(), finishing
dual stack support by merging pppol2tp_input_ip() into pppol2tp_input().
2015-04-11 13:56:41 +02:00
Sylvain Rochet
d6fdf7d4b1 PPP, PPPoL2TP, switched to dual stack IPv4/IPv6
Replaced ip4_addr_t to ip_addr_t in pppapi_pppol2tp_create() prototype,
now binding to UDPv6 or UDPv4 depending on the passed ip_addr_t type.

Removed pppol2tp_create_ip6() and pppapi_pppol2tp_create_ip6().
2015-04-11 13:15:06 +02:00
goldsimon
2e649e1843 Added IP_ADDR4()/IP_ADDR6() initializer macros that initialize ip_addr_t like their counterparts IP4_ADDR()/IP6_ADDR() 2015-04-10 08:49:32 +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
Sylvain Rochet
7285459375 PPP, MPPE, exported MPPE functions 2015-03-29 12:19:33 +02:00
Sylvain Rochet
52b7ebd4e7 PPP, MPPE, fixed compiler warnings 2015-03-29 12:19:33 +02:00
Sylvain Rochet
ea6f624b58 PPP, MPPE. fixed port mistake on SHA1 computation 2015-03-29 12:19:33 +02:00
Sylvain Rochet
3cf3b78192 PPP, MPPE, commented-in Linux interface calls structure 2015-03-29 12:19:33 +02:00
Sylvain Rochet
cdc2d034de PPP, MPPE, temporarily replaced kzalloc() with malloc() 2015-03-29 12:19:32 +02:00
Sylvain Rochet
cd8a17d644 PPP, MPPE, removed useless Linux stuff 2015-03-29 12:19:32 +02:00
Sylvain Rochet
57e3e7f150 PPP, MPPE, improved SHA1 padding
Don't allocate 512 bytes of RAM for padding. Reduce overall padding
size to 64, therefore using stack instead of RAM or ROM.
2015-03-29 12:19:32 +02:00
Sylvain Rochet
c759639603 PPP, MPPE, removed "compression" stats
We don't need "compression" stats on a encryption protocols, as commented
"Since every frame grows by MPPE_OVHD + 2 bytes, this is always going
to look bad ... and the longer the link is up the worse it will get."
2015-03-29 12:19:32 +02:00
Sylvain Rochet
a6c101aeb8 PPP, MPPE, removed now useless setup_sg() function 2015-03-29 12:19:32 +02:00
Sylvain Rochet
7ea8a754c1 PPP, MPPE, using our ARC4 instead of Linux crypto ARC4 2015-03-29 12:19:32 +02:00
Sylvain Rochet
d5667343cb PPP, updated polarssl readme 2015-03-29 12:19:32 +02:00
Sylvain Rochet
0bfe435c4f PPP, MPPE, updated polarssl ARC4 for lwIP 2015-03-29 12:19:32 +02:00
Sylvain Rochet
cd39843c75 PPP, MPPE, import unmodified ARC4 from polarssl 2015-03-29 12:19:32 +02:00
Sylvain Rochet
f9ae65acd8 PPP, MPPE, added build macro if MPPE is not enabled 2015-03-29 12:19:32 +02:00
Sylvain Rochet
cfd930cae7 PPP, MPPE, using our SHA1 instead of Linux crypto sha1 2015-03-29 12:19:32 +02:00
Sylvain Rochet
0b7e3610ac PPP, MPPE, using lwIP ERR_BUF instead of Linux DECOMP_ERROR error type 2015-03-29 12:19:32 +02:00
Sylvain Rochet
10946e7669 PPP, MPPE, removed a bit more Linux stuff 2015-03-29 12:19:32 +02:00
Sylvain Rochet
2dcd8c2729 PPP, MPPE, removed include we don't have 2015-03-29 12:19:32 +02:00
Sylvain Rochet
dcde1c2a8f PPP, CCP, added missing defines from linux/ppp-comp.h to ccp.h 2015-03-29 12:19:32 +02:00
Sylvain Rochet
0810384555 PPP, MPPE, replaced printk() to PPPDEBUG() 2015-03-29 12:19:32 +02:00
Sylvain Rochet
434fb1e0da PPP, MPPE, fixed path to mppe.h 2015-03-29 12:19:32 +02:00
Sylvain Rochet
435a0b98ac PPP, MPPE, cleaning license notice
We only need to keep the BSD license part in lwIP, cleaning the part which
is only relevant for the Linux kernel.
2015-03-29 12:19:32 +02:00
Sylvain Rochet
05eda236cc PPP, MPPE, import unmodified Linux MPPE encoder/decoder
This file, which is an unmodified copy of Linux MPPE encoder/decoder, is
licensed under a dual License BSD/GPL model. It was previously in the
pppd source tree and it was removed because this is merged into the Linux
kernel.
2015-03-29 12:19:32 +02:00
goldsimon
c998faeeab fixed bug #44649 lwip_socket_drop_registered_memberships 2015-03-27 13:18:34 +01:00
Sylvain Rochet
f967933e8b PPP, PPPoS, protect open flag in connect() and listen()
Protect open flag in connect() and listen(), this is a bitfield, it might
not be set atomically on some targets.
2015-03-26 23:30:18 +01:00
Sylvain Rochet
8862a1ac8f PPP, MPPE, ccp_options->mppe is a bitfield of MPPE_OPT_* and not a boolean, fixed
This is actually wrong as well in PPPd, oops.
2015-03-25 00:09:37 +01:00
Sylvain Rochet
ad56a115be PPP, CCP, moved ccp_test() from ccp_addci() to ccp_resetci()
We don't need to test our available compression protocols that much, we know
what we are going to be able to use in embedded. Even PPPd don't need that.

Checking only in ccp_resetci() is enough, this way we know our cilen size
before ccp_addci() is called. PPPd is designed that *_addci() can use less
bytes than it previously asked in *_cilen(), we prefer to avoid that here.

We actually don't need at all ccp_test() calls, we know what we are
able to support at compile time, we don't need to ask the kernel like
PPPd does. This is just the first step in ccp_test() removal.
2015-03-24 23:37:56 +01:00
Sylvain Rochet
c8ed013600 PPP, FSM, added assert to easily track cilen size mismatch
See c49fc8d for such a problem which ends up with heap corruption.
2015-03-24 23:10:58 +01:00
Sylvain Rochet
c49fc8db72 PPP, CCP: Fix ccp_cilen returning size if both deflate_correct and deflate_draft are enabled
This fixes a bug returning 4 byte less than necessary for the addci buffer
if both deflate_correct and deflate_draft are enabled.
2015-03-24 21:38:33 +01: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
86970a01d7 etharp: reduce ARP aging timeout from 20 minutes to 5 minutes, since this is a time obviously used in some switches as MAC learning table timeout. Having our ARP timeout higher than this can lead to sending unicast packets to multiple network segments. 2015-03-24 20:04:18 +01:00
Sylvain Rochet
210496f0ca PPP, IPV6, correct fix for IPV6CP_COMP disabling 2015-03-23 23:48:00 +01:00
sg
2eb0386c2a fixed bug #36017 ARP might not support duplicate addresses on multiple netifs (tried to correctly handle duplicate AutoIP addresses on multiple netifs, but only if explicitly enabled via ETHARP_TABLE_MATCH_NETIF==1) 2015-03-23 22:04:57 +01:00
sg
440c99100b fixed bug #34617: Stable etharp entries that are about to expire are now refreshed using unicast to prevent unnecessary broadcast.
Only if no answer is received after 15 seconds, broadcast is used.
2015-03-23 21:38:19 +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
Sylvain Rochet
17486408b4 PPP, IPV6, fixed build if VJ support is disabled 2015-03-21 20:41:03 +01:00
Sylvain Rochet
c17594c1d0 PPP, CORE, don't build get_loop_output() if demand support (not supported) is not enabled 2015-03-21 20:12:14 +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
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
Sylvain Rochet
d28bb04a9c PPP, PPPoE, improve reliability if we receive a PADT
Don't disconnect when we receive a PADT, we let the LCP Echo/Reply find
the fact that PPP session is down. Asking the PPP stack to end the
session require strict checking about the PPP phase to prevent endless
disconnection loops.

Luckily it previously does nothing because PADT frames are rarely sent
with a hunique tag and we only set the sc pointer if we receive a
hunique tag.
2015-03-02 00:16:25 +01:00
Sylvain Rochet
9de1c71ff7 PPP, PPPoE, removed global static buffer only used for debug
pppoe_error_tmp[] was only used in one function and only for debug purposes,
moved to stack.
2015-03-02 00:05:55 +01:00
Sylvain Rochet
3ce6dd166c PPP, L2TP, added link-level IPv6 support 2015-03-01 22:04:24 +01:00
Sylvain Rochet
684bef066f PPP, L2TP, merged common output code
New function: pppol2tp_udp_send(), common output code.
2015-03-01 21:22:21 +01:00
Sylvain Rochet
52f2221be9 PPP, L2TP, check source ip address and port
Improve L2TP defensiveness by checking source ip address and port
of input packets.
2015-03-01 21:15:15 +01:00
Sylvain Rochet
1bee131d52 PPP, L2TP, using LNS chosen destination port
L2TP LNS might chose its own local port, we actually stored
the port the LNS wanted to use but we never used it.
2015-03-01 21:14:52 +01:00
Sylvain Rochet
2731976a95 PPP, renamed ppp_open to ppp_connect
Makes it clear we are initiating the PPP session with ppp_connect
(i.e. acting as a PPP client) so there is no confusion possible
between ppp_connect and ppp_listen.
2015-03-01 10:53:08 +01:00
Sylvain Rochet
f7d5e81130 PPP, SERVER, MSCHAP: move output message from chap_server.message struct to stack
chap_server.message is only used in one function, moved to stack.
2015-03-01 00:34:00 +01:00
Sylvain Rochet
371bc91d73 PPP, SERVER: added PPPoS server support
New function: ppp_listen(), listen for an incoming PPP connection.
2015-02-28 22:41:18 +01:00
Sylvain Rochet
89771de6d0 PPP, remove VJ callback from link_callbacks if VJ support is not enabled 2015-02-28 21:39:32 +01:00
Sylvain Rochet
71b213df63 PPP, EAP: using MAXNAMELEN define instead of hardcoded 256 size for rhostname 2015-02-28 20:37:41 +01:00
Sylvain Rochet
7f3913ff58 PPP, EAP: removed malloc() and free()
Replaced pcb->eap.es_{client,server}.ea_peer pointer to a char table,
replaced strdup() with MEMCPY, etc.
2015-02-28 20:29:40 +01:00
Sylvain Rochet
d884034c9f PPP, replaced drand48() with magic_pow() 2015-02-28 19:50:25 +01:00
Sylvain Rochet
bec199c4a2 PPP, MAGIC: new function: magic_pow
magic_pow() returns a new random number between 0 and (2^pow)-1 included.
2015-02-28 19:36:03 +01:00
Sylvain Rochet
3686110ed2 PPP, SERVER: statically define our name for authentication purposes
We don't need that in RAM nor a pointer to a string, a static
define is fine for embedded devices, saved ~257 bytes of RAM.
2015-02-28 18:28:07 +01:00
Sylvain Rochet
708e421ec3 PPP, CORE: code cleaning 2015-02-28 18:08:37 +01:00
Sylvain Rochet
5ae7ee5276 PPP, SERVER: added CHAP authentication support 2015-02-28 17:40:07 +01:00
Sylvain Rochet
65493b421a PPP, SERVER, CHAP: fixed wrong pointer used on chap_timeout() 2015-02-28 15:36:35 +01:00
Sylvain Rochet
301511a840 PPP, SERVER: added PAP authentication support
New ppp auth function: auth_check_passwd() which check the user name and
passwd against configuration.

PAP: check remote user and password
2015-02-28 14:40:09 +01:00
Sylvain Rochet
e86a0a4325 PPP, CORE, SERVER, set auth configuration before auth
Set LCP wanted options accordingly to the user auth configuration
if peer is required to authenticate itself.
2015-02-28 13:08:20 +01:00
Sylvain Rochet
8d05279599 PPP, CORE, moved auth configuration from auth_reset() to lcp_resetci()
Prepare for PPP_SERVER support, we need to move auth configuration before
lcp_allowoptions is copied into lcp_gotoptions. Restore unused
auth_reset() function using pppd original source code.
2015-02-28 12:59:29 +01:00
Sylvain Rochet
587e0e3e0c PPP, CORE, beautified ppp_set_auth()
Beautified, added PPPAUTHTYPE_MSCHAP_V2 choice support.
2015-02-27 23:55:18 +01:00
Sylvain Rochet
2315f32ca0 PPP, CORE, cleaned struct ppp_settings coding style 2015-02-27 23:12:03 +01:00
Sylvain Rochet
5a71509353 PPP, CORE, IPCP: removed useless ask_for_local boolean
We don't need ask_for_local boolean, this is only useful for setup which
can determine the local IP address from the system hostname, which is
probably meaningless for embedded devices (and probably any devices).

It was actually only set by ip_check_options() which is commented out in
lwIP because we don't parse a config file nor check PPP configuration
(user is responsible about writing a configuration which is logical ;-).
Furthermore ask_for_local boolean never set actually had the wrong
default for PPP server setups.
2015-02-27 22:39:42 +01:00
Sylvain Rochet
a310bc19a7 netif: fixed compiler warning
lwip/src/core/netif.c: In function ‘netif_set_ipaddr’:
lwip/src/core/netif.c:403:5: warning: implicit declaration of function ‘udp_netif_ipv4_addr_changed’ [-Wimplicit-function-declaration]
     udp_netif_ipv4_addr_changed(&netif->ip_addr, ipaddr);
     ^
2015-02-26 22:45:37 +01:00
sg
0647533f8c fixed bug #44378 (TCP connections are not aborted on netif remove) 2015-02-26 22:25:39 +01:00
sg
99dd78964a fixed bug #40753 (re-bind UDP pcbs on change of IP address) 2015-02-26 22:17:30 +01:00
sg
0d1606ff23 Fixed last commit: can only check for bound sockets, not for unbound. There's some work to do for IPv6 in TCP... 2015-02-26 21:31:48 +01:00
sg
a6a92d42f9 Fixed bug #41700 (Call to tcp_listen_dual() should not accept IPv4 listen PCB args) 2015-02-26 21:23:40 +01:00
Sylvain Rochet
2aabe16163 PPP, PPPoS, removed ppp_accm_mask[], saved a few bytes of ROM
This was a pretty naive way of doing a bitshift, code is smaller if we let
the compiler decide.
2015-02-25 23:04:55 +01:00
sg
5984c996a8 fixed bug #40177 (System hangs when dealing with corrupted packets), implemented task #12357 (Ensure that malicious packets don't assert-fail): improved some pbuf_header calls to not assert-fail. 2015-02-25 22:58:27 +01:00
sg
c8d126f6ef work on task #12357 (Ensure that malicious packets don't assert-fail): don't let too short IP packets assert-fail; fix that IPv6 input did not obey VLAN header offset 2015-02-25 22:23:12 +01:00
Joel Cunningham
9004554da3 fixed bug #43028 (IP_MULTICAST_TTL affects unicast datagrams) 2015-02-25 21:59:21 +01:00
Greg Renda
4eb9efdd33 fixed bug #38210 (ip reassembly while remove oldest datagram) 2015-02-25 21:43:39 +01:00
sg
83740d81f2 fixed comment 2015-02-25 21:32:33 +01:00
sg
c8581e4cd9 fixed bug #38165 (socket with mulicast): ensure igmp membership are dropped when socket (not netconn!) is closed. 2015-02-25 21:30:22 +01:00
sg
612e33c499 fixed bug #38061 (wrong multicast routing in IPv4) by adding an optional default netif for multicast routing 2015-02-25 20:58:11 +01:00
sg
3e8ac30940 Fixed bug #44297 (CORE_LOCKING was broken some days ago); fixed that netconn_connect still used message passing for LWIP_TCPIP_CORE_LOCKING==1 2015-02-25 20:34:18 +01:00
Sylvain Rochet
4bcddd72e6 PPP, CORE, cleaned ppp_close() function
Calling new_phase() instead of assigning pcb->phase directly.
Removed redundant call to link status callback.
2015-02-24 22:13:04 +01:00
Sylvain Rochet
00bb70a62d PPP, CORE, functions ppp_set_netif_statuscallback() and ppp_set_netif_linkcallback() replaced with defines
PPP is now pointerful for a while, we don't need anymore accessor functions
for the unique PPP local and static control block. Replaced
ppp_set_netif_statuscallback() and ppp_set_netif_linkcallback() functions to
defines.

Removed pppapi_do_ppp_set_netif_statuscallback() and
pppapi_do_ppp_set_netif_linkcallback(), they were useless because
netif_set_status_callback() and netif_set_link_callback() can be
safely called while PPP status is in dead (= non open) state
and even before the PPP session is actually created at all.
2015-02-24 20:41:47 +01:00
Sylvain Rochet
b4990b5bb4 Fixed warnings on whole project introduced by const pointers on ip_addr_t 2015-02-22 22:50:06 +01:00
Sylvain Rochet
65095253a9 PPP, fixed warnings introduced by const pointers on ip_addr_t 2015-02-22 22:38:02 +01:00
sg
c87efb77bc patch by Jens Nielsen: fixed bug #38803 (Source address in broadcast ping reply) 2015-02-22 22:02:17 +01:00
sg
03159254ce added proper accessor functions for pcb->multicast_ip (previously used by get/setsockopt only) 2015-02-22 21:49:46 +01:00
sg
ec5cf8593e Continued chrysn's work: changed nearly all functions taking 'ip(X)_addr_t' pointer to take const pointers (changed user callbacks: raw_recv_fn, udp_recv_fn; changed port callbacks: netif_output_fn, netif_igmp_mac_filter_fn) 2015-02-22 21:46:35 +01:00
chrysn
9f065c0ea5 (api break) qualify ip_addr_t as const where feasible
this changes the callback signatures of the ip_output and the
{udp,raw}_recv functions.

changes were made by going through all header files, searching for
occurrences of ip_addr_t, qualifying them as const and if required
modifying the corresponding c files, looking for other uses of ip_addr_t
that would be required.

the following header files were not treated as i'm not using them and
wouldn't see them compiled: api.h api_msg.h dhcp.h dns.h igmp.h
netifapi.h pppapi.h snmp.h snmp_msg.h snmp_structs.h ppp.h pppol2tp.h
test/*

no modifications were done on ip6_addr_t.
2015-02-22 21:46:02 +01:00
Sylvain Rochet
df3f05e824 PPP, apply warnings found by MSVC fixes on other files needing the same fix 2015-02-22 21:39:04 +01:00
sg
9a10afbbc6 PPP: fixed 2 warnings found by MSVC 2015-02-22 21:30:17 +01:00
Sylvain Rochet
8d916b8573 PPP, PPPoS, removed unused next field in pppos_pcb
Linked list was removed, we don't need the next pointer anymore.
2015-02-22 16:57:57 +01:00
Sylvain Rochet
653657ae43 PPP, code cleaning 2015-02-22 16:45:38 +01:00
Sylvain Rochet
b0b7240022 PPP, PPPoS, moved advise about modem from pppos_create() to ppp_open()
pppos_create() can be called whether the modem is ready to process the
PPP session since pppos_create() does not start the PPP session anymore,
moved the advise from pppos_create() to ppp_open().
2015-02-22 16:20:03 +01:00
Sylvain Rochet
1e82003bf9 CORE, INIT, fail if none of PPP_IPV[46]_SUPPORT are enabled if PPP_SUPPORT is enabled
PPP_SUPPORT needs PPP_IPV4_SUPPORT and/or PPP_IPV6_SUPPORT turned on.
2015-02-22 14:30:24 +01:00
Sylvain Rochet
4be7fccad3 PPP, CORE, ppp_close() and ppp_sighup() ended up sharing almost everything, merged
Merged ppp_sighup() to ppp_close() using an optional argument  "nocarrier"
on ppp_close().
2015-02-22 14:25:36 +01:00
Sylvain Rochet
b040ace4c2 PPP, CORE, carrier lost signal, fixed FSM mismatch
ppp_sighup() hard change the PPP FSM phase, it ends up with a FSM
mismatch if PPP is currently connecting or disconnecting.

Only do "sighup" on the stable running phase, fallback to the close
method. Handle special DEAD and HOLDOFF states as well.
2015-02-22 13:54:52 +01:00
Sylvain Rochet
ab572ce5b9 PPP, CORE, fixed PPP phase state machine when ppp_close() is called during HOLDOFF phase
Aborting HOLDOFF leaves us at PPP_PHASE_DEAD, fixed.
2015-02-22 13:48:53 +01:00
Sylvain Rochet
ded77f59cd PPP, FSM, fixed "timeout sending Config-Requests" output
\n is not needed, fixed.
2015-02-22 12:12:38 +01:00
Sylvain Rochet
a1c5415f8f PPP, CORE, disable VJ is PPP IPV4 is compiled out
VJ compression is only supported for PPP IPv4, compile out VJ support
if PPP IPv4 is not compiled.
2015-02-22 02:34:45 +01:00
Sylvain Rochet
00e8988b52 PPP, IPv4 support is now optional
New compile time option: PPP_IPV4_SUPPORT

PPP IPv4 support can now be compiled out.
2015-02-22 02:28:04 +01:00
Sylvain Rochet
5680808fb6 PPP, CORE, ppp_ioctl PPPCTLG_UPSTATUS command now returns true if only IPv6 is up
PPPCTLG_UPSTATUS ioctl didn't return true if IPv6 was up and IPv4 down, fixed.
2015-02-22 01:34:47 +01:00
Sylvain Rochet
814bcc04ad PPP, CORE, using ip*_set_* functions instead of IP4_ADDR and SMEMCPY
Now using lwIP helper functions on ip_addr_t and ip6_addr_t.
2015-02-22 01:33:02 +01:00
Sylvain Rochet
a8cbff08ef PPP, IPV6, enable PPP IPv6 by default if LWIP_IPV6 is set 2015-02-22 00:25:23 +01:00
Sylvain Rochet
ee8a05c3c7 PPP, CORE, removed if_up and if6_up checks in sifdown() and sif6down()
It can't hurt us, checking is useless.
2015-02-21 23:53:40 +01:00
Sylvain Rochet
46d7f6f95d PPP, IPv6, fixed unicode in file headers 2015-02-21 23:49:57 +01:00
Sylvain Rochet
30c89310a6 PPP, CORE, IPv6, if_up flag used instead of if6_up for outgoing IPv6 packets, fixed
We can have an IPv6 only PPP interface, checking if6_up instead of if_up fixes
IPv6 only setup.

ppp_netif_output() which were only used for common code between
ppp_netif_output_ip4() and ppp_netif_output_ip6() is not necessary
anymore, removed, reducing call stack by one.
2015-02-21 23:34:45 +01:00
Sylvain Rochet
d6e1b86147 PPP, CORE, improved, re-ordered and re-numbered IOCTL commands 2015-02-21 21:52:39 +01:00
Sylvain Rochet
a8e973f5d7 PPP, CORE, remove the user ability to set the PPP error code (PPPCTLS_ERRCODE)
This is now totally useless, it was used for the PPP core code but it is not
used anymore, remove then the user ability to set the PPP error code through
PPPCTLS_ERRCODE.
2015-02-21 21:48:53 +01:00
Sylvain Rochet
c4d1354c54 PPP, CORE, don't use ppp_ioctl() from PPP core, assign pcb->err_code instead
Removed useless calls to ppp_ioctl(pcb, PPPCTLS_ERRCODE, …), we now assign
pcb->err_code directly instead. ppp_ioctl() is not linked anymore if user
application don't use it.
2015-02-21 21:42:59 +01:00
Sylvain Rochet
dc2e700057 PPP, CORE, using u8_t on ioctl command instead of int
We don't need an int here, all commands are between 0 and 255.
2015-02-21 21:37:08 +01:00
Sylvain Rochet
bfe0c3a8e0 opt.h: fixed warnings if PPP auth support is not enabled
lwip/src/netif/ppp/polarssl/md4.c:43:20: warning: "LWIP_INCLUDED_POLARSSL_MD4" is not defined [-Wundef]
lwip/src/netif/ppp/polarssl/sha1.c:42:20: warning: "LWIP_INCLUDED_POLARSSL_SHA1" is not defined [-Wundef]
lwip/src/netif/ppp/polarssl/des.c:43:20: warning: "LWIP_INCLUDED_POLARSSL_DES" is not defined [-Wundef]
2015-02-21 19:43:04 +01:00
Sylvain Rochet
a387270b76 PPP, PPPoS, fixed PPP_INPROC_MULTITHREADED support
Oops.
2015-02-21 19:38:47 +01:00
Sylvain Rochet
59b659b027 PPP, CORE, compile out auth support if none of auth protocols are enabled
Added macro PPP_AUTH_SUPPORT, if none of auth protocols are enabled
(PAP, CHAP, EAP) we reduce PPP memory usage by compiling out all
struct fields and source code used for authentication.
2015-02-21 19:32:38 +01:00
Sylvain Rochet
973472c51e opt: clarified VJ support
VJ is only supported for PPPoS, RFCs does not say VJ is forbidden on
PPPoE or PPPoL2TP (looks like it is strongly discouraged though, due
to checksum issues when using VJ).
2015-02-21 18:43:31 +01:00
Sylvain Rochet
f57d4818a4 PPP, using PPP netif->num number instead of ppp->num
Saved 2 bytes of RAM if debug is enabled, we are now using the
netif->num number instead of using our own ppp->num
2015-02-21 01:21:24 +01:00
Sylvain Rochet
6b4db944dd PPP, using err_t return code instead of PPPERR_
Standardised PPP API to follow lwIP already used return codes.
PPPERR_ are now used only on link status callback.
2015-02-20 21:24:58 +01:00
Sylvain Rochet
0a761d238a PPP, using err_t return type on ppp_ioctl() 2015-02-20 21:01:24 +01:00
Sylvain Rochet
c8f026c382 PPP, PPPoS, removed PPPERR_ on err_t return type 2015-02-20 20:54:05 +01:00
Sylvain Rochet
2c70c12814 PPP, PPPoL2TP, removed PPPERR_ usage
Low level protocol callbacks are using err_t returns type,
don't use PPPERR_ on them.
2015-02-20 20:52:10 +01:00
Sylvain Rochet
b31f6eb45f PPP, PPPoE, removed PPPERR_ usage
Low level protocol callbacks are using err_t returns type,
don't use PPPERR_ on them.
2015-02-20 20:51:37 +01:00
Sylvain Rochet
d387c1c83a PPP, PPPoS, added missing static modifier on pppos_netif_input() 2015-02-20 19:35:12 +01:00
Sylvain Rochet
7a1a2b9aa6 PPP, PPPoS, code cleaning 2015-02-20 01:00:48 +01:00
Sylvain Rochet
444da3ecec PPP, CORE, we don't need PPP_LINK_ENABLED_NUMBER anymore 2015-02-20 00:44:58 +01:00
Sylvain Rochet
1918914598 PPP, PPPoS, removed linked list
We don't need anymore the PPPoS linked list since we have callbacks
for everything.
2015-02-20 00:40:45 +01:00
Sylvain Rochet
29f3f2e1d8 PPP, PPPoS, moved VJ protocol handler to PPPoS
New callback, netif input, allow low level drivers to extend
ppp_input call, moved PPPoS VJ support to pppos.c.
2015-02-20 00:40:45 +01:00
Sylvain Rochet
759d11ce1a PPP, CORE, beautified ppp_ioctl() 2015-02-20 00:40:45 +01:00
Sylvain Rochet
729e24da78 PPP, PPPoS, added sub-ioctl commands
Allow low level drivers to extend ioctl call, moved PPPoS ioctl
commands to pppos.c.
2015-02-20 00:40:45 +01:00
Sylvain Rochet
ec362536f5 PPP, uniformised callbacks naming 2015-02-20 00:40:45 +01:00
Sylvain Rochet
b92fe3eecb PPP, CORE, new callbacks, send_config, recv_config, vj_config
Removed some calls from PPP core to PPPoS low level protocols,
the const struct allows us to have more and more callbacks
without using more RAM.
2015-02-20 00:40:44 +01:00
Sylvain Rochet
985de035bc PPP, CORE, now using const callbacks struct from lower level protocols
Saving some RAM by using callbacks struct in rodata for required
callbacks called by PPP core to PPP low level protocols.
2015-02-20 00:40:44 +01:00
Sylvain Rochet
2e40ceaaa4 CORE, enabling only PPPoL2TP is also a valid choice 2015-02-20 00:40:44 +01:00
Ivan Delamer
02a797f9f9 Modified netif flag values. 2015-02-19 16:25:30 -07:00
Ivan Delamer
b938154f6b Removed unused netif flag for DHCP 2015-02-19 16:22:19 -07:00
Ivan Delamer
e312ebcb57 Removed unused netif flag for point to point connections 2015-02-19 16:19:29 -07:00
Sylvain Rochet
02cf50063e PPP, PPPoX, added warnings about functions in headers which should not be called from lwIP user application 2015-02-18 23:14:30 +01:00
Sylvain Rochet
f511bec26c PPP, PPPoS, only check PPPoS PCB pointer if PPPoS is not the only enabled lower protocol
We only need to keep track of existing PPPoS interfaces if PPPoS
is not the only enabled protocol.

PPP CORE does not have callbacks pointers for all PPPoS callbacks
which should actually be required for PPPoS (VJ config, asyncmap, ...),
there is too much callbacks to create and PPPoS must be kept light,
especially for users who are only using PPPoS.

But there is a drawback, PPP CORE does not know which
lower protocols it is talking to thanks to the abstraction,
therefore if PPPoS is enabled as well as PPPoE or PPPoL2TP there
might be situation where PPP CORE calls pppos_ config functions
on interfaces which are NOT PPPoS one. This is very unlikely to
happen because protocols not supported by PPPoE or PPPoL2TP are
disabled at LCP/IPCP negotiation but we are better safe than sorry.

So we check if passed PPP pointer to PPPoS configuration functions
is a PPPoS interface by checking against a linked list of existing
PPPoS interfaces.
2015-02-18 23:14:30 +01:00
Sylvain Rochet
9f93c16bbf PPP, CORE, beautified auth protocols debug 2015-02-18 23:14:29 +01:00
Sylvain Rochet
892e75ca92 PPP, CORE, removed useless include of chap-new.h 2015-02-18 23:14:29 +01:00
Sylvain Rochet
5e73068e09 PPP, CORE, Removed (*datainput) from struct protent if not used
Data input is only used by CCP and ECP, which are not supported at this time,
remove this entry from struct protent to save some flash.
2015-02-18 23:14:29 +01:00
Sylvain Rochet
b71d9ce3f6 PPP, CORE, Removed useless enabled_flag from struct protent
Our struct protent are const everywhere to save RAM, enable/disable
flag on a const struct is useless, saving some flash, removed.
2015-02-18 23:14:29 +01:00
sg
730529353d fixed bug #37958 "netconn API doesn't handle correctly connections half-closed by peer" 2015-02-18 22:21:26 +01:00
sg
101f57d5e0 tcp_alloc() prefers killing CLOSING/LAST_ACK over active connections (see bug #39565) (tcp_kill_prio(): back to old implementation) 2015-02-18 21:30:45 +01:00
sg
2cfc9e286e "Not connected" shouldn't be fatal (as opposed to "closed") 2015-02-18 20:39:20 +01:00
sg
998ed99288 Fixed select not reporting received FIN as 'readable' in certain rare cases (bug #43779: select(), close(), and TCP retransmission error) 2015-02-18 20:38:42 +01:00
goldsimon
9048a7f021 fixed compiler warning in dhcp.c 2015-02-18 09:02:37 +01:00
Sylvain Rochet
1c91bb5a20 PPP, PPPoS, fixed warnings with PPPDEBUG disabled 2015-02-18 00:59:27 +01:00
Sylvain Rochet
19fdeae4ba PPP, chained returns up to ppp_free()
ppp_free() now returns lower level protocol return value if something failed.
2015-02-17 23:22:15 +01:00
Sylvain Rochet
50ecd2c12c PPP, CORE, removed useless st variable in ppp_close()
Code cleaning.
2015-02-17 23:22:15 +01:00
Sylvain Rochet
07f9212799 PPP, chained returns up to ppp_open()
ppp_open() now returns lower level protocol return value if something failed.
2015-02-17 23:22:15 +01:00
Sylvain Rochet
8a8cba75a2 PPP, lower protocols, chained returns from local functions to callback caller
PPPoS,PPPoE,PPPoL2TP functions using non-void returns are now propagated
to callback caller (PPP core).
2015-02-17 23:22:15 +01:00
Sylvain Rochet
1ae3808e13 PPP, CORE, prepared for lower protocols callbacks returning state
Until now, callbacks used void return, preparing callbacks to return
PPPERR_ status.
2015-02-17 23:22:14 +01:00
Sylvain Rochet
ee2936ffbf PPP, all protocols, uniformised naming
Uniformised fonction naming between and inside PPPoS, PPPoE, PPPoL2TP.
2015-02-17 23:22:14 +01:00
Sylvain Rochet
5b29f1cdec PPP, CORE, Fixed warning with PPP_PROTOCOLNAME enabled
lwip/src/netif/ppp/ppp.c: In function ‘ppp_input’:
lwip/src/netif/ppp/ppp.c:769:5: warning: ISO C90 forbids mixed declarations and code [-Wpedantic]
     const char *pname = protocol_name(protocol);
     ^
2015-02-17 23:22:14 +01:00
Sylvain Rochet
bce29ac353 PPP, CORE, code cleaning
Reordered functions in the order they are declared in headers.
Removed useless ppp_link_down() function.
Merged ppp_stop() and ppp_close().
Merged ppp_hup() and ppp_sighup().
2015-02-17 23:22:14 +01:00
Sylvain Rochet
f7584fa883 PPP, CORE, fixed callbacks return value
Fixed return value in case of abnormal termination.
Set pcb->err_code in case of failed setup link.
2015-02-17 23:22:14 +01:00
Sylvain Rochet
18074ff98f PPP, PPPoE, improved removal from linked list
Replaced naive link list removal code to a more clever one.
2015-02-17 23:22:14 +01:00
Sylvain Rochet
4ad60b477c PPP, PPPoS, structure size optimisation
Reordered PPPoS structure so there is no alignment hole for 32 and 64 bits
systems. Reduced types which were too large.
2015-02-17 23:22:14 +01:00
Sylvain Rochet
69469496e2 PPP, PPPoS, moved out_accm from PPP core to PPPoS
Last PPPoS variable in PPP core moved to PPPoS.
2015-02-17 23:22:14 +01:00
Sylvain Rochet
baaa2592a6 PPP, PPPoS, removed xmit_accm, almost duplicate of out_accm
xmit_accm was meant to be a user configurable asyncmap, it was actually
broken since the introduction of ppp_new by the way we now reset the PPP
initial state, looks like no one until now is needing it anymore. If
necessary we will reintroduce this feature later properly instead of a
dirty and ugly hack into the PPP code.
2015-02-17 23:22:14 +01:00
Sylvain Rochet
ecb8aa6fc1 PPP, PPPoS, merged ppp(os)_pcb_rx to pppos_pcb
Merged ppp(os)_pcb_rx to pppos_pcb, saved 8 bytes of pointers
and unecessary init steps.
2015-02-17 23:22:14 +01:00
Sylvain Rochet
34210901bf PPP, PPPoS, moved ppp.rx to pppos.rx
PPP rx control block moved to PPPoS
2015-02-17 23:22:14 +01:00
Sylvain Rochet
7132893863 PPP, PPPoS, re-enabled PPPCTLG_FD
Found a fine way to get PPP fd without making this call crash for for PPPoE
or PPPoL2TP.
2015-02-17 23:22:14 +01:00
Sylvain Rochet
cfe04d4453 PPP, PPPoS, using PPPoS PCB pointer on VJ and pppos_ configuration functions
Slightly more consistent this way, and prevent using link_ctx_cb pointer
from PPPoS protocol file.
2015-02-17 23:22:14 +01:00
Sylvain Rochet
f98f2890f3 PPP, PPPoS, check if PPPoS configuration functions are used on PPPoS
We don't have callbacks which can be set or cleared for PPPoS
configuration, there is too much callbacks to create and PPPoS must be
kept light, therefore PPPoS functions can be called when PPP core
configure a PPPoE or PPPoL2TP interface, this is very unlikely to
happens because protocols not supported by PPPoE or PPPoL2TP are
disabled at LCP/IPCP negotiation but being safe is still better.

Check if passed PPP pointer to PPPoS configuration functions is a PPPoS
interface by using a linked list of exiting PPPoS interfaces.
2015-02-17 23:22:14 +01:00
Sylvain Rochet
d93c21349f PPP, PPPoS, fixed build with PPP_FCS_TABLE=1
Oops, I managed to break builds with PPP_FCS_TABLE=1, fixed.
2015-02-17 23:22:14 +01:00
Sylvain Rochet
9358dbbd99 PPP, PPPoS, various static and const added
ppp_get_fcs() is now static, const modifier added on ppp_accm_mask
2015-02-17 23:22:13 +01:00
Sylvain Rochet
2b9d304816 PPP, PPPoS, renamed *sc pointer to *pppos, renamed *pcb pointers to *pppos and *ppp
It was a bit confusing and error prone having *pcb pointers for both
ppp_pcb* and pppos_pcb*, fixed confusion with a strict naming for both.
2015-02-17 23:22:13 +01:00
Sylvain Rochet
e6465a6f44 PPP, PPPoS, moved VJ from PPP core to PPPoS
VJ is only available for PPPoS, moved VJ from PPP CORE to PPPoS.
2015-02-17 23:22:13 +01:00
Sylvain Rochet
4aa9244b92 PPP, PPPoS moved fd from ppp_pcb to pppos_pcb
Moved fd from ppp_pcb to pppos_pcb.

However PPP ioctl PPPCTLG_FD is temporarily disabled until I found a
better solution.
2015-02-17 23:22:13 +01:00
Sylvain Rochet
1ac4d1b793 PPP, PPPoS needs vj.h 2015-02-17 23:22:13 +01:00
Sylvain Rochet
ea205f2fcd PPP, add PPPoS CB for PPPoS private data
Created a new PPPoS CB going to have PPPoS private data, so allocating a
PPPoE or a PPPoL2TP interface does not allocate as well PPPoS variables.
2015-02-17 23:22:13 +01:00
Sylvain Rochet
9c15ffbb74 PPP: Moved PPPoS from ppp.c to pppos.c
Started removing from PPP core most of low level protocol PPPoS
handling to separate files, using the new low level PPP callbacks.
2015-02-17 23:22:13 +01:00
Sylvain Rochet
09b4485870 PPP, generalized callbacks calls from PPP core, removed all PPPoE and PPPoL2TP references
Almost there, removed all PPPoE and PPPoL2TP references from PPP core,
using the generic callbacks interface everywhere.
2015-02-17 23:22:13 +01:00
Sylvain Rochet
19282d6d6c PPP, moved low level protocol connect init to low level protocol files
Low level protocol init machine state does not belong to PPP core,
moved those init to respective low level protocol files.
2015-02-17 23:22:13 +01:00
Sylvain Rochet
ee85aaccd2 PPP, removed low level create functions from PPP core
ppp_over_ethernet_create() moved from ppp.c to pppoe.c
ppp_over_l2tp_create() moved from ppp.c to pppol2tp.c
2015-02-17 23:22:13 +01:00
Sylvain Rochet
0afc34f6fc PPP, moved ppp_write and ppp_netif_output low level protocols functions to respective low level protocol files
Moved ppp_write_over_ethernet() and ppp_netif_output_over_ethernet() to pppoe.c
Moved ppp_write_over_l2tp() and ppp_netif_output_over_l2tp() to pppol2tp.c
2015-02-17 23:22:13 +01:00
Sylvain Rochet
45bfccfddc PPP, prepare new callbacks for low level protocols
New callbacks: write and netif_output
2015-02-17 23:22:13 +01:00
Sylvain Rochet
f8501478f6 PPP: prepared callbacks from PPP core to low level protocols
New PPP callback from PPP core to low level protocols, first
step about removing named calls to low level protocols from PPP core.
2015-02-17 23:22:13 +01:00
Sylvain Rochet
a5582e0960 PPP: re-order functions in the common sense API order
Re-order ppp.[ch] functions in the order functions should be called from
user application. Moved create functions, which actually return a PPP
control block before functions needing a PPP control block.
2015-02-17 23:22:13 +01:00
Sylvain Rochet
b4fe72c4a2 PPP: removed duplicated code in ppp_close()
Looks like previous refactoring and cleaning made ppp_close()
consistent for all our low level protocol backends, cleaned
up duplicated code.
2015-02-17 23:22:13 +01:00
Sylvain Rochet
48f7678771 PPP: re-order prototypes, ppp_init before ppp_new
Cosmetic only.
2015-02-17 23:22:13 +01:00
Sylvain Rochet
808098413c PPP: removed PPPoE and PPPoL2TP callback status notifier
Added necessary PPP core functions for PPPoE and PPPoL2TP status
notificaton (ppp_link_failed and ppp_link_end), removed callback,
low level protocol are now calling PPP core "link" functions.
2015-02-17 23:22:12 +01:00
Sylvain Rochet
74fd2dc9ad PPP: moved ppp_new() to low level protocol init for PPPoE and PPPoL2TP
First step of a rework of how low level protocols are using the
PPP core. Low level protocols are now going to use the core instead
of core using the low level protocols.

Final goal: separate PPP core code from low level protocols.
2015-02-17 23:22:12 +01:00
Sylvain Rochet
443b2551c7 PPP: moved duplicated init code from ppp_over_X_create() to ppp_new()
Some init code were duplicated for all low-level PPP protocols, moved
uselessly duplicated code to ppp_new().
2015-02-17 23:22:12 +01:00
Sylvain Rochet
7b681bc94a PPP: re-order functions in the common sense API order
Re-order ppp.[ch] functions in the order functions should be called from
user application. Moved create functions, which actually return a PPP
control block before functions needing a PPP control block.
2015-02-17 23:22:12 +01:00
Sylvain Rochet
bd29f7168c PPP: ppp_init() is not a public function, moving it in private part
ppp_init() is not a public fonction anymore, move this function
in ppp.c "private" functions.
2015-02-17 23:22:12 +01:00
Sylvain Rochet
c8c0dc2f53 PPP: using a macro for ppp_set_default() instead of a function
This function is only calling netif_set_default(), a macro
is adequate.
2015-02-17 23:22:12 +01:00
Sylvain Rochet
17c6be6a9b PPP: removed ppp_delete(), merged with ppp_free()
The only benefit of ppp_delete() call was about having a persistent
netif interface. netif was moved out of PPP pcb so we don't need
ppp_delete() anymore, second step in simplifying the weird
new/open/free/delete PPP API.
2015-02-17 23:22:12 +01:00
Sylvain Rochet
318e752fd6 PPP: removed ppp_new(), merged with ppp_over_X_create()
The only benefit of ppp_new() call was about having a persistent netif
interface. netif was moved out of PPP pcb so we don't need ppp_new()
anymore, first step in simplifying the weird new/open/free/delete PPP
API.
2015-02-17 23:22:12 +01:00
Sylvain Rochet
3dcfd7ba41 PPP: moved netif out of PPP control block
Users might want to share a netif control block between an Ethernet
interface and a PPPoS interface (I want actually) in case PPP is just
used as redundancy if Ethernet is down (eg. PPPoS GPRS fail over).

Moved netif out of PPP control block in a similar way it is currently
done for Ethernet interfaces. Furthermore, this is a first step on
removing the "new/create/free/delete" API which is awful but currently
necessary to handle fail over from PPPoX to another PPPoX (eg. from PPoE
on xDSL to PPPoS on GPRS fail over) without free()ing the netif which
might be used on udp_sendto() or L2TP VPN links.
2015-02-17 23:22:12 +01:00
sg
604a92dc3d fixed bug #38853 "connect() use a wrong errno": return ERR_ALREADY/EALRADY during connect, ERR_ISCONN/EISCONN when already connected 2015-02-17 22:10:23 +01:00
sg
b146ae96a7 sockets.c: removed LWIP_TCPIP_CORE_LOCKING hack in lwip_sendto(): since all functions are static when LWIP_NETCONN==0, the speedup gained by this hack should now be minimal and not worth the duplicate code. 2015-02-17 21:26:40 +01:00
goldsimon
0963e91c34 api_msg_c: fixed compiler warning (added brackets in if statement) 2015-02-17 09:38:20 +01:00
goldsimon
5d13b5a2fb fixed bug #37614 "Errors from ipX_output are not processed". Now tcp_output(_segment) checks for the return value of ipX_output and does not try to send more on error. A netif driver can call tcp_txnow() (from tcpip_thread!) to try to send again if TX buffers are available again. 2015-02-17 08:02:34 +01:00
sg
90db821036 patch #8361 "Add support for NTP option in DHCP" (slighly modified) 2015-02-16 21:23:06 +01:00
Sylvain Rochet
99d1fdd270 snmp: syntax error fix on endif comment
*/ omitted on comment, added.
2015-02-14 19:38:35 +01:00
Sylvain Rochet
10ab72855d opt: fix build without SNMP_COMMUNITY_EXT
define value omitted on #define SNMP_COMMUNITY_EXT in opt.h, default is 0
2015-02-14 19:38:29 +01:00
sg
0d18516af8 added support for write-access community and dedicated community for sending traps 2015-02-14 15:44:32 +01:00
sg
e22c815444 patch by Freddie Chopin: SNMP: const-correctness around snmp traps and enterprise 2015-02-14 15:11:44 +01:00
sg
e579e98469 minor coding style fix: tab -> spaces 2015-02-14 15:05:12 +01:00
sg
723eaa1f40 Fixed compiler warning in snmp.h introduced by last patches 2015-02-14 15:04:55 +01:00
Freddie Chopin
4ebeeaf1e0 msg_in.c, msg_in.c: add snmp_get_community() and snmp_set_community() accessors
Signed-off-by: Freddie Chopin <freddie.chopin@gmail.com>
2015-02-14 14:49:42 +01:00
Freddie Chopin
2c9ceea3cf msg_in.c, snmp_msg.h: convert snmp_community to a modifiable pointer
Signed-off-by: Freddie Chopin <freddie.chopin@gmail.com>
2015-02-14 14:49:41 +01:00
Freddie Chopin
c289872ab7 msg_in.c, msg_out.c, snmp_msg.h: rename snmp_publiccommunity to snmp_community, update descriptions
Signed-off-by: Freddie Chopin <freddie.chopin@gmail.com>
2015-02-14 14:49:39 +01:00
Freddie Chopin
9469bdc93e msg_in.c, snmp_msg.h: don't hardcode size of community string
Signed-off-by: Freddie Chopin <freddie.chopin@gmail.com>
2015-02-14 14:47:55 +01:00
Freddie Chopin
9b4564d7f3 snmp_trap_header_sum(): use strlen() to get the length of community string
Signed-off-by: Freddie Chopin <freddie.chopin@gmail.com>
2015-02-14 14:46:51 +01:00
sg
b5b5844119 added hook LWIP_HOOK_MEMP_AVAILABLE() to get informed when a memp pool was empty and an item is now available 2015-02-13 21:53:55 +01:00
sg
6ef7563f53 Added the option PBUF_LINK_ENCAPSULATION_HLEN to allocate additional header space for TX on netifs requiring additional headers 2015-02-13 21:42:04 +01:00
sg
e3e3200f95 fixed bug #22070 "MIB_OBJECT_WRITE_ONLY not implemented in SNMP" 2015-02-13 21:12:23 +01:00
sg
7a0f814043 introduce sys_timeouts_sleeptime (returns the time left before the next timeout is due, for NO_SYS==1) 2015-02-12 22:14:28 +01:00
sg
80b62df0a9 fixed bug #36403 "ip4_input() and ip6_input() always pass inp to higher layers": now the accepting netif is passed up, but the input netif is available through ip_current_input_netif() if required. 2015-02-12 22:04:10 +01:00
chrysn
81d4e201bb include the memp struct list once before actually using it
when custom lwipopts.h files are used (MEMP_USE_CUSTOM_POOLS), there is
typically the need to use sizeof(some_struct) in there, but on structs
that are not already declared in lwip; thus, they use #include on custom
headers.

even if the included files have proper include guards, the way memp
headers are used (

    typedef enum {
    #define LWIP_MEMPOOL(name,num,size,desc)  MEMP_##name,
    #include "lwip/memp_std.h"
      MEMP_MAX
    } memp_t;

) breaks when fresh includes are involved. in this patch, this gets
circumvented by including lwip/memp_std.h once with an empty
LWIP_MEMPOOL definition, so that all the includes from custom
lwippools.h files can be handled safely.
2015-02-11 23:10:15 +01:00
sg
8155b8cfb3 patch #7702 "Include ability to increase the socket number with defined offset" 2015-02-11 23:05:52 +01:00