summaryrefslogtreecommitdiff
path: root/sys/net/pf.c
diff options
context:
space:
mode:
authorLawrence Teo <lteo@cvs.openbsd.org>2014-07-10 03:18:00 +0000
committerLawrence Teo <lteo@cvs.openbsd.org>2014-07-10 03:18:00 +0000
commit1ddd2bb9b60e97bb4705f747421ba7f1c11f1b6c (patch)
tree96c32f75a6fe85a6b078fcded781e7dfc2b40a30 /sys/net/pf.c
parentf2aacc7c2d52053d548c057a2c53c168fb490ca0 (diff)
Simplify the way divert(4) sends packets to userspace: Instead of
unnecessarily allocating an mbuf tag to store the divert port, just pass the divert port directly to divert_packet() or divert6_packet() as an argument. includes a style fix pointed out by bluhm@ ok bluhm@ henning@ reyk@
Diffstat (limited to 'sys/net/pf.c')
-rw-r--r--sys/net/pf.c15
1 files changed, 5 insertions, 10 deletions
diff --git a/sys/net/pf.c b/sys/net/pf.c
index e8b5fc24940..162f968dcfa 100644
--- a/sys/net/pf.c
+++ b/sys/net/pf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pf.c,v 1.880 2014/07/02 13:04:50 mikeb Exp $ */
+/* $OpenBSD: pf.c,v 1.881 2014/07/10 03:17:59 lteo Exp $ */
/*
* Copyright (c) 2001 Daniel Hartmeier
@@ -6617,14 +6617,8 @@ done:
}
}
- if (action == PF_PASS && r->divert_packet.port) {
- struct pf_divert *divert;
-
- if ((divert = pf_get_divert(pd.m)))
- divert->port = r->divert_packet.port;
-
+ if (action == PF_PASS && r->divert_packet.port)
action = PF_DIVERT;
- }
if (pd.pflog) {
struct pf_rule_item *ri;
@@ -6651,12 +6645,13 @@ done:
case PF_DIVERT:
switch (pd.af) {
case AF_INET:
- if (divert_packet(pd.m, pd.dir) == 0)
+ if (!divert_packet(pd.m, pd.dir, r->divert_packet.port))
*m0 = NULL;
break;
#ifdef INET6
case AF_INET6:
- if (divert6_packet(pd.m, pd.dir) == 0)
+ if (!divert6_packet(pd.m, pd.dir,
+ r->divert_packet.port))
*m0 = NULL;
break;
#endif /* INET6 */