فهرست منبع

Merge branch 'feature/lwip_napt_forward' into 'master'

lw-IP: NAT support

Closes WIFI-931

See merge request espressif/esp-idf!7681
David Čermák 5 سال پیش
والد
کامیت
d043674b2b
4فایلهای تغییر یافته به همراه30 افزوده شده و 1 حذف شده
  1. 1 0
      components/lwip/CMakeLists.txt
  2. 14 0
      components/lwip/Kconfig
  3. 1 1
      components/lwip/lwip
  4. 14 0
      components/lwip/port/esp32/include/lwipopts.h

+ 1 - 0
components/lwip/CMakeLists.txt

@@ -46,6 +46,7 @@ set(srcs
     "lwip/src/core/ipv4/icmp.c"
     "lwip/src/core/ipv4/icmp.c"
     "lwip/src/core/ipv4/igmp.c"
     "lwip/src/core/ipv4/igmp.c"
     "lwip/src/core/ipv4/ip4.c"
     "lwip/src/core/ipv4/ip4.c"
+    "lwip/src/core/ipv4/ip4_napt.c"
     "lwip/src/core/ipv4/ip4_addr.c"
     "lwip/src/core/ipv4/ip4_addr.c"
     "lwip/src/core/ipv4/ip4_frag.c"
     "lwip/src/core/ipv4/ip4_frag.c"
     "lwip/src/core/ipv6/dhcp6.c"
     "lwip/src/core/ipv6/dhcp6.c"

+ 14 - 0
components/lwip/Kconfig

@@ -122,6 +122,20 @@ menu "LWIP"
         help
         help
             Enabling this option allows reassemblying incoming fragmented IP packets.
             Enabling this option allows reassemblying incoming fragmented IP packets.
 
 
+    config LWIP_IP_FORWARD
+        bool "Enable IP forwarding"
+        default n
+        help
+            Enabling this option allows packets forwarding across multiple interfaces.
+
+    config LWIP_IPV4_NAPT
+        bool "Enable NAT (new/experimental)"
+        depends on LWIP_IP_FORWARD
+        select LWIP_L2_TO_L3_COPY
+        default n
+        help
+            Enabling this option allows Network Address and Port Translation.
+
     config LWIP_STATS
     config LWIP_STATS
         bool "Enable LWIP statistics"
         bool "Enable LWIP statistics"
         default n
         default n

+ 1 - 1
components/lwip/lwip

@@ -1 +1 @@
-Subproject commit 5c181728c894d8c051070b1cf21c55a6222fc64b
+Subproject commit 754b8d5dcb2a2626d81918b60772c18dee41e54e

+ 14 - 0
components/lwip/port/esp32/include/lwipopts.h

@@ -185,6 +185,20 @@
  */
  */
 #define IP_REASS_MAX_PBUFS              10
 #define IP_REASS_MAX_PBUFS              10
 
 
+/**
+ * IP_FORWARD==1: Enables the ability to forward IP packets across network
+ * interfaces. If you are going to run lwIP on a device with only one network
+ * interface, define this to 0.
+ */
+#define IP_FORWARD                      CONFIG_LWIP_IP_FORWARD
+
+/**
+ * IP_NAPT==1: Enables IPv4 Network Address and Port Translation.
+ * Note that both CONFIG_LWIP_IP_FORWARD and CONFIG_LWIP_L2_TO_L3_COPY options
+ * need to be enabled in system configuration for the NAPT to work on ESP platform
+ */
+#define IP_NAPT                         CONFIG_LWIP_IPV4_NAPT
+
 /*
 /*
    ----------------------------------
    ----------------------------------
    ---------- ICMP options ----------
    ---------- ICMP options ----------