Match

The match structure is used by several messages within OpenFlow refers to a single entry in a flow table.

Match Structure

The wildcards field contains all the masks for fields in this structure, some fields have a monolithic mask (on/off), while other fields support variable length subnet masking.

Match Structure

Name Bits Byte Ordering Constraints
wildcards 32 MSBF See below
in_port 16 MSBF 0x0000...0xfeff
dl_src 48 MSBF 802.3 MAC
dl_dst 48 MSBF 802.3 MAC
dl_vlan 16 MSBF 802.1Q ID
dl_pcp 8 MSBF 802.1Q PCP
pad 8 - none
dl_type 16 MSBF 802.3 EtherType
nw_tos 8 MSBF IPv4 ToS
nw_proto 8 MSBF IPv4 Protocol
pad 16 - none
nw_src 32 MSBF IPv4 Source
nw_dst 32 MSBF IPv4 Destination
tp_src 16 MSBF TCP/UDP Source Port
tp_dst 16 MSBF TCP/UDP Destination Port

Match Constraints

Field Mask Target Mask
wildcards in_port 0x00000001
dl_vlan 0x00000002
dl_src 0x00000004
dl_dst 0x00000008
dl_type 0x00000010
nw_prot 0x00000020
tp_src 0x00000040
tp_dst 0x00000080
nw_src see table
nw_dst see table
dl_vlan_pcp 0x00100000
nw_tos 0x00200000
all 0x003fffff

Mask Conversions

Netmask VLSM Src Wildcard Dst Wildcard
255.255.255.255 /32 0x00000000 0x00000000
255.255.255.254 /31 0x00000100 0x00004000
255.255.255.252 /30 0x00000200 0x00008000
255.255.255.248 /29 0x00000300 0x0000c000
255.255.255.240 /28 0x00000400 0x00010000
255.255.255.224 /27 0x00000500 0x00014000
255.255.255.192 /26 0x00000600 0x00018000
255.255.255.128 /25 0x00000700 0x0001c000
255.255.255.0 /24 0x00000800 0x00020000
255.255.254.0 /23 0x00000900 0x00024000
255.255.252.0 /22 0x00000a00 0x00028000
255.255.248.0 /21 0x00000b00 0x0002c000
255.255.240.0 /20 0x00000c00 0x00030000
255.255.224.0 /19 0x00000d00 0x00034000
255.255.192.0 /18 0x00000e00 0x00038000
255.255.128.0 /17 0x00000f00 0x0003c000
255.255.0.0 /16 0x00001000 0x00040000
Netmask VLSM Src Wildcard Dst Wildcard
255.254.0.0 /15 0x00001100 0x00044000
255.252.0.0 /14 0x00001200 0x00048000
255.248.0.0 /13 0x00001300 0x0004c000
255.240.0.0 /12 0x00001400 0x00050000
255.224.0.0 /11 0x00001500 0x00054000
255.192.0.0 /10 0x00001600 0x00058000
255.128.0.0 /9 0x00001700 0x0005c000
255.0.0.0 /8 0x00001800 0x00060000
254.0.0.0 /7 0x00001900 0x00064000
252.0.0.0 /6 0x00001a00 0x00068000
248.0.0.0 /5 0x00001b00 0x0006c000
240.0.0.0 /4 0x00001c00 0x00070000
224.0.0.0 /3 0x00001d00 0x00074000
192.0.0.0 /2 0x00001e00 0x00078000
128.0.0.0 /1 0x00001f00 0x0007c000
0.0.0.0 /0 0x00002000 0x00080000

References

OpenFlow Switch Specification 1.0.0, pages 20-21

Match Structure

This version does away with multiple bit wildcards and uses mask fields in their place. Additionally, more attributes of IPv4 as well as MPLS are supported.

Match Structure

Name Bits Byte Ordering Constraints
type 16 MSBF = 0x0000
length 16 MSBF = 0x0058
in_port 32 MSBF 0x00000000...0xffffffef
wildcards 32 MSBF 0x00000000...0x000003ff
dl_src 48 MSBF 802.3 MAC
dl_src_mask 48 MSBF none
dl_dst 48 MSBF 802.3 MAC
dl_dst_mask 48 MSBF none
dl_vlan 16 MSBF 802.1Q VLAN
dl_pcp 8 MSBF 802.1Q PCP
pad 8 - none
dl_type 16 MSBF 802.3 Type
nw_tos 8 MSBF IPv4 ToS
nw_proto 8 MSBF IPv4 Protocol
nw_src 32 MSBF IPv4 Source
nw_src_mask 32 MSBF IPv4 Mask
nw_dst 32 MSBF IPv4 Destination
nw_dst_mask 32 MSBF IPv4 Mask
tp_src 16 MSBF TCP/UDP Source Port
tp_dst 16 MSBF TCP/UDP Destination Port
mpls_label 32 MSBF MPLS Label
mpls_tc 8 MSBF MPLS TC
pad 24 - none
metadata 64 MSBF none
metadata_mask 64 MSBF none

