ovs-ofctl.8: Clarify conntrack documentation.
[cascardo/ovs.git] / lib / learn.c
index 8ff1e0a..66201d5 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * 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.
@@ -148,8 +148,7 @@ learn_execute(const struct ofpact_learn *learn, const struct flow *flow,
         case NX_LEARN_DST_OUTPUT:
             if (spec->n_bits <= 16
                 || is_all_zeros(value.u8, sizeof value - 2)) {
-                ovs_be16 *last_be16 = &value.be16[ARRAY_SIZE(value.be16) - 1];
-                ofp_port_t port = u16_to_ofp(ntohs(*last_be16));
+                ofp_port_t port = u16_to_ofp(ntohll(value.integer));
 
                 if (ofp_to_u16(port) < ofp_to_u16(OFPP_MAX)
                     || port == OFPP_IN_PORT
@@ -162,7 +161,6 @@ learn_execute(const struct ofpact_learn *learn, const struct flow *flow,
             break;
         }
     }
-    ofpact_pad(ofpacts);
 
     fm->ofpacts = ofpacts->data;
     fm->ofpacts_len = ofpacts->size;
@@ -197,7 +195,7 @@ learn_parse_load_immediate(const char *s, struct ofpact_learn_spec *spec)
 
     err = parse_int_string(s, imm.u8, sizeof imm.u8, (char **) &s);
     if (err) {
-        return xasprintf("%s: bad hex digit in value", full_s);
+        return xasprintf("%s: too many bits in immediate value", full_s);
     }
 
     if (strncmp(s, "->", 2)) {
@@ -381,7 +379,7 @@ learn_parse__(char *orig, char *arg, struct ofpbuf *ofpacts)
             }
         }
     }
-    ofpact_update_len(ofpacts, &learn->ofpact);
+    ofpact_finish(ofpacts, &learn->ofpact);
 
     return NULL;
 }