summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Hartmeier <dhartmei@cvs.openbsd.org>2005-05-27 20:17:32 +0000
committerDaniel Hartmeier <dhartmei@cvs.openbsd.org>2005-05-27 20:17:32 +0000
commitab6b5633b9d5fda932c3ca1b0d710aa8a55e7bbe (patch)
treefdc3dbf27542df4bb5fb798102e8aaa71580bae7
parented094730ab1cdf6f6bf5e1ff29bfe40b67a6a908 (diff)
pass UID_MAX/NO_PID when the socket lookup failed, so tcpdump can
suppress output in this case.
-rw-r--r--sys/net/if_pflog.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/sys/net/if_pflog.c b/sys/net/if_pflog.c
index 158743d8083..d5370c1c7fa 100644
--- a/sys/net/if_pflog.c
+++ b/sys/net/if_pflog.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_pflog.c,v 1.13 2005/05/27 17:22:40 dhartmei Exp $ */
+/* $OpenBSD: if_pflog.c,v 1.14 2005/05/27 20:17:31 dhartmei Exp $ */
/*
* The authors of this code are John Ioannidis (ji@tla.org),
* Angelos D. Keromytis (kermit@csd.uch.gr) and
@@ -39,6 +39,7 @@
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/mbuf.h>
+#include <sys/proc.h>
#include <sys/socket.h>
#include <sys/ioctl.h>
@@ -203,8 +204,13 @@ pflog_packet(struct pfi_kif *kif, struct mbuf *m, sa_family_t af, u_int8_t dir,
}
if (rm->log & PF_LOG_SOCKET_LOOKUP && !pd->lookup.done)
pd->lookup.done = pf_socket_lookup(dir, pd);
- hdr.uid = pd->lookup.uid;
- hdr.pid = pd->lookup.pid;
+ if (pd->lookup.done > 0) {
+ hdr.uid = pd->lookup.uid;
+ hdr.pid = pd->lookup.pid;
+ } else {
+ hdr.uid = UID_MAX;
+ hdr.pid = NO_PID;
+ }
hdr.rule_uid = rm->cuid;
hdr.rule_pid = rm->cpid;
hdr.dir = dir;