[PATCH libnetfilter_queue v2] src: Fix IPv4 checksum calculation in AF_BRIDGE packet buffer

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

 



Updated:

 src/extra/pktbuff.c: If pktb was created in family AF_BRIDGE, then pktb->len
                      will include the bytes in the network header.
                      So set the IPv4 length to "tail - network_header"
                      rather than len

Signed-off-by: Duncan Roe <duncan_roe@xxxxxxxxxxxxxxx>
---
v2: fix whitespace
 src/extra/ipv4.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/extra/ipv4.c b/src/extra/ipv4.c
index 0227b62..c03f23f 100644
--- a/src/extra/ipv4.c
+++ b/src/extra/ipv4.c
@@ -117,7 +117,7 @@ int nfq_ip_mangle(struct pkt_buff *pktb, unsigned int dataoff,
 		return 0;
 
 	/* fix IP hdr checksum information */
-	iph->tot_len = htons(pktb->len);
+	iph->tot_len = htons(pktb->tail - pktb->network_header);
 	nfq_ip_set_checksum(iph);
 
 	return 1;
-- 
2.14.5




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

  Powered by Linux