From 3d4b2e6eb74ed5bb5b35373aa8a489536938fee6 Mon Sep 17 00:00:00 2001 From: Jan Scheurich Date: Fri, 23 Jun 2017 16:47:57 +0000 Subject: userspace: Add OXM field MFF_PACKET_TYPE Allow packet type namespace OFPHTN_ETHERTYPE as alternative pre-requisite for matching L3 protocols (MPLS, IP, IPv6, ARP etc). Change the meta-flow definition of packet_type field to use the new custom format MFS_PACKET_TYPE representing "(NS,NS_TYPE)". Parsing routine for MFS_PACKET_TYPE added to meta-flow.c. Formatting routine for field packet_type extracted from match_format() and moved to flow.c to be used from meta-flow.c for formatting MFS_PACKET_TYPE. Updated the ovs-fields man page source meta-flow.xml with documentation for packet-type-aware bridges and added documentation for field packet_type. Added packet_type to the matching properties in tests/ofproto.at. If dl_type is unwildcarded due to later packet modification, make sure it is cleared again if the original packet_type was not PT_ETH. Signed-off-by: Jan Scheurich Signed-off-by: Ben Pfaff --- lib/meta-flow.xml | 156 ++++++++++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 134 insertions(+), 22 deletions(-) (limited to 'lib/meta-flow.xml') diff --git a/lib/meta-flow.xml b/lib/meta-flow.xml index 5efd43100..856e1ba8c 100644 --- a/lib/meta-flow.xml +++ b/lib/meta-flow.xml @@ -22,26 +22,38 @@

- Some data fields, called root fields, are always present as a - consequence of the basic networking technology in use. The Ethernet header - fields are root fields in current versions of Open vSwitch, though future - versions might support other roots. (Currently, to support LISP tunnels, - which do not encapsulate an Ethernet header, Open vSwitch synthesizes one.) + Data fields that are always present as a consequence of the basic + networking technology in use are called called root fields. + Open vSwitch 2.7 and earlier considered Ethernet fields to be root fields, + and this remains the default mode of operation for Open vSwitch bridges. + In this mode, when a packet is received from a non-Ethernet interfaces, + such as a layer-3 LISP or GRE tunnel, Open vSwitch force-fits it to this + Ethernet-centric point of view by pretending that an Ethernet header is + present whose Ethernet type that indicates the packet's actual type (and + whose source and destination addresses are all-zero).

-

- Other data fields are not always present. A packet contains ARP fields, - for example, only when its Ethernet header indicates the Ethertype for ARP, + Open vSwitch 2.8 and later supports the ``packet type-aware pipeline'' + concept introduced in OpenFlow 1.5. A bridge configured to be packet + type-aware can handle packets of multiple networking technologies, such as + Ethernet, IP, ARP, MPLS, or NSH in parallel. Such a bridge does not have + any root fields. +

+ +

+ Non-root data fields are not always present. A packet contains ARP + fields, for example, only when its packet type is ARP or when it is an + Ethernet packet whose Ethernet header indicates the Ethertype for ARP, 0x0806. In this documentation, we say that a field is applicable when it is present in a packet, and inapplicable when it is not. (These are not standard terms.) We refer to the conditions that determine whether a field is applicable as prerequisites. Some VLAN-related fields are a special case: - these fields are always applicable, but have a designated value or bit that - indicates whether a VLAN header is present, with the remaining values or - bits indicating the VLAN header's content (if it is present). + these fields are always applicable for Ethernet packets, but have a + designated value or bit that indicates whether a VLAN header is present, + with the remaining values or bits indicating the VLAN header's content + (if it is present).

@@ -51,7 +63,8 @@ example, one may match (see Matching, below) a given field only if the match includes the field's prerequisite, e.g. matching an ARP field is only allowed if one also matches on - Ethertype 0x0806. + Ethertype 0x0806 or the for ARP in a packet + type-aware bridge.

@@ -301,6 +314,8 @@ tcp,tp_src=0x07c0/0xfff0

+
eth
+
packet_type=(0,0) (Open vSwitch 2.8 and later)
ip
eth_type=0x0800
ipv6
eth_type=0x86dd
icmp
eth_type=0x0800,ip_proto=1
@@ -317,6 +332,15 @@ tcp,tp_src=0x07c0/0xfff0
mplsm
eth_type=0x8848
+

+ These shorthand notations continue to work in packet type-aware bridges. + The absence of a packet_type match implies + packet_type=ethernet, so that shorthands match on Ethernet + packets with the implied eth_type. Please note that the shorthand + ip does not match packets of packet_type (1,0x800) for IPv4. +

+ +

Evolution of OpenFlow Fields

@@ -802,20 +826,12 @@ tcp,tp_src=0x07c0/0xfff0

    +
  • Packet type.
  • TCP flags.
  • Packet registers.
  • The output port in the OpenFlow action set.
-

- OpenFlow 1.5 also added OXMs for the following fields not documented here - and not yet implemented by Open vSwitch: -

- -
    -
  • Packet type.
  • -
-

Fields Reference

@@ -2273,6 +2289,102 @@ actions=clone(load:0->NXM_OF_IN_PORT[],output:123) + + +

+ The type of the packet in the format specified in OpenFlow 1.5: +

+ + +
+ + +
+ +
+ +

+ The upper 16 bits, ns, are a namespace. The meaning of + ns_type depends on the namespace. The packet type field is + specified and displayed in the format + (ns,ns_type). +

+ +

+ Open vSwitch currently supports the following classes of packet types + for matching: +

+
(0,0)
+
Ethernet.
+
(1,ethertype)
+
+

+ The specified ethertype. Open vSwitch can forward + packets with any ethertype, but it can only match on + and process data fields for the following supported packet types: +

+
+
(1,0x800)
IPv4
+
(1,0x806)
ARP
+
(1,0x86dd)
IPv6
+
(1,0x8847)
MPLS
+
(1,0x8848)
MPLS multicast
+
(1,0x8035)
RARP
+
(1,0x894f)
NSH
+
+
+
+

+ +

+ Consider the distinction between a packet with packet_type=(0,0), + dl_type=0x800 and one with packet_type=(1,0x800). + The former is an Ethernet frame that contains an IPv4 packet, like + this: +

+ + +
+ + + +
+
+ + + + +
+ +
+ +

+ The latter is an IPv4 packet not encapsulated inside any outer frame, + like this: +

+ + +
+ + + + +
+ +
+ +

+ Matching on is a pre-requisite for matching + on any data field, but for backward compatibility, when a match on a + data field is present without a match, Open + vSwitch acts as though a match on (0,0) (Ethernet) had + been supplied. Similarly, when Open vSwitch sends flow match + information to a controller, e.g. in a reply to a request to dump the + flow table, Open vSwitch omits a match on packet type (0,0) if it would + be implied by a data field match. +

+ + -- cgit v1.2.1