Debian Codegraph @

upstream/debian-unstable/man8/tc-ematch.8

raw
1 .TH ematch 8 "6 August 2012" iproute2 Linux
2 .
3 .SH NAME
4 ematch \- extended matches for use with "basic", "cgroup" or "flow" filters
5 .
6 .SH SYNOPSIS
7 .sp
8 .ad l
9 .B "tc filter add .. basic match"
10 .RI EXPR
11 .B .. flowid ..
12 .sp
13
14 .IR EXPR " := " TERM " [ { "
15 .B and | or
16 }
17 .IR EXPR
18 ]
19
20 .IR TERM " := [ " \fBnot " ] { " MATCH " | '(' " EXPR " ')' } "
21
22 .IR MATCH " := " module " '(' " ARGS " ')' "
23
24 .IR ARGS " := " ARG1 " " ARG2 " ..
25
26 .SH MATCHES
27
28 .SS cmp
29 Simple comparison ematch: arithmetic compare of packet data to a given value.
30
31 .IR cmp "( " ALIGN " at " OFFSET " [ " ATTRS " ] { " eq " | " lt " | " gt " } " VALUE " )
32
33 .IR ALIGN " := { " u8 " | " u16 " | " u32 " } "
34
35 .IR ATTRS " := [ layer " LAYER " ] [ mask " MASK " ] [ trans ]
36
37 .IR LAYER " := { " link " | " network " | " transport " | " 0..2 " }
38
39 .SS meta
40 Metadata ematch
41
42 .IR meta "( " OBJECT " { " eq " | " lt " |" gt " } " OBJECT " )
43
44 .IR OBJECT " := { " META_ID " | " VALUE " }
45
46 .IR META_ID " := " id " [ shift " SHIFT " ] [ mask " MASK " ]
47
48 .TP
49 meta attributes:
50
51 \fBrandom\fP 32 bit random value
52
53 \fBloadavg_1\fP Load average in last 5 minutes
54
55 \fBnf_mark\fP Netfilter mark
56
57 \fBvlan\fP Vlan tag
58
59 \fBsk_rcvbuf\fP Receive buffer size
60
61 \fBsk_snd_queue\fP Send queue length
62
63 .PP
64 A full list of meta attributes can be obtained via
65
66 # tc filter add dev eth1 basic match 'meta(list)'
67
68 .SS nbyte
69 match packet data byte sequence
70
71 .IR nbyte "( " NEEDLE " at " OFFSET " [ layer " LAYER " ] )
72
73 .IR NEEDLE " := { " string " | " c-escape-sequence " } "
74
75 .IR OFFSET " := " int
76
77 .IR LAYER " := { " link " | " network " | " transport " | " 0..2 " }
78
79 .SS u32
80 u32 ematch
81
82 .IR u32 "( " ALIGN " " VALUE " " MASK " at [ nexthdr+ ] " OFFSET " )
83
84 .IR ALIGN " := { " u8 " | " u16 " | " u32 " }
85
86 .SS ipset
87 test packet against ipset membership
88
89 .IR ipset "( " SETNAME " " FLAGS " )
90
91 .IR SETNAME " := " string
92
93 .IR FLAGS " := { " FLAG " [, " FLAGS "] }
94
95 The flag options are the same as those used by the iptables "set" match.
96
97 When using the ipset ematch with the "ip_set_hash:net,iface" set type,
98 the interface can be queried using "src,dst (source ip address, outgoing interface) or
99 "src,src" (source ip address, incoming interface) syntax.
100
101 .SS ipt
102 test packet against xtables matches
103
104 .IR ipt "( " [-6] " "-m " " MATCH_NAME " " FLAGS " )
105
106 .IR MATCH_NAME " := " string
107
108 .IR FLAGS " := { " FLAG " [, " FLAGS "] }
109
110 The flag options are the same as those used by the xtable match used.
111
112 .SS canid
113 ematch rule to match CAN frames
114
115 .IR canid "( " IDLIST " )
116
117 .IR IDLIST " := " IDSPEC [ IDLIST ]
118
119 .IR IDSPEC " := { ’sff’ " CANID " | ’eff’ " CANID " }
120
121 .IR CANID " := " ID [ ":MASK" ]
122
123 .IR ID ", " MASK " := hexadecimal number (i.e. 0x123)
124
125 .SH CAVEATS
126
127 The ematch syntax uses '(' and ')' to group expressions. All braces need to be
128 escaped properly to prevent shell commandline from interpreting these directly.
129
130 When using the ipset ematch with the "ifb" device, the outgoing device will be the
131 ifb device itself, e.g. "ifb0".
132 The original interface (i.e. the device the packet arrived on) is treated as the incoming interface.
133
134 .SH EXAMPLE & USAGE
135
136 # tc filter add .. basic match ...
137
138 # 'cmp(u16 at 3 layer 2 mask 0xff00 gt 20)'
139
140 # 'meta(nfmark gt 24)' and 'meta(tcindex mask 0xf0 eq 0xf0)'
141
142 # 'nbyte("ababa" at 12 layer 1)'
143
144 # 'u32(u16 0x1122 0xffff at nexthdr+4)'
145
146 Check if packet source ip address is member of set named \fBbulk\fP:
147
148 # 'ipset(bulk src)'
149
150 Check if packet source ip and the interface the packet arrived on is member of "hash:net,iface" set named \fBinteractive\fP:
151
152 # 'ipset(interactive src,src)'
153
154 Check if packet matches an IPSec state with reqid 1:
155
156 # 'ipt(-m policy --dir in --pol ipsec --reqid 1)'
157
158 .SH "AUTHOR"
159
160 The extended match infrastructure was added by Thomas Graf.