diff options
author | oleg <oleg@FreeBSD.org> | 2006-05-24 13:09:55 +0000 |
---|---|---|
committer | oleg <oleg@FreeBSD.org> | 2006-05-24 13:09:55 +0000 |
commit | 499297c74cc00692bc00ddab18c1e67dcbfaf0a9 (patch) | |
tree | adaee99342bafc97133da0f20bc5246de5eb3ec8 /sbin/ipfw/ipfw.8 | |
parent | 8ba778a258996098a6ddb344d5b39d907258b460 (diff) | |
download | FreeBSD-src-499297c74cc00692bc00ddab18c1e67dcbfaf0a9.zip FreeBSD-src-499297c74cc00692bc00ddab18c1e67dcbfaf0a9.tar.gz |
Implement internal (i.e. inside kernel) packet tagging using mbuf_tags(9).
Since tags are kept while packet resides in kernelspace, it's possible to
use other kernel facilities (like netgraph nodes) for altering those tags.
Submitted by: Andrey Elsukov <bu7cher at yandex dot ru>
Submitted by: Vadim Goncharov <vadimnuclight at tpu dot ru>
Approved by: glebius (mentor)
Idea from: OpenBSD PF
MFC after: 1 month
Diffstat (limited to 'sbin/ipfw/ipfw.8')
-rw-r--r-- | sbin/ipfw/ipfw.8 | 62 |
1 files changed, 61 insertions, 1 deletions
diff --git a/sbin/ipfw/ipfw.8 b/sbin/ipfw/ipfw.8 index 6dd3b6d..2011dd2 100644 --- a/sbin/ipfw/ipfw.8 +++ b/sbin/ipfw/ipfw.8 @@ -1,7 +1,7 @@ .\" .\" $FreeBSD$ .\" -.Dd May 12, 2006 +.Dd May 24, 2006 .Dt IPFW 8 .Os .Sh NAME @@ -420,6 +420,10 @@ rules is the following: .Ar action .Op Cm log Op Cm logamount Ar number .Op Cm altq Ar queue +.Oo +.Bro Cm tag | untag +.Brc Ar number +.Oc .Ar body .Ek .Ed @@ -552,6 +556,53 @@ command. Note: logging is done after all other packet matching conditions have been successfully verified, and before performing the final action (accept, deny, etc.) on the packet. +.It Cm tag Ar number +When a packet matches a rule with the +.Cm tag +keyword, the numeric tag for the given +.Ar number +in the range 0..65535 will be attached to the packet. +The tag acts as an internal marker (it is not sent out over +the wire) that can be used to identify these packets later on. +This can be used, for example, to provide trust between interfaces +and to start doing policy-based filtering. +A packet can have mutiple tags at the same time. +Tags are "sticky", meaning once a tag is applied to a packet by a +matching rule it exists until explicit removal. +Tags are kept with the packet everywhere within the kernel, but are +lost when packet leaves the kernel, for example, on transmitting +packet out to the network or sending packet to a +.Xr divert 4 +socket. +.Pp +To check for previously applied tags, use the +.Cm tagged +rule option. To delete previously applied tag, use the +.Cm untag +keyword. +.Pp +Note: since tags are kept with the packet everywhere in kernelspace, +they can be set and unset anywhere in kernel network subsystem +(using +.Xr mbuf_tags 9 +facility), not only by means of +.Xr ipfw 4 +.Cm tag +and +.Cm untag +keywords. +For example, there can be a specialized +.Xr netgraph 4 +node doing traffic analyzing and tagging for later inspecting +in firewall. +.It Cm untag Ar number +When a packet matches a rule with the +.Cm untag +keyword, the tag with the number +.Ar number +is searched among the tags attached to this packet and, +if found, removed from it. +Other tags bound to packet, if present, are left untouched. .It Cm altq Ar queue When a packet matches a rule with the .Cm altq @@ -1362,6 +1413,15 @@ specified as an argument. .It Cm src-port Ar ports Matches IP packets whose source port is one of the port(s) specified as argument. +.It Cm tagged Ar tag-list +Matches packets whose tags are included in +.Ar tag-list , +which is either a single value or a list of values or ranges +specified in the same way as +.Ar ports . +Tags can be applied to the packet using +.Cm tag +rule action parameter (see it's description for details on tags). .It Cm tcpack Ar ack TCP packets only. Match if the TCP header acknowledgment number field is set to |