Makefile.am: Clean flake8-check too.
[cascardo/ovs.git] / lib / bundle.c
index a514ebb..871a724 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2011, 2012, 2013, 2014 Nicira, Inc.
+/* Copyright (c) 2011, 2012, 2013, 2014, 2015 Nicira, Inc.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -29,7 +29,7 @@
 #include "ofp-errors.h"
 #include "ofp-util.h"
 #include "openflow/nicira-ext.h"
-#include "vlog.h"
+#include "openvswitch/vlog.h"
 
 VLOG_DEFINE_THIS_MODULE(bundle);
 
@@ -117,14 +117,14 @@ bundle_check(const struct ofpact_bundle *bundle, ofp_port_t max_ports,
 
     for (i = 0; i < bundle->n_slaves; i++) {
         ofp_port_t ofp_port = bundle->slaves[i];
-        enum ofperr error;
 
-        error = ofpact_check_output_port(ofp_port, max_ports);
-        if (error) {
-            VLOG_WARN_RL(&rl, "invalid slave %"PRIu16, ofp_port);
-            return error;
+        if (ofp_port != OFPP_NONE) {
+            enum ofperr error = ofpact_check_output_port(ofp_port, max_ports);
+            if (error) {
+                VLOG_WARN_RL(&rl, "invalid slave %"PRIu16, ofp_port);
+                return error;
+            }
         }
-
         /* Controller slaves are unsupported due to the lack of a max_len
          * argument. This may or may not change in the future.  There doesn't
          * seem to be a real-world use-case for supporting it. */
@@ -142,7 +142,7 @@ bundle_check(const struct ofpact_bundle *bundle, ofp_port_t max_ports,
  *
  * Returns NULL if successful, otherwise a malloc()'d string describing the
  * error.  The caller is responsible for freeing the returned string.*/
-static char * WARN_UNUSED_RESULT
+static char * OVS_WARN_UNUSED_RESULT
 bundle_parse__(const char *s, char **save_ptr,
                const char *fields, const char *basis, const char *algorithm,
                const char *slave_type, const char *dst,
@@ -175,10 +175,10 @@ bundle_parse__(const char *s, char **save_ptr,
         }
         ofpbuf_put(ofpacts, &slave_port, sizeof slave_port);
 
-        bundle = ofpacts->frame;
+        bundle = ofpacts->header;
         bundle->n_slaves++;
     }
-    ofpact_update_len(ofpacts, &bundle->ofpact);
+    ofpact_finish(ofpacts, &bundle->ofpact);
 
     bundle->basis = atoi(basis);
 
@@ -186,6 +186,10 @@ bundle_parse__(const char *s, char **save_ptr,
         bundle->fields = NX_HASH_FIELDS_ETH_SRC;
     } else if (!strcasecmp(fields, "symmetric_l4")) {
         bundle->fields = NX_HASH_FIELDS_SYMMETRIC_L4;
+    } else if (!strcasecmp(fields, "symmetric_l3l4")) {
+        bundle->fields = NX_HASH_FIELDS_SYMMETRIC_L3L4;
+    } else if (!strcasecmp(fields, "symmetric_l3l4+udp")) {
+        bundle->fields = NX_HASH_FIELDS_SYMMETRIC_L3L4_UDP;
     } else {
         return xasprintf("%s: unknown fields `%s'", s, fields);
     }
@@ -207,6 +211,11 @@ bundle_parse__(const char *s, char **save_ptr,
         if (error) {
             return error;
         }
+
+        if (!mf_nxm_header(bundle->dst.field->id)) {
+            return xasprintf("%s: experimenter OXM field '%s' not supported",
+                             s, dst);
+        }
     }
 
     return NULL;
@@ -217,7 +226,7 @@ bundle_parse__(const char *s, char **save_ptr,
  *
  * Returns NULL if successful, otherwise a malloc()'d string describing the
  * error.  The caller is responsible for freeing the returned string. */
-char * WARN_UNUSED_RESULT
+char * OVS_WARN_UNUSED_RESULT
 bundle_parse(const char *s, struct ofpbuf *ofpacts)
 {
     char *fields, *basis, *algorithm, *slave_type, *slave_delim;
@@ -244,7 +253,7 @@ bundle_parse(const char *s, struct ofpbuf *ofpacts)
  *
  * Returns NULL if successful, otherwise a malloc()'d string describing the
  * error.  The caller is responsible for freeing the returned string.*/
-char * WARN_UNUSED_RESULT
+char * OVS_WARN_UNUSED_RESULT
 bundle_parse_load(const char *s, struct ofpbuf *ofpacts)
 {
     char *fields, *basis, *algorithm, *slave_type, *dst, *slave_delim;