Commit Graph

3603 Commits

Author SHA1 Message Date
Erik Ekman
6cdea62638 Add functions to join/leave v6 multicast group by netif
Existing functions are based on IP address, but the address is used
only to look up which netif to act on. The netif-based core code is
extracted to new exported functions.

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

If you have a netif handle, this makes it easier to join/leave
groups, without the need to convert to IP address first only for the
IGMP code to convert back to netif.
2015-09-30 14:29:37 +02:00
goldsimon
373714c02f dns: improved handling 2nd server if first failed 2015-09-30 14:22:39 +02:00
goldsimon
927b72abd2 fixed bug #46072: ip4addr_aton() does not check the number range of all address parts 2015-09-30 14:15:36 +02:00
goldsimon
f89e859415 minor: fixed coding style in ip4addr_aton() 2015-09-30 14:13:05 +02:00
goldsimon
dae73e21b8 minor: fixed coding style in ip4addr_aton() 2015-09-30 14:11:50 +02:00
goldsimon
f950bf4362 ipaddr_aton(): favour ':' over '.' to decide for IPv6 first (since IPv6 mapped IPv4 addresses might contain both ':' and '.') 2015-09-30 14:06:44 +02:00
goldsimon
0621e8d1b1 ip6addr_aton(): fail on three successive colons in an IPv6 address string 2015-09-30 14:05:13 +02:00
goldsimon
5a185a0fbd minor: fixed coding style in ip6addr_aton() 2015-09-30 13:55:09 +02:00
goldsimon
45fd622491 Fixed bug #46071 Logic error in line 1473 in dns.c 2015-09-30 13:36:13 +02:00
goldsimon
5e7a74e2e7 fixed bug #46064: ip_set_v6() must set pcb ip address types as well 2015-09-28 09:36:36 +02:00
goldsimon
94625a8fa8 MIB2_STATS: moved netif related mib2 counters into a struct (defined in stats.h), added ifInErrors/ifInUnkownProtos (now handled in etharp.c) and ifOutErrors 2015-09-28 08:50:21 +02:00
goldsimon
dbe703cfb0 netdb: fixed warning about pointless comparison 2015-09-28 08:10:53 +02:00
goldsimon
bc30899168 fixed compiler warnings where passing variable instance to ip_addr_isany 2015-09-28 07:56:52 +02:00
Sylvain Rochet
d39f929675 PPP: magic: don't truncate sys_jiffies() return value
It used to be this way because the original implementation was close to
the hardware and used a free running 16 bits timer so it was necessary.
Currently what it is only doing is removing potential entropy we might
get from upper bits, that's a bad idea.
2015-09-27 17:15:31 +02:00
Sylvain Rochet
b589864144 sys.h: fixed comment, sys_msleep() is in ms, not in jiffies 2015-09-27 00:05:58 +02:00
Sylvain Rochet
9e0202b38f PPP, PPP_MAXIDLEFLAG is now in ms instead of jiffies
Jiffies isn't really a humanly readable value and it means the default
PPP_MAXIDLEFLAG period depends on the platform "jiffies" frequency,
which isn't nice.

