Skip to content
This repository was archived by the owner on Jun 27, 2018. It is now read-only.

How to use match

Joshua Reich edited this page Aug 9, 2013 · 19 revisions

match(f=v): match packets whose field f has value v

Built-in fields are:

FIELD TYPE EXAMPLE
switch int 4
inport int 3
outport int 2
srcmac MAC MAC('00:00:00:00:00:01')
dstmac MAC MAC('00:00:00:00:00:03')
srcip IP,string IP('10.0.1.1'), '10.0.0/24'
dstip IP,string IP('10.0.1.2'), '10.0.1/24'
tos int 0
srcport int 80
dstport int 8080
ethtype int 1
protocol int 7
vlan_id int 0
vlan_pcp int 0
Examples: ``` match(srcip=IP("1.1.1.2")) match(srcmac=MAC("00:00:00:00:00:01")) match(switch=4) ```

match also supports multiple field value pairs seperated by a comma - e.g.,

match(switch=4,srcmac=MAC("00:00:00:00:00:01"))

which means exactly the same thing as

match(switch=4) & match(srcmac=MAC("00:00:00:00:00:01"))
Clone this wiki locally