[PATCH libnetfilter_queue 1/2] src: doc: Update sample code to agree with documentation

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Updated:

 src/nlmsg.c: Update nfq_nlmsg_verdict_put_pkt() sample code to use pktb_len()
              as recommended in src/extra/pktbuff.c, pktb_len() doco

Signed-off-by: Duncan Roe <duncan_roe@xxxxxxxxxxxxxxx>
---
 src/nlmsg.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/src/nlmsg.c b/src/nlmsg.c
index c40a9e4..c950110 100644
--- a/src/nlmsg.c
+++ b/src/nlmsg.c
@@ -90,14 +90,13 @@ EXPORT_SYMBOL
 	pktb = pktb_alloc(AF_INET, payload, plen, 255);
 	// (decide that this packet needs mangling)
 	nfq_udp_mangle_ipv4(pktb, match_offset, match_len, rep_data, rep_len);
-	// Update IP Datagram length
-	plen += rep_len - match_len;
+	// nfq_udp_mangle_ipv4 updates packet length, no need to track locally
 
 	// Eventually nfq_send_verdict (line 39) gets called
 	// The received packet may or may not have been modified.
 	// Add this code before nfq_nlmsg_verdict_put call:
 	if (pktb_mangled(pktb))
-		nfq_nlmsg_verdict_put_pkt(nlh, pktb_data(pktb), plen);
+		nfq_nlmsg_verdict_put_pkt(nlh, pktb_data(pktb), pktb_len(pktb));
 \endverbatim
  */
 void nfq_nlmsg_verdict_put_pkt(struct nlmsghdr *nlh, const void *pkt,
-- 
2.14.5




[Index of Archives]     [Netfitler Users]     [Berkeley Packet Filter]     [LARTC]     [Bugtraq]     [Yosemite Forum]

  Powered by Linux