Cc: Kyle Mestery <kmest...@cisco.com> Signed-off-by: Simon Horman <ho...@verge.net.au>
--- v5 Add missing tun_key_s variable to parse_odp_key_attr() v4 Correct parsing of tunnel key in parse_odp_key_attr() so that it matches the out put of format_odp_key_attr() TODO: fix test suite v3 * Initial post Fix parse_odp_key_attr --- lib/odp-util.c | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/lib/odp-util.c b/lib/odp-util.c index ccd6121..a7b100b 100644 --- a/lib/odp-util.c +++ b/lib/odp-util.c @@ -925,6 +925,36 @@ parse_odp_key_attr(const char *s, const struct simap *port_names, } { + ovs_be32 ipv4_src; + ovs_be32 ipv4_dst; + unsigned long long tun_flags; + int ipv4_tos; + int ipv4_ttl; + int n = -1; + char tun_id_s[32]; + + if (sscanf(s, "ipv4_tunnel(tun_id=%31[x0123456789abcdefABCDEF]" + ",flags=%llx,src="IP_SCAN_FMT",dst="IP_SCAN_FMT + ",tos=%i,ttl=%i)%n", + tun_id_s, &tun_flags, + IP_SCAN_ARGS(&ipv4_src), IP_SCAN_ARGS(&ipv4_dst), + &ipv4_tos, &ipv4_ttl, &n) > 0 + && n > 0) { + struct ovs_key_ipv4_tunnel tun_key; + + tun_key.tun_id = htonll(strtoull(tun_id_s, NULL, 0)); + tun_key.tun_flags = tun_flags; + tun_key.ipv4_src = ipv4_src; + tun_key.ipv4_dst = ipv4_dst; + tun_key.ipv4_tos = ipv4_tos; + tun_key.ipv4_ttl = ipv4_ttl; + nl_msg_put_unspec(key, OVS_KEY_ATTR_IPV4_TUNNEL, + &tun_key, sizeof tun_key); + return n; + } + } + + { unsigned long long int in_port; int n = -1; -- 1.7.10.2.484.gcd07cc5 _______________________________________________ dev mailing list dev@openvswitch.org http://openvswitch.org/mailman/listinfo/dev