mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-29 11:11:45 -04:00
[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 <[email protected]> Signed-off-by: David S. Miller <[email protected]>
This commit is contained in:
parent
9d5010db7e
commit
8f4c1f9b04
7 changed files with 38 additions and 15 deletions
|
|
@ -27,12 +27,12 @@ static int validate_nla(struct nlattr *nla, int maxtype,
|
|||
const struct nla_policy *policy)
|
||||
{
|
||||
const struct nla_policy *pt;
|
||||
int minlen = 0, attrlen = nla_len(nla);
|
||||
int minlen = 0, attrlen = nla_len(nla), type = nla_type(nla);
|
||||
|
||||
if (nla->nla_type <= 0 || nla->nla_type > maxtype)
|
||||
if (type <= 0 || type > maxtype)
|
||||
return 0;
|
||||
|
||||
pt = &policy[nla->nla_type];
|
||||
pt = &policy[type];
|
||||
|
||||
BUG_ON(pt->type > NLA_TYPE_MAX);
|
||||
|
||||
|
|
@ -149,7 +149,7 @@ int nla_parse(struct nlattr *tb[], int maxtype, struct nlattr *head, int len,
|
|||
memset(tb, 0, sizeof(struct nlattr *) * (maxtype + 1));
|
||||
|
||||
nla_for_each_attr(nla, head, len, rem) {
|
||||
u16 type = nla->nla_type;
|
||||
u16 type = nla_type(nla);
|
||||
|
||||
if (type > 0 && type <= maxtype) {
|
||||
if (policy) {
|
||||
|
|
@ -185,7 +185,7 @@ struct nlattr *nla_find(struct nlattr *head, int len, int attrtype)
|
|||
int rem;
|
||||
|
||||
nla_for_each_attr(nla, head, len, rem)
|
||||
if (nla->nla_type == attrtype)
|
||||
if (nla_type(nla) == attrtype)
|
||||
return nla;
|
||||
|
||||
return NULL;
|
||||
|
|
|
|||
Loading…
Reference in a new issue