X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=lib%2Fnetlink.c;h=f1234ad4840dad8db21f3899a65415314f9bd50c;hb=c052da844bdf7fc2f87500f76fca529c4e3dc598;hp=3ed2f53a9e8c6a2b14e59e3ee2e6b0f30f430df8;hpb=ee913f985d470515cc018e57ea56aac3f087702f;p=openvswitch diff --git a/lib/netlink.c b/lib/netlink.c index 3ed2f53a..f1234ad4 100644 --- a/lib/netlink.c +++ b/lib/netlink.c @@ -358,6 +358,14 @@ nl_msg_next(struct ofpbuf *buffer, struct ofpbuf *msg) /* Attributes. */ +/* Returns the bits of 'nla->nla_type' that are significant for determining its + * type. */ +int +nl_attr_type(const struct nlattr *nla) +{ + return nla->nla_type & NLA_TYPE_MASK; +} + /* Returns the first byte in the payload of attribute 'nla'. */ const void * nl_attr_get(const struct nlattr *nla) @@ -539,12 +547,12 @@ nl_policy_parse(const struct ofpbuf *msg, size_t nla_offset, if (aligned_len > (char*)tail - (char*)p) { VLOG_DBG_RL(&rl, "%zu: attr %"PRIu16" aligned data len (%zu) " "> bytes left (%tu)", - offset, nla->nla_type, aligned_len, + offset, nl_attr_type(nla), aligned_len, (char*)tail - (char*)p); return false; } - type = nla->nla_type; + type = nl_attr_type(nla); if (type < n_attrs && policy[type].type != NL_A_NO_ATTR) { const struct nl_policy *e = &policy[type]; size_t min_len, max_len;