summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 9a964d7)
raw | patch | inline | side by side (parent: 9a964d7)
author | Stefan Rinkes <stefan.rinkes@gmail.com> | |
Thu, 14 Apr 2011 20:08:53 +0000 (22:08 +0200) | ||
committer | Stefan Rinkes <stefan.rinkes@gmail.com> | |
Thu, 14 Apr 2011 20:08:53 +0000 (22:08 +0200) |
src/pf.c | patch | blob | history |
diff --git a/src/pf.c b/src/pf.c
index a52bc9e4ac2d8ed4dbc99c5d0783bcc722cf2f15..b4d2a45863a54a12d3d128683bce6b4c5b157897 100644 (file)
--- a/src/pf.c
+++ b/src/pf.c
#define PF_SOCKET "/dev/pf"
struct pfdata {
- int pd_dev;
+ int pd_dev;
};
static struct pfdata pd;
-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);
void
submit_counter(const char *type, const char *inst, counter_t val)
if (ioctl(pd.pd_dev, DIOCGETSTATUS, &status) == -1) {
return (-1);
}
- close(pd.pd_dev);
+
+ close(pd.pd_dev);
if (!status.running)
return (-1);
-
+
return (0);
}
int
pf_read(void)
{
- int i;
- struct pf_status status;
+ int i;
+ struct pf_status status;
- char *cnames[] = PFRES_NAMES;
- char *lnames[] = LCNT_NAMES;
- char *names[] = { "searches", "inserts", "removals" };
+ char *cnames[] = PFRES_NAMES;
+ char *lnames[] = LCNT_NAMES;
+ char *names[] = { "searches", "inserts", "removals" };
if ((pd.pd_dev = open(PF_SOCKET, O_RDWR)) == -1) {
return (-1);
if (ioctl(pd.pd_dev, DIOCGETSTATUS, &status) == -1) {
return (-1);
}
- close(pd.pd_dev);
+
+ close(pd.pd_dev);
for (i = 0; i < PFRES_MAX; i++)
submit_counter("pf_counters", cnames[i], status.counters[i]);
for (i = 0; i < LCNT_MAX; i++)