Current-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: pflogd lwp



On Mon, Jul 13, 2009 at 03:29:38PM +0100, Chavdar Ivanov wrote:
> 2009/7/13 Patrick Welche <prlw1%cam.ac.uk@localhost>:
> > On Mon, Jul 13, 2009 at 02:13:33PM +0100, Chavdar Ivanov wrote:
> >> I was just about to post the same... pf seems to work for what I was
> >> able to test in five minutes, though.
> >
> > I just read something about ioctl so kernel/userland mismatch - but both
> > came from the same cvs update...
> 
> Likewise.

Does this untested patch work for you?

Cheers,

Patrick
Index: pflogd.c
===================================================================
RCS file: /cvsroot/src/dist/pf/sbin/pflogd/pflogd.c,v
retrieving revision 1.5
diff -u -r1.5 pflogd.c
--- pflogd.c    18 Jun 2008 09:06:26 -0000      1.5
+++ pflogd.c    13 Jul 2009 23:29:09 -0000
@@ -204,17 +204,15 @@
 if_exists(char *ifname)
 {
        int s;
-       struct ifreq ifr;
-       struct if_data ifrdat;
+       struct ifdatareq ifdr;
 
        if ((s = socket(AF_INET, SOCK_DGRAM, 0)) == -1)
                err(1, "socket");
-       bzero(&ifr, sizeof(ifr));
-       if (strlcpy(ifr.ifr_name, ifname, sizeof(ifr.ifr_name)) >=
-               sizeof(ifr.ifr_name))
-                       errx(1, "main ifr_name: strlcpy");
-       ifr.ifr_data = (caddr_t)&ifrdat;
-       if (ioctl(s, SIOCGIFDATA, (caddr_t)&ifr) == -1)
+       bzero(&ifdr, sizeof(ifdr));
+       if (strlcpy(ifdr.ifdr_name, ifname, sizeof(ifdr.ifdr_name)) >=
+               sizeof(ifdr.ifdr_name))
+                       errx(1, "main ifdr_name: strlcpy");
+       if (ioctl(s, SIOCGIFDATA, &ifdr) == -1)
                return (0);
        if (close(s))
                err(1, "close");


Home | Main Index | Thread Index | Old Index