diff options
-rw-r--r-- | net/netfilter/nf_conntrack_netlink.c | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/net/netfilter/nf_conntrack_netlink.c b/net/netfilter/nf_conntrack_netlink.c index 2b2af631d2b8..9a0c0d99dbfd 100644 --- a/net/netfilter/nf_conntrack_netlink.c +++ b/net/netfilter/nf_conntrack_netlink.c | |||
@@ -426,6 +426,17 @@ ctnetlink_proto_size(const struct nf_conn *ct) | |||
426 | } | 426 | } |
427 | 427 | ||
428 | static inline size_t | 428 | static inline size_t |
429 | ctnetlink_counters_size(const struct nf_conn *ct) | ||
430 | { | ||
431 | if (!nf_ct_ext_exist(ct, NF_CT_EXT_ACCT)) | ||
432 | return 0; | ||
433 | return 2 * nla_total_size(0) /* CTA_COUNTERS_ORIG|REPL */ | ||
434 | + 2 * nla_total_size(sizeof(uint64_t)) /* CTA_COUNTERS_PACKETS */ | ||
435 | + 2 * nla_total_size(sizeof(uint64_t)) /* CTA_COUNTERS_BYTES */ | ||
436 | ; | ||
437 | } | ||
438 | |||
439 | static inline size_t | ||
429 | ctnetlink_nlmsg_size(const struct nf_conn *ct) | 440 | ctnetlink_nlmsg_size(const struct nf_conn *ct) |
430 | { | 441 | { |
431 | return NLMSG_ALIGN(sizeof(struct nfgenmsg)) | 442 | return NLMSG_ALIGN(sizeof(struct nfgenmsg)) |
@@ -435,11 +446,7 @@ ctnetlink_nlmsg_size(const struct nf_conn *ct) | |||
435 | + 3 * nla_total_size(sizeof(u_int8_t)) /* CTA_PROTO_NUM */ | 446 | + 3 * nla_total_size(sizeof(u_int8_t)) /* CTA_PROTO_NUM */ |
436 | + nla_total_size(sizeof(u_int32_t)) /* CTA_ID */ | 447 | + nla_total_size(sizeof(u_int32_t)) /* CTA_ID */ |
437 | + nla_total_size(sizeof(u_int32_t)) /* CTA_STATUS */ | 448 | + nla_total_size(sizeof(u_int32_t)) /* CTA_STATUS */ |
438 | #ifdef CONFIG_NF_CT_ACCT | 449 | + ctnetlink_counters_size(ct) |
439 | + 2 * nla_total_size(0) /* CTA_COUNTERS_ORIG|REPL */ | ||
440 | + 2 * nla_total_size(sizeof(uint64_t)) /* CTA_COUNTERS_PACKETS */ | ||
441 | + 2 * nla_total_size(sizeof(uint64_t)) /* CTA_COUNTERS_BYTES */ | ||
442 | #endif | ||
443 | + nla_total_size(sizeof(u_int32_t)) /* CTA_TIMEOUT */ | 450 | + nla_total_size(sizeof(u_int32_t)) /* CTA_TIMEOUT */ |
444 | + nla_total_size(0) /* CTA_PROTOINFO */ | 451 | + nla_total_size(0) /* CTA_PROTOINFO */ |
445 | + nla_total_size(0) /* CTA_HELP */ | 452 | + nla_total_size(0) /* CTA_HELP */ |