Skip to content

Commit aa1059f

Browse files
committed
netfilter: nft_meta: add NFT_META_IFTYPE
jira LE-1907 Rebuild_History Non-Buildable kernel-5.14.0-284.30.1.el9_2 commit-author Pablo Neira Ayuso <pablo@netfilter.org> commit 56fa950 Generalize NFT_META_IIFTYPE to NFT_META_IFTYPE which allows you to match on the interface type of the skb->dev field. This field is used by the netdev family to add an implicit dependency to skip non-ethernet packets when matching on layer 3 and 4 TCP/IP header fields. For backward compatibility, add the NFT_META_IIFTYPE alias to NFT_META_IFTYPE. Add __NFT_META_IIFTYPE, to be used by userspace in the future to match specifically on the iiftype. Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org> (cherry picked from commit 56fa950) Signed-off-by: Jonathan Maple <jmaple@ciq.com>
1 parent b8b354d commit aa1059f

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

include/uapi/linux/netfilter/nf_tables.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -896,7 +896,8 @@ enum nft_meta_keys {
896896
NFT_META_OIF,
897897
NFT_META_IIFNAME,
898898
NFT_META_OIFNAME,
899-
NFT_META_IIFTYPE,
899+
NFT_META_IFTYPE,
900+
#define NFT_META_IIFTYPE NFT_META_IFTYPE
900901
NFT_META_OIFTYPE,
901902
NFT_META_SKUID,
902903
NFT_META_SKGID,
@@ -923,6 +924,7 @@ enum nft_meta_keys {
923924
NFT_META_TIME_HOUR,
924925
NFT_META_SDIF,
925926
NFT_META_SDIFNAME,
927+
__NFT_META_IIFTYPE,
926928
};
927929

928930
/**

net/netfilter/nft_meta.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,11 @@ static bool nft_meta_get_eval_ifname(enum nft_meta_keys key, u32 *dest,
243243
case NFT_META_OIF:
244244
nft_meta_store_ifindex(dest, nft_out(pkt));
245245
break;
246-
case NFT_META_IIFTYPE:
246+
case NFT_META_IFTYPE:
247+
if (!nft_meta_store_iftype(dest, pkt->skb->dev))
248+
return false;
249+
break;
250+
case __NFT_META_IIFTYPE:
247251
if (!nft_meta_store_iftype(dest, nft_in(pkt)))
248252
return false;
249253
break;

0 commit comments

Comments
 (0)