Match Constraints

Field Name Value
wildcards in_port 0x00000001
dl_vlan 0x00000002
dl_pcp 0x00000004
dl_type 0x00000008
nw_tos 0x00000010
nw_prot 0x00000020
tp_src 0x00000040
tp_dst 0x00000080
mpls_label 0x00000100
mpls_tc 0x00000200
all 0x000003ff

References

OpenFlow Switch Specification 1.1, pages 28-30

Match Structure

This version drastically changes how the matching structure and deprecates the previous method. The OpenFlow Extensible Match (OXM) is introduced as a structure that matches a particular protocol field. A complicated match rule is then defined a sequence of OXMs, which all must match. OXM's are segregated by class, and then field. For this specification there is only one class to worry about, OpenFlowBasic. Fields are then defined to handle very specific protocol matching. The length field of an OXM is exclusive, it specifies only the number of bytes in the OXM payload. The OXM header has a single bit that indicates whether a bitmask is present in the payload. OXM with an empty payload matches everything. OXM may have prerequisite OXM(s) (IPv4 field must be preceded by ethertype = 0x8000 OXM)

Match Structure

Name Bits Byte Ordering Constraints
Type 16 MSBF =0x0001
Length 16 MSBF ≥4
pad 32 - none

OXM TLV Structure

Name Bits Byte Ordering Constraints
Class 16 MSBF 0x0000,0x0001,0x8000,0xffff
Field 7 - Dependent on Class
Hasmask 1 - 0x0..0x1
Length 8 MSBF ≥1

OXM TLV Constraints

Class Name Class Value Field Name Field Length Field Value Hasmask Dependencies
nxm_0 0x0000 - - - - -
nxm_1 0x0001 - - - - -
OpenFlowBasic 0x8000 in_port 32 0x00 0 none
in_phy_port 32 0x01 0 in_port
metadata 64 0x02 0 none
128 0x02 1 none
eth_dst 48 0x03 0 none
96 0x03 1 none
eth_src 48 0x04 0 none
96 0x04 1 none
eth_type 16 0x05 0 none
vlan_vid 13 0x06 0 none
26 0x06 1 none
vlan_pcp 3 0x07 0 vlan_vid != none
ip_dscp 6 0x08 0 eth_type = 0x0800 || 0x86dd
ip_ecn 2 0x09 0 eth_type = 0x0800 || 0x86dd
ip_proto 8 0x0a 0 eth_type = 0x0800 || 0x86dd
ipv4_src 32 0x0b 0 eth_type = 0x0800
64 0x0b 1 eth_type = 0x0800
ipv4_dst 32 0x0c 0 eth_type = 0x0800
64 0x0c 1 eth_type = 0x0800
tcp_src 16 0x0d 0 ip_proto = 6
tcp_dst 16 0x0e 0 ip_proto = 6
udp_src 16 0x0f 0 ip_proto = 17
udp_dst 16 0x10 0 ip_proto = 17
sctp_src 16 0x11 0 ip_proto = 132
sctp_dst 16 0x12 0 ip_proto = 132
icmpv4_type 8 0x13 0 ip_proto = 1
icmpv4_code 8 0x14 0 ip_proto = 1
arp_op 16 0x15 0 eth_type = 0x0806
arp_spa 32 0x16 0 eth_type = 0x0806
64 0x16 1 eth_type = 0x0806
arp_tpa 32 0x17 0 eth_type = 0x0806
64 0x17 1 eth_type = 0x0806
arp_sha 48 0x18 0 eth_type = 0x0806
96 0x18 1 eth_type = 0x0806
arp_tha 48 0x19 0 eth_type = 0x0806
96 0x19 1 eth_type = 0x0806
ipv6_src 128 0x1a 0 eth_type = 0x86dd
256 0x1a 1 eth_type = 0x86dd
ipv6_dst 128 0x1b 0 eth_type = 0x86dd
256 0x1b 1 eth_type = 0x86dd
ipv6_flabel 20 0x1c 0 eth_type = 0x86dd
40 0x1c 1 eth_type = 0x86dd
icmpv6_type 8 0x1d 0 ip_proto = 58
icmpv6_code 8 0x1e 0 ip_proto = 58
ipv6_nd_target 128 0x1f 0 icmpv6_type = 135||136
ipv6_nd_sll 48 0x20 0 icmpv6_type = 135
ipv6_nd_tll 48 0x21 0 icmpv6_type = 136
mpls_label 20 0x22 0 eth_type = 0x8847||0x8848
mpls_tc 3 0x23 0 eth_type = 0x8847||0x8848
experimenter 0xffff - - - - -

