From owner-freebsd-questions Mon Oct 14 16:17:53 2002 Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 8929737B401 for ; Mon, 14 Oct 2002 16:17:52 -0700 (PDT) Received: from salmon.maths.tcd.ie (salmon.maths.tcd.ie [134.226.81.11]) by mx1.FreeBSD.org (Postfix) with SMTP id 31FA643E9E for ; Mon, 14 Oct 2002 16:17:51 -0700 (PDT) (envelope-from iedowse@maths.tcd.ie) Received: from walton.maths.tcd.ie by salmon.maths.tcd.ie with SMTP id ; 15 Oct 2002 00:17:50 +0100 (BST) To: Christopher Weimann Cc: freebsd-questions@freebsd.org Subject: Re: accept() doesn't pass back sockaddr In-Reply-To: Your message of "Mon, 14 Oct 2002 18:31:58 EDT." <20021014183158.B54055@mail.k12us.com> Date: Tue, 15 Oct 2002 00:17:49 +0100 From: Ian Dowse Message-ID: <200210150017.aa28289@salmon.maths.tcd.ie> Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG 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. Ian To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message