Merge branch 'mainstream'
[sliver-openvswitch.git] / utilities / ovs-dpctl.c
index 2e32604..363485b 100644 (file)
@@ -16,7 +16,6 @@
 
 #include <config.h>
 #include <arpa/inet.h>
-#include <assert.h>
 #include <errno.h>
 #include <getopt.h>
 #include <inttypes.h>
@@ -843,7 +842,7 @@ sort_output_actions__(struct nlattr *first, struct nlattr *end)
     size_t bytes = (uint8_t *) end - (uint8_t *) first;
     size_t n = bytes / NL_A_U32_SIZE;
 
-    assert(bytes % NL_A_U32_SIZE == 0);
+    ovs_assert(bytes % NL_A_U32_SIZE == 0);
     qsort(first, n, NL_A_U32_SIZE, compare_output_actions);
 }
 
@@ -940,14 +939,13 @@ dpctl_normalize_actions(int argc, char *argv[])
 
     hmap_init(&actions_per_flow);
     NL_ATTR_FOR_EACH (a, left, odp_actions.data, odp_actions.size) {
-        if (nl_attr_type(a) == OVS_ACTION_ATTR_POP_VLAN) {
+        const struct ovs_action_push_vlan *push;
+        switch(nl_attr_type(a)) {
+        case OVS_ACTION_ATTR_POP_VLAN:
             flow.vlan_tci = htons(0);
             continue;
-        }
-
-        if (nl_attr_type(a) == OVS_ACTION_ATTR_PUSH_VLAN) {
-            const struct ovs_action_push_vlan *push;
 
+        case OVS_ACTION_ATTR_PUSH_VLAN:
             push = nl_attr_get_unspec(a, sizeof *push);
             flow.vlan_tci = push->vlan_tci;
             continue;
@@ -964,7 +962,7 @@ dpctl_normalize_actions(int argc, char *argv[])
     HMAP_FOR_EACH (af, hmap_node, &actions_per_flow) {
         afs[i++] = af;
     }
-    assert(i == n_afs);
+    ovs_assert(i == n_afs);
 
     qsort(afs, n_afs, sizeof *afs, compare_actions_for_flow);
 
@@ -981,6 +979,15 @@ dpctl_normalize_actions(int argc, char *argv[])
             printf("no vlan: ");
         }
 
+        if (af->flow.mpls_depth) {
+            printf("mpls(label=%"PRIu32",tc=%d,ttl=%d): ",
+                   mpls_lse_to_label(af->flow.mpls_lse),
+                   mpls_lse_to_tc(af->flow.mpls_lse),
+                   mpls_lse_to_ttl(af->flow.mpls_lse));
+        } else {
+            printf("no mpls: ");
+        }
+
         ds_clear(&s);
         format_odp_actions(&s, af->actions.data, af->actions.size);
         puts(ds_cstr(&s));