Merge pull request #817 from armink/fix_lwip_tftp

[lwIP] Fix LwIP 2.0.2 tftp
This commit is contained in:
Bernard Xiong 2017-08-20 11:32:13 +08:00 committed by GitHub
commit 76a79f20d9
3 changed files with 19 additions and 7 deletions

View File

@ -29,7 +29,6 @@ src/core/udp.c
src/netif/ethernet.c src/netif/ethernet.c
src/netif/ethernetif.c src/netif/ethernetif.c
src/netif/lowpan6.c src/netif/lowpan6.c
src/netif/slipif.c
""") """)
ipv4_src = Split(""" ipv4_src = Split("""
@ -76,11 +75,6 @@ if GetDepend(['RT_LWIP_PPP']):
src += ppp_src src += ppp_src
path += [GetCurrentDir() + '/src/netif/ppp'] path += [GetCurrentDir() + '/src/netif/ppp']
# For testing apps
if GetDepend(['RT_USING_NETUTILS']):
src += Glob('./apps/*.c')
stc += Glob('./src/apps/tftp/*.c')
group = DefineGroup('lwIP', src, depend = ['RT_USING_LWIP', 'RT_USING_LWIP202'], CPPPATH = path) group = DefineGroup('lwIP', src, depend = ['RT_USING_LWIP', 'RT_USING_LWIP202'], CPPPATH = path)
Return('group') Return('group')

View File

@ -226,7 +226,7 @@ recv(void *arg, struct udp_pcb *upcb, struct pbuf *p, const ip_addr_t *addr, u16
case PP_HTONS(TFTP_WRQ): case PP_HTONS(TFTP_WRQ):
{ {
const char tftp_null = 0; const char tftp_null = 0;
char filename[TFTP_MAX_FILENAME_LEN] = { 0 }; char filename[TFTP_MAX_FILENAME_LEN + 1] = { 0 };
char mode[TFTP_MAX_MODE_LEN] = { 0 }; char mode[TFTP_MAX_MODE_LEN] = { 0 };
u16_t filename_end_offset; u16_t filename_end_offset;
u16_t mode_end_offset; u16_t mode_end_offset;

View File

@ -446,4 +446,22 @@
#define SO_REUSE 0 #define SO_REUSE 0
#endif #endif
/*
------------------------------------
------- Applications options -------
------------------------------------
*/
/**
* Max. length of TFTP filename
*/
#ifdef RT_LWIP_TFTP_MAX_FILENAME_LEN
#define TFTP_MAX_FILENAME_LEN RT_LWIP_TFTP_MAX_FILENAME_LEN
#elif defined(RT_DFS_ELM_MAX_LFN)
#define TFTP_MAX_FILENAME_LEN RT_DFS_ELM_MAX_LFN
#else
#define TFTP_MAX_FILENAME_LEN 64
#endif
#endif /* __LWIPOPTS_H__ */ #endif /* __LWIPOPTS_H__ */