ref: a8a642920444ec6689ccfae81a1b1e148f75190e
parent: 9898aafa0c1212b6c4aee99cb6b9f8280e88e5af
author: cinap_lenrek <[email protected]>
date: Tue Jul 10 05:11:19 EDT 2018
devip: make il connect fail quickly when theres no route
--- a/sys/src/9/ip/il.c
+++ b/sys/src/9/ip/il.c
@@ -208,7 +208,7 @@
void ilrcvmsg(Conv*, Block*);
-void ilsendctl(Conv*, Ilhdr*, int, ulong, ulong, int);
+int ilsendctl(Conv*, Ilhdr*, int, ulong, ulong, int);
void ilackq(Ilcb*, Block*);
void ilprocess(Conv*, Ilhdr*, Block*);
void ilpullup(Conv*);
@@ -984,7 +984,7 @@
qunlock(&ic->outo);
}
-void
+int
ilsendctl(Conv *ipc, Ilhdr *inih, int type, ulong id, ulong ack, int ilspec)
{
Ilhdr *ih;
@@ -1043,7 +1043,7 @@
iltype[ih->iltype], nhgetl(ih->ilid), nhgetl(ih->ilack),
nhgets(ih->ilsrc), nhgets(ih->ildst));
- ipoput4(ipc->p->f, bp, 0, ttl, tos, ipc);
+ return ipoput4(ipc->p->f, bp, 0, ttl, tos, ipc);
}
void
@@ -1283,7 +1283,8 @@
case IL_CONNECT:
ic->state = Ilsyncer;
iphtadd(&ipriv->ht, c);
- ilsendctl(c, nil, Ilsync, ic->start, ic->recvd, 0);
+ if(ilsendctl(c, nil, Ilsync, ic->start, ic->recvd, 0) < 0)
+ ilhangup(c, "no route");
break;
}