summaryrefslogtreecommitdiff
path: root/sys/net/pf.c
diff options
context:
space:
mode:
authorHenning Brauer <henning@cvs.openbsd.org>2008-09-09 13:56:40 +0000
committerHenning Brauer <henning@cvs.openbsd.org>2008-09-09 13:56:40 +0000
commiteafa0437596580a038262a0363fdd2115f6f1726 (patch)
tree508e9ede5b29e41966fa0aa869df62cbd54600a3 /sys/net/pf.c
parent456e9ebf40a66cc20f4da77dbd097479607938d9 (diff)
welcome pflow(4), a netflow v5 compatible flow export interface.
flows export data gathered from pf states. initial implementation by Joerg Goltermann <jg@osn.de>, guidance and many changes by me. 'put it in' theo
Diffstat (limited to 'sys/net/pf.c')
-rw-r--r--sys/net/pf.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/sys/net/pf.c b/sys/net/pf.c
index ed0831a698f..61f63b837a3 100644
--- a/sys/net/pf.c
+++ b/sys/net/pf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pf.c,v 1.618 2008/09/03 12:57:19 henning Exp $ */
+/* $OpenBSD: pf.c,v 1.619 2008/09/09 13:56:39 henning Exp $ */
/*
* Copyright (c) 2001 Daniel Hartmeier
@@ -38,6 +38,7 @@
#include "bpfilter.h"
#include "pflog.h"
#include "pfsync.h"
+#include "pflow.h"
#include <sys/param.h>
#include <sys/systm.h>
@@ -78,6 +79,7 @@
#include <dev/rndvar.h>
#include <net/pfvar.h>
#include <net/if_pflog.h>
+#include <net/if_pflow.h>
#if NPFSYNC > 0
#include <net/if_pfsync.h>
@@ -1090,6 +1092,10 @@ pf_unlink_state(struct pf_state *cur)
TH_RST|TH_ACK, 0, 0, 0, 1, cur->tag, NULL, NULL);
}
RB_REMOVE(pf_state_tree_id, &tree_id, cur);
+#if NPFLOW
+ if (cur->state_flags & PFSTATE_PFLOW)
+ export_pflow(cur);
+#endif
#if NPFSYNC
if (cur->creatorid == pf_status.hostid)
pfsync_delete_state(cur);
@@ -3453,6 +3459,8 @@ pf_create_state(struct pf_rule *r, struct pf_rule *nr, struct pf_rule *a,
s->state_flags |= PFSTATE_ALLOWOPTS;
if (r->rule_flag & PFRULE_STATESLOPPY)
s->state_flags |= PFSTATE_SLOPPY;
+ if (r->rule_flag & PFRULE_PFLOW)
+ s->state_flags |= PFSTATE_PFLOW;
s->log = r->log & PF_LOG_ALL;
if (nr != NULL)
s->log |= nr->log & PF_LOG_ALL;