OpenFlowBasic TLV Dependencies

References

OpenFlow Switch Specification 1.2, pages 32-38

Match Structure

The only changes from the previous version are the addition of three new oxm fields: MPLS BoS, PBB I-SID, TunnelID, and IPv6ExtHdr. IPv6ExtHdr indicates whether certain IPv6 header extensions are present: No Next Header, Encrypted ESP, Authentication header, 1 or 2 dest headers, fragment, router, hop-by-hop, unexpected repeats, and unexpected sequencing.

Match Header Structure

Name Bits Byte Ordering Constraints
Type 16 MSBF =0x0001
Length 16 MSBF ≥4
pad 32 - none

OXM TLV Structure

Name Bits Byte Ordering Constraints
Class 16 MSBF 0x0000,0x0001,0x8000,0xffff
Field 7 MSBF Dependent on Class
Hasmask 1 MSBF 0x0..0x1
Length 8 MSBF ≥1

OXM TLV Constraints

Class Name Class Value Field Name Field Length Field Value Hasmask Dependencies
nxm_0 0x0000 - - - - -
nxm_1 0x0001 - - - - -
OpenFlowBasic 0x8000 in_port 32 0x00 0 none
in_phy_port 32 0x01 0 in_port
metadata 64 0x02 0 none
128 0x02 1 none
eth_dst 48 0x03 0 none
96 0x03 1 none
eth_src 48 0x04 0 none
96 0x04 1 none
eth_type 16 0x05 0 none
vlan_vid 13 0x06 0 none
26 0x06 1 none
vlan_pcp 3 0x07 0 vlan_vid != none
ip_dscp 6 0x08 0 eth_type = 0x0800 || 0x86dd
ip_ecn 2 0x09 0 eth_type = 0x0800 || 0x86dd
ip_proto 8 0x0a 0 eth_type = 0x0800 || 0x86dd
ipv4_src 32 0x0b 0 eth_type = 0x0800
64 0x0b 1 eth_type = 0x0800
ipv4_dst 32 0x0c 0 eth_type = 0x0800
64 0x0c 1 eth_type = 0x0800
tcp_src 16 0x0d 0 ip_proto = 6
tcp_dst 16 0x0e 0 ip_proto = 6
udp_src 16 0x0f 0 ip_proto = 17
udp_dst 16 0x10 0 ip_proto = 17
sctp_src 16 0x11 0 ip_proto = 132
sctp_dst 16 0x12 0 ip_proto = 132
icmpv4_type 8 0x13 0 ip_proto = 1
icmpv4_code 8 0x14 0 ip_proto = 1
arp_op 16 0x15 0 eth_type = 0x0806
arp_spa 32 0x16 0 eth_type = 0x0806
64 0x16 1 eth_type = 0x0806
arp_tpa 32 0x17 0 eth_type = 0x0806
64 0x17 1 eth_type = 0x0806
arp_sha 48 0x18 0 eth_type = 0x0806
96 0x18 1 eth_type = 0x0806
arp_tha 48 0x19 0 eth_type = 0x0806
96 0x19 1 eth_type = 0x0806
ipv6_src 128 0x1a 0 eth_type = 0x86dd
256 0x1a 1 eth_type = 0x86dd
ipv6_dst 128 0x1b 0 eth_type = 0x86dd
256 0x1b 1 eth_type = 0x86dd
ipv6_flabel 20 0x1c 0 eth_type = 0x86dd
40 0x1c 1 eth_type = 0x86dd
icmpv6_type 8 0x1d 0 ip_proto = 58
icmpv6_code 8 0x1e 0 ip_proto = 58
ipv6_nd_target 128 0x1f 0 icmpv6_type = 135||136
ipv6_nd_sll 48 0x20 0 icmpv6_type = 135
ipv6_nd_tll 48 0x21 0 icmpv6_type = 136
mpls_label 20 0x22 0 eth_type = 0x8847||0x8848
mpls_tc 3 0x23 0 eth_type = 0x8847||0x8848
mpls_bos 1 0x24 0 eth_type = 0x8847||0x8848
pbb_isid 24 0x25 0 eth_type = 0x88E7
48 0x25 1 eth_type = 0x88E7
tunnel_id 64 0x26 0 none
128 0x26 1 none
ipv6_hexthdr 9 0x27 0 eth_type = 0x86dd
18 0x27 1 eth_type = 0x86dd
experimenter 0xffff - - - - -

