Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ruanhaishen
Nodemcu Firmware
Commits
310faf7f
Unverified
Commit
310faf7f
authored
Sep 07, 2019
by
Terry Ellison
Committed by
GitHub
Sep 07, 2019
Browse files
Merge pull request #2886 from nodemcu/dev
Next master drop
parents
68c425c0
a08e74d9
Changes
368
Hide whitespace changes
Inline
Side-by-side
app/lwip/Makefile
View file @
310faf7f
...
...
@@ -14,9 +14,9 @@
ifndef
PDIR
UP_EXTRACT_DIR
=
..
GEN_LIBS
=
liblwip.a
COMPONENTS_liblwip
=
api/liblwipapi.a
\
app/liblwipapp.a
\
core/liblwipcore.a
\
COMPONENTS_liblwip
=
api/liblwipapi.a
\
app/liblwipapp.a
\
core/liblwipcore.a
\
core/ipv4/liblwipipv4.a
\
netif/liblwipnetif.a
endif
...
...
@@ -29,7 +29,11 @@ endif
# makefile at its root level - these are then overridden
# for a subtree within the makefile rooted therein
#
#DEFINES +=
# Other potential configuration flags include:
# -DTXRX_TXBUF_DEBUG
# -DTXRX_RXBUF_DEBUG
# -DWLAN_CONFIG_CCX
CONFIGURATION_DEFINES
+=
-DPBUF_RSV_FOR_WLAN
-DEBUF_LWIP
#############################################################
# Recursion Magic - Don't touch this!!
...
...
@@ -43,8 +47,6 @@ endif
# Required for each makefile to inherit from the parent
#
INCLUDES
:=
$(INCLUDES)
-I
$(PDIR)
include
INCLUDES
+=
-I
./
PDIR
:=
../
$(PDIR)
sinclude
$(PDIR)Makefile
app/lwip/api/Makefile
View file @
310faf7f
...
...
@@ -39,8 +39,6 @@ endif
# Required for each makefile to inherit from the parent
#
INCLUDES
:=
$(INCLUDES)
-I
$(PDIR)
include
INCLUDES
+=
-I
./
PDIR
:=
../
$(PDIR)
sinclude
$(PDIR)Makefile
app/lwip/app/Makefile
View file @
310faf7f
...
...
@@ -39,8 +39,6 @@ endif
# Required for each makefile to inherit from the parent
#
INCLUDES
:=
$(INCLUDES)
-I
$(PDIR)
include
INCLUDES
+=
-I
./
PDIR
:=
../
$(PDIR)
sinclude
$(PDIR)Makefile
app/lwip/core/Makefile
View file @
310faf7f
...
...
@@ -39,8 +39,6 @@ endif
# Required for each makefile to inherit from the parent
#
INCLUDES
:=
$(INCLUDES)
-I
$(PDIR)
include
INCLUDES
+=
-I
./
PDIR
:=
../
$(PDIR)
sinclude
$(PDIR)Makefile
app/lwip/core/dhcp.c
View file @
310faf7f
...
...
@@ -119,7 +119,8 @@ static const char mem_debug_file[] ICACHE_RODATA_ATTR = __FILE__;
#define DHCP_OPTION_IDX_T2 5
#define DHCP_OPTION_IDX_SUBNET_MASK 6
#define DHCP_OPTION_IDX_ROUTER 7
#define DHCP_OPTION_IDX_DNS_SERVER 8
#define DHCP_OPTION_IDX_NTP 8
#define DHCP_OPTION_IDX_DNS_SERVER 9
#define DHCP_OPTION_IDX_MAX (DHCP_OPTION_IDX_DNS_SERVER + DNS_MAX_SERVERS)
/** Holds the decoded option values, only valid while in dhcp_recv.
...
...
@@ -292,19 +293,20 @@ dhcp_select(struct netif *netif)
dhcp_option
(
dhcp
,
DHCP_OPTION_SERVER_ID
,
4
);
dhcp_option_long
(
dhcp
,
ntohl
(
ip4_addr_get_u32
(
&
dhcp
->
server_ip_addr
)));
dhcp_option
(
dhcp
,
DHCP_OPTION_PARAMETER_REQUEST_LIST
,
1
2
/*num options*/
);
dhcp_option
(
dhcp
,
DHCP_OPTION_PARAMETER_REQUEST_LIST
,
1
3
/*num options*/
);
dhcp_option_byte
(
dhcp
,
DHCP_OPTION_SUBNET_MASK
);
dhcp_option_byte
(
dhcp
,
DHCP_OPTION_ROUTER
);
dhcp_option_byte
(
dhcp
,
DHCP_OPTION_BROADCAST
);
dhcp_option_byte
(
dhcp
,
DHCP_OPTION_DNS_SERVER
);
dhcp_option_byte
(
dhcp
,
DHCP_OPTION_NTP
);
dhcp_option_byte
(
dhcp
,
DHCP_OPTION_DOMAIN_NAME
);
dhcp_option_byte
(
dhcp
,
DHCP_OPTION_NB_TINS
);
dhcp_option_byte
(
dhcp
,
DHCP_OPTION_NB_TINT
);
dhcp_option_byte
(
dhcp
,
DHCP_OPTION_NB_TIS
);
dhcp_option_byte
(
dhcp
,
DHCP_OPTION_PRD
);
dhcp_option_byte
(
dhcp
,
DHCP_OPTION_STATIC_ROUTER
);
dhcp_option_byte
(
dhcp
,
DHCP_OPTION_CLASSLESS_STATIC_ROUTER
);
dhcp_option_byte
(
dhcp
,
DHCP_OPTION_VSN
);
dhcp_option_byte
(
dhcp
,
DHCP_OPTION_NB_TINS
);
dhcp_option_byte
(
dhcp
,
DHCP_OPTION_NB_TINT
);
dhcp_option_byte
(
dhcp
,
DHCP_OPTION_NB_TIS
);
dhcp_option_byte
(
dhcp
,
DHCP_OPTION_PRD
);
dhcp_option_byte
(
dhcp
,
DHCP_OPTION_STATIC_ROUTER
);
dhcp_option_byte
(
dhcp
,
DHCP_OPTION_CLASSLESS_STATIC_ROUTER
);
dhcp_option_byte
(
dhcp
,
DHCP_OPTION_VSN
);
#if LWIP_NETIF_HOSTNAME
if
(
netif
->
hostname
!=
NULL
)
{
...
...
@@ -383,7 +385,7 @@ dhcp_fine_tmr()
if
(
netif
->
dhcp
!=
NULL
)
{
/*add DHCP retries processing by LiuHan*/
if
(
DHCP_MAXRTX
!=
0
)
{
if
(
netif
->
dhcp
->
tries
>=
DHCP_MAXRTX
){
if
(
netif
->
dhcp
->
tries
>=
DHCP_MAXRTX
){
os_printf
(
"DHCP timeout
\n
"
);
if
(
netif
->
dhcp_event
!=
NULL
)
netif
->
dhcp_event
();
...
...
@@ -536,6 +538,7 @@ dhcp_handle_ack(struct netif *netif)
#if LWIP_DHCP_BOOTP_FILE
ip_addr_set_zero
(
&
dhcp
->
offered_si_addr
);
#endif
/* LWIP_DHCP_BOOTP_FILE */
ip_addr_set_zero
(
&
dhcp
->
offered_ntp_addr
);
/* lease time given? */
if
(
dhcp_option_given
(
dhcp
,
DHCP_OPTION_IDX_LEASE_TIME
))
{
...
...
@@ -593,6 +596,10 @@ dhcp_handle_ack(struct netif *netif)
n
++
;
}
#endif
/* LWIP_DNS */
if
(
dhcp_option_given
(
dhcp
,
DHCP_OPTION_IDX_NTP
))
{
ip4_addr_set_u32
(
&
dhcp
->
offered_ntp_addr
,
htonl
(
dhcp_get_option_value
(
dhcp
,
DHCP_OPTION_IDX_NTP
)));
}
}
/** Set a statically allocated struct dhcp to work with.
...
...
@@ -915,19 +922,20 @@ dhcp_discover(struct netif *netif)
}
}
#endif
/* LWIP_NETIF_HOSTNAME */
dhcp_option
(
dhcp
,
DHCP_OPTION_PARAMETER_REQUEST_LIST
,
1
2
/*num options*/
);
dhcp_option
(
dhcp
,
DHCP_OPTION_PARAMETER_REQUEST_LIST
,
1
3
/*num options*/
);
dhcp_option_byte
(
dhcp
,
DHCP_OPTION_SUBNET_MASK
);
dhcp_option_byte
(
dhcp
,
DHCP_OPTION_ROUTER
);
dhcp_option_byte
(
dhcp
,
DHCP_OPTION_BROADCAST
);
dhcp_option_byte
(
dhcp
,
DHCP_OPTION_DNS_SERVER
);
dhcp_option_byte
(
dhcp
,
DHCP_OPTION_NTP
);
dhcp_option_byte
(
dhcp
,
DHCP_OPTION_DOMAIN_NAME
);
dhcp_option_byte
(
dhcp
,
DHCP_OPTION_NB_TINS
);
dhcp_option_byte
(
dhcp
,
DHCP_OPTION_NB_TINT
);
dhcp_option_byte
(
dhcp
,
DHCP_OPTION_NB_TIS
);
dhcp_option_byte
(
dhcp
,
DHCP_OPTION_PRD
);
dhcp_option_byte
(
dhcp
,
DHCP_OPTION_STATIC_ROUTER
);
dhcp_option_byte
(
dhcp
,
DHCP_OPTION_CLASSLESS_STATIC_ROUTER
);
dhcp_option_byte
(
dhcp
,
DHCP_OPTION_VSN
);
dhcp_option_byte
(
dhcp
,
DHCP_OPTION_NB_TINS
);
dhcp_option_byte
(
dhcp
,
DHCP_OPTION_NB_TINT
);
dhcp_option_byte
(
dhcp
,
DHCP_OPTION_NB_TIS
);
dhcp_option_byte
(
dhcp
,
DHCP_OPTION_PRD
);
dhcp_option_byte
(
dhcp
,
DHCP_OPTION_STATIC_ROUTER
);
dhcp_option_byte
(
dhcp
,
DHCP_OPTION_CLASSLESS_STATIC_ROUTER
);
dhcp_option_byte
(
dhcp
,
DHCP_OPTION_VSN
);
dhcp_option_trailer
(
dhcp
);
...
...
@@ -1253,6 +1261,7 @@ dhcp_release(struct netif *netif)
#if LWIP_DHCP_BOOTP_FILE
ip_addr_set_zero
(
&
dhcp
->
offered_si_addr
);
#endif
/* LWIP_DHCP_BOOTP_FILE */
ip_addr_set_zero
(
&
dhcp
->
offered_ntp_addr
);
dhcp
->
offered_t0_lease
=
dhcp
->
offered_t1_renew
=
dhcp
->
offered_t2_rebind
=
0
;
/* create and initialize the DHCP message header */
...
...
@@ -1463,6 +1472,10 @@ again:
LWIP_ASSERT
(
"len >= decode_len"
,
len
>=
decode_len
);
decode_idx
=
DHCP_OPTION_IDX_DNS_SERVER
;
break
;
case
(
DHCP_OPTION_NTP
):
LWIP_ASSERT
(
"len == 4"
,
len
==
4
);
decode_idx
=
DHCP_OPTION_IDX_NTP
;
break
;
case
(
DHCP_OPTION_LEASE_TIME
):
LWIP_ASSERT
(
"len == 4"
,
len
==
4
);
decode_idx
=
DHCP_OPTION_IDX_LEASE_TIME
;
...
...
app/lwip/core/dns.c
View file @
310faf7f
...
...
@@ -177,7 +177,7 @@ struct dns_table_entry {
u8_t
seqno
;
u8_t
err
;
u32_t
ttl
;
char
name
[
DNS_MAX_NAME_LENGTH
]
;
char
*
name
;
ip_addr_t
ipaddr
;
/* pointer to callback on DNS query done */
dns_found_callback
found
;
...
...
@@ -924,11 +924,14 @@ dns_enqueue(const char *name, dns_found_callback found, void *callback_arg)
LWIP_DEBUGF
(
DNS_DEBUG
,
(
"dns_enqueue:
\"
%s
\"
: use DNS entry %"
U16_F
"
\n
"
,
name
,
(
u16_t
)(
i
)));
/* fill the entry */
namelen
=
LWIP_MIN
(
os_strlen
(
name
),
DNS_MAX_NAME_LENGTH
-
1
);
if
((
pEntry
->
name
=
(
char
*
)
mem_realloc
(
pEntry
->
name
,
namelen
+
1
))
==
NULL
)
{
return
ERR_MEM
;
}
pEntry
->
state
=
DNS_STATE_NEW
;
pEntry
->
seqno
=
dns_seqno
++
;
pEntry
->
found
=
found
;
pEntry
->
arg
=
callback_arg
;
namelen
=
LWIP_MIN
(
os_strlen
(
name
),
DNS_MAX_NAME_LENGTH
-
1
);
MEMCPY
(
pEntry
->
name
,
name
,
namelen
);
pEntry
->
name
[
namelen
]
=
0
;
...
...
app/lwip/core/ipv4/Makefile
View file @
310faf7f
...
...
@@ -39,8 +39,6 @@ endif
# Required for each makefile to inherit from the parent
#
INCLUDES
:=
$(INCLUDES)
-I
$(PDIR)
include
INCLUDES
+=
-I
./
PDIR
:=
../
$(PDIR)
sinclude
$(PDIR)Makefile
app/lwip/core/sys_arch.c
View file @
310faf7f
...
...
@@ -2,7 +2,7 @@
* copyright (c) 2010 - 2011 espressif system
*/
#include
"c_types
.h
"
#include
<stdint
.h
>
#include "ets_sys.h"
#include "osapi.h"
#include "os_type.h"
...
...
app/lwip/netif/Makefile
View file @
310faf7f
...
...
@@ -39,8 +39,6 @@ endif
# Required for each makefile to inherit from the parent
#
INCLUDES
:=
$(INCLUDES)
-I
$(PDIR)
include
INCLUDES
+=
-I
./
PDIR
:=
../
$(PDIR)
sinclude
$(PDIR)Makefile
app/mbedtls/Makefile
View file @
310faf7f
...
...
@@ -14,7 +14,9 @@
ifndef
PDIR
UP_EXTRACT_DIR
=
..
GEN_LIBS
=
libmbedtls.a
COMPONENTS_libmbedtls
=
library/liblibrary.a platform/libplatform.a app/libapp.a
COMPONENTS_libmbedtls
=
library/liblibrary.a
\
platform/libplatform.a
\
app/libapp.a
endif
...
...
@@ -26,7 +28,7 @@ endif
# for a subtree within the makefile rooted therein
#
DEFINES
+=
#CCFLAGS += --rename-section .text=.irom0.text --rename-section .literal=.irom0.literal
CONFIGURATION_DEFINES
+=
-DMBEDTLS_USER_CONFIG_FILE
=
\"
user_mbedtls.h
\"
#############################################################
# Recursion Magic - Don't touch this!!
...
...
@@ -40,8 +42,6 @@ DEFINES +=
# Required for each makefile to inherit from the parent
#
INCLUDES
:=
$(INCLUDES)
-I
$(PDIR)
include
INCLUDES
+=
-I
./
PDIR
:=
../
$(PDIR)
sinclude
$(PDIR)Makefile
app/mbedtls/app/Espconn_mem.c
View file @
310faf7f
#include
"c_types
.h
"
#include
<stdint
.h
>
#include "mem.h"
#include "user_interface.h"
...
...
app/mbedtls/app/Makefile
View file @
310faf7f
...
...
@@ -39,8 +39,6 @@ endif
# Required for each makefile to inherit from the parent
#
INCLUDES
:=
$(INCLUDES)
-I
$(PDIR)
include
INCLUDES
+=
-I
./
PDIR
:=
../
$(PDIR)
sinclude
$(PDIR)Makefile
app/mbedtls/app/lwIPFile.c
View file @
310faf7f
...
...
@@ -22,7 +22,7 @@
*
*/
#include
"c_types
.h
"
#include
<stdint
.h
>
#include <stdio.h>
//#include "os.h"
...
...
app/mbedtls/library/Makefile
View file @
310faf7f
...
...
@@ -39,8 +39,6 @@ endif
# Required for each makefile to inherit from the parent
#
INCLUDES
:=
$(INCLUDES)
-I
$(PDIR)
include
INCLUDES
+=
-I
./
PDIR
:=
../
$(PDIR)
sinclude
$(PDIR)Makefile
app/mbedtls/library/asn1write.c
View file @
310faf7f
...
...
@@ -331,14 +331,36 @@ int mbedtls_asn1_write_octet_string( unsigned char **p, unsigned char *start,
return
(
(
int
)
len
);
}
mbedtls_asn1_named_data
*
mbedtls_asn1_store_named_data
(
mbedtls_asn1_named_data
**
head
,
/* This is a copy of the ASN.1 parsing function mbedtls_asn1_find_named_data(),
* which is replicated to avoid a dependency ASN1_WRITE_C on ASN1_PARSE_C. */
static
mbedtls_asn1_named_data
*
asn1_find_named_data
(
mbedtls_asn1_named_data
*
list
,
const
char
*
oid
,
size_t
len
)
{
while
(
list
!=
NULL
)
{
if
(
list
->
oid
.
len
==
len
&&
memcmp
(
list
->
oid
.
p
,
oid
,
len
)
==
0
)
{
break
;
}
list
=
list
->
next
;
}
return
(
list
);
}
mbedtls_asn1_named_data
*
mbedtls_asn1_store_named_data
(
mbedtls_asn1_named_data
**
head
,
const
char
*
oid
,
size_t
oid_len
,
const
unsigned
char
*
val
,
size_t
val_len
)
{
mbedtls_asn1_named_data
*
cur
;
if
(
(
cur
=
mbedtls_
asn1_find_named_data
(
*
head
,
oid
,
oid_len
)
)
==
NULL
)
if
(
(
cur
=
asn1_find_named_data
(
*
head
,
oid
,
oid_len
)
)
==
NULL
)
{
// Add new entry if not present yet based on OID
//
...
...
app/mbedtls/library/bignum.c
View file @
310faf7f
...
...
@@ -500,26 +500,38 @@ cleanup:
}
/*
* Helper to write the digits high-order first
* Helper to write the digits high-order first
.
*/
static
int
mpi_write_hlp
(
mbedtls_mpi
*
X
,
int
radix
,
char
**
p
)
static
int
mpi_write_hlp
(
mbedtls_mpi
*
X
,
int
radix
,
char
**
p
,
const
size_t
buflen
)
{
int
ret
;
mbedtls_mpi_uint
r
;
size_t
length
=
0
;
char
*
p_end
=
*
p
+
buflen
;
if
(
radix
<
2
||
radix
>
16
)
return
(
MBEDTLS_ERR_MPI_BAD_INPUT_DATA
);
do
{
if
(
length
>=
buflen
)
{
return
(
MBEDTLS_ERR_MPI_BUFFER_TOO_SMALL
);
}
MBEDTLS_MPI_CHK
(
mbedtls_mpi_mod_int
(
&
r
,
X
,
radix
)
);
MBEDTLS_MPI_CHK
(
mbedtls_mpi_div_int
(
X
,
NULL
,
X
,
radix
)
);
MBEDTLS_MPI_CHK
(
mbedtls_mpi_mod_int
(
&
r
,
X
,
radix
)
);
MBEDTLS_MPI_CHK
(
mbedtls_mpi_div_int
(
X
,
NULL
,
X
,
radix
)
);
/*
* Write the residue in the current position, as an ASCII character.
*/
if
(
r
<
0xA
)
*
(
--
p_end
)
=
(
char
)(
'0'
+
r
);
else
*
(
--
p_end
)
=
(
char
)(
'A'
+
(
r
-
0xA
)
);
if
(
mbedtls_mpi_cmp_int
(
X
,
0
)
!=
0
)
MBEDTLS_MPI_CHK
(
mpi_write_hlp
(
X
,
radix
,
p
)
);
length
++
;
}
while
(
mbedtls_mpi_cmp_int
(
X
,
0
)
!=
0
);
if
(
r
<
10
)
*
(
*
p
)
++
=
(
char
)(
r
+
0x30
);
else
*
(
*
p
)
++
=
(
char
)(
r
+
0x37
);
memmove
(
*
p
,
p_end
,
length
);
*
p
+=
length
;
cleanup:
...
...
@@ -589,7 +601,7 @@ int mbedtls_mpi_write_string( const mbedtls_mpi *X, int radix,
if
(
T
.
s
==
-
1
)
T
.
s
=
1
;
MBEDTLS_MPI_CHK
(
mpi_write_hlp
(
&
T
,
radix
,
&
p
)
);
MBEDTLS_MPI_CHK
(
mpi_write_hlp
(
&
T
,
radix
,
&
p
,
buflen
)
);
}
*
p
++
=
'\0'
;
...
...
app/mbedtls/library/pkcs12.c
View file @
310faf7f
...
...
@@ -52,6 +52,8 @@ static void mbedtls_zeroize( void *v, size_t n ) {
volatile
unsigned
char
*
p
=
v
;
while
(
n
--
)
*
p
++
=
0
;
}
#if defined(MBEDTLS_ASN1_PARSE_C)
static
int
pkcs12_parse_pbe_params
(
mbedtls_asn1_buf
*
params
,
mbedtls_asn1_buf
*
salt
,
int
*
iterations
)
{
...
...
@@ -230,6 +232,8 @@ exit:
return
(
ret
);
}
#endif
/* MBEDTLS_ASN1_PARSE_C */
static
void
pkcs12_fill_buffer
(
unsigned
char
*
data
,
size_t
data_len
,
const
unsigned
char
*
filler
,
size_t
fill_len
)
{
...
...
app/mbedtls/library/pkcs5.c
View file @
310faf7f
...
...
@@ -54,22 +54,7 @@
#define mbedtls_printf printf
#endif
#if !defined(MBEDTLS_ASN1_PARSE_C)
int
mbedtls_pkcs5_pbes2
(
const
mbedtls_asn1_buf
*
pbe_params
,
int
mode
,
const
unsigned
char
*
pwd
,
size_t
pwdlen
,
const
unsigned
char
*
data
,
size_t
datalen
,
unsigned
char
*
output
)
{
((
void
)
pbe_params
);
((
void
)
mode
);
((
void
)
pwd
);
((
void
)
pwdlen
);
((
void
)
data
);
((
void
)
datalen
);
((
void
)
output
);
return
(
MBEDTLS_ERR_PKCS5_FEATURE_UNAVAILABLE
);
}
#else
#if defined(MBEDTLS_ASN1_PARSE_C)
static
int
pkcs5_parse_pbkdf2_params
(
const
mbedtls_asn1_buf
*
params
,
mbedtls_asn1_buf
*
salt
,
int
*
iterations
,
int
*
keylen
,
mbedtls_md_type_t
*
md_type
)
...
...
app/mbedtls/library/platform.c
View file @
310faf7f
...
...
@@ -25,15 +25,6 @@
#include MBEDTLS_CONFIG_FILE
#endif
// XXX Espressif are hacks sometimes. This is BS, but is taken from
// the mbedtls platform.c from their SDK. Really, this should go
// somewhere else. Note that the prototype here for vPortFree differs (!)
// from the one in sdk-overrides.h. That's above my pay grade.
// --nwf; 2018 Feb 18
extern
void
*
pvPortCalloc
(
unsigned
int
count
,
unsigned
int
size
);
extern
void
vPortFree
(
void
*
pv
);
#if defined(MBEDTLS_PLATFORM_C)
#include "mbedtls/platform.h"
...
...
app/mbedtls/platform/Makefile
View file @
310faf7f
...
...
@@ -39,8 +39,6 @@ endif
# Required for each makefile to inherit from the parent
#
INCLUDES
:=
$(INCLUDES)
-I
$(PDIR)
include
INCLUDES
+=
-I
./
PDIR
:=
../
$(PDIR)
sinclude
$(PDIR)Makefile
Prev
1
…
4
5
6
7
8
9
10
11
12
…
19
Next
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment