[ovs-dev] [PATCH] odp-util: Parse ipv4_tunnel key.
Pravin B Shelar
pshelar at nicira.com
Thu Nov 1 19:47:47 UTC 2012
Following patch fixes `ovs-appctl ofproto/trace` command with
ipv4_tunnel key in flow.
Bug #13785
Signed-off-by: Pravin B Shelar <pshelar at nicira.com>
---
lib/odp-util.c | 25 +++++++++++++++++++++++++
1 file changed, 25 insertions(+)
diff --git a/lib/odp-util.c b/lib/odp-util.c
index 9ed17ed..ce37061 100644
--- a/lib/odp-util.c
+++ b/lib/odp-util.c
@@ -915,6 +915,31 @@ parse_odp_key_attr(const char *s, const struct simap *port_names,
{
char tun_id_s[32];
int n = -1;
+ int ipv4_tos;
+ int ipv4_ttl;
+
+ struct ovs_key_ipv4_tunnel tun_key;
+ if (sscanf(s, "ipv4_tunnel(tun_id=%31[x0123456789abcdefABCDEF],"
+ "flags=%i,src="IP_SCAN_FMT",dst="IP_SCAN_FMT","
+ "tos=%i,ttl=%i)%n",
+ tun_id_s, &tun_key.tun_flags,
+ IP_SCAN_ARGS(&tun_key.ipv4_src), IP_SCAN_ARGS(&tun_key.ipv4_dst),
+ &ipv4_tos, &ipv4_ttl,
+ &n) > 0 && n > 0) {
+ tun_key.tun_id = htonll(strtoull(tun_id_s, NULL, 0));
+ 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;
+ }
+ }
+
+
+ {
+ char tun_id_s[32];
+ int n = -1;
if (sscanf(s, "tun_id(%31[x0123456789abcdefABCDEF])%n",
tun_id_s, &n) > 0 && n > 0) {
--
1.7.10
More information about the dev
mailing list