X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=lib%2Fofp-util.c;fp=lib%2Fofp-util.c;h=4facf0a579b631a876ad85de278f61a8f0ce8c98;hb=4fe3445afbbcda01e426d26cdcc1c7daa5d9f823;hp=fb8d6a1eebc78a53ff36876cad872f941a3ad111;hpb=72e8bf28bb38e8816435c64859fb350215b6a9e6;p=openvswitch diff --git a/lib/ofp-util.c b/lib/ofp-util.c index fb8d6a1e..4facf0a5 100644 --- a/lib/ofp-util.c +++ b/lib/ofp-util.c @@ -979,6 +979,16 @@ regs_fully_wildcarded(const struct flow_wildcards *wc) return true; } +static bool +tun_parms_fully_wildcarded(const struct flow_wildcards *wc) +{ + return (!wc->masks.tunnel.ip_src && + !wc->masks.tunnel.ip_dst && + !wc->masks.tunnel.ip_ttl && + !wc->masks.tunnel.ip_tos && + !wc->masks.tunnel.flags); +} + /* Returns a bit-mask of ofputil_protocols that can be used for sending 'match' * to a switch (e.g. to add or remove a flow). Only NXM can handle tunnel IDs, * registers, or fixing the Ethernet multicast bit. Otherwise, it's better to @@ -990,6 +1000,11 @@ ofputil_usable_protocols(const struct match *match) BUILD_ASSERT_DECL(FLOW_WC_SEQ == 18); + /* tunnel params other than tun_id can't be sent in a flow_mod */ + if (!tun_parms_fully_wildcarded(wc)) { + return OFPUTIL_P_NONE; + } + /* NXM, OXM, and OF1.1 support bitwise matching on ethernet addresses. */ if (!eth_mask_is_exact(wc->masks.dl_src) && !eth_addr_is_zero(wc->masks.dl_src)) { @@ -1630,7 +1645,6 @@ ofputil_flow_mod_usable_protocols(const struct ofputil_flow_mod *fms, usable_protocols &= OFPUTIL_P_OF10_NXM_ANY | OFPUTIL_P_OF12_OXM; } } - assert(usable_protocols); return usable_protocols; }