Merge branch 'master' of /repos/git/net-next-2.6
[sfrench/cifs-2.6.git] / net / netfilter / nf_conntrack_netlink.c
index afc52f2ee4ac1f906b1daf2166faf9cff9256399..4e55403bf263f5085af3f6a0735437424222aaa0 100644 (file)
@@ -426,6 +426,17 @@ ctnetlink_proto_size(const struct nf_conn *ct)
        return len;
 }
 
+static inline size_t
+ctnetlink_counters_size(const struct nf_conn *ct)
+{
+       if (!nf_ct_ext_exist(ct, NF_CT_EXT_ACCT))
+               return 0;
+       return 2 * nla_total_size(0) /* CTA_COUNTERS_ORIG|REPL */
+              + 2 * nla_total_size(sizeof(uint64_t)) /* CTA_COUNTERS_PACKETS */
+              + 2 * nla_total_size(sizeof(uint64_t)) /* CTA_COUNTERS_BYTES */
+              ;
+}
+
 static inline size_t
 ctnetlink_nlmsg_size(const struct nf_conn *ct)
 {
@@ -436,11 +447,7 @@ ctnetlink_nlmsg_size(const struct nf_conn *ct)
               + 3 * nla_total_size(sizeof(u_int8_t)) /* CTA_PROTO_NUM */
               + nla_total_size(sizeof(u_int32_t)) /* CTA_ID */
               + nla_total_size(sizeof(u_int32_t)) /* CTA_STATUS */
-#ifdef CONFIG_NF_CT_ACCT
-              + 2 * nla_total_size(0) /* CTA_COUNTERS_ORIG|REPL */
-              + 2 * nla_total_size(sizeof(uint64_t)) /* CTA_COUNTERS_PACKETS */
-              + 2 * nla_total_size(sizeof(uint64_t)) /* CTA_COUNTERS_BYTES */
-#endif
+              + ctnetlink_counters_size(ct)
               + nla_total_size(sizeof(u_int32_t)) /* CTA_TIMEOUT */
               + nla_total_size(0) /* CTA_PROTOINFO */
               + nla_total_size(0) /* CTA_HELP */