Date: Mon, 14 Oct 2002 20:50:08 -0400 From: Christopher Weimann <cweimann@k12hq.com> To: Ian Dowse <iedowse@maths.tcd.ie> Cc: freebsd-questions@freebsd.org Subject: Re: accept() doesn't pass back sockaddr Message-ID: <20021014205008.A1893@mail.k12us.com> In-Reply-To: <200210150017.aa28289@salmon.maths.tcd.ie>; from iedowse@maths.tcd.ie on Tue, Oct 15, 2002 at 12:17:49AM %2B0100 References: <20021014183158.B54055@mail.k12us.com> <200210150017.aa28289@salmon.maths.tcd.ie>
next in thread | previous in thread | raw e-mail | index | archive | help
On Tue 10/15/2002-12:17:49AM +0100, Ian Dowse wrote: > > In message <20021014183158.B54055@mail.k12us.com>, Christopher Weimann writes: > >I am using on a web filter ( dansguardian.org ) and am having > >problems on FreeBSD (4.5-STABLE). The filter runs fine for > >about 20 minutes or so then can't seem to come up with the > >right ip addresses for any client machines. > > > >After much reading of man pages, Stevens, and some banging > >of my head against the desk I decided that maybe it wasn't > >me :) I found a PR that I think seems to relate (misc/34307) > >but this still confuses me. I would think that if the > >situation this PR describes were to be the case all sorts > >of things wouldn't be working right. > > Is the code in question correctly initialising the variable that > the `addrlen' parameter points to before calling accept? It looks > as if this might be the problem in the PR you mention. I mean that > the code should look like > > sin_len = sizeof(sin); > s = accept(servsock, (struct sockaddr *)&sin, &sin_len); > > where `sin_len' is reset to the correct length before calling > accept() each time. I think sin_len may be reset to 0 when an error > occurs, but otherwise you would get away with not resetting it. > I think you have it. I checked and the code in question has the same problem as the PR code, sin_len is not being reset to the proper value before each call to accept(). I will put this change in and sometime tommorow ( once the box gets some traffic ) I will know if this has fixed it. I'm betting it will. Thank you! To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20021014205008.A1893>