Commit 52f0f4e1 authored by Pablo Neira Ayuso's avatar Pablo Neira Ayuso

netfilter: nft_tproxy: restrict support to TCP and UDP transport protocols

Add unfront check for TCP and UDP packets before performing further
processing.

Fixes: 4ed8eb65 ("netfilter: nf_tables: Add native tproxy support")
Signed-off-by: default avatarPablo Neira Ayuso <pablo@netfilter.org>
parent 8f518d43
......@@ -30,6 +30,12 @@ static void nft_tproxy_eval_v4(const struct nft_expr *expr,
__be16 tport = 0;
struct sock *sk;
if (pkt->tprot != IPPROTO_TCP &&
pkt->tprot != IPPROTO_UDP) {
regs->verdict.code = NFT_BREAK;
return;
}
hp = skb_header_pointer(skb, ip_hdrlen(skb), sizeof(_hdr), &_hdr);
if (!hp) {
regs->verdict.code = NFT_BREAK;
......@@ -91,7 +97,8 @@ static void nft_tproxy_eval_v6(const struct nft_expr *expr,
memset(&taddr, 0, sizeof(taddr));
if (!pkt->tprot_set) {
if (pkt->tprot != IPPROTO_TCP &&
pkt->tprot != IPPROTO_UDP) {
regs->verdict.code = NFT_BREAK;
return;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment