lib: Replace IP_TYPE_ references with IPPROTO_.
[cascardo/ovs.git] / lib / ofp-print.c
index 9d1b3b0..73820e8 100644 (file)
@@ -663,6 +663,22 @@ ofp_print_switch_config(struct ds *string, const struct ofp_switch_config *osc)
     uint16_t flags;
 
     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;
+    }
     if (flags) {
         ds_put_format(string, " ***unknown flags 0x%04"PRIx16"***", flags);
     }
@@ -733,11 +749,11 @@ ofp_match_to_string(const struct ofp_match *om, int verbosity)
         if (om->dl_type == htons(ETH_TYPE_IP)) {
             if (!(w & OFPFW_NW_PROTO)) {
                 skip_proto = true;
-                if (om->nw_proto == IP_TYPE_ICMP) {
+                if (om->nw_proto == IPPROTO_ICMP) {
                     ds_put_cstr(&f, "icmp,");
-                } else if (om->nw_proto == IP_TYPE_TCP) {
+                } else if (om->nw_proto == IPPROTO_TCP) {
                     ds_put_cstr(&f, "tcp,");
-                } else if (om->nw_proto == IP_TYPE_UDP) {
+                } else if (om->nw_proto == IPPROTO_UDP) {
                     ds_put_cstr(&f, "udp,");
                 } else {
                     ds_put_cstr(&f, "ip,");
@@ -784,7 +800,7 @@ ofp_match_to_string(const struct ofp_match *om, int verbosity)
     }
     print_wild(&f, "nw_tos=", w & OFPFW_NW_TOS, verbosity,
                "%u", om->nw_tos);
-    if (om->nw_proto == IP_TYPE_ICMP) {
+    if (om->nw_proto == IPPROTO_ICMP) {
         print_wild(&f, "icmp_type=", w & OFPFW_ICMP_TYPE, verbosity,
                    "%d", ntohs(om->icmp_type));
         print_wild(&f, "icmp_code=", w & OFPFW_ICMP_CODE, verbosity,
@@ -912,6 +928,7 @@ ofp_print_flow_removed(struct ds *string, const struct ofp_header *oh)
         return;
     }
 
+    ds_put_char(string, ' ');
     cls_rule_format(&fr.rule, string);
 
     ds_put_cstr(string, " reason=");
@@ -1022,6 +1039,7 @@ ofp_print_ofpst_desc_reply(struct ds *string, const struct ofp_header *oh)
 {
     const struct ofp_desc_stats *ods = ofputil_stats_body(oh);
 
+    ds_put_char(string, '\n');
     ds_put_format(string, "Manufacturer: %.*s\n",
             (int) sizeof ods->mfr_desc, ods->mfr_desc);
     ds_put_format(string, "Hardware: %.*s\n",
@@ -1243,7 +1261,7 @@ static void
 ofp_print_ofpst_port_request(struct ds *string, const struct ofp_header *oh)
 {
     const struct ofp_port_stats_request *psr = ofputil_stats_body(oh);
-    ds_put_format(string, "port_no=%"PRIu16, ntohs(psr->port_no));
+    ds_put_format(string, " port_no=%"PRIu16, ntohs(psr->port_no));
 }
 
 static void
@@ -1401,8 +1419,8 @@ ofp_print_nxt_status_message(struct ds *string, const struct ofp_header *oh)
     struct ofpbuf b;
 
     ofpbuf_use_const(&b, oh, ntohs(oh->length));
-    ofpbuf_pull(&b, sizeof *oh);
-    ds_put_char(string, '"');
+    ofpbuf_pull(&b, sizeof(struct nicira_header));
+    ds_put_cstr(string, " \"");
     ds_put_printable(string, b.data, b.size);
     ds_put_char(string, '"');
 }