mirror of
https://github.com/lwip-tcpip/lwip.git
synced 2025-03-15 13:20:57 +00:00
bug #46094: moved IPv4 routing hook functions down so that they implement actual routing (source-based IPv4 routing is not affected by this change)
This commit is contained in:
parent
52b426a343
commit
d2bb569ee4
@ -123,6 +123,7 @@ struct netif *
|
||||
ip4_route_src(const ip4_addr_t *dest, const ip4_addr_t *src)
|
||||
{
|
||||
if (src != NULL) {
|
||||
/* when src==NULL, the hook is called from ip4_route(dest) */
|
||||
struct netif *netif = LWIP_HOOK_IP4_ROUTE_SRC(dest, src);
|
||||
if (netif != NULL) {
|
||||
return netif;
|
||||
@ -146,18 +147,6 @@ ip4_route(const ip4_addr_t *dest)
|
||||
{
|
||||
struct netif *netif;
|
||||
|
||||
#ifdef LWIP_HOOK_IP4_ROUTE_SRC
|
||||
netif = LWIP_HOOK_IP4_ROUTE_SRC(dest, NULL);
|
||||
if (netif != NULL) {
|
||||
return netif;
|
||||
}
|
||||
#elif defined(LWIP_HOOK_IP4_ROUTE)
|
||||
netif = LWIP_HOOK_IP4_ROUTE(dest);
|
||||
if (netif != NULL) {
|
||||
return netif;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if LWIP_MULTICAST_TX_OPTIONS
|
||||
/* Use administratively selected interface for multicast by default */
|
||||
if (ip4_addr_ismulticast(dest) && ip4_default_multicast_netif) {
|
||||
@ -199,6 +188,18 @@ ip4_route(const ip4_addr_t *dest)
|
||||
}
|
||||
#endif /* LWIP_NETIF_LOOPBACK && !LWIP_HAVE_LOOPIF */
|
||||
|
||||
#ifdef LWIP_HOOK_IP4_ROUTE_SRC
|
||||
netif = LWIP_HOOK_IP4_ROUTE_SRC(dest, NULL);
|
||||
if (netif != NULL) {
|
||||
return netif;
|
||||
}
|
||||
#elif defined(LWIP_HOOK_IP4_ROUTE)
|
||||
netif = LWIP_HOOK_IP4_ROUTE(dest);
|
||||
if (netif != NULL) {
|
||||
return netif;
|
||||
}
|
||||
#endif
|
||||
|
||||
if ((netif_default == NULL) || !netif_is_up(netif_default) || !netif_is_link_up(netif_default) ||
|
||||
ip4_addr_isany_val(*netif_ip4_addr(netif_default))) {
|
||||
/* No matching netif found and default netif is not usable.
|
||||
|
Loading…
x
Reference in New Issue
Block a user