From 829a451c2b866d502306bd0b8cbb1991a55faa45 Mon Sep 17 00:00:00 2001 From: cinap_lenrek Date: Tue, 10 Apr 2018 20:02:03 +0200 Subject: devip: properly initialize the connection ignoreadvice and tos flags --- sys/src/9/ip/devip.c | 10 ++++++---- sys/src/9/ip/ip.h | 2 +- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/sys/src/9/ip/devip.c b/sys/src/9/ip/devip.c index 6a08a0491..447c1ce68 100644 --- a/sys/src/9/ip/devip.c +++ b/sys/src/9/ip/devip.c @@ -549,7 +549,7 @@ closeconv(Conv *cv) } /* close all incoming calls since no listen will ever happen */ - for(nc = cv->incall; nc; nc = cv->incall){ + for(nc = cv->incall; nc != nil; nc = cv->incall){ cv->incall = nc->next; closeconv(nc); } @@ -561,9 +561,9 @@ closeconv(Conv *cv) while((mp = cv->multi) != nil) ipifcremmulti(cv, mp->ma, mp->ia); - cv->r = nil; - cv->rgen = 0; - cv->p->close(cv); + if(cv->p->close != nil) + (*cv->p->close)(cv); + cv->state = Idle; qunlock(cv); } @@ -1318,7 +1318,9 @@ retry: c->lport = 0; c->rport = 0; c->restricted = 0; + c->ignoreadvice = 0; c->ttl = MAXTTL; + c->tos = 0; qreopen(c->rq); qreopen(c->wq); qreopen(c->eq); diff --git a/sys/src/9/ip/ip.h b/sys/src/9/ip/ip.h index b7991ebe0..92ed960f1 100644 --- a/sys/src/9/ip/ip.h +++ b/sys/src/9/ip/ip.h @@ -181,9 +181,9 @@ struct Conv Proto* p; int restricted; /* remote port is restricted */ + int ignoreadvice; /* don't terminate connection on icmp errors */ uint ttl; /* max time to live */ uint tos; /* type of service */ - int ignoreadvice; /* don't terminate connection on icmp errors */ uchar ipversion; uchar laddr[IPaddrlen]; /* local IP address */ -- cgit v1.2.3