[netfilter-cvslog] r6429 - in trunk/libnfnetlink: include/libnfnetlink src

laforge at netfilter.org laforge at netfilter.org
Mon Jan 23 18:15:14 CET 2006


Author: laforge at netfilter.org
Date: 2006-01-23 18:15:13 +0100 (Mon, 23 Jan 2006)
New Revision: 6429

Modified:
   trunk/libnfnetlink/include/libnfnetlink/linux_nfnetlink.h
   trunk/libnfnetlink/src/libnfnetlink.c
Log:
fix nfnl_build_nfa_iovec() to set the attribute values (Andreas Florath)


Modified: trunk/libnfnetlink/include/libnfnetlink/linux_nfnetlink.h
===================================================================
--- trunk/libnfnetlink/include/libnfnetlink/linux_nfnetlink.h	2006-01-23 17:03:33 UTC (rev 6428)
+++ trunk/libnfnetlink/include/libnfnetlink/linux_nfnetlink.h	2006-01-23 17:15:13 UTC (rev 6429)
@@ -112,6 +112,7 @@
 {
 	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 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 @@
 
 #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;								\
 })
 

Modified: trunk/libnfnetlink/src/libnfnetlink.c
===================================================================
--- trunk/libnfnetlink/src/libnfnetlink.c	2006-01-23 17:03:33 UTC (rev 6428)
+++ trunk/libnfnetlink/src/libnfnetlink.c	2006-01-23 17:15:13 UTC (rev 6429)
@@ -725,6 +725,10 @@
 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;




More information about the netfilter-cvslog mailing list