diff options
author | Harald Welte <laforge@netfilter.org> | 2005-10-10 23:52:19 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2005-10-10 23:52:19 -0400 |
commit | ebe0bbf06c9e03613bdcb6b5a704595a9344b7ff (patch) | |
tree | 33453cb2cd33095e3a226d0866bdfe1019473646 /net | |
parent | f40863cec87464f3f4ec3a6c00e3fda3bbb0c91b (diff) |
[NETFILTER] nfnetlink: use highest bit of nfa_type to indicate nested TLV
As Henrik Nordstrom pointed out, all our efforts with "split endian" (i.e.
host byte order tags, net byte order values) are useless, unless a parser
can determine whether an attribute is nested or not.
This patch steals the highest bit of nfattr.nfa_type to indicate whether
the data payload contains a nested nfattr (1) or not (0).
This will break userspace compatibility, but luckily no kernel with
nfnetlink was released so far.
Signed-off-by: Harald Welte <laforge@netfilter.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net')
-rw-r--r-- | net/netfilter/nfnetlink.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/net/netfilter/nfnetlink.c b/net/netfilter/nfnetlink.c index 1caaca06f698..4bc27a6334c1 100644 --- a/net/netfilter/nfnetlink.c +++ b/net/netfilter/nfnetlink.c | |||
@@ -133,7 +133,7 @@ int nfattr_parse(struct nfattr *tb[], int maxattr, struct nfattr *nfa, int len) | |||
133 | memset(tb, 0, sizeof(struct nfattr *) * maxattr); | 133 | memset(tb, 0, sizeof(struct nfattr *) * maxattr); |
134 | 134 | ||
135 | while (NFA_OK(nfa, len)) { | 135 | while (NFA_OK(nfa, len)) { |
136 | unsigned flavor = nfa->nfa_type; | 136 | unsigned flavor = NFA_TYPE(nfa); |
137 | if (flavor && flavor <= maxattr) | 137 | if (flavor && flavor <= maxattr) |
138 | tb[flavor-1] = nfa; | 138 | tb[flavor-1] = nfa; |
139 | nfa = NFA_NEXT(nfa, len); | 139 | nfa = NFA_NEXT(nfa, len); |
@@ -177,7 +177,7 @@ nfnetlink_check_attributes(struct nfnetlink_subsystem *subsys, | |||
177 | int attrlen = nlh->nlmsg_len - NLMSG_ALIGN(min_len); | 177 | int attrlen = nlh->nlmsg_len - NLMSG_ALIGN(min_len); |
178 | 178 | ||
179 | while (NFA_OK(attr, attrlen)) { | 179 | while (NFA_OK(attr, attrlen)) { |
180 | unsigned flavor = attr->nfa_type; | 180 | unsigned flavor = NFA_TYPE(attr); |
181 | if (flavor) { | 181 | if (flavor) { |
182 | if (flavor > attr_count) | 182 | if (flavor > attr_count) |
183 | return -EINVAL; | 183 | return -EINVAL; |