From 08444bc82bbfcf044391fe0bb968001636465963 Mon Sep 17 00:00:00 2001 From: michele <> Date: Sun, 4 Oct 2009 16:08:37 +0000 Subject: [PATCH] Add (again) support for divert sockets. They allow you to: - queue packets from pf(4) to a userspace application - reinject packets from the application into the kernel stack. The divert socket can be bound to a special "divert port" and will receive every packet diverted to that port by pf(4). The pf syntax is pretty simple, e.g.: pass on em0 inet proto tcp from any to any port 80 divert-packet port 1 A lot of discussion have happened since my last commit that resulted in many changes and improvements. I would *really* like to thank everyone who took part in the discussion especially canacar@ who spotted out which are the limitations of this approach. OpenBSD divert(4) is meant to be compatible with software running on top of FreeBSD's divert sockets even though they are pretty different and will become even more with time. discusses with many, but mainly reyk@ canacar@ deraadt@ dlg@ claudio@ beck@ tested by reyk@ and myself ok reyk@ claudio@ beck@ manpage help and ok by jmc@ --- src/etc/protocols | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/etc/protocols b/src/etc/protocols index d522dc53..4458af37 100644 --- a/src/etc/protocols +++ b/src/etc/protocols @@ -1,7 +1,7 @@ # # Internet (IP) protocols # -# $OpenBSD: protocols,v 1.21 2004/05/07 16:27:23 henning Exp $ +# $OpenBSD: protocols,v 1.22 2009/10/04 16:08:37 michele Exp $ # # Updated based on RFC 1340, Assigned Numbers (July 1992). # See also http://www.iana.org/assignments/protocol-numbers @@ -142,3 +142,4 @@ fc 133 FC # Fibre Channel rsvp-e2e-ignore 134 RSVP-E2E-IGNORE pfsync 240 PFSYNC # PF Synchronization reserved 255 Reserved # +divert 258 DIVERT # Divert pseudo-protocol [non IANA]