From owner-freebsd-pf@FreeBSD.ORG Thu Sep 16 04:02:17 2004 Return-Path: Delivered-To: freebsd-pf@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 674) id ED38316A4CF; Thu, 16 Sep 2004 04:02:17 +0000 (GMT) Delivered-To: mlaier@vampire.homelinux.org Received: (qmail 38942 invoked by uid 1005); 24 Feb 2004 02:39:22 -0000 Delivered-To: max@vampire.homelinux.org Received: (qmail 38939 invoked from network); 24 Feb 2004 02:39:22 -0000 Received: from moutng.kundenserver.de (212.227.126.183) by p50839aba.dip.t-dialin.net with SMTP; 24 Feb 2004 02:39:22 -0000 Received: from [212.227.126.148] (helo=mxng05.kundenserver.de) by moutng.kundenserver.de with esmtp (Exim 3.35 #1) id 1AvSPZ-0005op-00 for max@vampire.homelinux.org; Tue, 24 Feb 2004 03:35:05 +0100 Received: from [206.53.239.180] (helo=turing.freelists.org) by mxng05.kundenserver.de with esmtp (Exim 3.35 #1) id 1AvSPZ-0002Jv-00 for max@love2party.net; Tue, 24 Feb 2004 03:35:05 +0100 Received: from turing (localhost [127.0.0.1])ESMTP id 539DB394FAC; Mon, 23 Feb 2004 21:32:32 -0500 (EST) Received: with ECARTIS (v1.0.0; list pf4freebsd); Mon, 23 Feb 2004 21:32:19 -0500 (EST) X-Original-To: pf4freebsd@freelists.org Delivered-To: pf4freebsd@freelists.org Received: from ns.kt-is.co.kr (ns.kt-is.co.kr [211.218.149.125]) ESMTP id 97B0C394F07 for ; Mon, 23 Feb 2004 21:32:16 -0500 (EST) Received: from michelle.kt-is.co.kr (ns2.kt-is.co.kr [220.76.118.193]) (authenticated bits=128) by ns.kt-is.co.kr (8.12.10/8.12.10) with ESMTP id i1O2MNAh001214 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=FAIL) for ; Tue, 24 Feb 2004 11:22:23 +0900 (KST) Received: from michelle.kt-is.co.kr (localhost.kt-is.co.kr [127.0.0.1]) by michelle.kt-is.co.kr (8.12.10/8.12.10) with ESMTP id i1O2Yalp004456 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Tue, 24 Feb 2004 11:34:36 +0900 (KST) (envelope-from yongari@kt-is.co.kr) Received: (from yongari@localhost) by michelle.kt-is.co.kr (8.12.10/8.12.10/Submit) id i1O2YZi7004455 for pf4freebsd@freelists.org; Tue, 24 Feb 2004 11:34:35 +0900 (KST) (envelope-from yongari@kt-is.co.kr) From: Pyun YongHyeon To: pf4freebsd@freelists.org Message-ID: <20040224023435.GB4129@kt-is.co.kr> References: <20040224001503.GA99464@kate.fud.org.nz> <200402240135.55752.max@love2party.net> <20040224012947.GA99698@kate.fud.org.nz> Mime-Version: 1.0 Content-type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20040224012947.GA99698@kate.fud.org.nz> User-Agent: Mutt/1.4.1i X-Filter-Version: 1.11a (ns.kt-is.co.kr) X-archive-position: 284 X-ecartis-version: Ecartis v1.0.0 Sender: pf4freebsd-bounce@freelists.org Errors-To: pf4freebsd-bounce@freelists.org X-original-sender: yongari@kt-is.co.kr Precedence: normal X-list: pf4freebsd Content-Transfer-Encoding: quoted-printable X-Provags-Forward: max@love2party.net -> max@vampire.homelinux.org X-UID: 402 X-Length: 5412 X-Mailman-Approved-At: Thu, 16 Sep 2004 04:05:47 +0000 Subject: [pf4freebsd] Re: pfflowd port X-BeenThere: freebsd-pf@freebsd.org X-Mailman-Version: 2.1.1 Reply-To: pf4freebsd@freelists.org List-Id: Technical discussion and general questions about packet filter (pf) List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Date: Thu, 16 Sep 2004 04:02:18 -0000 X-Original-Date: Tue, 24 Feb 2004 11:34:35 +0900 X-List-Received-Date: Thu, 16 Sep 2004 04:02:18 -0000 On Tue, Feb 24, 2004 at 02:29:47PM +1300, Andrew Thompson wrote: > On Tue, Feb 24, 2004 at 01:35:55AM +0100, Max Laier wrote: > > On Tuesday 24 February 2004 01:15, Andrew Thompson wrote: > > > Hi all, > > > > > > I have created a port for pfflowd and thought i'd get feedback bef= ore > > > submitting a PR. > > > > > > It can be found @ > > > > > > http://www.fud.org.nz/pfflowd-port.tar.gz > >=20 > > Okay, some feedback: > > 1) You copied from security/pf (which is okay), but you should updat= e the=20 > > pkg-descr. >=20 > oops, my bad. >=20 > > 2) pkg-plist is empty, but should contain: > > sbin/pfflowd > > etc/rc.d/pfflowd.sh.sample >=20 > oops again :) >=20 > > 3) Not sure what the patch for pfflowd.c should do. What is wrong wi= th the=20 > > check for invalid ports? >=20 > It generated a gcc warning, as addr->sin_port is a uint16_t which cant > be negative or >65536. -Werror made this fatal. >=20 How about this? parse_hostport(const char *s, struct sockaddr_in *addr) { char *host, *port; +#if defined(__FreeBSD__) + int val; +#endif =20 if ((host =3D strdup(s)) =3D=3D NULL) { fprintf(stderr, "Out of memory\n"); @@ -197,12 +204,22 @@ } *(port - 1) =3D '\0'; addr->sin_family =3D AF_INET; +#if defined(__FreeBSD__) + val =3D atoi(port); + if (val <=3D 0 || val >=3D 65536) { + fprintf(stderr, "Invalid -n port.\n"); + usage(); + exit(1); + } + addr->sin_port =3D (in_port_t)val; +#else addr->sin_port =3D atoi(port); if (addr->sin_port <=3D 0 || addr->sin_port >=3D 65536) { fprintf(stderr, "Invalid -n port.\n"); usage(); exit(1); } +#endif addr->sin_port =3D htons(addr->sin_port); if (inet_aton(host, &addr->sin_addr) =3D=3D 0) { fprintf(stderr, "Invalid -n host.\n"); Memeber sin_port is 'u_int16_t' type. So checking with <=3D0 or >=3D 65536 does not work at all. > > 4) Maybe get the pidfile.{c,h} from us (include/support/) and add th= em=20 > > instead of just removing and pidfile support. >=20 > Thanks, I wasnt sure where pidfile() came from. >=20 >=20 > Andy >=20 Regards, Pyun YongHyeon --=20 Pyun YongHyeon