diff options
Diffstat (limited to 'src/cmd/netstack/udp.c')
-rw-r--r-- | src/cmd/netstack/udp.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/src/cmd/netstack/udp.c b/src/cmd/netstack/udp.c index 285af41..3b53b47 100644 --- a/src/cmd/netstack/udp.c +++ b/src/cmd/netstack/udp.c @@ -55,10 +55,13 @@ struct udp_conn *udpc_new( c->lport = u.src ? u.src : 50000; // TODO randomize source ports c->rport = u.dst; if (arpcache_get(c->rip, &c->rmac) < 0) { - // TODO make arp request, wait for reply - warnx("IP not in ARP cache, unimplemented"); - free(c); - return NULL; + // TODO wait for ARP reply + arp_request(c->rip); + if (arpcache_get(state.gateway, &c->rmac) < 0) { + warnx("neither target nor gateway not in ARP cache, dropping"); + free(c); + return NULL; + } } c->on_recv = on_recv; c->carg = carg; |