Skip to content
Permalink
Browse files
netfilter: nft_osf: check for TCP packet before further processing
The osf expression only supports for TCP packets, add a upfront sanity
check to skip packet parsing if this is not a TCP packet.

Fixes: b96af92 ("netfilter: nf_tables: implement Passive OS fingerprint module in nft_osf")
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
  • Loading branch information
ummakynes authored and intel-lab-lkp committed Jun 16, 2021
1 parent 3e2206f commit f572a05becf9cc86053b01e0f0f898334583692a
Showing 1 changed file with 5 additions and 0 deletions.
@@ -28,6 +28,11 @@ static void nft_osf_eval(const struct nft_expr *expr, struct nft_regs *regs,
struct nf_osf_data data;
struct tcphdr _tcph;

if (pkt->tprot != IPPROTO_TCP) {
regs->verdict.code = NFT_BREAK;
break;
}

tcp = skb_header_pointer(skb, ip_hdrlen(skb),
sizeof(struct tcphdr), &_tcph);
if (!tcp) {

0 comments on commit f572a05

Please sign in to comment.