diff mbox series

[libnftnl] src: support for NFT_CT_{SRC,DST}_{IP,IP6}

Message ID 20180309114143.470-1-pablo@netfilter.org
State Accepted
Delegated to: Pablo Neira
Headers show
Series [libnftnl] src: support for NFT_CT_{SRC,DST}_{IP,IP6} | expand

Commit Message

Pablo Neira Ayuso March 9, 2018, 11:41 a.m. UTC
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
---
 include/linux/netfilter/nf_tables.h | 12 ++++++++++--
 src/expr/ct.c                       |  6 +++++-
 2 files changed, 15 insertions(+), 3 deletions(-)
diff mbox series

Patch

diff --git a/include/linux/netfilter/nf_tables.h b/include/linux/netfilter/nf_tables.h
index d6dbb0d08c10..b904e336c419 100644
--- a/include/linux/netfilter/nf_tables.h
+++ b/include/linux/netfilter/nf_tables.h
@@ -906,8 +906,8 @@  enum nft_rt_attributes {
  * @NFT_CT_EXPIRATION: relative conntrack expiration time in ms
  * @NFT_CT_HELPER: connection tracking helper assigned to conntrack
  * @NFT_CT_L3PROTOCOL: conntrack layer 3 protocol
- * @NFT_CT_SRC: conntrack layer 3 protocol source (IPv4/IPv6 address)
- * @NFT_CT_DST: conntrack layer 3 protocol destination (IPv4/IPv6 address)
+ * @NFT_CT_SRC: conntrack layer 3 protocol source (IPv4/IPv6 address, deprecated)
+ * @NFT_CT_DST: conntrack layer 3 protocol destination (IPv4/IPv6 address, deprecated)
  * @NFT_CT_PROTOCOL: conntrack layer 4 protocol
  * @NFT_CT_PROTO_SRC: conntrack layer 4 protocol source
  * @NFT_CT_PROTO_DST: conntrack layer 4 protocol destination
@@ -917,6 +917,10 @@  enum nft_rt_attributes {
  * @NFT_CT_AVGPKT: conntrack average bytes per packet
  * @NFT_CT_ZONE: conntrack zone
  * @NFT_CT_EVENTMASK: ctnetlink events to be generated for this conntrack
+ * @NFT_CT_SRC_IP: conntrack layer 3 protocol source (IPv4 address)
+ * @NFT_CT_DST_IP: conntrack layer 3 protocol destination (IPv4 address)
+ * @NFT_CT_SRC_IP6: conntrack layer 3 protocol source (IPv6 address)
+ * @NFT_CT_DST_IP6: conntrack layer 3 protocol destination (IPv6 address)
  */
 enum nft_ct_keys {
 	NFT_CT_STATE,
@@ -938,6 +942,10 @@  enum nft_ct_keys {
 	NFT_CT_AVGPKT,
 	NFT_CT_ZONE,
 	NFT_CT_EVENTMASK,
+	NFT_CT_SRC_IP,
+	NFT_CT_DST_IP,
+	NFT_CT_SRC_IP6,
+	NFT_CT_DST_IP6,
 };
 
 /**
diff --git a/src/expr/ct.c b/src/expr/ct.c
index 6f87a72487ae..d4dd1d92c116 100644
--- a/src/expr/ct.c
+++ b/src/expr/ct.c
@@ -32,7 +32,7 @@  struct nftnl_expr_ct {
 #define IP_CT_DIR_REPLY		1
 
 #ifndef NFT_CT_MAX
-#define NFT_CT_MAX (NFT_CT_EVENTMASK + 1)
+#define NFT_CT_MAX (NFT_CT_DST_IP6 + 1)
 #endif
 
 static int
@@ -172,6 +172,10 @@  static const char *ctkey2str_array[NFT_CT_MAX] = {
 	[NFT_CT_AVGPKT]		= "avgpkt",
 	[NFT_CT_ZONE]		= "zone",
 	[NFT_CT_EVENTMASK]	= "event",
+	[NFT_CT_SRC_IP]		= "src_ip",
+	[NFT_CT_DST_IP]		= "dst_ip",
+	[NFT_CT_SRC_IP6]	= "src_ip6",
+	[NFT_CT_DST_IP6]	= "dst_ip6",
 };
 
 static const char *ctkey2str(uint32_t ctkey)