Skip to contentSkip to conversation

netfilter: nft_extdhr: Drop pointless check of tprot_set

PATCH Applied Phil Sutter 2 participants 2 messages Jun 11, 2021 – Jun 18, 2021

Subsystems (2)
lore
Share & tools
lore

Phil Sutter

author reviewer
#0 lore raw

PATCH 1/1 netfilter: nft_extdhr: Drop pointless check of tprot_set

Pablo says, tprot_set is only there to detect if tprot was set to IPPROTO_IP as that evaluates to zero. Therefore, code asserting a different value in tprot does not need to check tprot_set.

Fixes 935b7f6430188 ("netfilter: nft_exthdr: add TCP option matching")
---
 net/netfilter/nft_exthdr.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
net/netfilter/nft_exthdr.c +1 -1
index 9cf86be2cff4b..4f583d2e220e4 100644
@@ -164,7 +164,7 @@ nft_tcp_header_pointer(const struct nft_pktinfo *pkt,
 {
 	struct tcphdr *tcph;
 
-	if (!pkt->tprot_set || pkt->tprot != IPPROTO_TCP)
+	if (pkt->tprot != IPPROTO_TCP)
 		return NULL;
 
 	tcph = skb_header_pointer(pkt->skb, nft_thoff(pkt), sizeof(*tcph), buffer);
Signature · 1 line
2.31.1
maintainer Applied
#1 lore raw
Quoted 3 lines · Phil Sutter

Pablo says, tprot_set is only there to detect if tprot was set to IPPROTO_IP as that evaluates to zero. Therefore, code asserting a different value in tprot does not need to check tprot_set.

Applied, thanks.