summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
author/C=DE/ST=Berlin/L=Berlin/O=Netfilter Project/OU=Development/CN=laforge/emailAddress=laforge@netfilter.org </C=DE/ST=Berlin/L=Berlin/O=Netfilter Project/OU=Development/CN=laforge/emailAddress=laforge@netfilter.org>2006-01-23 17:15:13 +0000
committer/C=DE/ST=Berlin/L=Berlin/O=Netfilter Project/OU=Development/CN=laforge/emailAddress=laforge@netfilter.org </C=DE/ST=Berlin/L=Berlin/O=Netfilter Project/OU=Development/CN=laforge/emailAddress=laforge@netfilter.org>2006-01-23 17:15:13 +0000
commit0455f4ffb3557036089d1f71bb013297ddcb9286 (patch)
tree15d9f0c0ddbf5395fd691dbb6397a9e50b2c28ba
parent45cf69d25c897341defab1ffc7c1810f1520cec7 (diff)
fix nfnl_build_nfa_iovec() to set the attribute values (Andreas Florath)
-rw-r--r--include/libnfnetlink/linux_nfnetlink.h8
-rw-r--r--src/libnfnetlink.c4
2 files changed, 7 insertions, 5 deletions
diff --git a/include/libnfnetlink/linux_nfnetlink.h b/include/libnfnetlink/linux_nfnetlink.h
index 934a247..f08e870 100644
--- a/include/libnfnetlink/linux_nfnetlink.h
+++ b/include/libnfnetlink/linux_nfnetlink.h
@@ -112,6 +112,7 @@ struct nfnl_callback
{
int (*call)(struct sock *nl, struct sk_buff *skb,
struct nlmsghdr *nlh, struct nfattr *cda[], int *errp);
+ kernel_cap_t cap_required; /* capabilities required for this msg */
u_int16_t attr_count; /* number of nfattr's */
};
@@ -145,7 +146,7 @@ extern void nfnl_unlock(void);
extern int nfnetlink_subsys_register(struct nfnetlink_subsystem *n);
extern int nfnetlink_subsys_unregister(struct nfnetlink_subsystem *n);
-extern void nfattr_parse(struct nfattr *tb[], int maxattr,
+extern int nfattr_parse(struct nfattr *tb[], int maxattr,
struct nfattr *nfa, int len);
#define nfattr_parse_nested(tb, max, nfa) \
@@ -153,14 +154,11 @@ extern void nfattr_parse(struct nfattr *tb[], int maxattr,
#define nfattr_bad_size(tb, max, cta_min) \
({ int __i, __res = 0; \
- for (__i=0; __i<max; __i++) { \
- if (!cta_min[__i]) \
- continue; \
+ for (__i=0; __i<max; __i++) \
if (tb[__i] && NFA_PAYLOAD(tb[__i]) < cta_min[__i]){ \
__res = 1; \
break; \
} \
- } \
__res; \
})
diff --git a/src/libnfnetlink.c b/src/libnfnetlink.c
index 756893b..def45fb 100644
--- a/src/libnfnetlink.c
+++ b/src/libnfnetlink.c
@@ -725,6 +725,10 @@ int nfnl_parse_attr(struct nfattr *tb[], int max, struct nfattr *nfa, int len)
void nfnl_build_nfa_iovec(struct iovec *iov, struct nfattr *nfa,
u_int16_t type, u_int32_t len, unsigned char *val)
{
+ /* Set the attribut values */
+ nfa->nfa_len = sizeof(struct nfattr) + len;
+ nfa->nfa_type = type;
+
iov[0].iov_base = nfa;
iov[0].iov_len = sizeof(*nfa);
iov[1].iov_base = val;