Index: src/conntrack/api.c =================================================================== --- src/conntrack/api.c (revisión: 6716) +++ src/conntrack/api.c (copia de trabajo) @@ -185,6 +185,12 @@ * @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 @@ 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); + } } /** Index: src/conntrack/getter.c =================================================================== --- src/conntrack/getter.c (revisión: 6716) +++ src/conntrack/getter.c (copia de trabajo) @@ -162,6 +162,11 @@ 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 @@ [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, };