Blame man/man8/tc-ematch.8

Packit Service 3880ab
.TH ematch 8 "6 August 2012" iproute2 Linux
Packit Service 3880ab
.
Packit Service 3880ab
.SH NAME
Packit Service 3880ab
ematch \- extended matches for use with "basic", "cgroup"  or "flow" filters
Packit Service 3880ab
.
Packit Service 3880ab
.SH SYNOPSIS
Packit Service 3880ab
.sp
Packit Service 3880ab
.ad l
Packit Service 3880ab
.B "tc filter add .. basic match"
Packit Service 3880ab
.RI EXPR
Packit Service 3880ab
.B .. flowid ..
Packit Service 3880ab
.sp
Packit Service 3880ab
Packit Service 3880ab
.IR EXPR " := " TERM " [ { "
Packit Service 3880ab
.B and | or
Packit Service 3880ab
}
Packit Service 3880ab
.IR EXPR
Packit Service 3880ab
]
Packit Service 3880ab
Packit Service 3880ab
.IR TERM " := [ " \fBnot " ] { " MATCH " | '(' " EXPR " ')' } "
Packit Service 3880ab
Packit Service 3880ab
.IR MATCH " := " module " '(' " ARGS " ')' "
Packit Service 3880ab
Packit Service 3880ab
.IR ARGS " := " ARG1 " " ARG2 " ..
Packit Service 3880ab
Packit Service 3880ab
.SH MATCHES
Packit Service 3880ab
Packit Service 3880ab
.SS cmp
Packit Service 3880ab
Simple comparison ematch: arithmetic compare of packet data to a given value.
Packit Service 3880ab
Packit Service 3880ab
.IR cmp "( " ALIGN " at " OFFSET " [ " ATTRS " ] { " eq " | " lt " | " gt " } " VALUE " )
Packit Service 3880ab
Packit Service 3880ab
.IR ALIGN " := { " u8 " | " u16 " | " u32 " } "
Packit Service 3880ab
Packit Service 3880ab
.IR ATTRS " := [ layer " LAYER " ] [ mask " MASK " ] [ trans ]
Packit Service 3880ab
Packit Service 3880ab
.IR LAYER " := { " link " | " network " | " transport " | " 0..2 " }
Packit Service 3880ab
Packit Service 3880ab
.SS meta
Packit Service 3880ab
Metadata ematch
Packit Service 3880ab
Packit Service 3880ab
.IR meta "( " OBJECT " { " eq " | " lt " |" gt " } " OBJECT " )
Packit Service 3880ab
Packit Service 3880ab
.IR OBJECT " := { " META_ID " |  " VALUE " }
Packit Service 3880ab
Packit Service 3880ab
.IR META_ID " := " id " [ shift " SHIFT " ] [ mask " MASK " ]
Packit Service 3880ab
Packit Service 3880ab
.TP
Packit Service 3880ab
meta attributes:
Packit Service 3880ab
Packit Service 3880ab
\fBrandom\fP 32 bit random value
Packit Service 3880ab
Packit Service 3880ab
\fBloadavg_1\fP Load average in last 5 minutes
Packit Service 3880ab
Packit Service 3880ab
\fBnf_mark\fP Netfilter mark
Packit Service 3880ab
Packit Service 3880ab
\fBvlan\fP Vlan tag
Packit Service 3880ab
Packit Service 3880ab
\fBsk_rcvbuf\fP Receive buffer size
Packit Service 3880ab
Packit Service 3880ab
\fBsk_snd_queue\fP Send queue length
Packit Service 3880ab
Packit Service 3880ab
.PP
Packit Service 3880ab
A full list of meta attributes can be obtained via
Packit Service 3880ab
Packit Service 3880ab
# tc filter add dev eth1 basic match 'meta(list)'
Packit Service 3880ab
Packit Service 3880ab
.SS nbyte
Packit Service 3880ab
match packet data byte sequence
Packit Service 3880ab
Packit Service 3880ab
.IR nbyte "( " NEEDLE  " at " OFFSET " [ layer " LAYER " ] )
Packit Service 3880ab
Packit Service 3880ab
.IR NEEDLE  " := { " string " | " c-escape-sequence "  } "
Packit Service 3880ab
Packit Service 3880ab
.IR OFFSET  " := " int
Packit Service 3880ab
Packit Service 3880ab
.IR LAYER " := { " link " | " network " | " transport " | " 0..2 " }
Packit Service 3880ab
Packit Service 3880ab
.SS u32
Packit Service 3880ab
u32 ematch
Packit Service 3880ab
Packit Service 3880ab
.IR u32 "( " ALIGN " " VALUE " " MASK " at [ nexthdr+ ] " OFFSET " )
Packit Service 3880ab
Packit Service 3880ab
.IR ALIGN " := { " u8 " | " u16 " | " u32 " }
Packit Service 3880ab
Packit Service 3880ab
.SS ipset
Packit Service 3880ab
test packet against ipset membership
Packit Service 3880ab
Packit Service 3880ab
.IR ipset "( " SETNAME " " FLAGS " )
Packit Service 3880ab
Packit Service 3880ab
.IR SETNAME " := " string
Packit Service 3880ab
Packit Service 3880ab
.IR FLAGS " := { " FLAG " [, " FLAGS "] }
Packit Service 3880ab
Packit Service 3880ab
The flag options are the same as those used by the iptables "set" match.
Packit Service 3880ab
Packit Service 3880ab
When using the ipset ematch with the "ip_set_hash:net,iface" set type,
Packit Service 3880ab
the interface can be queried using "src,dst (source ip address, outgoing interface) or
Packit Service 3880ab
"src,src" (source ip address, incoming interface) syntax.
Packit Service 3880ab
Packit Service 3880ab
.SS ipt
Packit Service 3880ab
test packet against xtables matches
Packit Service 3880ab
Packit Service 3880ab
.IR ipt "( " [-6] " "-m " " MATCH_NAME " " FLAGS " )
Packit Service 3880ab
Packit Service 3880ab
.IR MATCH_NAME " := " string
Packit Service 3880ab
Packit Service 3880ab
.IR FLAGS " := { " FLAG " [, " FLAGS "] }
Packit Service 3880ab
Packit Service 3880ab
The flag options are the same as those used by the xtable match used.
Packit Service 3880ab
Packit Service 3880ab
.SS canid
Packit Service 3880ab
ematch rule to match CAN frames
Packit Service 3880ab
Packit Service 3880ab
.IR canid "( " IDLIST " )
Packit Service 3880ab
Packit Service 3880ab
.IR IDLIST " :=  " IDSPEC [ IDLIST ]
Packit Service 3880ab
Packit Service 3880ab
.IR IDSPEC " := { ’sff’ " CANID " | ’eff’ " CANID " }
Packit Service 3880ab
Packit Service 3880ab
.IR CANID " := " ID [ ":MASK" ]
Packit Service 3880ab
Packit Service 3880ab
.IR ID ", " MASK " := hexadecimal number (i.e. 0x123)
Packit Service 3880ab
Packit Service 3880ab
.SH CAVEATS
Packit Service 3880ab
Packit Service 3880ab
The ematch syntax uses '(' and ')' to group expressions. All braces need to be
Packit Service 3880ab
escaped properly to prevent shell commandline from interpreting these directly.
Packit Service 3880ab
Packit Service 3880ab
When using the ipset ematch with the "ifb" device, the outgoing device will be the
Packit Service 3880ab
ifb device itself, e.g. "ifb0".
Packit Service 3880ab
The original interface (i.e. the device the packet arrived on) is treated as the incoming interface.
Packit Service 3880ab
Packit Service 3880ab
.SH EXAMPLE & USAGE
Packit Service 3880ab
Packit Service 3880ab
# tc filter add .. basic match ...
Packit Service 3880ab
Packit Service 3880ab
# 'cmp(u16 at 3 layer 2 mask 0xff00 gt 20)'
Packit Service 3880ab
Packit Service 3880ab
# 'meta(nfmark gt 24)' and 'meta(tcindex mask 0xf0 eq 0xf0)'
Packit Service 3880ab
Packit Service 3880ab
# 'nbyte("ababa" at 12 layer 1)'
Packit Service 3880ab
Packit Service 3880ab
# 'u32(u16 0x1122 0xffff at nexthdr+4)'
Packit Service 3880ab
Packit Service 3880ab
Check if packet source ip address is member of set named \fBbulk\fP:
Packit Service 3880ab
Packit Service 3880ab
# 'ipset(bulk src)'
Packit Service 3880ab
Packit Service 3880ab
Check if packet source ip and the interface the packet arrived on is member of "hash:net,iface" set named \fBinteractive\fP:
Packit Service 3880ab
Packit Service 3880ab
# 'ipset(interactive src,src)'
Packit Service 3880ab
Packit Service 3880ab
Check if packet matches an IPSec state with reqid 1:
Packit Service 3880ab
Packit Service 3880ab
# 'ipt(-m policy --dir in --pol ipsec --reqid 1)'
Packit Service 3880ab
Packit Service 3880ab
.SH "AUTHOR"
Packit Service 3880ab
Packit Service 3880ab
The extended match infrastructure was added by Thomas Graf.