[netfilter-cvslog] r6430 - trunk/libnetfilter_queue/src

laforge at netfilter.org laforge at netfilter.org
Mon Jan 23 18:17:31 CET 2006


Author: laforge at netfilter.org
Date: 2006-01-23 18:17:30 +0100 (Mon, 23 Jan 2006)
New Revision: 6430

Modified:
   trunk/libnetfilter_queue/src/libnetfilter_queue.c
Log:
fix __set_verdict() to correctly handle payload (Closes: #435) (Andreas Florath)


Modified: trunk/libnetfilter_queue/src/libnetfilter_queue.c
===================================================================
--- trunk/libnetfilter_queue/src/libnetfilter_queue.c	2006-01-23 17:15:13 UTC (rev 6429)
+++ trunk/libnetfilter_queue/src/libnetfilter_queue.c	2006-01-23 17:17:30 UTC (rev 6430)
@@ -14,6 +14,9 @@
  *  You should have received a copy of the GNU General Public License
  *  along with this program; if not, write to the Free Software
  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ *
+ *  2006-01-23 Andreas Florath <andreas at florath.net>
+ *	Fix __set_verdict() that it can now handle payload.
  */
 
 #include <stdio.h>
@@ -298,6 +301,10 @@
 	struct iovec iov[3];
 	int nvecs;
 
+	/* This must be declared here (and not inside the data
+	 * handling block) because the iovec points to this. */
+	struct nfattr data_attr;
+
 	memset(iov, 0, sizeof(iov));
 
 	vh.verdict = htonl(verdict);
@@ -317,11 +324,14 @@
 	nvecs = 1;
 
 	if (data_len) {
-		struct nfattr data_attr;
-
 		nfnl_build_nfa_iovec(&iov[1], &data_attr, NFQA_PAYLOAD,
 				data_len, data);
 		nvecs += 2;
+		/* Add the length of the appended data to the message
+		 * header.  The size of the attribute is given in the
+		 * nfa_len field and is set in the nfnl_build_nfa_iovec()
+		 * function. */
+		nmh->nlmsg_len += data_attr.nfa_len;
 	}
 
 	return nfnl_sendiov(qh->h->nfnlh, iov, nvecs, 0);




More information about the netfilter-cvslog mailing list