summaryrefslogtreecommitdiff
path: root/sys/src/9/ip/tcp.c
diff options
context:
space:
mode:
authorcinap_lenrek <cinap_lenrek@felloff.net>2018-04-08 21:15:00 +0200
committercinap_lenrek <cinap_lenrek@felloff.net>2018-04-08 21:15:00 +0200
commitc2dd9b1da7659c9ac42e7612e5621e9426956c73 (patch)
tree8c191ea02792997669a87965419aac936243104f /sys/src/9/ip/tcp.c
parentdc8432d4593c7a4b0a187d0174d4e4e603e456f6 (diff)
devip: implement source specific routing
Diffstat (limited to 'sys/src/9/ip/tcp.c')
-rw-r--r--sys/src/9/ip/tcp.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/sys/src/9/ip/tcp.c b/sys/src/9/ip/tcp.c
index f241a5c8e..95c03be1e 100644
--- a/sys/src/9/ip/tcp.c
+++ b/sys/src/9/ip/tcp.c
@@ -864,8 +864,7 @@ tcpmtu(Route *r, int version, uint *scale)
* otherwise, we use the default MSS which assumes a
* safe minimum MTU of 1280 bytes for V6.
*/
- if(r != nil){
- ifc = r->ifc;
+ if(r != nil && (ifc = r->ifc) != nil){
mtu = ifc->maxtu - ifc->m->hsize;
if(version == V4)
return mtu - (TCP4_PKT + TCP4_HDRSIZE);
@@ -1314,7 +1313,7 @@ tcpsndsyn(Conv *s, Tcpctl *tcb)
tcb->sndsyntime = NOW;
/* set desired mss and scale */
- tcb->mss = tcpmtu(v6lookup(s->p->f, s->raddr, s), s->ipversion, &tcb->scale);
+ tcb->mss = tcpmtu(v6lookup(s->p->f, s->raddr, s->laddr, s), s->ipversion, &tcb->scale);
tpriv = s->p->priv;
tpriv->stats[Mss] = tcb->mss;
}
@@ -1492,7 +1491,7 @@ sndsynack(Proto *tcp, Limbo *lp)
seg.ack = lp->irs+1;
seg.flags = SYN|ACK;
seg.urg = 0;
- seg.mss = tcpmtu(v6lookup(tcp->f, lp->raddr, nil), lp->version, &scale);
+ seg.mss = tcpmtu(v6lookup(tcp->f, lp->raddr, lp->laddr, nil), lp->version, &scale);
seg.wnd = QMAX;
/* if the other side set scale, we should too */
@@ -1768,7 +1767,7 @@ tcpincoming(Conv *s, Tcp *segp, uchar *src, uchar *dst, uchar version)
tcb->flags |= SYNACK;
/* set desired mss and scale */
- tcb->mss = tcpmtu(v6lookup(s->p->f, src, s), version, &tcb->scale);
+ tcb->mss = tcpmtu(v6lookup(s->p->f, src, dst, s), version, &tcb->scale);
/* our sending max segment size cannot be bigger than what he asked for */
if(lp->mss != 0 && lp->mss < tcb->mss)