Thread (25 messages) flat view 25 messages, 3 authors, 2011-11-21

Re: [PATCH 02/17] netfilter: nat: remove module reference counting from NAT protocols

From: Patrick McHardy <hidden>
Date: 2011-11-21 14:59:14
Also in: netfilter-devel

On 11/21/2011 08:36 AM, Eric Dumazet wrote:
Le lundi 21 novembre 2011 à 06:45 +0100, kaber@trash.net a écrit :
quoted
From: Patrick McHardy<redacted>

The only remaining user of NAT protocol module reference counting is NAT
ctnetlink support. Since this is a fairly short sequence of code, convert
over to use RCU and remove module reference counting.

Signed-off-by: Patrick McHardy<redacted>
@@ -612,16 +592,18 @@ static int nfnetlink_parse_nat_proto(struct nlattr *attr,
  	if (err<  0)
  		return err;

-	npt = nf_nat_proto_find_get(nf_ct_protonum(ct));
+	rcu_read_lock();
+	npt = __nf_nat_proto_find(nf_ct_protonum(ct));
  	if (npt->nlattr_to_range)
  		err = npt->nlattr_to_range(tb, range);
-	nf_nat_proto_put(npt);
+	rcu_read_unlock();
  	return err;
  }
Seems good, but you should explain in changelog why its safe.

(Using rcu also means special action must be taken in the write side,
here the module removal)
I'll update the changelog for the next submission.
quoted
  static const struct nla_policy nat_nla_policy[CTA_NAT_MAX+1] = {
  	[CTA_NAT_MINIP]		= { .type = NLA_U32 },
  	[CTA_NAT_MAXIP]		= { .type = NLA_U32 },
+	[CTA_NAT_PROTO]		= { .type = NLA_NESTED },
  };
I just dont understand this part :-
Yeah, it doesn't belong into this patch.

--
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help