Add cpu support to meta expresion.
This allows you to match packets with cpu number.
Signed-off-by: Ana Rey <anarey@gmail.com>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
* @NFT_META_BRI_IIFNAME: packet input bridge interface name
* @NFT_META_BRI_OIFNAME: packet output bridge interface name
* @NFT_META_PKTTYPE: packet type (skb->pkt_type), special handling for loopback
+ * @NFT_META_CPU: cpu id through smp_processor_id()
*/
enum nft_meta_keys {
NFT_META_LEN,
NFT_META_BRI_IIFNAME,
NFT_META_BRI_OIFNAME,
NFT_META_PKTTYPE,
+ NFT_META_CPU,
};
/**
#include <linux/in.h>
#include <linux/ip.h>
#include <linux/ipv6.h>
+#include <linux/smp.h>
#include <net/dst.h>
#include <net/sock.h>
#include <net/tcp_states.h> /* for TCP_TIME_WAIT */
goto err;
}
break;
+ case NFT_META_CPU:
+ dest->data[0] = smp_processor_id();
+ break;
default:
WARN_ON(1);
goto err;
case NFT_META_SECMARK:
#endif
case NFT_META_PKTTYPE:
+ case NFT_META_CPU:
break;
default:
return -EOPNOTSUPP;