A tunnel value attribute is not allowed to have an empty IP destination
address but this is legal for masks. This drops both the checks for
serializing masks and also the sanity checks on them.

Signed-off-by: Jesse Gross <je...@nicira.com>
---
 datapath/flow.c | 5 ++++-
 lib/odp-util.c  | 2 +-
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/datapath/flow.c b/datapath/flow.c
index ebe8fb3..457d123 100644
--- a/datapath/flow.c
+++ b/datapath/flow.c
@@ -1248,6 +1248,9 @@ int ipv4_tun_from_nlattr(const struct nlattr *attr,
                return -EINVAL;
        }
 
+       if (is_mask)
+               return 0;
+
        if (!match->key->tun_key.ipv4_dst) {
                OVS_NLERR("IPv4 tunnel destination address is zero.\n");
                return -EINVAL;
@@ -1701,7 +1704,7 @@ int ovs_flow_to_nlattrs(const struct sw_flow_key *swkey,
        if (nla_put_u32(skb, OVS_KEY_ATTR_PRIORITY, output->phy.priority))
                goto nla_put_failure;
 
-       if (swkey->tun_key.ipv4_dst &&
+       if ((swkey->tun_key.ipv4_dst || is_mask) &&
            ipv4_tun_to_nlattr(skb, &swkey->tun_key, &output->tun_key))
                goto nla_put_failure;
 
diff --git a/lib/odp-util.c b/lib/odp-util.c
index daf0c5c..50b7e81 100644
--- a/lib/odp-util.c
+++ b/lib/odp-util.c
@@ -2338,7 +2338,7 @@ odp_flow_key_from_flow__(struct ofpbuf *buf, const struct 
flow *data,
         nl_msg_put_u32(buf, OVS_KEY_ATTR_PRIORITY, data->skb_priority);
     }
 
-    if (flow->tunnel.ip_dst) {
+    if (flow->tunnel.ip_dst || is_mask) {
         tun_key_to_attr(buf, &data->tunnel);
     }
 
-- 
1.8.1.2

_______________________________________________
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev

Reply via email to