From: Stefan Rinkes Date: Mon, 25 Apr 2011 16:13:09 +0000 (+0200) Subject: pf plugin: dont reinvent code, use code from pfctl X-Git-Tag: collectd-5.2.0~12^2~10 X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=0d11110149376ebaa100c23b5216309fb726518d;p=collectd.git pf plugin: dont reinvent code, use code from pfctl --- diff --git a/src/pf.c b/src/pf.c index 1c5f3161..3b8e8095 100644 --- a/src/pf.c +++ b/src/pf.c @@ -17,19 +17,20 @@ #include "pfcommon.h" -static int pf_init(void); -static int pf_read(void); -static void submit_counter(const char *, const char *, counter_t); +static int pf_init(void); +static int pf_read(void); +static void submit_counter(const char *, const char *, counter_t); -int pfdev = -1; +char *pf_device = "/dev/pf"; int pf_init(void) { struct pf_status status; + int pfdev = -1; - if ((pfdev = open(PF_SOCKET, O_RDONLY)) == -1) { - warn("unable to open %s", PF_SOCKET); + if ((pfdev = open(pf_device, O_RDONLY)) == -1) { + warn("unable to open %s", pf_device); return (-1); } @@ -49,15 +50,16 @@ pf_init(void) int pf_read(void) { - int i; struct pf_status status; + int pfdev = -1; + int i; char *cnames[] = PFRES_NAMES; char *lnames[] = LCNT_NAMES; char *names[] = { "searches", "inserts", "removals" }; - if ((pfdev = open(PF_SOCKET, O_RDONLY)) == -1) { - warn("unable tot open %s", PF_SOCKET); + if ((pfdev = open(pf_device, O_RDONLY)) == -1) { + warn("unable to open %s", pf_device); return (-1); }