diff options
author | Jiri Pirko <jpirko@redhat.com> | 2010-04-01 06:39:19 -0400 |
---|---|---|
committer | Patrick McHardy <kaber@trash.net> | 2010-04-01 06:39:19 -0400 |
commit | d26e6a02835affa8bafe09a51e37f9fbc339e415 (patch) | |
tree | c831a7c295baffa5b2a3c36bef3a669a51e6ae7a /net/netfilter | |
parent | b44672889c11e13e4f4dc0a8ee23f0e64f1e57c6 (diff) |
netfilter: ctnetlink: compute message size properly
Message size should be dependent on the presence of an accounting
extension, not on CONFIG_NF_CT_ACCT definition.
Signed-off-by: Jiri Pirko <jpirko@redhat.com>
Signed-off-by: Patrick McHardy <kaber@trash.net>
Diffstat (limited to 'net/netfilter')
-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 */ |