Skip to content

Commit 0b2712f

Browse files
authored
Merge pull request cesanta#1911 from cesanta/gwarp
Ask for gw mac when needed and not known
2 parents 69f1acd + d364d50 commit 0b2712f

File tree

2 files changed

+2
-0
lines changed

2 files changed

+2
-0
lines changed

mip/mip.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -297,6 +297,7 @@ static struct ip *tx_ip(struct mip_if *ifp, uint8_t proto, uint32_t ip_src,
297297
if (!mac && ((ip_dst & ifp->mask) == (ifp->ip & ifp->mask)))
298298
arp_ask(ifp, ip_dst); // Same net, lookup
299299
if (!mac) mac = arp_cache_find(ifp, ifp->gw); // Use gateway MAC
300+
if (!mac) arp_ask(ifp, ifp->gw); // Not found? lookup
300301
if (mac) memcpy(eth->dst, mac, sizeof(eth->dst)); // Found? Use it
301302
if (!mac) memset(eth->dst, 255, sizeof(eth->dst)); // No? Use broadcast
302303
memcpy(eth->src, ifp->mac, sizeof(eth->src)); // TODO(cpq): ARP lookup

mongoose.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6823,6 +6823,7 @@ static struct ip *tx_ip(struct mip_if *ifp, uint8_t proto, uint32_t ip_src,
68236823
if (!mac && ((ip_dst & ifp->mask) == (ifp->ip & ifp->mask)))
68246824
arp_ask(ifp, ip_dst); // Same net, lookup
68256825
if (!mac) mac = arp_cache_find(ifp, ifp->gw); // Use gateway MAC
6826+
if (!mac) arp_ask(ifp, ifp->gw); // Not found? lookup
68266827
if (mac) memcpy(eth->dst, mac, sizeof(eth->dst)); // Found? Use it
68276828
if (!mac) memset(eth->dst, 255, sizeof(eth->dst)); // No? Use broadcast
68286829
memcpy(eth->src, ifp->mac, sizeof(eth->src)); // TODO(cpq): ARP lookup

0 commit comments

Comments
 (0)