|
@@ -596,6 +596,9 @@ ctnetlink_nlmsg_size(const struct nf_conn *ct)
|
|
|
#endif
|
|
#endif
|
|
|
#ifdef CONFIG_NF_CONNTRACK_MARK
|
|
#ifdef CONFIG_NF_CONNTRACK_MARK
|
|
|
+ nla_total_size(sizeof(u_int32_t)) /* CTA_MARK */
|
|
+ nla_total_size(sizeof(u_int32_t)) /* CTA_MARK */
|
|
|
|
|
+#endif
|
|
|
|
|
+#ifdef CONFIG_NF_CONNTRACK_ZONES
|
|
|
|
|
+ + nla_total_size(sizeof(u_int16_t)) /* CTA_ZONE */
|
|
|
#endif
|
|
#endif
|
|
|
+ ctnetlink_proto_size(ct)
|
|
+ ctnetlink_proto_size(ct)
|
|
|
+ ctnetlink_label_size(ct)
|
|
+ ctnetlink_label_size(ct)
|
|
@@ -1150,7 +1153,7 @@ static int ctnetlink_done_list(struct netlink_callback *cb)
|
|
|
static int
|
|
static int
|
|
|
ctnetlink_dump_list(struct sk_buff *skb, struct netlink_callback *cb, bool dying)
|
|
ctnetlink_dump_list(struct sk_buff *skb, struct netlink_callback *cb, bool dying)
|
|
|
{
|
|
{
|
|
|
- struct nf_conn *ct, *last = NULL;
|
|
|
|
|
|
|
+ struct nf_conn *ct, *last;
|
|
|
struct nf_conntrack_tuple_hash *h;
|
|
struct nf_conntrack_tuple_hash *h;
|
|
|
struct hlist_nulls_node *n;
|
|
struct hlist_nulls_node *n;
|
|
|
struct nfgenmsg *nfmsg = nlmsg_data(cb->nlh);
|
|
struct nfgenmsg *nfmsg = nlmsg_data(cb->nlh);
|
|
@@ -1163,8 +1166,7 @@ ctnetlink_dump_list(struct sk_buff *skb, struct netlink_callback *cb, bool dying
|
|
|
if (cb->args[2])
|
|
if (cb->args[2])
|
|
|
return 0;
|
|
return 0;
|
|
|
|
|
|
|
|
- if (cb->args[0] == nr_cpu_ids)
|
|
|
|
|
- return 0;
|
|
|
|
|
|
|
+ last = (struct nf_conn *)cb->args[1];
|
|
|
|
|
|
|
|
for (cpu = cb->args[0]; cpu < nr_cpu_ids; cpu++) {
|
|
for (cpu = cb->args[0]; cpu < nr_cpu_ids; cpu++) {
|
|
|
struct ct_pcpu *pcpu;
|
|
struct ct_pcpu *pcpu;
|
|
@@ -1174,7 +1176,6 @@ ctnetlink_dump_list(struct sk_buff *skb, struct netlink_callback *cb, bool dying
|
|
|
|
|
|
|
|
pcpu = per_cpu_ptr(net->ct.pcpu_lists, cpu);
|
|
pcpu = per_cpu_ptr(net->ct.pcpu_lists, cpu);
|
|
|
spin_lock_bh(&pcpu->lock);
|
|
spin_lock_bh(&pcpu->lock);
|
|
|
- last = (struct nf_conn *)cb->args[1];
|
|
|
|
|
list = dying ? &pcpu->dying : &pcpu->unconfirmed;
|
|
list = dying ? &pcpu->dying : &pcpu->unconfirmed;
|
|
|
restart:
|
|
restart:
|
|
|
hlist_nulls_for_each_entry(h, n, list, hnnode) {
|
|
hlist_nulls_for_each_entry(h, n, list, hnnode) {
|
|
@@ -1193,7 +1194,9 @@ restart:
|
|
|
ct);
|
|
ct);
|
|
|
rcu_read_unlock();
|
|
rcu_read_unlock();
|
|
|
if (res < 0) {
|
|
if (res < 0) {
|
|
|
- nf_conntrack_get(&ct->ct_general);
|
|
|
|
|
|
|
+ if (!atomic_inc_not_zero(&ct->ct_general.use))
|
|
|
|
|
+ continue;
|
|
|
|
|
+ cb->args[0] = cpu;
|
|
|
cb->args[1] = (unsigned long)ct;
|
|
cb->args[1] = (unsigned long)ct;
|
|
|
spin_unlock_bh(&pcpu->lock);
|
|
spin_unlock_bh(&pcpu->lock);
|
|
|
goto out;
|
|
goto out;
|
|
@@ -1202,10 +1205,10 @@ restart:
|
|
|
if (cb->args[1]) {
|
|
if (cb->args[1]) {
|
|
|
cb->args[1] = 0;
|
|
cb->args[1] = 0;
|
|
|
goto restart;
|
|
goto restart;
|
|
|
- } else
|
|
|
|
|
- cb->args[2] = 1;
|
|
|
|
|
|
|
+ }
|
|
|
spin_unlock_bh(&pcpu->lock);
|
|
spin_unlock_bh(&pcpu->lock);
|
|
|
}
|
|
}
|
|
|
|
|
+ cb->args[2] = 1;
|
|
|
out:
|
|
out:
|
|
|
if (last)
|
|
if (last)
|
|
|
nf_ct_put(last);
|
|
nf_ct_put(last);
|
|
@@ -2039,6 +2042,9 @@ ctnetlink_nfqueue_build_size(const struct nf_conn *ct)
|
|
|
#endif
|
|
#endif
|
|
|
#ifdef CONFIG_NF_CONNTRACK_MARK
|
|
#ifdef CONFIG_NF_CONNTRACK_MARK
|
|
|
+ nla_total_size(sizeof(u_int32_t)) /* CTA_MARK */
|
|
+ nla_total_size(sizeof(u_int32_t)) /* CTA_MARK */
|
|
|
|
|
+#endif
|
|
|
|
|
+#ifdef CONFIG_NF_CONNTRACK_ZONES
|
|
|
|
|
+ + nla_total_size(sizeof(u_int16_t)) /* CTA_ZONE */
|
|
|
#endif
|
|
#endif
|
|
|
+ ctnetlink_proto_size(ct)
|
|
+ ctnetlink_proto_size(ct)
|
|
|
;
|
|
;
|