diff --git a/mip/mip.c b/mip/mip.c index 872bd0f3..597f13ae 100644 --- a/mip/mip.c +++ b/mip/mip.c @@ -297,6 +297,7 @@ static struct ip *tx_ip(struct mip_if *ifp, uint8_t proto, uint32_t ip_src, if (!mac && ((ip_dst & ifp->mask) == (ifp->ip & ifp->mask))) arp_ask(ifp, ip_dst); // Same net, lookup if (!mac) mac = arp_cache_find(ifp, ifp->gw); // Use gateway MAC + if (!mac) arp_ask(ifp, ifp->gw); // Not found? lookup if (mac) memcpy(eth->dst, mac, sizeof(eth->dst)); // Found? Use it if (!mac) memset(eth->dst, 255, sizeof(eth->dst)); // No? Use broadcast memcpy(eth->src, ifp->mac, sizeof(eth->src)); // TODO(cpq): ARP lookup diff --git a/mongoose.c b/mongoose.c index b436acf5..0cf4b629 100644 --- a/mongoose.c +++ b/mongoose.c @@ -6824,6 +6824,7 @@ static struct ip *tx_ip(struct mip_if *ifp, uint8_t proto, uint32_t ip_src, if (!mac && ((ip_dst & ifp->mask) == (ifp->ip & ifp->mask))) arp_ask(ifp, ip_dst); // Same net, lookup if (!mac) mac = arp_cache_find(ifp, ifp->gw); // Use gateway MAC + if (!mac) arp_ask(ifp, ifp->gw); // Not found? lookup if (mac) memcpy(eth->dst, mac, sizeof(eth->dst)); // Found? Use it if (!mac) memset(eth->dst, 255, sizeof(eth->dst)); // No? Use broadcast memcpy(eth->src, ifp->mac, sizeof(eth->src)); // TODO(cpq): ARP lookup