diff options
author | Ben Pfaff <blp@nicira.com> | 2011-07-20 09:50:37 -0700 |
---|---|---|
committer | Ben Pfaff <blp@nicira.com> | 2011-07-20 09:59:08 -0700 |
commit | 8815f11cd2fc1ec08c441a020caa30a8844fa16b (patch) | |
tree | 92cf844e73c1597d2d75fa8290bd06f45506c463 /lib/bundle.c | |
parent | 150a9f153b27a0d4b67388bd60d619dc78fa22ce (diff) | |
download | openvswitch-8815f11cd2fc1ec08c441a020caa30a8844fa16b.tar.gz |
bundle: Treat slave_type properly as 32-bit value.
Found by sparse.
Diffstat (limited to 'lib/bundle.c')
-rw-r--r-- | lib/bundle.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/lib/bundle.c b/lib/bundle.c index 0b0e3617d..996955f62 100644 --- a/lib/bundle.c +++ b/lib/bundle.c @@ -69,7 +69,8 @@ int bundle_check(const struct nx_action_bundle *nab, int max_ports) { static struct vlog_rate_limit rl = VLOG_RATE_LIMIT_INIT(1, 5); - uint16_t n_slaves, fields, algorithm, slave_type, subtype; + uint16_t n_slaves, fields, algorithm, subtype; + uint32_t slave_type; size_t slaves_size, i; int error; @@ -77,7 +78,7 @@ bundle_check(const struct nx_action_bundle *nab, int max_ports) n_slaves = ntohs(nab->n_slaves); fields = ntohs(nab->fields); algorithm = ntohs(nab->algorithm); - slave_type = ntohs(nab->slave_type); + slave_type = ntohl(nab->slave_type); slaves_size = ntohs(nab->len) - sizeof *nab; error = ofp_mkerr(OFPET_BAD_ACTION, OFPBAC_BAD_ARGUMENT); @@ -204,7 +205,7 @@ bundle_parse(struct ofpbuf *b, const char *s) } if (!strcasecmp(slave_type, "ofport")) { - nab->slave_type = htons(NXM_OF_IN_PORT); + nab->slave_type = htonl(NXM_OF_IN_PORT); } else { ovs_fatal(0, "%s: unknown slave_type `%s'", s, slave_type); } @@ -233,7 +234,7 @@ bundle_format(const struct nx_action_bundle *nab, struct ds *s) algorithm = "<unknown>"; } - switch (ntohs(nab->slave_type)) { + switch (ntohl(nab->slave_type)) { case NXM_OF_IN_PORT: slave_type = "ofport"; break; |