From 01fcdfc6b3223d186c35d9b4e188c9e104887f4c Mon Sep 17 00:00:00 2001 From: Jesse Gross Date: Thu, 1 Aug 2013 16:17:47 -0700 Subject: [PATCH] odp-util: Always serialize tunnel mask attributes. 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 Acked-by: Andy Zhou --- datapath/flow.c | 18 ++++++++++-------- lib/odp-util.c | 2 +- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/datapath/flow.c b/datapath/flow.c index ebe8fb329..e259e6dad 100644 --- a/datapath/flow.c +++ b/datapath/flow.c @@ -1248,14 +1248,16 @@ int ipv4_tun_from_nlattr(const struct nlattr *attr, return -EINVAL; } - if (!match->key->tun_key.ipv4_dst) { - OVS_NLERR("IPv4 tunnel destination address is zero.\n"); - return -EINVAL; - } + if (!is_mask) { + if (!match->key->tun_key.ipv4_dst) { + OVS_NLERR("IPv4 tunnel destination address is zero.\n"); + return -EINVAL; + } - if (!ttl) { - OVS_NLERR("IPv4 tunnel TTL not specified.\n"); - return -EINVAL; + if (!ttl) { + OVS_NLERR("IPv4 tunnel TTL not specified.\n"); + return -EINVAL; + } } return 0; @@ -1701,7 +1703,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 daf0c5c42..50b7e81ae 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); } -- 2.47.0