Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=ac6d141dc7d1d0eeec850d1b451dca83ce649684
Commit:     ac6d141dc7d1d0eeec850d1b451dca83ce649684
Parent:     c8e2078cfe414a99cf6f2f2f1d78c7e75392e9d4
Author:     Pablo Neira Ayuso <[EMAIL PROTECTED]>
AuthorDate: Wed Mar 14 16:45:39 2007 -0700
Committer:  David S. Miller <[EMAIL PROTECTED]>
CommitDate: Wed Apr 25 22:25:58 2007 -0700

    [NETFILTER]: nfnetlink: parse attributes with nfattr_parse in 
nfnetlink_check_attribute
    
    Use nfattr_parse to parse attributes, this patch also modifies the default
    behaviour since unknown attributes will be ignored instead of returning
    EINVAL. This ensure backward compatibility: new libraries with new
    attributes and old kernels can work.
    
    Signed-off-by: Pablo Neira Ayuso <[EMAIL PROTECTED]>
    Signed-off-by: Patrick McHardy <[EMAIL PROTECTED]>
    Signed-off-by: David S. Miller <[EMAIL PROTECTED]>
---
 net/netfilter/nfnetlink.c |   16 ++--------------
 1 files changed, 2 insertions(+), 14 deletions(-)

diff --git a/net/netfilter/nfnetlink.c b/net/netfilter/nfnetlink.c
index 9ba6aa4..dec36ab 100644
--- a/net/netfilter/nfnetlink.c
+++ b/net/netfilter/nfnetlink.c
@@ -151,26 +151,14 @@ nfnetlink_check_attributes(struct nfnetlink_subsystem 
*subsys,
                           struct nlmsghdr *nlh, struct nfattr *cda[])
 {
        int min_len = NLMSG_SPACE(sizeof(struct nfgenmsg));
-       u_int16_t attr_count;
        u_int8_t cb_id = NFNL_MSG_TYPE(nlh->nlmsg_type);
-
-       attr_count = subsys->cb[cb_id].attr_count;
-       memset(cda, 0, sizeof(struct nfattr *) * attr_count);
+       u_int16_t attr_count = subsys->cb[cb_id].attr_count;
 
        /* check attribute lengths. */
        if (likely(nlh->nlmsg_len > min_len)) {
                struct nfattr *attr = NFM_NFA(NLMSG_DATA(nlh));
                int attrlen = nlh->nlmsg_len - NLMSG_ALIGN(min_len);
-
-               while (NFA_OK(attr, attrlen)) {
-                       unsigned flavor = NFA_TYPE(attr);
-                       if (flavor) {
-                               if (flavor > attr_count)
-                                       return -EINVAL;
-                               cda[flavor - 1] = attr;
-                       }
-                       attr = NFA_NEXT(attr, attrlen);
-               }
+               nfattr_parse(cda, attr_count, attr, attrlen);
        }
 
        /* implicit: if nlmsg_len == min_len, we return 0, and an empty
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to