2
0
mirror of https://github.com/openvswitch/ovs synced 2025-08-31 06:15:47 +00:00

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 <jan.scheurich@ericsson.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
This commit is contained in:
Jan Scheurich
2017-06-23 16:47:57 +00:00
committed by Ben Pfaff
parent be7ac2f3c1
commit 3d4b2e6eb7
24 changed files with 657 additions and 285 deletions

View File

@@ -251,6 +251,7 @@ parse_field(const struct mf_field *mf, const char *s,
error = mf_parse(mf, s, port_map, &value, &mask);
if (!error) {
*usable_protocols &= mf_set(mf, &value, &mask, match, &error);
match_add_ethernet_prereq(match, mf);
}
return error;
}
@@ -297,6 +298,8 @@ parse_subfield(const char *name, const char *str_value, struct match *match,
bitwise_copy(&val, size, 0, &value, size, sf.ofs, sf.n_bits);
bitwise_one ( &mask, size, sf.ofs, sf.n_bits);
*usable_protocols &= mf_set(field, &value, &mask, match, &error);
match_add_ethernet_prereq(match, sf.field);
}
return error;
}
@@ -416,6 +419,9 @@ parse_ofp_str__(struct ofputil_flow_mod *fm, int command, char *string,
if (p->nw_proto) {
match_set_nw_proto(&fm->match, p->nw_proto);
}
match_set_default_packet_type(&fm->match);
} else if (!strcmp(name, "eth")) {
match_set_packet_type(&fm->match, htonl(PT_ETH));
} else if (fields & F_FLAGS && !strcmp(name, "send_flow_rem")) {
fm->flags |= OFPUTIL_FF_SEND_FLOW_REM;
} else if (fields & F_FLAGS && !strcmp(name, "check_overlap")) {
@@ -517,6 +523,12 @@ parse_ofp_str__(struct ofputil_flow_mod *fm, int command, char *string,
return error;
}
}
/* Copy ethertype to flow->dl_type for matches on packet_type
* (OFPHTN_ETHERTYPE, ethertype). */
if (fm->match.wc.masks.packet_type == OVS_BE32_MAX &&
pt_ns(fm->match.flow.packet_type) == OFPHTN_ETHERTYPE) {
fm->match.flow.dl_type = pt_ns_type_be(fm->match.flow.packet_type);
}
/* Check for usable protocol interdependencies between match fields. */
if (fm->match.flow.dl_type == htons(ETH_TYPE_IPV6)) {
const struct flow_wildcards *wc = &fm->match.wc;