Use NETIF_FOREACH macro at appropriate places

Use NETIF_FOREACH macro to get some optimizations for LWIP_SINGLE_NETIF case.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: goldsimon <goldsimon@gmx.de>
This commit is contained in:
Axel Lin
2017-11-17 22:19:59 +08:00
committed by goldsimon
parent 8c6884b2db
commit 2ff0ef027e
3 changed files with 9 additions and 9 deletions

View File

@@ -162,7 +162,7 @@ ip4_route(const ip4_addr_t *dest)
#endif /* LWIP_MULTICAST_TX_OPTIONS */
/* iterate through netifs */
for (netif = netif_list; netif != NULL; netif = netif->next) {
NETIF_FOREACH(netif) {
/* 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))) {
/* network mask matches? */
@@ -186,7 +186,7 @@ ip4_route(const ip4_addr_t *dest)
return netif_default;
}
/* default netif is not up, just use any netif for loopback traffic */
for (netif = netif_list; netif != NULL; netif = netif->next) {
NETIF_FOREACH(netif) {
if (netif_is_up(netif)) {
return netif;
}