summaryrefslogtreecommitdiffstats
path: root/src/extra/tcp.c
diff options
context:
space:
mode:
authorDuncan Roe <duncan_roe@optusnet.com.au>2020-01-26 15:02:02 +1100
committerPablo Neira Ayuso <pablo@netfilter.org>2020-01-29 18:36:32 +0100
commit9d360e93cb2688f3fb8c37fd8e76e2a02e2d12bd (patch)
treedc26fca2742bad9dfca16fea4af068ed5ac6175e /src/extra/tcp.c
parentba3a63eefbfeeafc95cb401777ba049af32a2b4d (diff)
Simplify struct pkt_buff: remove tail
In struct pkt_buff, we only ever needed any 2 of len, data and tail. This has caused bugs in the past, e.g. commit 8a4316f31. Delete tail, and where the value of pktb->tail was required, use new pktb_tail() function. Signed-off-by: Duncan Roe <duncan_roe@optusnet.com.au> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'src/extra/tcp.c')
-rw-r--r--src/extra/tcp.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/extra/tcp.c b/src/extra/tcp.c
index cca20e7..933c6ee 100644
--- a/src/extra/tcp.c
+++ b/src/extra/tcp.c
@@ -46,7 +46,7 @@ struct tcphdr *nfq_tcp_get_hdr(struct pkt_buff *pktb)
return NULL;
/* No room for the TCP header. */
- if (pktb->tail - pktb->transport_header < sizeof(struct tcphdr))
+ if (pktb_tail(pktb) - pktb->transport_header < sizeof(struct tcphdr))
return NULL;
return (struct tcphdr *)pktb->transport_header;
@@ -68,7 +68,7 @@ void *nfq_tcp_get_payload(struct tcphdr *tcph, struct pkt_buff *pktb)
return NULL;
/* malformed TCP data offset. */
- if (pktb->transport_header + len > pktb->tail)
+ if (pktb->transport_header + len > pktb_tail(pktb))
return NULL;
return pktb->transport_header + len;
@@ -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 - (tcph->doff * 4);
+ return pktb_tail(pktb) - pktb->transport_header - (tcph->doff * 4);
}
/**