Skip to contentSkip to conversation

netfilter: nat: Update obsolete comment on get_unique_tuple()

PATCH In review Yonatan Goldschmidt 3 participants 5 messages Jun 27, 2019 – Jul 2, 2019

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 netfilter: nat: Update obsolete comment on get_unique_tuple()

Commit c7232c9979cba ("netfilter: add protocol independent NAT core") added nf_nat_core.c based on ipv4/netfilter/nf_nat_core.c, with this comment copied.

Referred function doesn't exist anymore, and anyway since day one of this file it should have referred the generic __nf_conntrack_confirm(), added in 9fb9cbb1082d6.

---
 net/netfilter/nf_nat_core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
net/netfilter/nf_nat_core.c +1 -1
index 9ab410455992..3f6023ed4966 100644
@@ -519,7 +519,7 @@ static void nf_nat_l4proto_unique_tuple(struct nf_conntrack_tuple *tuple,
  * and NF_INET_LOCAL_OUT, we change the destination to map into the
  * range. It might not be possible to get a unique tuple, but we try.
  * At worst (or if we race), we will end up with a final duplicate in
- * __ip_conntrack_confirm and drop the packet. */
+ * __nf_conntrack_confirm and drop the packet. */
 static void
 get_unique_tuple(struct nf_conntrack_tuple *tuple,
                 const struct nf_conntrack_tuple *orig_tuple,

---

#1 lore raw
Quoted 18 lines · Yonatan Goldschmidt

Commit c7232c9979cba ("netfilter: add protocol independent NAT core") added nf_nat_core.c based on ipv4/netfilter/nf_nat_core.c, with this comment copied.

Referred function doesn't exist anymore, and anyway since day one of this file it should have referred the generic __nf_conntrack_confirm(), added in 9fb9cbb1082d6.

---
 net/netfilter/nf_nat_core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
net/netfilter/nf_nat_core.c +0 -0
index 9ab410455992..3f6023ed4966 100644

net/netfilter/nf_nat_core.c static void nf_nat_l4proto_unique_tuple(struct nf_conntrack_tuple *tuple, · line 522

Quoted 5 lines
net/netfilter/nf_nat_core.c +1 -1
@@ -519,7 +519,7 @@ static void nf_nat_l4proto_unique_tuple(struct nf_conntrack_tuple *tuple,
  * and NF_INET_LOCAL_OUT, we change the destination to map into the
  * range. It might not be possible to get a unique tuple, but we try.
  * At worst (or if we race), we will end up with a final duplicate in
- * __ip_conntrack_confirm and drop the packet. */
+ * __nf_conntrack_confirm and drop the packet. */

I dislike this oneliners to update comments, I tend to think it's too much overhead a patch just to update something obvious to the reader.

However, I also understand you may want to fix this while passing by here.

So my sugggestion is that you run:

git grep ip_conntrack

in the tree, searching for comments and documentation that can be updated, eg.

net/netfilter/nf_conntrack_proto_icmp.c: /* See ip_conntrack_proto_tcp.c */

Please, only update comments / documentation in your patch.

The ip_conntrack_ prefix is legacy, that it was used by the time there was only support for IPv4 in the connection tracking system.

Thanks.

#2 lore raw
Quoted 38 lines · Pablo Neira Ayuso
Quoted 18 lines · Yonatan Goldschmidt

Commit c7232c9979cba ("netfilter: add protocol independent NAT core") added nf_nat_core.c based on ipv4/netfilter/nf_nat_core.c, with this comment copied.

Referred function doesn't exist anymore, and anyway since day one of this file it should have referred the generic __nf_conntrack_confirm(), added in 9fb9cbb1082d6.

---
 net/netfilter/nf_nat_core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
net/netfilter/nf_nat_core.c +0 -0
index 9ab410455992..3f6023ed4966 100644

net/netfilter/nf_nat_core.c static void nf_nat_l4proto_unique_tuple(struct nf_conntrack_tuple *tuple, · line 522

Quoted 5 lines
net/netfilter/nf_nat_core.c +1 -1
@@ -519,7 +519,7 @@ static void nf_nat_l4proto_unique_tuple(struct nf_conntrack_tuple *tuple,
  * and NF_INET_LOCAL_OUT, we change the destination to map into the
  * range. It might not be possible to get a unique tuple, but we try.
  * At worst (or if we race), we will end up with a final duplicate in
- * __ip_conntrack_confirm and drop the packet. */
+ * __nf_conntrack_confirm and drop the packet. */

I dislike this oneliners to update comments, I tend to think it's too much overhead a patch just to update something obvious to the reader.

However, I also understand you may want to fix this while passing by here.

So my sugggestion is that you run:

git grep ip_conntrack

in the tree, searching for comments and documentation that can be updated, eg.

Quoted 8 lines

net/netfilter/nf_conntrack_proto_icmp.c: /* See ip_conntrack_proto_tcp.c */

Please, only update comments / documentation in your patch.

The ip_conntrack_ prefix is legacy, that it was used by the time there was only support for IPv4 in the connection tracking system.

Thanks.

Okay, I've updated all comments which I found relevant, and made them refer to current files/functions names.
I have retained comments referring to historical actions (i.e, comments like "derived from ..." were not touched, even if the file it was derived from is no longer here).

---
 include/linux/netfilter/nf_conntrack_h323_asn1.h | 2 +-
 net/ipv4/netfilter/ipt_CLUSTERIP.c               | 4 ++--
 net/netfilter/nf_conntrack_core.c                | 2 +-
 net/netfilter/nf_conntrack_h323_asn1.c           | 4 ++--
 net/netfilter/nf_conntrack_proto_gre.c           | 2 +-
 net/netfilter/nf_conntrack_proto_icmp.c          | 2 +-
 net/netfilter/nf_nat_core.c                      | 2 +-
 7 files changed, 9 insertions(+), 9 deletions(-)
include/linux/netfilter/nf_conntrack_h323_asn1.h +1 -1
index 91d6275292a5..a3844e2cd531 100644
@@ -1,6 +1,6 @@
 /* SPDX-License-Identifier: GPL-2.0-only */
 /****************************************************************************
- * ip_conntrack_h323_asn1.h - BER and PER decoding library for H.323
+ * nf_conntrack_h323_asn1.h - BER and PER decoding library for H.323
  * 			      conntrack/NAT module.
  *
  * Copyright (c) 2006 by Jing Min Zhao <[email protected]>
net/ipv4/netfilter/ipt_CLUSTERIP.c +2 -2
index 4d6bf7ac0792..6bdb1ab8af61 100644
@@ -416,8 +416,8 @@ clusterip_tg(struct sk_buff *skb, const struct xt_action_param *par)
 	     ctinfo == IP_CT_RELATED_REPLY))
 		return XT_CONTINUE;
 
-	/* ip_conntrack_icmp guarantees us that we only have ICMP_ECHO,
-	 * TIMESTAMP, INFO_REQUEST or ADDRESS type icmp packets from here
+	/* nf_conntrack_proto_icmp guarantees us that we only have ICMP_ECHO,
+	 * TIMESTAMP, INFO_REQUEST or ICMP_ADDRESS type icmp packets from here
 	 * on, which all have an ID field [relevant for hashing]. */
 
 	hash = clusterip_hashfn(skb, cipinfo->config);
net/netfilter/nf_conntrack_core.c +1 -1
index f4f9b8344a32..fd7d317951d4 100644
@@ -1817,7 +1817,7 @@ EXPORT_SYMBOL_GPL(nf_ct_kill_acct);
 #include <linux/mutex.h>
 
 /* Generic function for tcp/udp/sctp/dccp and alike. This needs to be
- * in ip_conntrack_core, since we don't want the protocols to autoload
+ * in nf_conntrack_core, since we don't want the protocols to autoload
  * or depend on ctnetlink */
 int nf_ct_port_tuple_to_nlattr(struct sk_buff *skb,
 			       const struct nf_conntrack_tuple *tuple)
net/netfilter/nf_conntrack_h323_asn1.c +2 -2
index 8f6ba8162f0b..e86b12bd19ed 100644
@@ -1,11 +1,11 @@
 // SPDX-License-Identifier: GPL-2.0-only
 /*
- * ip_conntrack_helper_h323_asn1.c - BER and PER decoding library for H.323
+ * nf_conntrack_helper_h323_asn1.c - BER and PER decoding library for H.323
  * 			      	     conntrack/NAT module.
  *
  * Copyright (c) 2006 by Jing Min Zhao <[email protected]>
  *
- * See ip_conntrack_helper_h323_asn1.h for details.
+ * See nf_conntrack_helper_h323_asn1.h for details.
  */
 
 #ifdef __KERNEL__
net/netfilter/nf_conntrack_proto_gre.c +1 -1
index c2eb365f1723..ceb492a418c1 100644
@@ -1,6 +1,6 @@
 // SPDX-License-Identifier: GPL-2.0-only
 /*
- * ip_conntrack_proto_gre.c - Version 3.0
+ * nf_conntrack_proto_gre.c - Version 3.0
  *
  * Connection tracking protocol helper module for GRE.
  *
net/netfilter/nf_conntrack_proto_icmp.c +1 -1
index a824367ed518..5f37aff3b2a9 100644
@@ -215,7 +215,7 @@ int nf_conntrack_icmpv4_error(struct nf_conn *tmpl,
 		return -NF_ACCEPT;
 	}
 
-	/* See ip_conntrack_proto_tcp.c */
+	/* See nf_conntrack_proto_tcp.c */
 	if (state->net->ct.sysctl_checksum &&
 	    state->hook == NF_INET_PRE_ROUTING &&
 	    nf_ip_checksum(skb, state->hook, dataoff, 0)) {
net/netfilter/nf_nat_core.c +1 -1
index 9ab410455992..3f6023ed4966 100644
@@ -519,7 +519,7 @@ static void nf_nat_l4proto_unique_tuple(struct nf_conntrack_tuple *tuple,
  * and NF_INET_LOCAL_OUT, we change the destination to map into the
  * range. It might not be possible to get a unique tuple, but we try.
  * At worst (or if we race), we will end up with a final duplicate in
- * __ip_conntrack_confirm and drop the packet. */
+ * __nf_conntrack_confirm and drop the packet. */
 static void
 get_unique_tuple(struct nf_conntrack_tuple *tuple,
 		 const struct nf_conntrack_tuple *orig_tuple,
#3 lore raw
Quoted 46 lines · Yonatan Goldschmidt
Quoted 45 lines · Pablo Neira Ayuso
Quoted 18 lines · Yonatan Goldschmidt

Commit c7232c9979cba ("netfilter: add protocol independent NAT core") added nf_nat_core.c based on ipv4/netfilter/nf_nat_core.c, with this comment copied.

Referred function doesn't exist anymore, and anyway since day one of this file it should have referred the generic __nf_conntrack_confirm(), added in 9fb9cbb1082d6.

---
 net/netfilter/nf_nat_core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
net/netfilter/nf_nat_core.c +0 -0
index 9ab410455992..3f6023ed4966 100644

net/netfilter/nf_nat_core.c static void nf_nat_l4proto_unique_tuple(struct nf_conntrack_tuple *tuple, · line 522

Quoted 5 lines
net/netfilter/nf_nat_core.c +1 -1
@@ -519,7 +519,7 @@ static void nf_nat_l4proto_unique_tuple(struct nf_conntrack_tuple *tuple,
  * and NF_INET_LOCAL_OUT, we change the destination to map into the
  * range. It might not be possible to get a unique tuple, but we try.
  * At worst (or if we race), we will end up with a final duplicate in
- * __ip_conntrack_confirm and drop the packet. */
+ * __nf_conntrack_confirm and drop the packet. */

I dislike this oneliners to update comments, I tend to think it's too much overhead a patch just to update something obvious to the reader.

However, I also understand you may want to fix this while passing by here.

So my sugggestion is that you run:

git grep ip_conntrack

in the tree, searching for comments and documentation that can be updated, eg.

net/netfilter/nf_conntrack_proto_icmp.c: /* See ip_conntrack_proto_tcp.c */

Please, only update comments / documentation in your patch.

The ip_conntrack_ prefix is legacy, that it was used by the time there was only support for IPv4 in the connection tracking system.

Quoted 7 lines
Quoted 1 line

Thanks.

Okay, I've updated all comments which I found relevant, and made them refer to current files/functions names.
I have retained comments referring to historical actions (i.e, comments like "derived from ..." were not touched, even if the file it was derived from is no longer here).

Thanks, LGTM.

Would you re-submit this again? This is not showing in my patchwork:

https://patchwork.ozlabs.org/project/netfilter-devel/list/

Please, also include a new subject title and patch description according to this change.

Quoted 107 lines
---
 include/linux/netfilter/nf_conntrack_h323_asn1.h | 2 +-
 net/ipv4/netfilter/ipt_CLUSTERIP.c               | 4 ++--
 net/netfilter/nf_conntrack_core.c                | 2 +-
 net/netfilter/nf_conntrack_h323_asn1.c           | 4 ++--
 net/netfilter/nf_conntrack_proto_gre.c           | 2 +-
 net/netfilter/nf_conntrack_proto_icmp.c          | 2 +-
 net/netfilter/nf_nat_core.c                      | 2 +-
 7 files changed, 9 insertions(+), 9 deletions(-)
include/linux/netfilter/nf_conntrack_h323_asn1.h +1 -1
index 91d6275292a5..a3844e2cd531 100644
@@ -1,6 +1,6 @@
 /* SPDX-License-Identifier: GPL-2.0-only */
 /****************************************************************************
- * ip_conntrack_h323_asn1.h - BER and PER decoding library for H.323
+ * nf_conntrack_h323_asn1.h - BER and PER decoding library for H.323
  * 			      conntrack/NAT module.
  *
  * Copyright (c) 2006 by Jing Min Zhao <[email protected]>
net/ipv4/netfilter/ipt_CLUSTERIP.c +2 -2
index 4d6bf7ac0792..6bdb1ab8af61 100644
@@ -416,8 +416,8 @@ clusterip_tg(struct sk_buff *skb, const struct xt_action_param *par)
 	     ctinfo == IP_CT_RELATED_REPLY))
 		return XT_CONTINUE;
 
-	/* ip_conntrack_icmp guarantees us that we only have ICMP_ECHO,
-	 * TIMESTAMP, INFO_REQUEST or ADDRESS type icmp packets from here
+	/* nf_conntrack_proto_icmp guarantees us that we only have ICMP_ECHO,
+	 * TIMESTAMP, INFO_REQUEST or ICMP_ADDRESS type icmp packets from here
 	 * on, which all have an ID field [relevant for hashing]. */
 
 	hash = clusterip_hashfn(skb, cipinfo->config);
net/netfilter/nf_conntrack_core.c +1 -1
index f4f9b8344a32..fd7d317951d4 100644
@@ -1817,7 +1817,7 @@ EXPORT_SYMBOL_GPL(nf_ct_kill_acct);
 #include <linux/mutex.h>
 
 /* Generic function for tcp/udp/sctp/dccp and alike. This needs to be
- * in ip_conntrack_core, since we don't want the protocols to autoload
+ * in nf_conntrack_core, since we don't want the protocols to autoload
  * or depend on ctnetlink */
 int nf_ct_port_tuple_to_nlattr(struct sk_buff *skb,
 			       const struct nf_conntrack_tuple *tuple)
net/netfilter/nf_conntrack_h323_asn1.c +2 -2
index 8f6ba8162f0b..e86b12bd19ed 100644
@@ -1,11 +1,11 @@
 // SPDX-License-Identifier: GPL-2.0-only
 /*
- * ip_conntrack_helper_h323_asn1.c - BER and PER decoding library for H.323
+ * nf_conntrack_helper_h323_asn1.c - BER and PER decoding library for H.323
  * 			      	     conntrack/NAT module.
  *
  * Copyright (c) 2006 by Jing Min Zhao <[email protected]>
  *
- * See ip_conntrack_helper_h323_asn1.h for details.
+ * See nf_conntrack_helper_h323_asn1.h for details.
  */
 
 #ifdef __KERNEL__
net/netfilter/nf_conntrack_proto_gre.c +1 -1
index c2eb365f1723..ceb492a418c1 100644
@@ -1,6 +1,6 @@
 // SPDX-License-Identifier: GPL-2.0-only
 /*
- * ip_conntrack_proto_gre.c - Version 3.0
+ * nf_conntrack_proto_gre.c - Version 3.0
  *
  * Connection tracking protocol helper module for GRE.
  *
net/netfilter/nf_conntrack_proto_icmp.c +1 -1
index a824367ed518..5f37aff3b2a9 100644
@@ -215,7 +215,7 @@ int nf_conntrack_icmpv4_error(struct nf_conn *tmpl,
 		return -NF_ACCEPT;
 	}
 
-	/* See ip_conntrack_proto_tcp.c */
+	/* See nf_conntrack_proto_tcp.c */
 	if (state->net->ct.sysctl_checksum &&
 	    state->hook == NF_INET_PRE_ROUTING &&
 	    nf_ip_checksum(skb, state->hook, dataoff, 0)) {
net/netfilter/nf_nat_core.c +1 -1
index 9ab410455992..3f6023ed4966 100644
@@ -519,7 +519,7 @@ static void nf_nat_l4proto_unique_tuple(struct nf_conntrack_tuple *tuple,
  * and NF_INET_LOCAL_OUT, we change the destination to map into the
  * range. It might not be possible to get a unique tuple, but we try.
  * At worst (or if we race), we will end up with a final duplicate in
- * __ip_conntrack_confirm and drop the packet. */
+ * __nf_conntrack_confirm and drop the packet. */
 static void
 get_unique_tuple(struct nf_conntrack_tuple *tuple,
 		 const struct nf_conntrack_tuple *orig_tuple,
maintainer
#4 lore raw
Quoted 6 lines · Pablo Neira Ayuso

Would you re-submit this again? This is not showing in my patchwork:

https://patchwork.ozlabs.org/project/netfilter-devel/list/

Please, also include a new subject title and patch description according to this change.

Yon, if you submit this again, would you make these small changes?

Quoted 11 lines

include/linux/netfilter/nf_conntrack_h323_asn1.h line 5

Quoted 11 lines
include/linux/netfilter/nf_conntrack_h323_asn1.h +1 -1
index 91d6275292a5..a3844e2cd531 100644
@@ -1,6 +1,6 @@
 /* SPDX-License-Identifier: GPL-2.0-only */
 /****************************************************************************
- * ip_conntrack_h323_asn1.h - BER and PER decoding library for H.323
+ * nf_conntrack_h323_asn1.h - BER and PER decoding library for H.323
  * 			      conntrack/NAT module.
  *

I suggest to drop the file name here, its a self-reference.

Quoted 8 lines
Quoted 8 lines
include/linux/netfilter/nf_conntrack_h323_asn1.h +0 -0
 	hash = clusterip_hashfn(skb, cipinfo->config);
net/netfilter/nf_conntrack_core.c +0 -0
index f4f9b8344a32..fd7d317951d4 100644
@@ -1817,7 +1817,7 @@ EXPORT_SYMBOL_GPL(nf_ct_kill_acct);
 #include <linux/mutex.h>
 
Quoted 4 lines

net/netfilter/nf_conntrack_core.c EXPORT_SYMBOL_GPL(nf_ct_kill_acct); · line 1821

Quoted 4 lines
net/netfilter/nf_conntrack_core.c +1 -1
 /* Generic function for tcp/udp/sctp/dccp and alike. This needs to be
- * in ip_conntrack_core, since we don't want the protocols to autoload
+ * in nf_conntrack_core, since we don't want the protocols to autoload
  * or depend on ctnetlink */

The protocols are not modular anymore.

"Generic function for tcp/udp/sctp/dccp and alike." is enough i think.

Quoted 5 lines
Quoted 5 lines
net/netfilter/nf_conntrack_core.c +0 -0
 int nf_ct_port_tuple_to_nlattr(struct sk_buff *skb,
 			       const struct nf_conntrack_tuple *tuple)
net/netfilter/nf_conntrack_h323_asn1.c +0 -1
index 8f6ba8162f0b..e86b12bd19ed 100644
--- a/net/netfilter/nf_conntrack_h323_asn1.c
Quoted 8 lines

net/netfilter/nf_conntrack_h323_asn1.c line 5

Quoted 8 lines

+++ b/net/netfilter/nf_conntrack_h323_asn1.c

net/netfilter/nf_conntrack_h323_asn1.c +1 -1
@@ -1,11 +1,11 @@
 // SPDX-License-Identifier: GPL-2.0-only
 /*
- * ip_conntrack_helper_h323_asn1.c - BER and PER decoding library for H.323
+ * nf_conntrack_helper_h323_asn1.c - BER and PER decoding library for H.323
  * 			      	     conntrack/NAT module.
  *

I would just drop the name above, as its a self-reference.

Quoted 4 lines

net/netfilter/nf_conntrack_h323_asn1.c line 8

Quoted 4 lines
net/netfilter/nf_conntrack_h323_asn1.c +1 -1
  * Copyright (c) 2006 by Jing Min Zhao <[email protected]>
  *
- * See ip_conntrack_helper_h323_asn1.h for details.
+ * See nf_conntrack_helper_h323_asn1.h for details.

This is fine.

Quoted 9 lines

net/netfilter/nf_conntrack_proto_gre.c line 4

Quoted 9 lines
net/netfilter/nf_conntrack_proto_gre.c +1 -1
@@ -1,6 +1,6 @@
 // SPDX-License-Identifier: GPL-2.0-only
 /*
- * ip_conntrack_proto_gre.c - Version 3.0
+ * nf_conntrack_proto_gre.c - Version 3.0
  *

Consider removing the "ip_conntrack" line completely, version doesn't make sense given this is in mainline kernel.

Rest looks good to me.