summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorThomas Graf <tgraf@suug.ch>2007-09-12 14:44:36 +0200
committerDavid S. Miller <davem@sunset.davemloft.net>2007-10-10 16:49:16 -0700
commit8f4c1f9b049df3be11090f1c2c4738700302acae (patch)
tree51271d32096e4419173072d120176b4428e52a11 /include
parent9d5010db7ecfd6ec00119d3b185c4c0cd3265167 (diff)
downloadop-kernel-dev-8f4c1f9b049df3be11090f1c2c4738700302acae.zip
op-kernel-dev-8f4c1f9b049df3be11090f1c2c4738700302acae.tar.gz
[NETLINK]: Introduce nested and byteorder flag to netlink attribute
This change allows the generic attribute interface to be used within the netfilter subsystem where this flag was initially introduced. The byte-order flag is yet unused, it's intended use is to allow automatic byte order convertions for all atomic types. Signed-off-by: Thomas Graf <tgraf@suug.ch> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include')
-rw-r--r--include/linux/netlink.h14
-rw-r--r--include/net/netlink.h9
2 files changed, 23 insertions, 0 deletions
diff --git a/include/linux/netlink.h b/include/linux/netlink.h
index d2843ae..e638256 100644
--- a/include/linux/netlink.h
+++ b/include/linux/netlink.h
@@ -131,6 +131,20 @@ struct nlattr
__u16 nla_type;
};
+/*
+ * nla_type (16 bits)
+ * +---+---+-------------------------------+
+ * | N | O | Attribute Type |
+ * +---+---+-------------------------------+
+ * N := Carries nested attributes
+ * O := Payload stored in network byte order
+ *
+ * Note: The N and O flag are mutually exclusive.
+ */
+#define NLA_F_NESTED (1 << 15)
+#define NLA_F_NET_BYTEORDER (1 << 14)
+#define NLA_TYPE_MASK ~(NLA_F_NESTED | NLA_F_NET_BYTEORDER)
+
#define NLA_ALIGNTO 4
#define NLA_ALIGN(len) (((len) + NLA_ALIGNTO - 1) & ~(NLA_ALIGNTO - 1))
#define NLA_HDRLEN ((int) NLA_ALIGN(sizeof(struct nlattr)))
diff --git a/include/net/netlink.h b/include/net/netlink.h
index d7b824b..695e613 100644
--- a/include/net/netlink.h
+++ b/include/net/netlink.h
@@ -667,6 +667,15 @@ static inline int nla_padlen(int payload)
}
/**
+ * nla_type - attribute type
+ * @nla: netlink attribute
+ */
+static inline int nla_type(const struct nlattr *nla)
+{
+ return nla->nla_type & NLA_TYPE_MASK;
+}
+
+/**
* nla_data - head of payload
* @nla: netlink attribute
*/
OpenPOWER on IntegriCloud