Skip to content

Commit

Permalink
lib/tc: Fix sparse warnings.
Browse files Browse the repository at this point in the history
"sparse" complains with the warning 'incorrect type in argument 1
(different base types)' in function nl_parse_flower_ip when parsing a key
flag and in function nl_msg_put_flower_options when writing the key
flag. Fix this by using network byte order when reading and writing key
flags to netlink messages.

Fixes: 83e8660 ("netdev-tc-offloads: Add support for IP fragmentation")
Signed-off-by: Ian Stokes <ian.stokes@intel.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Roi Dayan <roid@mellanox.com>
  • Loading branch information
istokes authored and blp committed Mar 31, 2018
1 parent 45a60c2 commit 7e0f69b
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions lib/tc.c
Expand Up @@ -377,8 +377,9 @@ nl_parse_flower_ip(struct nlattr **attrs, struct tc_flower *flower) {
}

if (attrs[TCA_FLOWER_KEY_FLAGS_MASK]) {
key->flags = ntohl(nl_attr_get_u32(attrs[TCA_FLOWER_KEY_FLAGS]));
mask->flags = ntohl(nl_attr_get_u32(attrs[TCA_FLOWER_KEY_FLAGS_MASK]));
key->flags = ntohl(nl_attr_get_be32(attrs[TCA_FLOWER_KEY_FLAGS]));
mask->flags =
ntohl(nl_attr_get_be32(attrs[TCA_FLOWER_KEY_FLAGS_MASK]));
}

if (attrs[TCA_FLOWER_KEY_IPV4_SRC_MASK]) {
Expand Down Expand Up @@ -1503,9 +1504,9 @@ nl_msg_put_flower_options(struct ofpbuf *request, struct tc_flower *flower)
}

if (flower->mask.flags) {
nl_msg_put_u32(request, TCA_FLOWER_KEY_FLAGS,
nl_msg_put_be32(request, TCA_FLOWER_KEY_FLAGS,
htonl(flower->key.flags));
nl_msg_put_u32(request, TCA_FLOWER_KEY_FLAGS_MASK,
nl_msg_put_be32(request, TCA_FLOWER_KEY_FLAGS_MASK,
htonl(flower->mask.flags));
}

Expand Down

0 comments on commit 7e0f69b

Please sign in to comment.