let ip4/6_input_accept return int instead of netif*

This commit is contained in:
goldsimon 2017-03-01 14:16:27 +01:00
parent 18c7c5d81c
commit f978a7ed31
2 changed files with 13 additions and 11 deletions

View File

@ -357,7 +357,7 @@ return_noroute:
#endif /* IP_FORWARD */
/** Return true if the current input packet should be accepted on this netif */
static struct netif*
static int
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",
@ -379,7 +379,7 @@ ip4_input_accept(struct netif *netif)
LWIP_DEBUGF(IP_DEBUG, ("ip4_input: packet accepted on interface %c%c\n",
netif->name[0], netif->name[1]));
/* accept on this netif */
return netif;
return 1;
}
#if LWIP_AUTOIP
/* 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",
netif->name[0], netif->name[1]));
/* accept on this netif */
return netif;
return 1;
}
#endif /* LWIP_AUTOIP */
}
return NULL;
return 0;
}
/**
@ -524,8 +524,9 @@ ip4_input(struct pbuf *p, struct netif *inp)
} else {
/* start trying with inp. if that's not acceptable, start walking the
list of configured netifs. */
netif = ip4_input_accept(inp);
if (netif == NULL) {
if (ip4_input_accept(inp)) {
netif = inp;
} else {
#if !LWIP_NETIF_LOOPBACK || LWIP_HAVE_LOOPIF
/* Packets sent to the loopback address must not be accepted on an
* interface that does not have the loopback address assigned to it,

View File

@ -458,7 +458,7 @@ ip6_forward(struct pbuf *p, struct ip6_hdr *iphdr, struct netif *inp)
#endif /* LWIP_IPV6_FORWARD */
/** Return true if the current input packet should be accepted on this netif */
static struct netif*
static int
ip6_input_accept(struct netif *netif)
{
/* interface is up? */
@ -477,11 +477,11 @@ ip6_input_accept(struct netif *netif)
#endif /* IPV6_CUSTOM_SCOPES */
) {
/* 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 {
/* start trying with inp. if that's not acceptable, start walking the
list of configured netifs. */
netif = ip6_input_accept(inp);
if (netif == NULL) {
if (ip6_input_accept(inp)) {
netif = inp;
} else {
#if !IPV6_CUSTOM_SCOPES
/* Shortcut: stop looking for other interfaces if either the source or
* the destination has a scope constrained to this interface. Custom