diff --git a/CHANGELOG b/CHANGELOG index 60edb330..f39acfa3 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -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 diff --git a/src/core/ipv4/ip.c b/src/core/ipv4/ip.c index 1b990ec8..dd316041 100644 --- a/src/core/ipv4/ip.c +++ b/src/core/ipv4/ip.c @@ -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;