Commit Graph

3451 Commits

Author SHA1 Message Date
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