History

netfilter: nf_tables: add devgroup support in meta expresion

Add devgroup support to let us match device group of a packets incoming or outgoing interface.

Ana Rey committed 12 years ago

Commit 3045d761 parent ce24b722 files · +16 −0Browse files

Unified · Split

2 files
  1. include/uapi/linux/netfilter/nf_tables.h +4 −0
  2. net/netfilter/nft_meta.c +12 −0
include/uapi/linux/netfilter/nf_tables.h+4−0
@@ -573,6 +573,8 @@ enum nft_exthdr_attributes { · 572 unmodified lines
573573 * @NFT_META_BRI_OIFNAME: packet output bridge interface name
574574 * @NFT_META_PKTTYPE: packet type (skb->pkt_type), special handling for loopback
575575 * @NFT_META_CPU: cpu id through smp_processor_id()
576+ * @NFT_META_IIFGROUP: packet input interface group
577+ * @NFT_META_OIFGROUP: packet output interface group
576578 */
577579 enum nft_meta_keys {
578580 NFT_META_LEN,
@@ -596,6 +598,8 @@ enum nft_meta_keys { · 17 unmodified lines
596598 NFT_META_BRI_OIFNAME,
597599 NFT_META_PKTTYPE,
598600 NFT_META_CPU,
601+ NFT_META_IIFGROUP,
602+ NFT_META_OIFGROUP,
599603 };
600604
601605 /**
net/netfilter/nft_meta.c+12−0
@@ -155,6 +155,16 @@ void nft_meta_get_eval(const struct nft_expr *expr, · 154 unmodified lines
155155 case NFT_META_CPU:
156156 dest->data[0] = smp_processor_id();
157157 break;
158+ case NFT_META_IIFGROUP:
159+ if (in == NULL)
160+ goto err;
161+ dest->data[0] = in->group;
162+ break;
163+ case NFT_META_OIFGROUP:
164+ if (out == NULL)
165+ goto err;
166+ dest->data[0] = out->group;
167+ break;
158168 default:
159169 WARN_ON(1);
160170 goto err;
@@ -228,6 +238,8 @@ int nft_meta_get_init(const struct nft_ctx *ctx, · 67 unmodified lines
228238 #endif
229239 case NFT_META_PKTTYPE:
230240 case NFT_META_CPU:
241+ case NFT_META_IIFGROUP:
242+ case NFT_META_OIFGROUP:
231243 break;
232244 default:
233245 return -EOPNOTSUPP;