提交 3c1fece8 编写于 作者: P Phil Sutter 提交者: Pablo Neira Ayuso

netfilter: nft_exthdr: Allow checking TCP option presence, too

Honor NFT_EXTHDR_F_PRESENT flag so we check if the TCP option is
present.
Signed-off-by: NPhil Sutter <phil@nwl.cc>
Signed-off-by: NPablo Neira Ayuso <pablo@netfilter.org>
上级 8d70eeb8
...@@ -98,14 +98,21 @@ static void nft_exthdr_tcp_eval(const struct nft_expr *expr, ...@@ -98,14 +98,21 @@ static void nft_exthdr_tcp_eval(const struct nft_expr *expr,
goto err; goto err;
offset = i + priv->offset; offset = i + priv->offset;
dest[priv->len / NFT_REG32_SIZE] = 0; if (priv->flags & NFT_EXTHDR_F_PRESENT) {
memcpy(dest, opt + offset, priv->len); *dest = 1;
} else {
dest[priv->len / NFT_REG32_SIZE] = 0;
memcpy(dest, opt + offset, priv->len);
}
return; return;
} }
err: err:
regs->verdict.code = NFT_BREAK; if (priv->flags & NFT_EXTHDR_F_PRESENT)
*dest = 0;
else
regs->verdict.code = NFT_BREAK;
} }
static const struct nla_policy nft_exthdr_policy[NFTA_EXTHDR_MAX + 1] = { static const struct nla_policy nft_exthdr_policy[NFTA_EXTHDR_MAX + 1] = {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册