netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH libnetfilter_queue] src: Fix IPv4 checksum calculation in AF_BRIDGE packet buffer
@ 2019-11-16  3:18 Duncan Roe
  2019-11-17  2:35 ` [PATCH libnetfilter_queue v2] " Duncan Roe
  0 siblings, 1 reply; 3+ messages in thread
From: Duncan Roe @ 2019-11-16  3:18 UTC (permalink / raw)
  To: pablo; +Cc: netfilter-devel

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@optusnet.com.au>
---
 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..1b0f96b 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


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH libnetfilter_queue v2] src: Fix IPv4 checksum calculation in AF_BRIDGE packet buffer
  2019-11-16  3:18 [PATCH libnetfilter_queue] src: Fix IPv4 checksum calculation in AF_BRIDGE packet buffer Duncan Roe
@ 2019-11-17  2:35 ` Duncan Roe
  2019-11-21 14:03   ` Pablo Neira Ayuso
  0 siblings, 1 reply; 3+ messages in thread
From: Duncan Roe @ 2019-11-17  2:35 UTC (permalink / raw)
  To: pablo; +Cc: netfilter-devel

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@optusnet.com.au>
---
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


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH libnetfilter_queue v2] src: Fix IPv4 checksum calculation in AF_BRIDGE packet buffer
  2019-11-17  2:35 ` [PATCH libnetfilter_queue v2] " Duncan Roe
@ 2019-11-21 14:03   ` Pablo Neira Ayuso
  0 siblings, 0 replies; 3+ messages in thread
From: Pablo Neira Ayuso @ 2019-11-21 14:03 UTC (permalink / raw)
  To: Duncan Roe; +Cc: netfilter-devel

On Sun, Nov 17, 2019 at 01:35:40PM +1100, Duncan Roe wrote:
> 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

Applied, thanks.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-11-21 14:03 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-16  3:18 [PATCH libnetfilter_queue] src: Fix IPv4 checksum calculation in AF_BRIDGE packet buffer Duncan Roe
2019-11-17  2:35 ` [PATCH libnetfilter_queue v2] " Duncan Roe
2019-11-21 14:03   ` Pablo Neira Ayuso

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).