diff options
author | Thomas Graf <tgraf@suug.ch> | 2007-09-12 08:44:36 -0400 |
---|---|---|
committer | David S. Miller <davem@sunset.davemloft.net> | 2007-10-10 19:49:16 -0400 |
commit | 8f4c1f9b049df3be11090f1c2c4738700302acae (patch) | |
tree | 51271d32096e4419173072d120176b4428e52a11 /net/netlink/attr.c | |
parent | 9d5010db7ecfd6ec00119d3b185c4c0cd3265167 (diff) |
[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 'net/netlink/attr.c')
-rw-r--r-- | net/netlink/attr.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/net/netlink/attr.c b/net/netlink/attr.c index e4d7bed99c2e..ec39d12c2423 100644 --- a/net/netlink/attr.c +++ b/net/netlink/attr.c | |||
@@ -27,12 +27,12 @@ static int validate_nla(struct nlattr *nla, int maxtype, | |||
27 | const struct nla_policy *policy) | 27 | const struct nla_policy *policy) |
28 | { | 28 | { |
29 | const struct nla_policy *pt; | 29 | const struct nla_policy *pt; |
30 | int minlen = 0, attrlen = nla_len(nla); | 30 | int minlen = 0, attrlen = nla_len(nla), type = nla_type(nla); |
31 | 31 | ||
32 | if (nla->nla_type <= 0 || nla->nla_type > maxtype) | 32 | if (type <= 0 || type > maxtype) |
33 | return 0; | 33 | return 0; |
34 | 34 | ||
35 | pt = &policy[nla->nla_type]; | 35 | pt = &policy[type]; |
36 | 36 | ||
37 | BUG_ON(pt->type > NLA_TYPE_MAX); | 37 | BUG_ON(pt->type > NLA_TYPE_MAX); |
38 | 38 | ||
@@ -149,7 +149,7 @@ int nla_parse(struct nlattr *tb[], int maxtype, struct nlattr *head, int len, | |||
149 | memset(tb, 0, sizeof(struct nlattr *) * (maxtype + 1)); | 149 | memset(tb, 0, sizeof(struct nlattr *) * (maxtype + 1)); |
150 | 150 | ||
151 | nla_for_each_attr(nla, head, len, rem) { | 151 | nla_for_each_attr(nla, head, len, rem) { |
152 | u16 type = nla->nla_type; | 152 | u16 type = nla_type(nla); |
153 | 153 | ||
154 | if (type > 0 && type <= maxtype) { | 154 | if (type > 0 && type <= maxtype) { |
155 | if (policy) { | 155 | if (policy) { |
@@ -185,7 +185,7 @@ struct nlattr *nla_find(struct nlattr *head, int len, int attrtype) | |||
185 | int rem; | 185 | int rem; |
186 | 186 | ||
187 | nla_for_each_attr(nla, head, len, rem) | 187 | nla_for_each_attr(nla, head, len, rem) |
188 | if (nla->nla_type == attrtype) | 188 | if (nla_type(nla) == attrtype) |
189 | return nla; | 189 | return nla; |
190 | 190 | ||
191 | return NULL; | 191 | return NULL; |