version 1.9, 2017/06/01 14:38:28 |
version 1.10, 2019/05/09 15:01:09 |
|
|
*/ |
*/ |
|
|
#include <sys/types.h> |
#include <sys/types.h> |
|
#include <sys/sysctl.h> |
#include <sys/ioctl.h> |
#include <sys/ioctl.h> |
#include <sys/socket.h> |
#include <sys/socket.h> |
#include <sys/signal.h> |
#include <sys/signal.h> |
|
|
const char *pf_scounters[FCNT_MAX+1] = FCNT_NAMES; |
const char *pf_scounters[FCNT_MAX+1] = FCNT_NAMES; |
|
|
static struct pf_status status; |
static struct pf_status status; |
extern int pf_dev; |
|
int num_pf = 0; |
int num_pf = 0; |
|
|
field_def fields_pf[] = { |
field_def fields_pf[] = { |
|
|
int |
int |
read_pf(void) |
read_pf(void) |
{ |
{ |
if (pf_dev < 0) { |
size_t size = sizeof(status); |
num_disp = 0; |
int mib[3] = { CTL_KERN, KERN_PFSTATUS }; |
return 0; |
|
} |
|
|
|
if (ioctl(pf_dev, DIOCGETSTATUS, &status)) { |
if (sysctl(mib, 2, &status, &size, NULL, 0) < 0) { |
error("DIOCGETSTATUS: %s", strerror(errno)); |
error("sysctl(PFCTL_STATUS): %s", strerror(errno)); |
return (-1); |
return (-1); |
} |
} |
|
|