netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Duncan Roe <duncan_roe@optusnet.com.au>
To: pablo@netfilter.org
Cc: netfilter-devel@vger.kernel.org
Subject: [PATCH libnetfilter_queue 1/1] src: Fix value returned by nfq_tcp_get_payload_len()
Date: Wed,  8 Jan 2020 08:42:24 +1100	[thread overview]
Message-ID: <20200107214224.9549-2-duncan_roe@optusnet.com.au> (raw)
In-Reply-To: <20200107214224.9549-1-duncan_roe@optusnet.com.au>

Remember to subtract the TCP header length.

Signed-off-by: Duncan Roe <duncan_roe@optusnet.com.au>
---
 src/extra/tcp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/extra/tcp.c b/src/extra/tcp.c
index 0f83500..236663f 100644
--- a/src/extra/tcp.c
+++ b/src/extra/tcp.c
@@ -83,7 +83,7 @@ void *nfq_tcp_get_payload(struct tcphdr *tcph, struct pkt_buff *pktb)
 EXPORT_SYMBOL
 unsigned int nfq_tcp_get_payload_len(struct tcphdr *tcph, struct pkt_buff *pktb)
 {
-	return pktb->tail - pktb->transport_header;
+	return pktb->tail - pktb->transport_header -tcph->doff * 4;
 }
 
 /**
-- 
2.14.5


  reply	other threads:[~2020-01-07 21:42 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-07 21:42 [PATCH libnetfilter_queue 0/1] src: Fix value returned by nfq_tcp_get_payload_len() Duncan Roe
2020-01-07 21:42 ` Duncan Roe [this message]
2020-01-10 11:18   ` [PATCH libnetfilter_queue 1/1] " Pablo Neira Ayuso

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200107214224.9549-2-duncan_roe@optusnet.com.au \
    --to=duncan_roe@optusnet.com.au \
    --cc=netfilter-devel@vger.kernel.org \
    --cc=pablo@netfilter.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).