mirror of
https://git.savannah.nongnu.org/git/lwip.git
synced 2025-08-03 21:14:40 +08:00
let ip4/6_input_accept return int instead of netif*
This commit is contained in:
parent
18c7c5d81c
commit
f978a7ed31
@ -357,7 +357,7 @@ return_noroute:
|
|||||||
#endif /* IP_FORWARD */
|
#endif /* IP_FORWARD */
|
||||||
|
|
||||||
/** Return true if the current input packet should be accepted on this netif */
|
/** Return true if the current input packet should be accepted on this netif */
|
||||||
static struct netif*
|
static int
|
||||||
ip4_input_accept(struct netif *netif)
|
ip4_input_accept(struct netif *netif)
|
||||||
{
|
{
|
||||||
LWIP_DEBUGF(IP_DEBUG, ("ip_input: iphdr->dest 0x%"X32_F" netif->ip_addr 0x%"X32_F" (0x%"X32_F", 0x%"X32_F", 0x%"X32_F")\n",
|
LWIP_DEBUGF(IP_DEBUG, ("ip_input: iphdr->dest 0x%"X32_F" netif->ip_addr 0x%"X32_F" (0x%"X32_F", 0x%"X32_F", 0x%"X32_F")\n",
|
||||||
@ -379,7 +379,7 @@ ip4_input_accept(struct netif *netif)
|
|||||||
LWIP_DEBUGF(IP_DEBUG, ("ip4_input: packet accepted on interface %c%c\n",
|
LWIP_DEBUGF(IP_DEBUG, ("ip4_input: packet accepted on interface %c%c\n",
|
||||||
netif->name[0], netif->name[1]));
|
netif->name[0], netif->name[1]));
|
||||||
/* accept on this netif */
|
/* accept on this netif */
|
||||||
return netif;
|
return 1;
|
||||||
}
|
}
|
||||||
#if LWIP_AUTOIP
|
#if LWIP_AUTOIP
|
||||||
/* connections to link-local addresses must persist after changing
|
/* connections to link-local addresses must persist after changing
|
||||||
@ -388,11 +388,11 @@ ip4_input_accept(struct netif *netif)
|
|||||||
LWIP_DEBUGF(IP_DEBUG, ("ip4_input: LLA packet accepted on interface %c%c\n",
|
LWIP_DEBUGF(IP_DEBUG, ("ip4_input: LLA packet accepted on interface %c%c\n",
|
||||||
netif->name[0], netif->name[1]));
|
netif->name[0], netif->name[1]));
|
||||||
/* accept on this netif */
|
/* accept on this netif */
|
||||||
return netif;
|
return 1;
|
||||||
}
|
}
|
||||||
#endif /* LWIP_AUTOIP */
|
#endif /* LWIP_AUTOIP */
|
||||||
}
|
}
|
||||||
return NULL;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -524,8 +524,9 @@ ip4_input(struct pbuf *p, struct netif *inp)
|
|||||||
} else {
|
} else {
|
||||||
/* start trying with inp. if that's not acceptable, start walking the
|
/* start trying with inp. if that's not acceptable, start walking the
|
||||||
list of configured netifs. */
|
list of configured netifs. */
|
||||||
netif = ip4_input_accept(inp);
|
if (ip4_input_accept(inp)) {
|
||||||
if (netif == NULL) {
|
netif = inp;
|
||||||
|
} else {
|
||||||
#if !LWIP_NETIF_LOOPBACK || LWIP_HAVE_LOOPIF
|
#if !LWIP_NETIF_LOOPBACK || LWIP_HAVE_LOOPIF
|
||||||
/* Packets sent to the loopback address must not be accepted on an
|
/* Packets sent to the loopback address must not be accepted on an
|
||||||
* interface that does not have the loopback address assigned to it,
|
* interface that does not have the loopback address assigned to it,
|
||||||
|
@ -458,7 +458,7 @@ ip6_forward(struct pbuf *p, struct ip6_hdr *iphdr, struct netif *inp)
|
|||||||
#endif /* LWIP_IPV6_FORWARD */
|
#endif /* LWIP_IPV6_FORWARD */
|
||||||
|
|
||||||
/** Return true if the current input packet should be accepted on this netif */
|
/** Return true if the current input packet should be accepted on this netif */
|
||||||
static struct netif*
|
static int
|
||||||
ip6_input_accept(struct netif *netif)
|
ip6_input_accept(struct netif *netif)
|
||||||
{
|
{
|
||||||
/* interface is up? */
|
/* interface is up? */
|
||||||
@ -477,11 +477,11 @@ ip6_input_accept(struct netif *netif)
|
|||||||
#endif /* IPV6_CUSTOM_SCOPES */
|
#endif /* IPV6_CUSTOM_SCOPES */
|
||||||
) {
|
) {
|
||||||
/* accept on this netif */
|
/* accept on this netif */
|
||||||
return netif;
|
return 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return NULL;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -612,8 +612,9 @@ ip6_input(struct pbuf *p, struct netif *inp)
|
|||||||
} else {
|
} else {
|
||||||
/* start trying with inp. if that's not acceptable, start walking the
|
/* start trying with inp. if that's not acceptable, start walking the
|
||||||
list of configured netifs. */
|
list of configured netifs. */
|
||||||
netif = ip6_input_accept(inp);
|
if (ip6_input_accept(inp)) {
|
||||||
if (netif == NULL) {
|
netif = inp;
|
||||||
|
} else {
|
||||||
#if !IPV6_CUSTOM_SCOPES
|
#if !IPV6_CUSTOM_SCOPES
|
||||||
/* Shortcut: stop looking for other interfaces if either the source or
|
/* Shortcut: stop looking for other interfaces if either the source or
|
||||||
* the destination has a scope constrained to this interface. Custom
|
* the destination has a scope constrained to this interface. Custom
|
||||||
|
Loading…
x
Reference in New Issue
Block a user