ofp-util: Actually map vendor codes to IDs correctly.
[sliver-openvswitch.git] / lib / ofp-util.c
index 5f33876..8f1625c 100644 (file)
@@ -125,10 +125,10 @@ put_openflow_xid(size_t openflow_len, uint8_t type, uint32_t xid,
 /* Updates the 'length' field of the OpenFlow message in 'buffer' to
  * 'buffer->size'. */
 void
-update_openflow_length(struct ofpbuf *buffer) 
+update_openflow_length(struct ofpbuf *buffer)
 {
     struct ofp_header *oh = ofpbuf_at_assert(buffer, 0, sizeof *oh);
-    oh->length = htons(buffer->size); 
+    oh->length = htons(buffer->size);
 }
 
 struct ofpbuf *
@@ -303,7 +303,7 @@ make_echo_reply(const struct ofp_header *rq)
 }
 
 static int
-check_message_type(uint8_t got_type, uint8_t want_type) 
+check_message_type(uint8_t got_type, uint8_t want_type)
 {
     if (got_type != want_type) {
         char *want_type_name = ofp_message_type_to_string(want_type);
@@ -438,6 +438,21 @@ check_ofp_packet_out(const struct ofp_header *oh, struct ofpbuf *data,
     return 0;
 }
 
+struct ofpbuf *
+make_nxt_flow_mod_table_id(bool enable)
+{
+    struct nxt_flow_mod_table_id *flow_mod_table_id;
+    struct ofpbuf *buffer;
+
+    flow_mod_table_id = make_openflow(sizeof *flow_mod_table_id, OFPT_VENDOR,
+                                      &buffer);
+
+    flow_mod_table_id->vendor = htonl(NX_VENDOR_ID);
+    flow_mod_table_id->subtype = htonl(NXT_FLOW_MOD_TABLE_ID);
+    flow_mod_table_id->set = enable;
+    return buffer;
+}
+
 const struct ofp_flow_stats *
 flow_stats_first(struct flow_stats_iterator *iter,
                  const struct ofp_stats_reply *osr)
@@ -564,6 +579,9 @@ check_nicira_action(const union ofp_action *a, unsigned int len)
     switch (ntohs(nah->subtype)) {
     case NXAST_RESUBMIT:
     case NXAST_SET_TUNNEL:
+    case NXAST_DROP_SPOOFED_ARP:
+    case NXAST_SET_QUEUE:
+    case NXAST_POP_QUEUE:
         return check_action_exact_len(a, len, 16);
     default:
         return ofp_mkerr(OFPET_BAD_ACTION, OFPBAC_BAD_VENDOR_TYPE);
@@ -827,6 +845,8 @@ vendor_code_to_id(uint8_t code)
 {
     switch (code) {
 #define OFPUTIL_VENDOR(NAME, VENDOR_ID) case NAME: return VENDOR_ID;
+        OFPUTIL_VENDORS
+#undef OFPUTIL_VENDOR
     default:
         return UINT32_MAX;
     }