From owner-freebsd-pf@FreeBSD.ORG Mon Nov 7 13:31:21 2005 Return-Path: X-Original-To: freebsd-pf@freebsd.org Delivered-To: freebsd-pf@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 31B4316A41F for ; Mon, 7 Nov 2005 13:31:21 +0000 (GMT) (envelope-from rajkumars@gmail.com) Received: from xproxy.gmail.com (xproxy.gmail.com [66.249.82.196]) by mx1.FreeBSD.org (Postfix) with ESMTP id 1CE7A43D76 for ; Mon, 7 Nov 2005 13:31:10 +0000 (GMT) (envelope-from rajkumars@gmail.com) Received: by xproxy.gmail.com with SMTP id t13so381373wxc for ; Mon, 07 Nov 2005 05:31:10 -0800 (PST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:mime-version:content-type:content-transfer-encoding:content-disposition; b=sAA4eIzFuf1v1029H+YWm3PP0a43P/NQv+I93BufCnBcmSYXi6Ge/i0q8xkc7BVuPst8gJrZTEX5DG0NX2DgPyRn+y7DmBR4f8mrTmI+A7+F7HEcdGWr8XAZBgBpQNtMfu1z3Vih/8ihQG/cK9+E7V8QRUAAatI43XN1EBvnp0k= Received: by 10.70.100.20 with SMTP id x20mr4168804wxb; Mon, 07 Nov 2005 05:02:54 -0800 (PST) Received: by 10.70.116.17 with HTTP; Mon, 7 Nov 2005 05:02:54 -0800 (PST) Message-ID: <64de5c8b0511070502jd164aa2od7bd2a7ee032ace@mail.gmail.com> Date: Mon, 7 Nov 2005 18:32:54 +0530 From: Rajkumar S To: freebsd-pf@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Subject: pf ipctl programming question X-BeenThere: freebsd-pf@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Technical discussion and general questions about packet filter \(pf\)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Nov 2005 13:31:21 -0000 Hi, I am trying to add FreeBSD 6.0 support to snortsam http://www.snortsam.net/ But before hacking in to the actual code I am currently learning to use pf ioctl, and I am facing a problem. I created a small test program to test the ioctl interface, #include #include #include #include #include #include #include #include #include #include #include int main(int argc, char *argv[]) { struct pfioc_rule rule; int pfdev; pfdev =3D open("/dev/pf", O_RDWR); if (pfdev =3D=3D -1) err(1, "open(\"/dev/pf\") failed"); bzero(&rule, sizeof(struct pfioc_rule)); strncpy(rule.rule.ifname, "rl0", IFNAMSIZ); strncpy(rule.anchor, "testanchor", PF_ANCHOR_NAME_SIZE-1); rule.action =3D PF_CHANGE_GET_TICKET; if(ioctl(pfdev, DIOCCHANGERULE, &rule)<0) { printf("Error: DIOCCHANGERULE %s.\n", strerror(errno)); return 255; } This is basically as simple as it could be, and while I run it I get the er= ror: Error: DIOCCHANGERULE Invalid argument. Looking through the google*, I found that the problem is that I did not init the ruleset along with anchor. But from the docs or man pages I could not find out how can I init the ruleset. Can some one point me towads the right direction? with warm regards, raj *: http://62.65.145.30/pf/msg03157.html