fixed bug #39514 ip_route() may return an IPv6-only interface

This commit is contained in:
Simon Goldschmidt 2014-02-25 22:37:52 +01:00
parent e9908048ec
commit f36d6b7ef5
2 changed files with 9 additions and 1 deletions

View File

@ -96,6 +96,9 @@ HISTORY
++ Bugfixes:
2014-02-25: Simon Goldschmidt
ip4.c: fixed bug #39514 ip_route() may return an IPv6-only interface
2014-02-25: Simon Goldschmidt, patch by Fatih Asici
* pbuf.c: fixed bug #39356 Wrong increment in pbuf_memfind()

View File

@ -123,7 +123,12 @@ ip_route(ip_addr_t *dest)
/* iterate through netifs */
for (netif = netif_list; netif != NULL; netif = netif->next) {
/* network mask matches? */
if (netif_is_up(netif)) {
if ((netif_is_up(netif))
#if LWIP_IPV6
/* prevent using IPv6-only interfaces */
&& (!ip_addr_isany(&(netif->ip_addr)))
#endif /* LWIP_IPV6 */
) {
if (ip_addr_netcmp(dest, &(netif->ip_addr), &(netif->netmask))) {
/* return netif on which to forward IP packet */
return netif;