IDF release/v4.0 08219f3cf

This commit is contained in:
me-no-dev
2020-01-25 14:51:58 +00:00
parent 8c723be135
commit 41ba143063
858 changed files with 37940 additions and 49396 deletions

View File

@ -36,6 +36,10 @@
#ifndef CCP_H
#define CCP_H
#ifdef __cplusplus
extern "C" {
#endif
/*
* CCP codes.
*/
@ -152,5 +156,9 @@ extern const struct protent ccp_protent;
void ccp_resetrequest(ppp_pcb *pcb); /* Issue a reset-request. */
#ifdef __cplusplus
}
#endif
#endif /* CCP_H */
#endif /* PPP_SUPPORT && CCP_SUPPORT */

View File

@ -36,6 +36,10 @@
#include "ppp.h"
#ifdef __cplusplus
extern "C" {
#endif
/*
* CHAP packets begin with a standard header with code, id, len (2 bytes).
*/
@ -188,5 +192,9 @@ extern void chap_auth_with_peer(ppp_pcb *pcb, const char *our_name, int digest_c
/* Represents the CHAP protocol to the main pppd code */
extern const struct protent chap_protent;
#ifdef __cplusplus
}
#endif
#endif /* CHAP_H */
#endif /* PPP_SUPPORT && CHAP_SUPPORT */

View File

@ -34,6 +34,13 @@
#include "netif/ppp/ppp_opts.h"
#if PPP_SUPPORT && ECP_SUPPORT /* don't build if not configured for use in lwipopts.h */
#ifndef ECP_H
#define ECP_H
#ifdef __cplusplus
extern "C" {
#endif
typedef struct ecp_options {
bool required; /* Is ECP required? */
unsigned enctype; /* Encryption type */
@ -47,4 +54,9 @@ extern ecp_options ecp_hisoptions[];
extern const struct protent ecp_protent;
#ifdef __cplusplus
}
#endif
#endif /* ECP_H */
#endif /* PPP_SUPPORT && ECP_SUPPORT */

View File

@ -41,6 +41,10 @@
#ifndef EUI64_H
#define EUI64_H
#ifdef __cplusplus
extern "C" {
#endif
/*
* @todo:
*
@ -90,5 +94,9 @@ typedef union
char *eui64_ntoa(eui64_t); /* Returns ascii representation of id */
#ifdef __cplusplus
}
#endif
#endif /* EUI64_H */
#endif /* PPP_SUPPORT && PPP_IPV6_SUPPORT */

View File

@ -50,6 +50,10 @@
#include "ppp.h"
#ifdef __cplusplus
extern "C" {
#endif
/*
* Packet header = Code, id, length.
*/
@ -170,6 +174,9 @@ void fsm_input(fsm *f, u_char *inpacket, int l);
void fsm_protreject(fsm *f);
void fsm_sdata(fsm *f, u_char code, u_char id, const u_char *data, int datalen);
#ifdef __cplusplus
}
#endif
#endif /* FSM_H */
#endif /* PPP_SUPPORT */

View File

@ -48,6 +48,10 @@
#ifndef IPCP_H
#define IPCP_H
#ifdef __cplusplus
extern "C" {
#endif
/*
* Options.
*/
@ -122,5 +126,9 @@ char *ip_ntoa (u32_t);
extern const struct protent ipcp_protent;
#ifdef __cplusplus
}
#endif
#endif /* IPCP_H */
#endif /* PPP_SUPPORT && PPP_IPV4_SUPPORT */

View File

@ -146,6 +146,10 @@
#include "eui64.h"
#ifdef __cplusplus
extern "C" {
#endif
/*
* Options.
*/
@ -179,5 +183,9 @@ typedef struct ipv6cp_options {
extern const struct protent ipv6cp_protent;
#ifdef __cplusplus
}
#endif
#endif /* IPV6CP_H */
#endif /* PPP_SUPPORT && PPP_IPV6_SUPPORT */

View File

@ -50,6 +50,10 @@
#include "ppp.h"
#ifdef __cplusplus
extern "C" {
#endif
/*
* Options.
*/
@ -167,5 +171,9 @@ extern const struct protent lcp_protent;
#define DEFLOOPBACKFAIL 10
#endif /* moved to ppp_opts.h */
#ifdef __cplusplus
}
#endif
#endif /* LCP_H */
#endif /* PPP_SUPPORT */

View File

@ -80,6 +80,10 @@
#ifndef MAGIC_H
#define MAGIC_H
#ifdef __cplusplus
extern "C" {
#endif
/***********************
*** PUBLIC FUNCTIONS ***
***********************/
@ -117,6 +121,10 @@ void magic_random_bytes(unsigned char *buf, u32_t buf_len);
*/
u32_t magic_pow(u8_t pow);
#ifdef __cplusplus
}
#endif
#endif /* MAGIC_H */
#endif /* PPP_SUPPORT */

View File

@ -41,6 +41,10 @@
#include "netif/ppp/pppcrypt.h"
#ifdef __cplusplus
extern "C" {
#endif
#define MPPE_PAD 4 /* MPPE growth per frame */
#define MPPE_MAX_KEY_LEN 16 /* largest key length (128-bit) */
@ -169,5 +173,9 @@ err_t mppe_compress(ppp_pcb *pcb, ppp_mppe_state *state, struct pbuf **pb, u16_t
void mppe_decomp_reset(ppp_pcb *pcb, ppp_mppe_state *state);
err_t mppe_decompress(ppp_pcb *pcb, ppp_mppe_state *state, struct pbuf **pb);
#ifdef __cplusplus
}
#endif
#endif /* MPPE_H */
#endif /* PPP_SUPPORT && MPPE_SUPPORT */

View File

@ -47,6 +47,10 @@
#include "lwip/ip6_addr.h"
#endif /* PPP_IPV6_SUPPORT */
#ifdef __cplusplus
extern "C" {
#endif
/* Disable non-working or rarely used PPP feature, so rarely that we don't want to bloat ppp_opts.h with them */
#ifndef PPP_OPTIONS
#define PPP_OPTIONS 0
@ -685,6 +689,10 @@ err_t ppp_ioctl(ppp_pcb *pcb, u8_t cmd, void *arg);
#define ppp_set_netif_linkcallback(ppp, link_cb) \
netif_set_link_callback(ppp->netif, link_cb);
#ifdef __cplusplus
}
#endif
#endif /* PPP_H */
#endif /* PPP_SUPPORT */

View File

@ -53,6 +53,10 @@
#include "ppp.h"
#include "pppdebug.h"
#ifdef __cplusplus
extern "C" {
#endif
/*
* Memory used for control packets.
*
@ -406,9 +410,6 @@ void ppp_link_end(ppp_pcb *pcb);
/* function called to process input packet */
void ppp_input(ppp_pcb *pcb, struct pbuf *pb);
/* helper function, merge a pbuf chain into one pbuf */
struct pbuf *ppp_singlebuf(struct pbuf *p);
/*
* Functions called by PPP protocols.
@ -624,6 +625,98 @@ void ppp_dump_packet(ppp_pcb *pcb, const char *tag, unsigned char *p, int len);
/* dump packet to debug log if interesting */
#endif /* PRINTPKT_SUPPORT */
/*
* Number of necessary timers analysis.
*
* PPP use at least one timer per each of its protocol, but not all protocols are
* active at the same time, thus the number of necessary timeouts is actually
* lower than enabled protocols. Here is the actual necessary timeouts based
* on code analysis.
*
* Note that many features analysed here are not working at all and are only
* there for a comprehensive analysis of necessary timers in order to prevent
* having to redo that each time we add a feature.
*
* Timer list
*
* | holdoff timeout
* | low level protocol timeout (PPPoE or PPPoL2P)
* | LCP delayed UP
* | LCP retransmit (FSM)
* | LCP Echo timer
* .| PAP or CHAP or EAP authentication
* . | ECP retransmit (FSM)
* . | CCP retransmit (FSM) when MPPE is enabled
* . | CCP retransmit (FSM) when MPPE is NOT enabled
* . | IPCP retransmit (FSM)
* . .| IP6CP retransmit (FSM)
* . . | Idle time limit
* . . | Max connect time
* . . | Max octets
* . . | CCP RACK timeout
* . . .
* PPP_PHASE_DEAD
* PPP_PHASE_HOLDOFF
* | . . .
* PPP_PHASE_INITIALIZE
* | . . .
* PPP_PHASE_ESTABLISH
* | . . .
* |. . .
* | . .
* PPP_PHASE_AUTHENTICATE
* | . .
* || . .
* PPP_PHASE_NETWORK
* | || . .
* | ||| .
* PPP_PHASE_RUNNING
* | .|||||
* | . ||||
* PPP_PHASE_TERMINATE
* | . ||||
* PPP_PHASE_NETWORK
* |. .
* PPP_PHASE_ESTABLISH
* PPP_PHASE_DISCONNECT
* PPP_PHASE_DEAD
*
* Alright, PPP basic retransmission and LCP Echo consume one timer.
* 1
*
* If authentication is enabled one timer is necessary during authentication.
* 1 + PPP_AUTH_SUPPORT
*
* If ECP is enabled one timer is necessary before IPCP and/or IP6CP, one more
* is necessary if CCP is enabled (only with MPPE support but we don't care much
* up to this detail level).
* 1 + ECP_SUPPORT + CCP_SUPPORT
*
* If CCP is enabled it might consume a timer during IPCP or IP6CP, thus
* we might use IPCP, IP6CP and CCP timers simultaneously.
* 1 + PPP_IPV4_SUPPORT + PPP_IPV6_SUPPORT + CCP_SUPPORT
*
* When entering running phase, IPCP or IP6CP is still running. If idle time limit
* is enabled one more timer is necessary. Same for max connect time and max
* octets features. Furthermore CCP RACK might be used past this point.
* 1 + PPP_IPV4_SUPPORT + PPP_IPV6_SUPPORT -1 + PPP_IDLETIMELIMIT + PPP_MAXCONNECT + MAXOCTETS + CCP_SUPPORT
*
* IPv4 or IPv6 must be enabled, therefore we don't need to take care the authentication
* and the CCP + ECP case, thus reducing overall complexity.
* 1 + LWIP_MAX(PPP_IPV4_SUPPORT + PPP_IPV6_SUPPORT + CCP_SUPPORT, PPP_IPV4_SUPPORT + PPP_IPV6_SUPPORT -1 + PPP_IDLETIMELIMIT + PPP_MAXCONNECT + MAXOCTETS + CCP_SUPPORT)
*
* We don't support PPP_IDLETIMELIMIT + PPP_MAXCONNECT + MAXOCTETS features
* and adding those defines to ppp_opts.h just for having the value always
* defined to 0 isn't worth it.
* 1 + LWIP_MAX(PPP_IPV4_SUPPORT + PPP_IPV6_SUPPORT + CCP_SUPPORT, PPP_IPV4_SUPPORT + PPP_IPV6_SUPPORT -1 + CCP_SUPPORT)
*
* Thus, the following is enough for now.
* 1 + PPP_IPV4_SUPPORT + PPP_IPV6_SUPPORT + CCP_SUPPORT
*/
#ifdef __cplusplus
}
#endif
#endif /* PPP_SUPPORT */
#endif /* LWIP_HDR_PPP_IMPL_H */

View File

@ -44,6 +44,13 @@
#define PPPOE_SUPPORT 0
#endif
/**
* PPPOE_SCNAME_SUPPORT==1: Enable PPP Over Ethernet Service Name and Concentrator Name support
*/
#ifndef PPPOE_SCNAME_SUPPORT
#define PPPOE_SCNAME_SUPPORT 0
#endif
/**
* PPPOL2TP_SUPPORT==1: Enable PPP Over L2TP
*/
@ -72,15 +79,27 @@
#define LWIP_PPP_API (PPP_SUPPORT && (NO_SYS == 0))
#endif
#if PPP_SUPPORT
/**
* MEMP_NUM_PPP_PCB: the number of simultaneously active PPP
* connections (requires the PPP_SUPPORT option)
*/
#ifndef MEMP_NUM_PPP_PCB
#define MEMP_NUM_PPP_PCB 1
#define MEMP_NUM_PPP_PCB 1
#endif
#if PPP_SUPPORT
/**
* PPP_NUM_TIMEOUTS_PER_PCB: the number of sys_timeouts running in parallel per
* ppp_pcb. See the detailed explanation at the end of ppp_impl.h about simultaneous
* timers analysis.
*/
#ifndef PPP_NUM_TIMEOUTS_PER_PCB
#define PPP_NUM_TIMEOUTS_PER_PCB (1 + PPP_IPV4_SUPPORT + PPP_IPV6_SUPPORT + CCP_SUPPORT)
#endif
/* The number of sys_timeouts required for the PPP module */
#define PPP_NUM_TIMEOUTS (PPP_SUPPORT * PPP_NUM_TIMEOUTS_PER_PCB * MEMP_NUM_PPP_PCB)
/**
* MEMP_NUM_PPPOS_INTERFACES: the number of concurrently active PPPoS
@ -590,4 +609,9 @@
#endif /* PPP_SUPPORT */
/* Default value if unset */
#ifndef PPP_NUM_TIMEOUTS
#define PPP_NUM_TIMEOUTS 0
#endif /* PPP_NUM_TIMEOUTS */
#endif /* LWIP_PPP_OPTS_H */

View File

@ -47,7 +47,7 @@ extern "C" {
struct pppapi_msg_msg {
ppp_pcb *ppp;
union {
#if ESP_LWIP
#if ESP_PPP
struct {
u8_t authtype;
const char *user;
@ -111,7 +111,7 @@ struct pppapi_msg {
/* API for application */
err_t pppapi_set_default(ppp_pcb *pcb);
#if ESP_LWIP
#if ESP_PPP
void pppapi_set_auth(ppp_pcb *pcb, u8_t authtype, const char *user, const char *passwd);
#endif
#if PPP_NOTIFY_PHASE

View File

@ -44,6 +44,10 @@
*/
#include "lwip/arch.h"
#ifdef __cplusplus
extern "C" {
#endif
/*
* Map hashes and ciphers functions to PolarSSL
*/
@ -131,6 +135,10 @@
void pppcrypt_56_to_64_bit_key(u_char *key, u_char *des_key);
#ifdef __cplusplus
}
#endif
#endif /* PPPCRYPT_H */
#endif /* PPP_SUPPORT */

View File

@ -40,6 +40,10 @@
#ifndef PPPDEBUG_H
#define PPPDEBUG_H
#ifdef __cplusplus
extern "C" {
#endif
/* Trace levels. */
#define LOG_CRITICAL (PPP_DEBUG | LWIP_DBG_LEVEL_SEVERE)
#define LOG_ERR (PPP_DEBUG | LWIP_DBG_LEVEL_SEVERE)
@ -75,6 +79,10 @@
#endif /* PPP_DEBUG */
#ifdef __cplusplus
}
#endif
#endif /* PPPDEBUG_H */
#endif /* PPP_SUPPORT */

View File

@ -76,6 +76,10 @@
#include "ppp.h"
#include "lwip/etharp.h"
#ifdef __cplusplus
extern "C" {
#endif
#ifdef PACK_STRUCT_USE_INCLUDES
# include "arch/bpstruct.h"
#endif
@ -145,10 +149,10 @@ struct pppoe_softc {
u16_t sc_session; /* PPPoE session id */
u8_t sc_state; /* discovery phase or session connected */
#ifdef PPPOE_TODO
u8_t *sc_service_name; /* if != NULL: requested name of service */
u8_t *sc_concentrator_name; /* if != NULL: requested concentrator id */
#endif /* PPPOE_TODO */
#if PPPOE_SCNAME_SUPPORT
const char *sc_service_name; /* if != NULL: requested name of service */
const char *sc_concentrator_name; /* if != NULL: requested concentrator id */
#endif /* PPPOE_SCNAME_SUPPORT */
u8_t sc_ac_cookie[PPPOE_MAX_AC_COOKIE_LEN]; /* content of AC cookie we must echo back */
u8_t sc_ac_cookie_len; /* length of cookie data */
#ifdef PPPOE_SERVER
@ -174,6 +178,10 @@ ppp_pcb *pppoe_create(struct netif *pppif,
void pppoe_disc_input(struct netif *netif, struct pbuf *p);
void pppoe_data_input(struct netif *netif, struct pbuf *p);
#ifdef __cplusplus
}
#endif
#endif /* PPP_OE_H */
#endif /* PPP_SUPPORT && PPPOE_SUPPORT */

View File

@ -39,6 +39,10 @@
#include "ppp.h"
#ifdef __cplusplus
extern "C" {
#endif
/* Timeout */
#define PPPOL2TP_CONTROL_TIMEOUT (5*1000) /* base for quick timeout calculation */
#define PPPOL2TP_SLOW_RETRY (60*1000) /* persistent retry interval */
@ -179,7 +183,7 @@ struct pppol2tp_pcb_s {
u16_t tunnel_port; /* Tunnel port */
u16_t our_ns; /* NS to peer */
u16_t peer_nr; /* NR from peer */
u16_t peer_ns; /* NS from peer */
u16_t peer_ns; /* Expected NS from peer */
u16_t source_tunnel_id; /* Tunnel ID assigned by peer */
u16_t remote_tunnel_id; /* Tunnel ID assigned to peer */
u16_t source_session_id; /* Session ID assigned by peer */
@ -197,5 +201,9 @@ ppp_pcb *pppol2tp_create(struct netif *pppif,
const u8_t *secret, u8_t secret_len,
ppp_link_status_cb_fn link_status_cb, void *ctx_cb);
#ifdef __cplusplus
}
#endif
#endif /* PPPOL2TP_H */
#endif /* PPP_SUPPORT && PPPOL2TP_SUPPORT */

View File

@ -42,6 +42,10 @@
#include "ppp.h"
#include "vj.h"
#ifdef __cplusplus
extern "C" {
#endif
/* PPP packet parser states. Current state indicates operation yet to be
* completed. */
enum {
@ -114,5 +118,9 @@ void pppos_input(ppp_pcb *ppp, u8_t* data, int len);
err_t pppos_input_sys(struct pbuf *p, struct netif *inp);
#endif /* !NO_SYS && !PPP_INPROC_IRQ_SAFE */
#ifdef __cplusplus
}
#endif
#endif /* PPPOS_H */
#endif /* PPP_SUPPORT && PPPOL2TP_SUPPORT */

View File

@ -50,6 +50,10 @@
#include "ppp.h"
#ifdef __cplusplus
extern "C" {
#endif
/*
* Packet header = Code, id, length.
*/
@ -119,5 +123,9 @@ void upap_authpeer(ppp_pcb *pcb);
extern const struct protent pap_protent;
#ifdef __cplusplus
}
#endif
#endif /* UPAP_H */
#endif /* PPP_SUPPORT && PAP_SUPPORT */

View File

@ -31,6 +31,10 @@
#include "lwip/ip.h"
#include "lwip/priv/tcp_priv.h"
#ifdef __cplusplus
extern "C" {
#endif
#define MAX_SLOTS 16 /* must be > 2 and < 256 */
#define MAX_HDR 128
@ -156,6 +160,10 @@ extern void vj_uncompress_err (struct vjcompress *comp);
extern int vj_uncompress_uncomp(struct pbuf *nb, struct vjcompress *comp);
extern int vj_uncompress_tcp (struct pbuf **nb, struct vjcompress *comp);
#ifdef __cplusplus
}
#endif
#endif /* VJ_H */
#endif /* PPP_SUPPORT && VJ_SUPPORT */