--- zzzz-none-000/linux-4.19.183/net/netfilter/nf_conntrack_netlink.c 2021-03-24 10:07:39.000000000 +0000 +++ bcm63-7530ax-756/linux-4.19.183/net/netfilter/nf_conntrack_netlink.c 2023-06-28 08:54:21.000000000 +0000 @@ -54,6 +54,9 @@ #include #include +#ifdef CONFIG_BCM_KF_NETFILTER +#include +#endif MODULE_LICENSE("GPL"); @@ -236,6 +239,9 @@ static int dump_counters(struct sk_buff *skb, struct nf_conn_acct *acct, +#if defined(CONFIG_BCM_KF_BLOG) && defined(CONFIG_BLOG) + const struct nf_conn *ct, +#endif enum ip_conntrack_dir dir, int type) { enum ctattr_type attr = dir ? CTA_COUNTERS_REPLY: CTA_COUNTERS_ORIG; @@ -250,6 +256,19 @@ pkts = atomic64_read(&counter[dir].packets); bytes = atomic64_read(&counter[dir].bytes); } +#if defined(CONFIG_BCM_KF_BLOG) && defined(CONFIG_BLOG) +/*TODO: support CTRZERO for fast_stats */ + + { + BlogFcStats_t fast_stats = {0}; + + blog_ct_get_stats(ct, ct->bcm_ext.blog_key[dir], dir, + &fast_stats); + + pkts += fast_stats.rx_packets; + bytes += fast_stats.rx_bytes; + } +#endif nest_count = nla_nest_start(skb, attr | NLA_F_NESTED); if (!nest_count) @@ -277,10 +296,17 @@ if (!acct) return 0; +#if defined(CONFIG_BCM_KF_BLOG) && defined(CONFIG_BLOG) + if (dump_counters(skb, acct, ct, IP_CT_DIR_ORIGINAL, type) < 0) + return -1; + if (dump_counters(skb, acct, ct, IP_CT_DIR_REPLY, type) < 0) + return -1; +#else if (dump_counters(skb, acct, IP_CT_DIR_ORIGINAL, type) < 0) return -1; if (dump_counters(skb, acct, IP_CT_DIR_REPLY, type) < 0) return -1; +#endif return 0; } @@ -573,6 +599,11 @@ ctnetlink_dump_protoinfo(skb, ct) < 0)) goto nla_put_failure; +#ifdef CONFIG_BCM_KF_NETFILTER + if (bcm_ctnetlink_dump(skb, ct) < 0) + goto nla_put_failure; +#endif + nlmsg_end(skb, nlh); return skb->len; @@ -675,6 +706,9 @@ #endif + ctnetlink_proto_size(ct) + ctnetlink_label_size(ct) +#ifdef CONFIG_BCM_KF_NETFILTER + + bcm_ctnetlink_size(ct) +#endif ; } @@ -798,6 +832,10 @@ && ctnetlink_dump_mark(skb, ct) < 0) goto nla_put_failure; #endif +#ifdef CONFIG_BCM_KF_NETFILTER + if (bcm_ctnetlink_dump(skb, ct) < 0) + goto nla_put_failure; +#endif nlmsg_end(skb, nlh); err = nfnetlink_send(skb, net, item->portid, group, item->report, GFP_ATOMIC); @@ -1901,6 +1939,12 @@ return err; } +#ifdef CONFIG_BCM_KF_NETFILTER + err = bcm_ctnetlink_change(ct, cda); + if (err < 0) + return err; +#endif + return 0; } @@ -2364,6 +2408,9 @@ + nla_total_size(sizeof(u_int16_t)) /* CTA_ZONE|CTA_TUPLE_ZONE */ #endif + ctnetlink_proto_size(ct) +#ifdef CONFIG_BCM_KF_NETFILTER + + bcm_ctnetlink_size(ct) +#endif ; } @@ -2439,6 +2486,10 @@ #endif if (ctnetlink_dump_labels(skb, ct) < 0) goto nla_put_failure; +#ifdef CONFIG_BCM_KF_NETFILTER + if (bcm_ctnetlink_dump(skb, ct) < 0) + goto nla_put_failure; +#endif return 0; nla_put_failure: