From 75d1a172320a312b97d692cd60668c02eb980c9d Mon Sep 17 00:00:00 2001 From: "/C=DE/ST=Berlin/L=Berlin/O=Netfilter Project/OU=Development/CN=pablo/emailAddress=pablo@netfilter.org" Date: Mon, 19 Dec 2005 20:29:58 +0000 Subject: Slightly API changes required for the upcoming ipv6 support --- .../libnetfilter_conntrack/libnetfilter_conntrack.h | 7 ++++--- .../libnetfilter_conntrack/linux_nfnetlink_conntrack.h | 3 +++ src/libnetfilter_conntrack.c | 18 ++++++++++-------- utils/ctnl_test.c | 4 ++-- 4 files changed, 19 insertions(+), 13 deletions(-) diff --git a/include/libnetfilter_conntrack/libnetfilter_conntrack.h b/include/libnetfilter_conntrack/libnetfilter_conntrack.h index b0b6aeb..32daaca 100644 --- a/include/libnetfilter_conntrack/libnetfilter_conntrack.h +++ b/include/libnetfilter_conntrack/libnetfilter_conntrack.h @@ -263,8 +263,9 @@ extern int nfct_get_conntrack(struct nfct_handle *cth, /* * Conntrack table dumping & zeroing */ -extern int nfct_dump_conntrack_table(struct nfct_handle *cth); -extern int nfct_dump_conntrack_table_reset_counters(struct nfct_handle *cth); +extern int nfct_dump_conntrack_table(struct nfct_handle *cth, int family); +extern int nfct_dump_conntrack_table_reset_counters(struct nfct_handle *cth, + int family); /* * Conntrack event notification @@ -301,7 +302,7 @@ extern int nfct_conntrack_compare(struct nfct_conntrack *ct1, /* * Expectations */ -extern int nfct_dump_expect_list(struct nfct_handle *cth); +extern int nfct_dump_expect_list(struct nfct_handle *cth, int family); extern int nfct_flush_conntrack_table(struct nfct_handle *cth); extern int nfct_get_expectation(struct nfct_handle *cth, struct nfct_tuple *tuple, diff --git a/include/libnetfilter_conntrack/linux_nfnetlink_conntrack.h b/include/libnetfilter_conntrack/linux_nfnetlink_conntrack.h index 32e0f2a..edf3e91 100644 --- a/include/libnetfilter_conntrack/linux_nfnetlink_conntrack.h +++ b/include/libnetfilter_conntrack/linux_nfnetlink_conntrack.h @@ -64,6 +64,9 @@ enum ctattr_l4proto { CTA_PROTO_ICMP_ID, CTA_PROTO_ICMP_TYPE, CTA_PROTO_ICMP_CODE, + CTA_PROTO_ICMPV6_ID, + CTA_PROTO_ICMPV6_TYPE, + CTA_PROTO_ICMPV6_CODE, __CTA_PROTO_MAX }; #define CTA_PROTO_MAX (__CTA_PROTO_MAX - 1) diff --git a/src/libnetfilter_conntrack.c b/src/libnetfilter_conntrack.c index 145d64f..0976143 100644 --- a/src/libnetfilter_conntrack.c +++ b/src/libnetfilter_conntrack.c @@ -932,7 +932,8 @@ int nfct_get_conntrack(struct nfct_handle *cth, struct nfct_tuple *tuple, return nfnl_listen(&cth->nfnlh, &callback_handler, cth); } -static int __nfct_dump_conntrack_table(struct nfct_handle *cth, int zero) +static int __nfct_dump_conntrack_table(struct nfct_handle *cth, int zero, + int family) { int err, msg; struct nfnlhdr req; @@ -945,7 +946,7 @@ static int __nfct_dump_conntrack_table(struct nfct_handle *cth, int zero) else msg = IPCTNL_MSG_CT_GET; - nfnl_fill_hdr(&cth->nfnlh, &req.nlh, 0, AF_INET, 0, + nfnl_fill_hdr(&cth->nfnlh, &req.nlh, 0, family, 0, msg, NLM_F_ROOT|NLM_F_MATCH|NLM_F_REQUEST|NLM_F_DUMP); err = nfnl_send(&cth->nfnlh, &req.nlh); @@ -955,14 +956,15 @@ static int __nfct_dump_conntrack_table(struct nfct_handle *cth, int zero) return nfnl_listen(&cth->nfnlh, &callback_handler, cth); } -int nfct_dump_conntrack_table(struct nfct_handle *cth) +int nfct_dump_conntrack_table(struct nfct_handle *cth, int family) { - return(__nfct_dump_conntrack_table(cth, 0)); + return(__nfct_dump_conntrack_table(cth, 0, family)); } -int nfct_dump_conntrack_table_reset_counters(struct nfct_handle *cth) +int nfct_dump_conntrack_table_reset_counters(struct nfct_handle *cth, + int family) { - return(__nfct_dump_conntrack_table(cth, 1)); + return(__nfct_dump_conntrack_table(cth, 1, family)); } int nfct_event_conntrack(struct nfct_handle *cth) @@ -987,7 +989,7 @@ void nfct_register_proto(struct nfct_proto *h) list_add(&h->head, &proto_list); } -int nfct_dump_expect_list(struct nfct_handle *cth) +int nfct_dump_expect_list(struct nfct_handle *cth, int family) { int err; struct nfnlhdr req; @@ -995,7 +997,7 @@ int nfct_dump_expect_list(struct nfct_handle *cth) memset(&req, 0, sizeof(req)); cth->handler = nfct_expect_netlink_handler; - nfnl_fill_hdr(&cth->nfnlh, &req.nlh, 0, AF_INET, 0, + nfnl_fill_hdr(&cth->nfnlh, &req.nlh, 0, family, 0, IPCTNL_MSG_EXP_GET, NLM_F_ROOT|NLM_F_MATCH|NLM_F_REQUEST); err = nfnl_send(&cth->nfnlh, &req.nlh); diff --git a/utils/ctnl_test.c b/utils/ctnl_test.c index e5075ef..9f4f28e 100644 --- a/utils/ctnl_test.c +++ b/utils/ctnl_test.c @@ -96,12 +96,12 @@ int main(int argc, char **argv) "you have NET_CAPABILITIES"); nfct_register_callback(cth, nfct_default_conntrack_display, NULL); - ret = nfct_dump_conntrack_table_reset_counters(cth); + ret = nfct_dump_conntrack_table_reset_counters(cth, AF_INET); fprintf(stdout, "TEST 2: dump conntrack table and reset (%d)\n", ret); if (ret < 0) errors++; - ret = nfct_dump_conntrack_table(cth); + ret = nfct_dump_conntrack_table(cth, AF_INET); fprintf(stdout, "TEST 3: dump conntrack table (%d)\n", ret); if (ret < 0) errors++; -- cgit v1.2.3