fixed bug #21643 (udp_send/raw_send don't fail if netif is down) by letting ip_route only use netifs that are up.

This commit is contained in:
goldsimon 2007-11-28 06:48:50 +00:00
parent ce7c311ecf
commit f07c1cf874
2 changed files with 11 additions and 4 deletions

View File

@ -499,6 +499,10 @@ HISTORY
++ Bug fixes:
2007-11-27 Simon Goldschmidt
* ip.c: fixed bug #21643 (udp_send/raw_send don't fail if netif is down) by
letting ip_route only use netifs that are up.
2007-11-27 Simon Goldschmidt
* err.h, api_lib.c, api_msg.c, sockets.c: Changed error handling: ERR_MEM, ERR_BUF
and ERR_RTE are seen as non-fatal, all other errors are fatal. netconns and

View File

@ -73,15 +73,18 @@ ip_route(struct ip_addr *dest)
/* iterate through netifs */
for(netif = netif_list; netif != NULL; netif = netif->next) {
/* network mask matches? */
if (ip_addr_netcmp(dest, &(netif->ip_addr), &(netif->netmask))) {
/* return netif on which to forward IP packet */
return netif;
if (netif_is_up(netif)) {
if (ip_addr_netcmp(dest, &(netif->ip_addr), &(netif->netmask))) {
/* return netif on which to forward IP packet */
return netif;
}
}
}
if (netif_default == NULL) {
if ((netif_default == NULL) || (!netif_is_up(netif_default))) {
LWIP_DEBUGF(IP_DEBUG | 2, ("ip_route: No route to 0x%"X32_F"\n", dest->addr));
IP_STATS_INC(ip.rterr);
snmp_inc_ipoutnoroutes();
return NULL;
}
/* no matching netif found, use default netif */
return netif_default;