mirror of
https://github.com/openvswitch/ovs
synced 2025-08-31 06:15:47 +00:00
meta-flow: Make it simpler to expand mf_values in the future
Remove hard coded array index and make it dependent on the array size. Signed-off-by: Madhu Challa <challa@noironetworks.com> Co-authored-by: Ben Pfaff <blp@nicira.com> Signed-off-by: Ben Pfaff <blp@nicira.com>
This commit is contained in:
@@ -147,7 +147,8 @@ 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)) {
|
||||
ofp_port_t port = u16_to_ofp(ntohs(value.be16[7]));
|
||||
ovs_be16 *last_be16 = &value.be16[ARRAY_SIZE(value.be16) - 1];
|
||||
ofp_port_t port = u16_to_ofp(ntohs(*last_be16));
|
||||
|
||||
if (ofp_to_u16(port) < ofp_to_u16(OFPP_MAX)
|
||||
|| port == OFPP_IN_PORT
|
||||
@@ -209,7 +210,8 @@ learn_parse_load_immediate(const char *s, struct ofpact_learn_spec *spec)
|
||||
}
|
||||
s = arrow;
|
||||
} else {
|
||||
imm.be64[1] = htonll(strtoull(s, (char **) &s, 0));
|
||||
ovs_be64 *last_be64 = &imm.be64[ARRAY_SIZE(imm.be64) - 1];
|
||||
*last_be64 = htonll(strtoull(s, (char **) &s, 0));
|
||||
}
|
||||
|
||||
if (strncmp(s, "->", 2)) {
|
||||
|
Reference in New Issue
Block a user