* [PATCH nf-next] netfilter: nft_meta: infer ptktype from IP address from the output path
@ 2021-10-26 11:25 Pablo Neira Ayuso
0 siblings, 0 replies; only message in thread
From: Pablo Neira Ayuso @ 2021-10-26 11:25 UTC (permalink / raw)
To: netfilter-devel
meta pkttype always says 0 (host) from the output path. The code to
infer the packet type from the IP address is already in place for
loopback traffic, extend it to infer it the packet type from the output,
postrouting and egress path too.
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
---
net/netfilter/nft_meta.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/net/netfilter/nft_meta.c b/net/netfilter/nft_meta.c
index 516e74635bae..58a87205be8e 100644
--- a/net/netfilter/nft_meta.c
+++ b/net/netfilter/nft_meta.c
@@ -371,7 +371,11 @@ void nft_meta_get_eval(const struct nft_expr *expr,
break;
#endif
case NFT_META_PKTTYPE:
- if (skb->pkt_type != PACKET_LOOPBACK) {
+ if (skb->pkt_type != PACKET_LOOPBACK &&
+ nft_hook(pkt) != NF_INET_LOCAL_OUT &&
+ nft_hook(pkt) != NF_INET_POST_ROUTING &&
+ (nft_pf(pkt) == NFPROTO_NETDEV &&
+ nft_hook(pkt) != NF_NETDEV_EGRESS)) {
nft_reg_store8(dest, skb->pkt_type);
break;
}
--
2.30.2
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2021-10-26 11:25 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-10-26 11:25 [PATCH nf-next] netfilter: nft_meta: infer ptktype from IP address from the output path Pablo Neira Ayuso
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).