OpenFlowBasic TLV Dependencies

References

OpenFlow Switch Specification 1.3, pages 39-46

Match Structure

Version 1.3 added three new oxm fields: MPLS BoS, PBB I-SID, TunnelID, and IPv6ExtHdr. IPv6ExtHdr indicates whether certain IPv6 header extensions are present: No Next Header, Encrypted ESP, Authentication header, 1 or 2 dest headers, fragment, router, hop-by-hop, unexpected repeats, and unexpected sequencing.

Match Header Structure

Name Bits Byte Ordering Constraints
Type 16 MSBF =0x0001
Length 16 MSBF ≥4
pad 32 - none

OXM TLV Structure

Name Bits Byte Ordering Constraints
Class 16 MSBF 0x0000,0x0001,0x8000,0xffff
Field 7 MSBF Dependent on Class
Hasmask 1 MSBF 0x0..0x1
Length 8 MSBF ≥1

OXM TLV Constraints

Class Name Class Value Field Name Field Length Field Value Hasmask Dependencies
nxm_0 0x0000 - - - - -
nxm_1 0x0001 - - - - -
OpenFlowBasic 0x8000 in_port 32 0x00 0 none
in_phy_port 32 0x01 0 in_port
metadata 64 0x02 0 none
128 0x02 1 none
eth_dst 48 0x03 0 none
96 0x03 1 none
eth_src 48 0x04 0 none
96 0x04 1 none
eth_type 16 0x05 0 none
vlan_vid 13 0x06 0 none
26 0x06 1 none
vlan_pcp 3 0x07 0 vlan_vid != none
ip_dscp 6 0x08 0 eth_type = 0x0800 || 0x86dd
ip_ecn 2 0x09 0 eth_type = 0x0800 || 0x86dd
ip_proto 8 0x0a 0 eth_type = 0x0800 || 0x86dd
ipv4_src 32 0x0b 0 eth_type = 0x0800
64 0x0b 1 eth_type = 0x0800
ipv4_dst 32 0x0c 0 eth_type = 0x0800
64 0x0c 1 eth_type = 0x0800
tcp_src 16 0x0d 0 ip_proto = 6
tcp_dst 16 0x0e 0 ip_proto = 6
udp_src 16 0x0f 0 ip_proto = 17
udp_dst 16 0x10 0 ip_proto = 17
sctp_src 16 0x11 0 ip_proto = 132
sctp_dst 16 0x12 0 ip_proto = 132
icmpv4_type 8 0x13 0 ip_proto = 1
icmpv4_code 8 0x14 0 ip_proto = 1
arp_op 16 0x15 0 eth_type = 0x0806
arp_spa 32 0x16 0 eth_type = 0x0806
64 0x16 1 eth_type = 0x0806
arp_tpa 32 0x17 0 eth_type = 0x0806
64 0x17 1 eth_type = 0x0806
arp_sha 48 0x18 0 eth_type = 0x0806
96 0x18 1 eth_type = 0x0806
arp_tha 48 0x19 0 eth_type = 0x0806
96 0x19 1 eth_type = 0x0806
ipv6_src 128 0x1a 0 eth_type = 0x86dd
256 0x1a 1 eth_type = 0x86dd
ipv6_dst 128 0x1b 0 eth_type = 0x86dd
256 0x1b 1 eth_type = 0x86dd
ipv6_flabel 20 0x1c 0 eth_type = 0x86dd
40 0x1c 1 eth_type = 0x86dd
icmpv6_type 8 0x1d 0 ip_proto = 58
icmpv6_code 8 0x1e 0 ip_proto = 58
ipv6_nd_target 128 0x1f 0 icmpv6_type = 135||136
ipv6_nd_sll 48 0x20 0 icmpv6_type = 135
ipv6_nd_tll 48 0x21 0 icmpv6_type = 136
mpls_label 20 0x22 0 eth_type = 0x8847||0x8848
mpls_tc 3 0x23 0 eth_type = 0x8847||0x8848
mpls_bos 1 0x24 0 eth_type = 0x8847||0x8848
pbb_isid 24 0x25 0 eth_type = 0x88E7
48 0x25 1 eth_type = 0x88E7
tunnel_id 64 0x26 0 none
128 0x26 1 none
ipv6_hexthdr 9 0x27 0 eth_type = 0x86dd
18 0x27 1 eth_type = 0x86dd
experimenter 0xffff - - - - -

OpenFlowBasic TLV Dependencies

References

OpenFlow Switch Specification 1.3.1, pages 45-54

Under development
This section is under active development.

Under development
This section is under active development.

Under development
This section is under active development.