ofp-util: Add OFP_ACTION_ALIGN macro to header.
[sliver-openvswitch.git] / lib / ofp-print.c
index 569a70a..87ae185 100644 (file)
 #include <stdlib.h>
 #include <ctype.h>
 
+#include "byte-order.h"
 #include "compiler.h"
 #include "dynamic-string.h"
 #include "flow.h"
+#include "ofp-util.h"
 #include "ofpbuf.h"
 #include "openflow/openflow.h"
 #include "openflow/nicira-ext.h"
 #include "packets.h"
 #include "pcap.h"
 #include "util.h"
-#include "xtoxll.h"
 
 static void ofp_print_port_name(struct ds *string, uint16_t port);
 static void ofp_print_queue_name(struct ds *string, uint32_t port);
@@ -130,7 +131,7 @@ ofp_packet_in(struct ds *string, const void *oh, size_t len, int verbosity)
     ds_put_char(string, '\n');
 
     if (verbosity > 0) {
-        flow_t flow;
+        struct flow flow;
         struct ofpbuf packet;
         struct ofp_match match;
         packet.data = (void *) op->data;
@@ -205,6 +206,17 @@ ofp_print_nx_action(struct ds *string, const struct nx_action_header *nah)
         ds_put_cstr(string, "drop_spoofed_arp");
         break;
 
+    case NXAST_SET_QUEUE: {
+        const struct nx_action_set_queue *nasq =
+                                            (struct nx_action_set_queue *)nah;
+        ds_put_format(string, "set_queue:%u", ntohl(nasq->queue_id));
+        break;
+    }
+
+    case NXAST_POP_QUEUE:
+        ds_put_cstr(string, "pop_queue");
+        break;
+
     default:
         ds_put_format(string, "***unknown Nicira action:%d***",
                       ntohs(nah->subtype));
@@ -283,10 +295,10 @@ ofp_print_action(struct ds *string, const struct ofp_action_header *ah,
         return -1;
     }
 
-    if ((len % 8) != 0) {
+    if ((len % OFP_ACTION_ALIGN) != 0) {
         ds_put_format(string,
-                "***action %"PRIu16" length not a multiple of 8***\n",
-                type);
+                      "***action %"PRIu16" length not a multiple of %d***\n",
+                      type, OFP_ACTION_ALIGN);
         return -1;
     }
 
@@ -726,10 +738,10 @@ ofp_match_to_string(const struct ofp_match *om, int verbosity)
         } else {
             print_wild(&f, "nw_proto=", w & OFPFW_NW_PROTO, verbosity,
                        "%u", om->nw_proto);
-            print_wild(&f, "nw_tos=", w & OFPFW_NW_TOS, verbosity,
-                       "%u", om->nw_tos);
         }
     }
+    print_wild(&f, "nw_tos=", w & OFPFW_NW_TOS, verbosity,
+               "%u", om->nw_tos);
     if (om->nw_proto == IP_TYPE_ICMP) {
         print_wild(&f, "icmp_type=", w & OFPFW_ICMP_TYPE, verbosity,
                    "%d", ntohs(om->icmp_type));