aboutsummaryrefslogtreecommitdiffstats
path: root/sysutils/pfstat/files/patch-pf.c
blob: 92abe2b69e40515b57da61f8c30c890cf3a5bd42 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
--- pf.c.orig   Thu May 11 23:41:07 2006
+++ pf.c    Mon Dec 11 21:08:31 2006
@@ -67,10 +67,8 @@
 
    /* first, find out how many queues there are */
    memset(&pa, 0, sizeof(pa));
-   if (ioctl(fd, DIOCGETALTQS, &pa)) {
-       fprintf(stderr, "ioctl: DIOCGETALTQS: %s\n", strerror(errno));
-       return (1);
-   }
+   if (ioctl(fd, DIOCGETALTQS, &pa))
+       return (0);
    mnr = pa.nr;
 
    /* fetch each of those queues */
@@ -144,23 +142,24 @@
 query_ifaces(int fd, void (*cb)(int, const char *, int, double))
 {
    struct pfioc_iface io;
-   struct pfi_kif ifs[256];
+   struct pfi_if ifs[256];
    int i, j;
 
    memset(&io, 0, sizeof(io));
    io.pfiio_buffer = ifs;
    io.pfiio_esize = sizeof(ifs[0]);
    io.pfiio_size = sizeof(ifs) / sizeof(ifs[0]);
+   io.pfiio_flags = PFI_FLAG_ALLMASK;
    if (ioctl(fd, DIOCIGETIFACES, &io)) {
        fprintf(stderr, "ioctl: DIOCIGETIFACES: %s\n", strerror(errno));
        return (1);
    }
    for (i = 0; i < io.pfiio_size; ++i)
        for (j = 0; j < 16; ++j)
-           (*cb)(COL_TYPE_IFACE, ifs[i].pfik_name,
+           (*cb)(COL_TYPE_IFACE, ifs[i].pfif_name,
                j, j & 4 ?
-               ifs[i].pfik_packets[j&1?0:1][j&2?0:1][j&8?0:1] :
-               ifs[i].pfik_bytes[j&1?0:1][j&2?0:1][j&8?0:1]);
+               ifs[i].pfif_packets[j&1?0:1][j&2?0:1][j&8?0:1] :
+               ifs[i].pfif_bytes[j&1?0:1][j&2?0:1][j&8?0:1]);
    /* bytes/packets[af][dir][op] */
    return (0);
 }