Change PPP_MAXIDLEFLAG to use ms instead of jiffies, the current
PPP_MAXIDLEFLAG default (100 ms), looks like a sane value and is
left unchanged.
2015-09-26 23:01:15 +02:00
sg
ba41685353 PPP: include "ppp_settings.h" if PPP_INCLUDE_SETTINGS_HEADER is defined to be able to silence some warnings in PPP code only (at least msvc needs this since PPP produces more warnings than the rest) 2015-09-24 22:04:48 +02:00
sg
bb91bd2279 fixed coding style: use more () 2015-09-24 21:04:20 +02:00
Sylvain Rochet
8b2c73de4e ip4: routing: check peer for point to point interfaces
gw netif field for point to point interfaces is the peer IP address.
Check if the destination is equals to the gw field of point to point
interfaces (broadcast flag is not set) when routing an IP packet.
2015-09-24 21:01:52 +02:00
goldsimon
715d8d3881 simplify FDSETSAFESET()/FDSETSAFEGET(): p is not required 2015-09-24 15:34:54 +02:00
goldsimon
5ad743e182 FD_SET: dump NULL-check that hides usage error, dump non-standard FD_SET_VAL 2015-09-24 15:21:03 +02:00
goldsimon
b0917d987a Cleaned up using struct netif.ip_addr by creating API functions for it 2015-09-24 14:57:16 +02:00
goldsimon
99d2e5233d struct udp_pcb.multicast_ip must be an ip_addr_t, too, to completely avoid temporary storage 2015-09-24 14:55:55 +02:00
goldsimon
e11e12f01d Fixed ETHARP_TRUST_IP_MAC after changing struct netif.ip_addr/netmask to ip_addr_t 2015-09-24 14:46:29 +02:00
goldsimon
c71723101a Removed ip_2_ip4/6_c const macros again now that ip_2_ip4/6 macros keep the original const'ness 2015-09-24 14:38:52 +02:00
goldsimon
262a641396 eliminate temporary storage when using netif addresses for ip_addr_t* now that they have the correct type (ATTENTION: ip6_select_source_address() and ip4_netif_get_local_ip() now return ip_addr_t*!) 2015-09-24 14:34:24 +02:00
goldsimon
4d2f4ce78c udp: don't use ip4_2_ip() where not required 2015-09-24 10:39:13 +02:00
goldsimon
51ce505d7d Simplify ip_2_ip6/4(_c) macros (and removed LWIP_ALLOW_STATIC_FN_IN_HEADER) -> now the *_c versions should not be required any more 2015-09-24 10:13:45 +02:00
goldsimon
f85737bf29 Fixed const warning in lwip_writev 2015-09-24 09:30:00 +02:00
goldsimon
ed4130bd2f Fixed const errors after changing netif_ip4_addr/netif_ip6_addr to return cont pointers 2015-09-24 08:06:50 +02:00
goldsimon
0fbdd5e56e fixed compiling LWIP_HAVE_LOOPIF after changing struct netif.ip6_addr to ip_addr_t 2015-09-24 07:58:29 +02:00
Joel Cunningham
cc4d09423a Add writev function
This commit adds compatibility with POSIX writev according to the Open
Group specification:
http://pubs.opengroup.org/onlinepubs/009695399/functions/writev.html

