mirror of
https://git.savannah.nongnu.org/git/lwip.git
synced 2026-08-13 19:13:37 +08:00
Added LWIP_SINGLE_NETIF for small targets with only one netif (see task #13515, there might be more optimizations to come with this option)
This commit is contained in:
@@ -85,6 +85,10 @@
|
||||
struct netif *
|
||||
ip6_route(const ip6_addr_t *src, const ip6_addr_t *dest)
|
||||
{
|
||||
#if LWIP_SINGLE_NETIF
|
||||
LWIP_UNUSED_ARG(src);
|
||||
LWIP_UNUSED_ARG(dest);
|
||||
#else /* LWIP_SINGLE_NETIF */
|
||||
struct netif *netif;
|
||||
s8_t i;
|
||||
|
||||
@@ -239,6 +243,7 @@ ip6_route(const ip6_addr_t *src, const ip6_addr_t *dest)
|
||||
return NULL;
|
||||
}
|
||||
#endif /* LWIP_NETIF_LOOPBACK && !LWIP_HAVE_LOOPIF */
|
||||
#endif /* !LWIP_SINGLE_NETIF */
|
||||
|
||||
/* no matching netif found, use default netif, if up */
|
||||
if ((netif_default == NULL) || !netif_is_up(netif_default) || !netif_is_link_up(netif_default)) {
|
||||
@@ -636,7 +641,8 @@ ip6_input(struct pbuf *p, struct netif *inp)
|
||||
goto netif_found;
|
||||
}
|
||||
#endif /* !LWIP_NETIF_LOOPBACK || LWIP_HAVE_LOOPIF */
|
||||
for (netif = netif_list; netif != NULL; netif = netif->next) {
|
||||
#if ! LWIP_SINGLE_NETIF
|
||||
NETIF_FOREACH(netif) {
|
||||
if (netif == inp) {
|
||||
/* we checked that before already */
|
||||
continue;
|
||||
@@ -645,6 +651,7 @@ ip6_input(struct pbuf *p, struct netif *inp)
|
||||
break;
|
||||
}
|
||||
}
|
||||
#endif /* !LWIP_SINGLE_NETIF */
|
||||
}
|
||||
netif_found:
|
||||
LWIP_DEBUGF(IP6_DEBUG, ("ip6_input: packet accepted on interface %c%c\n",
|
||||
|
||||
@@ -313,8 +313,7 @@ mld6_joingroup(const ip6_addr_t *srcaddr, const ip6_addr_t *groupaddr)
|
||||
struct netif *netif;
|
||||
|
||||
/* loop through netif's */
|
||||
netif = netif_list;
|
||||
while (netif != NULL) {
|
||||
NETIF_FOREACH(netif) {
|
||||
/* Should we join this interface ? */
|
||||
if (ip6_addr_isany(srcaddr) ||
|
||||
netif_get_ip6_addr_match(netif, srcaddr) >= 0) {
|
||||
@@ -323,9 +322,6 @@ mld6_joingroup(const ip6_addr_t *srcaddr, const ip6_addr_t *groupaddr)
|
||||
return err;
|
||||
}
|
||||
}
|
||||
|
||||
/* proceed to next network interface */
|
||||
netif = netif->next;
|
||||
}
|
||||
|
||||
return err;
|
||||
@@ -402,8 +398,7 @@ mld6_leavegroup(const ip6_addr_t *srcaddr, const ip6_addr_t *groupaddr)
|
||||
struct netif *netif;
|
||||
|
||||
/* loop through netif's */
|
||||
netif = netif_list;
|
||||
while (netif != NULL) {
|
||||
NETIF_FOREACH(netif) {
|
||||
/* Should we leave this interface ? */
|
||||
if (ip6_addr_isany(srcaddr) ||
|
||||
netif_get_ip6_addr_match(netif, srcaddr) >= 0) {
|
||||
@@ -413,8 +408,6 @@ mld6_leavegroup(const ip6_addr_t *srcaddr, const ip6_addr_t *groupaddr)
|
||||
err = res;
|
||||
}
|
||||
}
|
||||
/* proceed to next network interface */
|
||||
netif = netif->next;
|
||||
}
|
||||
|
||||
return err;
|
||||
@@ -489,9 +482,9 @@ mld6_leavegroup_netif(struct netif *netif, const ip6_addr_t *groupaddr)
|
||||
void
|
||||
mld6_tmr(void)
|
||||
{
|
||||
struct netif *netif = netif_list;
|
||||
struct netif *netif;
|
||||
|
||||
while (netif != NULL) {
|
||||
NETIF_FOREACH(netif) {
|
||||
struct mld_group *group = netif_mld6_data(netif);
|
||||
|
||||
while (group != NULL) {
|
||||
@@ -508,7 +501,6 @@ mld6_tmr(void)
|
||||
}
|
||||
group = group->next;
|
||||
}
|
||||
netif = netif->next;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1042,7 +1042,7 @@ nd6_tmr(void)
|
||||
}
|
||||
|
||||
/* Process our own addresses, updating address lifetimes and/or DAD state. */
|
||||
for (netif = netif_list; netif != NULL; netif = netif->next) {
|
||||
NETIF_FOREACH(netif) {
|
||||
for (i = 0; i < LWIP_IPV6_NUM_ADDRESSES; ++i) {
|
||||
u8_t addr_state;
|
||||
#if LWIP_IPV6_ADDRESS_LIFETIMES
|
||||
@@ -1121,7 +1121,7 @@ nd6_tmr(void)
|
||||
|
||||
#if LWIP_IPV6_SEND_ROUTER_SOLICIT
|
||||
/* Send router solicitation messages, if necessary. */
|
||||
for (netif = netif_list; netif != NULL; netif = netif->next) {
|
||||
NETIF_FOREACH(netif) {
|
||||
if ((netif->rs_count > 0) && netif_is_up(netif) &&
|
||||
netif_is_link_up(netif) &&
|
||||
!ip6_addr_isinvalid(netif_ip6_addr_state(netif, 0)) &&
|
||||
|
||||
Reference in New Issue
Block a user