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 --- include/libnetfilter_conntrack/libnetfilter_conntrack.h | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'include/libnetfilter_conntrack') diff --git a/include/libnetfilter_conntrack/libnetfilter_conntrack.h b/include/libnetfilter_conntrack/libnetfilter_conntrack.h index a4a60cb..5518418 100644 --- a/include/libnetfilter_conntrack/libnetfilter_conntrack.h +++ b/include/libnetfilter_conntrack/libnetfilter_conntrack.h @@ -149,6 +149,10 @@ enum nf_conntrack_attr_grp { ATTR_GRP_MASTER_PORT, /* struct nfct_attr_grp_port */ ATTR_GRP_ORIG_COUNTERS, /* struct nfct_attr_grp_ctrs */ ATTR_GRP_REPL_COUNTERS, /* struct nfct_attr_grp_ctrs */ + ATTR_GRP_ORIG_ADDR_SRC = 12, /* union nfct_attr_grp_addr */ + ATTR_GRP_ORIG_ADDR_DST, /* union nfct_attr_grp_addr */ + ATTR_GRP_REPL_ADDR_SRC, /* union nfct_attr_grp_addr */ + ATTR_GRP_REPL_ADDR_DST, /* union nfct_attr_grp_addr */ ATTR_GRP_MAX }; @@ -174,6 +178,12 @@ struct nfct_attr_grp_ctrs { u_int64_t bytes; }; +union nfct_attr_grp_addr { + u_int32_t ip; + u_int32_t ip6[4]; + u_int32_t addr[4]; +}; + /* message type */ enum nf_conntrack_msg_type { NFCT_T_UNKNOWN = 0, -- cgit v1.2.3