--- ipv4/ip_orig.c 2016-05-20 18:08:47.000000000 -0700 +++ ipv4/ip.c 2016-05-20 18:09:12.000000000 -0700 @@ -132,16 +132,24 @@ } #endif + struct netif *same_addr = NULL; /* iterate through netifs */ for (netif = netif_list; netif != NULL; netif = netif->next) { /* network mask matches? */ if (netif_is_up(netif)) { + if (ip_addr_cmp(dest, &(netif->ip_addr))) { + same_addr = netif; + continue; + } if (ip_addr_netcmp(dest, &(netif->ip_addr), &(netif->netmask))) { /* return netif on which to forward IP packet */ return netif; } } } + if (same_addr != NULL) { + return same_addr; + } if ((netif_default == NULL) || (!netif_is_up(netif_default))) { LWIP_DEBUGF(IP_DEBUG | LWIP_DBG_LEVEL_SERIOUS, ("ip_route: No route to %"U16_F".%"U16_F".%"U16_F".%"U16_F"\n", ip4_addr1_16(dest), ip4_addr2_16(dest), ip4_addr3_16(dest), ip4_addr4_16(dest)));