From 096567100178c1f2d49b0d3e7764e665d547c3fa Mon Sep 17 00:00:00 2001 From: Pablo Neira Ayuso Date: Thu, 26 Apr 2012 16:38:02 +0200 Subject: conntrack: add new ATTR_GRP_[ORIG|REPL]_ADDR_[SRC|DST] attribute This allows you to set and to get the address for both IPv4 and IPV6 using the same interface. This can simplify much redundant code that needs to support both protocols. This relies on some fixed layout union: union nfct_attr_grp_addr { u_int32_t ip; u_int32_t ip6[4]; u_int32_t addr[4]; }; But I don't see this library will support anything different from IPv4 and IPv6 as layer 3 protocol. If that happens and some point, we can add some new attribute group and deprecate this one. Signed-off-by: Pablo Neira Ayuso --- src/conntrack/grp.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'src/conntrack/grp.c') diff --git a/src/conntrack/grp.c b/src/conntrack/grp.c index 295444d..92a523b 100644 --- a/src/conntrack/grp.c +++ b/src/conntrack/grp.c @@ -68,4 +68,16 @@ const uint32_t attr_grp_bitmask[ATTR_GRP_MAX][__NFCT_BITSET] = { [0] = (1 << (ATTR_REPL_COUNTER_PACKETS)) | (1 << (ATTR_REPL_COUNTER_BYTES)), }, + [ATTR_GRP_ORIG_ADDR_SRC] = { + [0] = (1 << ATTR_ORIG_IPV4_SRC) | (1 << ATTR_ORIG_IPV6_SRC), + }, + [ATTR_GRP_ORIG_ADDR_DST] = { + [0] = (1 << ATTR_ORIG_IPV4_DST) | (1 << ATTR_ORIG_IPV6_DST), + }, + [ATTR_GRP_REPL_ADDR_SRC] = { + [1] = (1 << ATTR_REPL_IPV4_SRC) | (1 << ATTR_REPL_IPV6_SRC), + }, + [ATTR_GRP_REPL_ADDR_DST] = { + [1] = (1 << ATTR_REPL_IPV4_DST) | (1 << ATTR_REPL_IPV6_DST), + }, }; -- cgit v1.2.3