提交 7759628d 编写于 作者: L liuxianliang

[modify] #5335, PR

上级 9b80e1be
......@@ -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
*/
......
......@@ -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__ */
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册