summaryrefslogtreecommitdiff
path: root/src/user/app/netstack/tcp.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/user/app/netstack/tcp.c')
-rw-r--r--src/user/app/netstack/tcp.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/user/app/netstack/tcp.c b/src/user/app/netstack/tcp.c
index 2f13a31..dd6d121 100644
--- a/src/user/app/netstack/tcp.c
+++ b/src/user/app/netstack/tcp.c
@@ -120,10 +120,13 @@ struct tcp_conn *tcpc_new(
c->lport = t.src ? t.src : 50002; // TODO randomize source ports
c->rport = t.dst;
if (arpcache_get(c->rip, &c->rmac) < 0) {
- // TODO make arp request, wait for reply
- eprintf("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) {
+ eprintf("neither target nor gateway not in ARP cache, dropping");
+ free(c);
+ return NULL;
+ }
}
c->state = SYN_SENT;