dpif-linux: Fix build with certain 64-bit kernel/userspace combinations.
[openvswitch] / lib / netlink.h
index 0bd2c41e60357df54dbda65aae4a34c71797420e..2d3457167a819f10b5111b7769069c90cd5ab1f7 100644 (file)
@@ -124,6 +124,12 @@ nl_attr_is_valid(const struct nlattr *nla, size_t maxlen)
          (LEFT) > 0;                                                    \
          (LEFT) -= NLA_ALIGN((ITER)->nla_len), (ITER) = nl_attr_next(ITER))
 
+/* These variants are convenient for iterating nested attributes. */
+#define NL_NESTED_FOR_EACH(ITER, LEFT, A)                               \
+    NL_ATTR_FOR_EACH(ITER, LEFT, nl_attr_get(A), nl_attr_get_size(A))
+#define NL_NESTED_FOR_EACH_UNSAFE(ITER, LEFT, A)                        \
+    NL_ATTR_FOR_EACH_UNSAFE(ITER, LEFT, nl_attr_get(A), nl_attr_get_size(A))
+
 /* Netlink attribute parsing. */
 int nl_attr_type(const struct nlattr *);
 const void *nl_attr_get(const struct nlattr *);
@@ -160,5 +166,7 @@ bool nl_parse_nested(const struct nlattr *, const struct nl_policy[],
 const struct nlattr *nl_attr_find(const struct ofpbuf *, size_t hdr_len,
                                   uint16_t type);
 const struct nlattr *nl_attr_find_nested(const struct nlattr *, uint16_t type);
+const struct nlattr *nl_attr_find__(const struct nlattr *attrs, size_t size,
+                                    uint16_t type);
 
 #endif /* netlink.h */