Implementation maps to sendmsg in the same manner that write() maps to
send()
2015-09-23 15:52:28 -05:00
sg
db76671d4d task #13729: Convert netif addresses (IPv4 & IPv6) to ip_addr_t (so they can be used without conversion/temporary storage) 2015-09-23 22:09:37 +02:00
sg
05e6f06b62 Fixed IP_ADDR6 macro for IPv6 only 2015-09-23 22:07:34 +02:00
sg
f36adac8ab fixed compiling udp.c for IPv6-only 2015-09-23 22:07:14 +02:00
sg
121268d320 Added ip_addr_set_zero_ip4() to explicitly set the type to IPv4 for dual-stack 2015-09-23 21:56:34 +02:00
goldsimon
e6b6543c33 igmp: use netif_ip4_addr() instead of directly accessing struct netif member 2015-09-23 16:26:56 +02:00
Dirk Ziegelmeier
e00e4a6c13 make netif_ip4_* get accessors return const pointers 2015-09-23 13:19:56 +02:00
Sylvain Rochet
2f40d19193 trivial CVS to Git renaming 2015-09-22 21:09:57 +02:00
goldsimon
abc74464a0 Revert "make netif_ip4_addr/netmask/gw macros return constant IP address pointers"
This reverts commit b9b31a5e72.
2015-09-22 11:42:41 +02:00
Dirk Ziegelmeier
b9b31a5e72 make netif_ip4_addr/netmask/gw macros return constant IP address pointers 2015-09-21 20:32:14 +02:00
Sylvain Rochet
8eab90418a PPP, auth, code cleaning: removed useless variables on stack 2015-09-18 22:51:32 +02:00
Sylvain Rochet
83cddd8941 PPP: more const and mixed u_char/char types fixes 2015-09-18 20:11:09 +02:00
sg
cb6adc643b PPP: more const fixes 2015-09-17 22:20:12 +02:00
sg
0454950564 fixed compiling for various config combinations 2015-09-17 22:19:37 +02:00
sg
4f9bcc5ecc fixed compiler warnings reported by mingw-64 2015-09-17 22:00:16 +02:00
sg
39e32ea7c1 fixed const warning for !IPV6_FRAG_COPYHEADER 2015-09-17 21:59:54 +02:00
sg
2f3dcf7a16 fixed compiling lwip_sendmsg for LWIP_NETIF_TX_SINGLE_PBUF && LWIP_CHECKSUM_ON_COPY 2015-09-17 21:36:25 +02:00
sg
6f0dceee09 fixed some printf formatters (mainly for window scaling code) 2015-09-17 21:33:25 +02:00
sg
9614c60cf6 fixed constness for DNS_LOCAL_HOSTLIST_IS_DYNAMIC 2015-09-17 21:32:11 +02:00
Dirk Ziegelmeier
cca758d332 Fixed using wrong sockaddr type in lwip_getaddrinfo when IPv6 is enabled 2015-09-17 20:55:44 +02:00
Robert Szewczyk
52a4ca99a8 pbuf_take: make it comply with API specifications
LWIP_ERROR macro exited the function early with the return code
indicating a SUCCESS. Fix the error codes. Return the specified
error code for cases when the pbuf is too short.
2015-09-17 17:05:01 +02:00
Joel Cunningham
72b3f3f612 Hook up TCP cachehit stat
This commit hooks up the TCP cachehit stat to the PCB locality feature
so that when a PCB is moved to the head of the list and a segment comes
in, we consider this a cache hit

This also matches the usage of the cachehit stat in UDP
2015-09-17 17:02:39 +02:00
Dirk Ziegelmeier
f62022cdf3 Compiler warning fixes (mostly constness in dual-stack configurations) 2015-09-17 13:59:52 +02:00
goldsimon
726af89168 minor compiler warning fixes and coding style 2015-09-17 11:00:21 +02:00
Joel Cunningham
c1c1754171 Sockets: add sendmsg
Adds sendmsg implementation for TCP and UDP sockets. Control messages
are not supported at this point, but could be added in the future

https://savannah.nongnu.org/bugs/?44805

Change-Id: Iddb287fd4b693f7563f8c923f76785cdde782d2f
2015-09-16 15:49:02 -05:00
sg
68a1ec2eb1 Fixed passing ip_input() to netif_add() for single-IP-version NO_SYS configurations 2015-09-16 22:09:54 +02:00
chrysn
b85b554db1 PPP, FSM, don't call memcpy with NULL even when size = 0 2015-09-16 16:03:15 +02:00
goldsimon
dc04118469 fixed missing comment after #endif 2015-09-15 08:19:26 +02:00
Joel Cunningham
7276f49f54 Fix typos from task #12243
This fixes two typos spotted during visual inspection of changes related
to task #12243
2015-09-14 20:43:21 +02:00
Sylvain Rochet
4704c9a0ad tcp: fixed CHECKSUM_GEN_TCP feature (misplaced #define) 2015-09-14 14:48:35 +02:00
Sylvain Rochet
c15b357889 PPP, merged ppp_link_set_callbacks() into ppp_new() 2015-09-13 18:28:06 +02:00
Sylvain Rochet
46204a9f86 PPP, reorder initialisation of low level protocols to call ppp_link_set_callbacks() just after PPP control block allocation 2015-09-13 18:21:14 +02:00
Sylvain Rochet
5b07569eb9 PPP, remove now unused ioctl callback from link_callbacks structure 2015-09-13 17:59:14 +02:00
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