Browse Source

Merge pull request #817 from armink/fix_lwip_tftp

[lwIP] Fix LwIP 2.0.2 tftp
Bernard Xiong 8 years ago
parent
commit
76a79f20d9

+ 0 - 6
components/net/lwip-2.0.2/SConscript

@@ -29,7 +29,6 @@ src/core/udp.c
 src/netif/ethernet.c
 src/netif/ethernetif.c
 src/netif/lowpan6.c
-src/netif/slipif.c
 """)
 
 ipv4_src = Split("""
@@ -76,11 +75,6 @@ if GetDepend(['RT_LWIP_PPP']):
     src += ppp_src
     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)
 
 Return('group')

+ 1 - 1
components/net/lwip-2.0.2/src/apps/tftp/tftp_server.c

@@ -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):
     {
       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 };
       u16_t filename_end_offset;
       u16_t mode_end_offset;

+ 18 - 0
components/net/lwip-2.0.2/src/lwipopts.h

@@ -446,4 +446,22 @@
 #define SO_REUSE                        0
 #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__ */