/*
- * Copyright (c) 2010, 2011, 2012, 2013, 2014 Nicira, Inc.
+ * Copyright (c) 2010, 2011, 2012, 2013, 2014, 2016, 2017, 2019 Nicira, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
#include <config.h>
#include "multipath.h"
-#include <arpa/inet.h>
-#include <inttypes.h>
#include <sys/types.h>
#include <netinet/in.h>
+#include <arpa/inet.h>
+#include <inttypes.h>
#include "colors.h"
-#include "dynamic-string.h"
#include "nx-match.h"
-#include "ofp-actions.h"
-#include "ofp-util.h"
-#include "openvswitch/ofp-errors.h"
#include "openflow/nicira-ext.h"
+#include "openvswitch/dynamic-string.h"
+#include "openvswitch/ofp-actions.h"
+#include "openvswitch/ofp-errors.h"
#include "packets.h"
+#include "util.h"
\f
/* Checks that 'mp' is valid on flow. Returns 0 if it is valid, otherwise an
* OFPERR_*. */
enum ofperr
multipath_check(const struct ofpact_multipath *mp,
- const struct flow *flow)
+ const struct match *match)
{
- return mf_check_dst(&mp->dst, flow);
+ return mf_check_dst(&mp->dst, match);
}
\f
/* multipath_execute(). */
}
\f
/* Parses 's_' as a set of arguments to the "multipath" action and initializes
- * 'mp' accordingly. ovs-ofctl(8) describes the format parsed.
+ * 'mp' accordingly. ovs-actions(7) describes the format parsed.
*
* Returns NULL if successful, otherwise a malloc()'d string describing the
* error. The caller is responsible for freeing the returned string.*/
mp->fields = NX_HASH_FIELDS_SYMMETRIC_L3L4;
} else if (!strcasecmp(fields, "symmetric_l3l4+udp")) {
mp->fields = NX_HASH_FIELDS_SYMMETRIC_L3L4_UDP;
+ } else if (!strcasecmp(fields, "nw_src")) {
+ mp->fields = NX_HASH_FIELDS_NW_SRC;
+ } else if (!strcasecmp(fields, "nw_dst")) {
+ mp->fields = NX_HASH_FIELDS_NW_DST;
+ } else if (!strcasecmp(fields, "symmetric_l3")) {
+ mp->fields = NX_HASH_FIELDS_SYMMETRIC_L3;
} else {
return xasprintf("%s: unknown fields `%s'", s_, fields);
}
}
if (!mf_nxm_header(mp->dst.field->id)) {
return xasprintf("%s: experimenter OXM field '%s' not supported",
- s, dst);
+ s_, dst);
}
if (mp->dst.n_bits < 16 && n_links > (1u << mp->dst.n_bits)) {
return xasprintf("%s: %d-bit destination field has %u possible "
}
/* Parses 's_' as a set of arguments to the "multipath" action and initializes
- * 'mp' accordingly. ovs-ofctl(8) describes the format parsed.
+ * 'mp' accordingly. ovs-actions(7) describes the format parsed.
*
* Returns NULL if successful, otherwise a malloc()'d string describing the
* error. The caller is responsible for freeing the returned string. */
return error;
}
-/* Appends a description of 'mp' to 's', in the format that ovs-ofctl(8)
+/* Appends a description of 'mp' to 's', in the format that ovs-actions(7)
* describes. */
void
multipath_format(const struct ofpact_multipath *mp, struct ds *s)
algorithm = "<unknown>";
}
- ds_put_format(s, "%smultipath(%s%s,%"PRIu16",%s,%d,%"PRIu16",",
+ ds_put_format(s, "%smultipath(%s%s,%"PRIu16",%s,%d,%"PRIu32",",
colors.paren, colors.end, fields, mp->basis, algorithm,
mp->max_link + 1, mp->arg);
mf_format_subfield(&mp->dst, s);