]> granicus.if.org Git - esp-idf/commitdiff
fix(lwip): fix tcp connect fail when enable LOOPIF
authorLiu Han <liuhan@espressif.com>
Thu, 27 Apr 2017 10:59:47 +0000 (18:59 +0800)
committerLiu Han <liuhan@espressif.com>
Thu, 27 Apr 2017 10:59:47 +0000 (18:59 +0800)
components/lwip/core/ipv4/ip4.c

index 1d581d4d85197de775d1b5caec084a43165f2533..3877e2060923cd45201d2c612697046ccb76e1ea 100755 (executable)
@@ -147,6 +147,9 @@ ip4_route(const ip4_addr_t *dest)
 {
 #if ESP_LWIP
   struct netif *non_default_netif = NULL;
+#if LWIP_HAVE_LOOPIF
+  struct netif *loop_default_netif = netif_find("lo0");
+#endif
 #endif
   struct netif *netif;
 
@@ -173,7 +176,11 @@ ip4_route(const ip4_addr_t *dest)
       }
 
       if (netif != netif_default){
+#if LWIP_HAVE_LOOPIF
+          non_default_netif = (netif == loop_default_netif) ? NULL : netif;
+#else
           non_default_netif = netif;
+#endif
       }
     }
   }