Просмотр исходного кода

fix: net_lwip2,应该根据lwip版本号来判断是否执行udp_bind_netif,dns查询的udp上下文

Wendal Chen 8 месяцев назад
Родитель
Сommit
de618fde37

+ 2 - 2
components/network/adapter_lwip2/net_lwip2.c

@@ -5,11 +5,11 @@
 #include "luat_rtos.h"
 #include "dns_def.h"
 #include "luat_network_adapter.h"
+#include "lwip/init.h"
 #include "lwip/tcpip.h"
 #include "lwip/udp.h"
 #include "lwip/sockets.h"
 #include "net_lwip2.h"
-
 #include "luat_crypto.h"
 #include "luat_msgbus.h"
 #include "luat_malloc.h"
@@ -110,7 +110,7 @@ void net_lwip2_set_netif(uint8_t adapter_index, struct netif *netif) {
 		prvlwip.dns_udp[adapter_index] = udp_new();
 		prvlwip.dns_udp[adapter_index]->recv = net_lwip2_dns_recv_cb;
 		prvlwip.dns_udp[adapter_index]->recv_arg = adapter_index;
-		#ifdef udp_bind_netif
+		#if LWIP_VERSION_MAJOR == 2 && LWIP_VERSION_MINOR >= 1
 		udp_bind_netif(prvlwip.dns_udp[adapter_index], netif);
 		#endif
 		int tmp = adapter_index;

+ 1 - 1
components/network/netdrv/src/luat_netdrv_whale.c

@@ -19,7 +19,7 @@
 #define LUAT_LOG_TAG "netdrv.whale"
 #include "luat_log.h"
 
-#ifdef LUAt_USE_NETDRV_LWIP_ARP
+#ifdef LUAT_USE_NETDRV_LWIP_ARP
 extern err_t luat_netdrv_netif_input_main(struct pbuf *p, struct netif *inp);
 extern err_t luat_netdrv_etharp_output(struct netif *netif, struct pbuf *q, const ip4_addr_t *ipaddr);
 #else