* [PATCH libnetfilter_queue 0/1] src: Fix value returned by nfq_tcp_get_payload_len() @ 2020-01-07 21:42 Duncan Roe 2020-01-07 21:42 ` [PATCH libnetfilter_queue 1/1] " Duncan Roe 0 siblings, 1 reply; 3+ messages in thread From: Duncan Roe @ 2020-01-07 21:42 UTC (permalink / raw) To: pablo; +Cc: netfilter-devel This fix is similar to nfq_udp_get_payload_len fix b09038c Both nfq_tcp_get_payload_len & nfq_udp_get_payload_len are one-liners, unlike nfq_{tcp,udp}_get_payload which have checks for a malformed packet. It is not a given that programs will always call xx_get_payload before xx_get_payload_len so if you like I can make a v2 where nfq_{tcp,udp}_get_payload_len do have such checks. Cheers ... Duncan. Duncan Roe (1): src: Fix value returned by nfq_tcp_get_payload_len() src/extra/tcp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.14.5 ^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH libnetfilter_queue 1/1] src: Fix value returned by nfq_tcp_get_payload_len() 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 2020-01-10 11:18 ` Pablo Neira Ayuso 0 siblings, 1 reply; 3+ messages in thread From: Duncan Roe @ 2020-01-07 21:42 UTC (permalink / raw) To: pablo; +Cc: netfilter-devel 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 ^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH libnetfilter_queue 1/1] src: Fix value returned by nfq_tcp_get_payload_len() 2020-01-07 21:42 ` [PATCH libnetfilter_queue 1/1] " Duncan Roe @ 2020-01-10 11:18 ` Pablo Neira Ayuso 0 siblings, 0 replies; 3+ messages in thread From: Pablo Neira Ayuso @ 2020-01-10 11:18 UTC (permalink / raw) To: Duncan Roe; +Cc: netfilter-devel On Wed, Jan 08, 2020 at 08:42:24AM +1100, Duncan Roe wrote: > Remember to subtract the TCP header length. Applied, thanks. ^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2020-01-10 11:19 UTC | newest] Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 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 ` [PATCH libnetfilter_queue 1/1] " Duncan Roe 2020-01-10 11:18 ` 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).