summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
author/C=DE/ST=Berlin/L=Berlin/O=Netfilter Project/OU=Development/CN=pablo/emailAddress=pablo@netfilter.org </C=DE/ST=Berlin/L=Berlin/O=Netfilter Project/OU=Development/CN=pablo/emailAddress=pablo@netfilter.org>2007-01-05 23:25:23 +0000
committer/C=DE/ST=Berlin/L=Berlin/O=Netfilter Project/OU=Development/CN=pablo/emailAddress=pablo@netfilter.org </C=DE/ST=Berlin/L=Berlin/O=Netfilter Project/OU=Development/CN=pablo/emailAddress=pablo@netfilter.org>2007-01-05 23:25:23 +0000
commit7b240df7f18dc47e3287ec0d212a88e84fd66ee7 (patch)
tree25e7b2fcd8c784ccab714afd4e914076781958fd
parent079b41ade6f5ead5d372a8114891832fe5c388ff (diff)
- fix a crash on trying to set the counters of a conntracksvn_t_libnetfilter_conntrack-0.0.50
- document that ATTR_*_COUNTER_*, ATTR_USE and ATTR_ID are unsettable - implement getter for the ATTR_USE attribute Based on patches from Victor Stinner.
-rw-r--r--src/conntrack/api.c12
-rw-r--r--src/conntrack/getter.c6
2 files changed, 16 insertions, 2 deletions
diff --git a/src/conntrack/api.c b/src/conntrack/api.c
index a3cc061..f008f49 100644
--- a/src/conntrack/api.c
+++ b/src/conntrack/api.c
@@ -185,6 +185,12 @@ void nfct_callback_unregister(struct nfct_handle *h)
* @ct: pointer to a valid conntrack
* @type: attribute type
* @value: pointer to the attribute value
+ *
+ * Note that certain attributes are unsettable:
+ * - ATTR_USE
+ * - ATTR_ID
+ * - ATTR_*_COUNTER_*
+ * The call of this function for such attributes do nothing.
*/
void nfct_set_attr(struct nf_conntrack *ct,
const enum nf_conntrack_attr type,
@@ -196,8 +202,10 @@ void nfct_set_attr(struct nf_conntrack *ct,
if (type >= ATTR_MAX)
return;
- set_attr_array[type](ct, value);
- set_bit(type, ct->set);
+ if (set_attr_array[type]) {
+ set_attr_array[type](ct, value);
+ set_bit(type, ct->set);
+ }
}
/**
diff --git a/src/conntrack/getter.c b/src/conntrack/getter.c
index 7e19978..40d65a1 100644
--- a/src/conntrack/getter.c
+++ b/src/conntrack/getter.c
@@ -162,6 +162,11 @@ static const void *get_attr_status(const struct nf_conntrack *ct)
return &ct->status;
}
+static const void *get_attr_use(const struct nf_conntrack *ct)
+{
+ return &ct->use;
+}
+
get_attr get_attr_array[] = {
[ATTR_ORIG_IPV4_SRC] = get_attr_orig_ipv4_src,
[ATTR_ORIG_IPV4_DST] = get_attr_orig_ipv4_dst,
@@ -193,5 +198,6 @@ get_attr get_attr_array[] = {
[ATTR_ORIG_COUNTER_BYTES] = get_attr_orig_counter_bytes,
[ATTR_REPL_COUNTER_PACKETS] = get_attr_repl_counter_packets,
[ATTR_REPL_COUNTER_BYTES] = get_attr_repl_counter_bytes,
+ [ATTR_USE] = get_attr_use,
[ATTR_STATUS] = get_attr_status,
};