meta-flow: Correctly set destination MAC in mf_set_flow_value().
[sliver-openvswitch.git] / lib / ofp-print.c
index 2311092..fe852b4 100644 (file)
@@ -140,7 +140,7 @@ ofp_print_packet_in(struct ds *string, const struct ofp_packet_in *op,
         struct ofpbuf packet;
 
         ofpbuf_use_const(&packet, op->data, data_len);
-        flow_extract(&packet, 0, ntohs(op->in_port), &flow);
+        flow_extract(&packet, 0, 0, ntohs(op->in_port), &flow);
         flow_format(string, &flow);
         ds_put_char(string, '\n');
     }
@@ -338,6 +338,10 @@ ofp_print_action(struct ds *s, const union ofp_action *a,
         learn_format((const struct nx_action_learn *) a, s);
         break;
 
+    case OFPUTIL_NXAST_EXIT:
+        ds_put_cstr(s, "exit");
+        break;
+
     default:
         break;
     }
@@ -604,21 +608,9 @@ ofp_print_switch_config(struct ds *string, const struct ofp_switch_config *osc)
 
     flags = ntohs(osc->flags);
 
-    ds_put_cstr(string, " frags=");
-    switch (flags & OFPC_FRAG_MASK) {
-    case OFPC_FRAG_NORMAL:
-        ds_put_cstr(string, "normal");
-        flags &= ~OFPC_FRAG_MASK;
-        break;
-    case OFPC_FRAG_DROP:
-        ds_put_cstr(string, "drop");
-        flags &= ~OFPC_FRAG_MASK;
-        break;
-    case OFPC_FRAG_REASM:
-        ds_put_cstr(string, "reassemble");
-        flags &= ~OFPC_FRAG_MASK;
-        break;
-    }
+    ds_put_format(string, " frags=%s", ofputil_frag_handling_to_string(flags));
+    flags &= ~OFPC_FRAG_MASK;
+
     if (flags) {
         ds_put_format(string, " ***unknown flags 0x%04"PRIx16"***", flags);
     }
@@ -739,9 +731,9 @@ ofp_match_to_string(const struct ofp_match *om, int verbosity)
                "%u", om->nw_tos);
     if (om->nw_proto == IPPROTO_ICMP) {
         print_wild(&f, "icmp_type=", w & OFPFW_ICMP_TYPE, verbosity,
-                   "%d", ntohs(om->icmp_type));
+                   "%d", ntohs(om->tp_src));
         print_wild(&f, "icmp_code=", w & OFPFW_ICMP_CODE, verbosity,
-                   "%d", ntohs(om->icmp_code));
+                   "%d", ntohs(om->tp_dst));
     } else {
         print_wild(&f, "tp_src=", w & OFPFW_TP_SRC, verbosity,
                    "%d", ntohs(om->tp_src));
@@ -947,15 +939,11 @@ ofp_print_error_msg(struct ds *string, const struct ofp_error_msg *oem)
         ds_put_printable(string, payload, payload_len);
         break;
 
-    case OFPET_BAD_REQUEST:
+    default:
         s = ofp_to_string(payload, payload_len, 1);
         ds_put_cstr(string, s);
         free(s);
         break;
-
-    default:
-        ds_put_hex_dump(string, payload, payload_len, 0, true);
-        break;
     }
 }
 
@@ -1053,7 +1041,9 @@ ofp_print_flow_stats_reply(struct ds *string, const struct ofp_header *oh)
         }
 
         cls_rule_format(&fs.rule, string);
-        ds_put_char(string, ' ');
+        if (string->string[string->length - 1] != ' ') {
+            ds_put_char(string, ' ');
+        }
         ofp_print_actions(string, fs.actions, fs.n_actions);
      }
 }