summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorliuxianliang <[email protected]>2021-12-22 14:27:50 +0800
committerliuxianliang <[email protected]>2021-12-22 14:27:50 +0800
commit7759628db7c8737587f5c4f4a05c8114748d3be8 (patch)
tree4cb142529d5fac52456fed6e27e61c8404bd95f8
parent9b80e1be25cf5bb2e54d3316c80e0baffc87cf4b (diff)
[modify] #5335, PR
-rw-r--r--components/net/lwip-2.1.2/src/arch/sys_arch.c28
-rw-r--r--components/net/lwip-2.1.2/src/lwipopts.h8
2 files changed, 31 insertions, 5 deletions
diff --git a/components/net/lwip-2.1.2/src/arch/sys_arch.c b/components/net/lwip-2.1.2/src/arch/sys_arch.c
index c97609a4ea..a7d3f98968 100644
--- a/components/net/lwip-2.1.2/src/arch/sys_arch.c
+++ b/components/net/lwip-2.1.2/src/arch/sys_arch.c
@@ -360,7 +360,7 @@ err_t sys_mutex_new(sys_mutex_t *mutex)
rt_snprintf(tname, RT_NAME_MAX, "%s%d", SYS_LWIP_MUTEX_NAME, counter);
counter ++;
- tmpmutex = rt_mutex_create(tname, RT_IPC_FLAG_FIFO);
+ tmpmutex = rt_mutex_create(tname, RT_IPC_FLAG_PRIO);
if (tmpmutex == RT_NULL)
return ERR_MEM;
else
@@ -779,6 +779,32 @@ void ppp_trace(int level, const char *format, ...)
}
#endif
+#ifdef LWIP_HOOK_IP4_ROUTE_SRC
+struct netif *lwip_ip4_route_src(const ip4_addr_t *dest, const ip4_addr_t *src)
+{
+ struct netif *netif;
+
+ /* iterate through netifs */
+ for (netif = netif_list; netif != NULL; netif = netif->next)
+ {
+ /* is the netif up, does it have a link and a valid address? */
+ if (netif_is_up(netif) && netif_is_link_up(netif) && !ip4_addr_isany_val(*netif_ip4_addr(netif)))
+ {
+ /* gateway matches on a non broadcast interface? (i.e. peer in a point to point interface) */
+ if (src != NULL)
+ {
+ if (ip4_addr_cmp(src, netif_ip4_addr(netif)))
+ {
+ return netif;
+ }
+ }
+ }
+ }
+ netif = netif_default;
+ return netif;
+}
+#endif /* LWIP_HOOK_IP4_ROUTE_SRC */
+
/*
* export bsd socket symbol for RT-Thread Application Module
*/
diff --git a/components/net/lwip-2.1.2/src/lwipopts.h b/components/net/lwip-2.1.2/src/lwipopts.h
index 81409a9d0a..f5eb177d5d 100644
--- a/components/net/lwip-2.1.2/src/lwipopts.h
+++ b/components/net/lwip-2.1.2/src/lwipopts.h
@@ -47,10 +47,6 @@
#define LWIP_PLATFORM_BYTESWAP 0
-#ifndef BYTE_ORDER
-#define BYTE_ORDER LITTLE_ENDIAN
-#endif
-
/* #define RT_LWIP_DEBUG */
#ifdef RT_LWIP_DEBUG
@@ -648,4 +644,8 @@
#endif
+#define LWIP_HOOK_IP4_ROUTE_SRC(dest, src) lwip_ip4_route_src(dest, src)
+#include "lwip/ip_addr.h"
+struct netif *lwip_ip4_route_src(const ip4_addr_t *dest, const ip4_addr_t *src);
+
#endif /* __LWIPOPTS_H__ */