netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH nf-next 0/7] coding style improvements for netfilter
@ 2015-10-11 16:32 Ian Morris
  2015-10-11 16:32 ` [PATCH nf-next 1/7] netfilter-ipv6: label placement Ian Morris
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: Ian Morris @ 2015-10-11 16:32 UTC (permalink / raw)
  To: netfilter-devel, netdev; +Cc: Ian Morris

This series of patches improves the coding style of the netfilter-ipv6 
code by addressing some issues detected by checkpatch.

The changes were previously submitted as part of a larger monolithic 
patch but on advice from Pablo, these are being re-sent in smaller, 
more structured batches.

Ian Morris (7):
  netfilter-ipv6: label placement
  netfilter-ipv6: function definition layout
  netfilter-ipv6: code indentation
  netfilter-ipv6: whitespace around operators
  netfilter-ipv6: ternary operator layout
  netfilter-ipv6: improve if statements
  netfilter-ipv6: pointer cast layout

 net/ipv6/netfilter/ip6_tables.c                | 20 ++++++++++----------
 net/ipv6/netfilter/ip6t_SYNPROXY.c             |  2 +-
 net/ipv6/netfilter/nf_conntrack_proto_icmpv6.c |  4 ++--
 net/ipv6/netfilter/nf_conntrack_reasm.c        |  4 ++--
 net/ipv6/netfilter/nf_reject_ipv6.c            |  4 ++--
 net/ipv6/netfilter/nft_chain_route_ipv6.c      |  6 +++---
 6 files changed, 20 insertions(+), 20 deletions(-)

-- 
1.9.1


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH nf-next 1/7] netfilter-ipv6: label placement
  2015-10-11 16:32 [PATCH nf-next 0/7] coding style improvements for netfilter Ian Morris
@ 2015-10-11 16:32 ` Ian Morris
  2015-10-11 16:32 ` [PATCH nf-next 2/7] netfilter-ipv6: function definition layout Ian Morris
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: Ian Morris @ 2015-10-11 16:32 UTC (permalink / raw)
  To: netfilter-devel, netdev; +Cc: Ian Morris

Whitespace cleansing: Labels should not be indented.

No changes detected by objdiff.

Signed-off-by: Ian Morris <ipm@chirality.org.uk>
---
 net/ipv6/netfilter/ip6_tables.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/ipv6/netfilter/ip6_tables.c b/net/ipv6/netfilter/ip6_tables.c
index 80e3bd7..67a2821 100644
--- a/net/ipv6/netfilter/ip6_tables.c
+++ b/net/ipv6/netfilter/ip6_tables.c
@@ -561,7 +561,7 @@ mark_source_chains(const struct xt_table_info *newinfo,
 				pos = newpos;
 			}
 		}
-		next:
+next:
 		duprintf("Finished chain %u\n", hook);
 	}
 	return 1;
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH nf-next 2/7] netfilter-ipv6: function definition layout
  2015-10-11 16:32 [PATCH nf-next 0/7] coding style improvements for netfilter Ian Morris
  2015-10-11 16:32 ` [PATCH nf-next 1/7] netfilter-ipv6: label placement Ian Morris
@ 2015-10-11 16:32 ` Ian Morris
  2015-10-11 16:32 ` [PATCH nf-next 3/7] netfilter-ipv6: code indentation Ian Morris
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: Ian Morris @ 2015-10-11 16:32 UTC (permalink / raw)
  To: netfilter-devel, netdev; +Cc: Ian Morris

Use tabs instead of spaces to indent second line of parameters in
function definitions.

No changes detected by objdiff.

Signed-off-by: Ian Morris <ipm@chirality.org.uk>
---
 net/ipv6/netfilter/ip6_tables.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/net/ipv6/netfilter/ip6_tables.c b/net/ipv6/netfilter/ip6_tables.c
index 67a2821..0654312 100644
--- a/net/ipv6/netfilter/ip6_tables.c
+++ b/net/ipv6/netfilter/ip6_tables.c
@@ -816,7 +816,7 @@ static void cleanup_entry(struct ip6t_entry *e, struct net *net)
    newinfo) */
 static int
 translate_table(struct net *net, struct xt_table_info *newinfo, void *entry0,
-                const struct ip6t_replace *repl)
+		const struct ip6t_replace *repl)
 {
 	struct ip6t_entry *iter;
 	unsigned int i;
@@ -1090,7 +1090,7 @@ static int compat_table_info(const struct xt_table_info *info,
 #endif
 
 static int get_info(struct net *net, void __user *user,
-                    const int *len, int compat)
+		    const int *len, int compat)
 {
 	char name[XT_TABLE_MAXNAMELEN];
 	struct xt_table *t;
@@ -1152,7 +1152,7 @@ static int get_info(struct net *net, void __user *user,
 
 static int
 get_entries(struct net *net, struct ip6t_get_entries __user *uptr,
-            const int *len)
+	    const int *len)
 {
 	int ret;
 	struct ip6t_get_entries get;
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH nf-next 3/7] netfilter-ipv6: code indentation
  2015-10-11 16:32 [PATCH nf-next 0/7] coding style improvements for netfilter Ian Morris
  2015-10-11 16:32 ` [PATCH nf-next 1/7] netfilter-ipv6: label placement Ian Morris
  2015-10-11 16:32 ` [PATCH nf-next 2/7] netfilter-ipv6: function definition layout Ian Morris
@ 2015-10-11 16:32 ` Ian Morris
  2015-10-11 16:32 ` [PATCH nf-next 4/7] netfilter-ipv6: whitespace around operators Ian Morris
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: Ian Morris @ 2015-10-11 16:32 UTC (permalink / raw)
  To: netfilter-devel, netdev; +Cc: Ian Morris

Use tabs instead of spaces to indent code.

No changes detected by objdiff.

Signed-off-by: Ian Morris <ipm@chirality.org.uk>
---
 net/ipv6/netfilter/ip6_tables.c           | 4 ++--
 net/ipv6/netfilter/ip6t_SYNPROXY.c        | 2 +-
 net/ipv6/netfilter/nft_chain_route_ipv6.c | 6 +++---
 3 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/net/ipv6/netfilter/ip6_tables.c b/net/ipv6/netfilter/ip6_tables.c
index 0654312..62190c3 100644
--- a/net/ipv6/netfilter/ip6_tables.c
+++ b/net/ipv6/netfilter/ip6_tables.c
@@ -443,8 +443,8 @@ ip6t_do_table(struct sk_buff *skb,
 			break;
 	} while (!acpar.hotdrop);
 
- 	xt_write_recseq_end(addend);
- 	local_bh_enable();
+	xt_write_recseq_end(addend);
+	local_bh_enable();
 
 #ifdef DEBUG_ALLOW_ALL
 	return NF_ACCEPT;
diff --git a/net/ipv6/netfilter/ip6t_SYNPROXY.c b/net/ipv6/netfilter/ip6t_SYNPROXY.c
index c235660..5312e9d 100644
--- a/net/ipv6/netfilter/ip6t_SYNPROXY.c
+++ b/net/ipv6/netfilter/ip6t_SYNPROXY.c
@@ -244,7 +244,7 @@ synproxy_send_client_ack(const struct synproxy_net *snet,
 	synproxy_build_options(nth, opts);
 
 	synproxy_send_tcp(snet, skb, nskb, skb->nfct, IP_CT_ESTABLISHED_REPLY,
-	                  niph, nth, tcp_hdr_size);
+			  niph, nth, tcp_hdr_size);
 }
 
 static bool
diff --git a/net/ipv6/netfilter/nft_chain_route_ipv6.c b/net/ipv6/netfilter/nft_chain_route_ipv6.c
index 9df75bd..71d995f 100644
--- a/net/ipv6/netfilter/nft_chain_route_ipv6.c
+++ b/net/ipv6/netfilter/nft_chain_route_ipv6.c
@@ -61,11 +61,11 @@ static const struct nf_chain_type nft_chain_route_ipv6 = {
 	.name		= "route",
 	.type		= NFT_CHAIN_T_ROUTE,
 	.family		= NFPROTO_IPV6,
-        .owner		= THIS_MODULE,
+	.owner		= THIS_MODULE,
 	.hook_mask	= (1 << NF_INET_LOCAL_OUT),
 	.hooks		= {
-                [NF_INET_LOCAL_OUT]	= nf_route_table_hook,
-        },
+		[NF_INET_LOCAL_OUT]	= nf_route_table_hook,
+	},
 };
 
 static int __init nft_chain_route_init(void)
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH nf-next 4/7] netfilter-ipv6: whitespace around operators
  2015-10-11 16:32 [PATCH nf-next 0/7] coding style improvements for netfilter Ian Morris
                   ` (2 preceding siblings ...)
  2015-10-11 16:32 ` [PATCH nf-next 3/7] netfilter-ipv6: code indentation Ian Morris
@ 2015-10-11 16:32 ` Ian Morris
  2015-10-11 16:32 ` [PATCH nf-next 5/7] netfilter-ipv6: ternary operator layout Ian Morris
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: Ian Morris @ 2015-10-11 16:32 UTC (permalink / raw)
  To: netfilter-devel, netdev; +Cc: Ian Morris

This patch cleanses whitespace around arithmetical operators.

No changes detected by objdiff.

Signed-off-by: Ian Morris <ipm@chirality.org.uk>
---
 net/ipv6/netfilter/nf_conntrack_proto_icmpv6.c | 4 ++--
 net/ipv6/netfilter/nf_conntrack_reasm.c        | 2 +-
 net/ipv6/netfilter/nf_reject_ipv6.c            | 4 ++--
 3 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/net/ipv6/netfilter/nf_conntrack_proto_icmpv6.c b/net/ipv6/netfilter/nf_conntrack_proto_icmpv6.c
index d3b7974..660bc10 100644
--- a/net/ipv6/netfilter/nf_conntrack_proto_icmpv6.c
+++ b/net/ipv6/netfilter/nf_conntrack_proto_icmpv6.c
@@ -57,12 +57,12 @@ static const u_int8_t invmap[] = {
 	[ICMPV6_ECHO_REQUEST - 128]	= ICMPV6_ECHO_REPLY + 1,
 	[ICMPV6_ECHO_REPLY - 128]	= ICMPV6_ECHO_REQUEST + 1,
 	[ICMPV6_NI_QUERY - 128]		= ICMPV6_NI_REPLY + 1,
-	[ICMPV6_NI_REPLY - 128]		= ICMPV6_NI_QUERY +1
+	[ICMPV6_NI_REPLY - 128]		= ICMPV6_NI_QUERY + 1
 };
 
 static const u_int8_t noct_valid_new[] = {
 	[ICMPV6_MGM_QUERY - 130] = 1,
-	[ICMPV6_MGM_REPORT -130] = 1,
+	[ICMPV6_MGM_REPORT - 130] = 1,
 	[ICMPV6_MGM_REDUCTION - 130] = 1,
 	[NDISC_ROUTER_SOLICITATION - 130] = 1,
 	[NDISC_ROUTER_ADVERTISEMENT - 130] = 1,
diff --git a/net/ipv6/netfilter/nf_conntrack_reasm.c b/net/ipv6/netfilter/nf_conntrack_reasm.c
index 701cd2b..cfcc71f 100644
--- a/net/ipv6/netfilter/nf_conntrack_reasm.c
+++ b/net/ipv6/netfilter/nf_conntrack_reasm.c
@@ -445,7 +445,7 @@ nf_ct_frag6_reasm(struct frag_queue *fq, struct net_device *dev)
 	skb_reset_transport_header(head);
 	skb_push(head, head->data - skb_network_header(head));
 
-	for (fp=head->next; fp; fp = fp->next) {
+	for (fp = head->next; fp; fp = fp->next) {
 		head->data_len += fp->len;
 		head->len += fp->len;
 		if (head->ip_summed != fp->ip_summed)
diff --git a/net/ipv6/netfilter/nf_reject_ipv6.c b/net/ipv6/netfilter/nf_reject_ipv6.c
index 94b4c6d..5629db8 100644
--- a/net/ipv6/netfilter/nf_reject_ipv6.c
+++ b/net/ipv6/netfilter/nf_reject_ipv6.c
@@ -26,7 +26,7 @@ const struct tcphdr *nf_reject_ip6_tcphdr_get(struct sk_buff *oldskb,
 	int tcphoff;
 
 	proto = oip6h->nexthdr;
-	tcphoff = ipv6_skip_exthdr(oldskb, ((u8*)(oip6h+1) - oldskb->data),
+	tcphoff = ipv6_skip_exthdr(oldskb, ((u8 *)(oip6h + 1) - oldskb->data),
 				   &proto, &frag_off);
 
 	if ((tcphoff < 0) || (tcphoff > oldskb->len)) {
@@ -224,7 +224,7 @@ static bool reject6_csum_ok(struct sk_buff *skb, int hook)
 		return true;
 
 	proto = ip6h->nexthdr;
-	thoff = ipv6_skip_exthdr(skb, ((u8*)(ip6h+1) - skb->data), &proto, &fo);
+	thoff = ipv6_skip_exthdr(skb, ((u8 *)(ip6h + 1) - skb->data), &proto, &fo);
 
 	if (thoff < 0 || thoff >= skb->len || (fo & htons(~0x7)) != 0)
 		return false;
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH nf-next 5/7] netfilter-ipv6: ternary operator layout
  2015-10-11 16:32 [PATCH nf-next 0/7] coding style improvements for netfilter Ian Morris
                   ` (3 preceding siblings ...)
  2015-10-11 16:32 ` [PATCH nf-next 4/7] netfilter-ipv6: whitespace around operators Ian Morris
@ 2015-10-11 16:32 ` Ian Morris
  2015-10-11 16:32 ` [PATCH nf-next 6/7] netfilter-ipv6: improve if statements Ian Morris
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: Ian Morris @ 2015-10-11 16:32 UTC (permalink / raw)
  To: netfilter-devel, netdev; +Cc: Ian Morris

Correct whitespace layout of ternary operators in the netfilter-ipv6
code.

No changes detected by objdiff.

Signed-off-by: Ian Morris <ipm@chirality.org.uk>
---
 net/ipv6/netfilter/ip6_tables.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/net/ipv6/netfilter/ip6_tables.c b/net/ipv6/netfilter/ip6_tables.c
index 62190c3..80f014a 100644
--- a/net/ipv6/netfilter/ip6_tables.c
+++ b/net/ipv6/netfilter/ip6_tables.c
@@ -117,7 +117,7 @@ ip6_packet_match(const struct sk_buff *skb,
 	if (FWINV(ret != 0, IP6T_INV_VIA_IN)) {
 		dprintf("VIA in mismatch (%s vs %s).%s\n",
 			indev, ip6info->iniface,
-			ip6info->invflags&IP6T_INV_VIA_IN ?" (INV)":"");
+			ip6info->invflags&IP6T_INV_VIA_IN ? " (INV)" : "");
 		return false;
 	}
 
@@ -126,7 +126,7 @@ ip6_packet_match(const struct sk_buff *skb,
 	if (FWINV(ret != 0, IP6T_INV_VIA_OUT)) {
 		dprintf("VIA out mismatch (%s vs %s).%s\n",
 			outdev, ip6info->outiface,
-			ip6info->invflags&IP6T_INV_VIA_OUT ?" (INV)":"");
+			ip6info->invflags&IP6T_INV_VIA_OUT ? " (INV)" : "");
 		return false;
 	}
 
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH nf-next 6/7] netfilter-ipv6: improve if statements
  2015-10-11 16:32 [PATCH nf-next 0/7] coding style improvements for netfilter Ian Morris
                   ` (4 preceding siblings ...)
  2015-10-11 16:32 ` [PATCH nf-next 5/7] netfilter-ipv6: ternary operator layout Ian Morris
@ 2015-10-11 16:32 ` Ian Morris
  2015-10-11 16:32 ` [PATCH nf-next 7/7] netfilter-ipv6: pointer cast layout Ian Morris
  2015-10-14 10:40 ` [PATCH nf-next 0/7] coding style improvements for netfilter Pablo Neira Ayuso
  7 siblings, 0 replies; 9+ messages in thread
From: Ian Morris @ 2015-10-11 16:32 UTC (permalink / raw)
  To: netfilter-devel, netdev; +Cc: Ian Morris

Correct whitespace layout of if statements.

No changes detected by objdiff.

Signed-off-by: Ian Morris <ipm@chirality.org.uk>
---
 net/ipv6/netfilter/ip6_tables.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/net/ipv6/netfilter/ip6_tables.c b/net/ipv6/netfilter/ip6_tables.c
index 80f014a..bd660ec 100644
--- a/net/ipv6/netfilter/ip6_tables.c
+++ b/net/ipv6/netfilter/ip6_tables.c
@@ -133,7 +133,7 @@ ip6_packet_match(const struct sk_buff *skb,
 /* ... might want to do something with class and flowlabel here ... */
 
 	/* look for the desired protocol header */
-	if((ip6info->flags & IP6T_F_PROTO)) {
+	if (ip6info->flags & IP6T_F_PROTO) {
 		int protohdr;
 		unsigned short _frag_off;
 
@@ -151,7 +151,7 @@ ip6_packet_match(const struct sk_buff *skb,
 				ip6info->proto);
 
 		if (ip6info->proto == protohdr) {
-			if(ip6info->invflags & IP6T_INV_PROTO) {
+			if (ip6info->invflags & IP6T_INV_PROTO) {
 				return false;
 			}
 			return true;
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH nf-next 7/7] netfilter-ipv6: pointer cast layout
  2015-10-11 16:32 [PATCH nf-next 0/7] coding style improvements for netfilter Ian Morris
                   ` (5 preceding siblings ...)
  2015-10-11 16:32 ` [PATCH nf-next 6/7] netfilter-ipv6: improve if statements Ian Morris
@ 2015-10-11 16:32 ` Ian Morris
  2015-10-14 10:40 ` [PATCH nf-next 0/7] coding style improvements for netfilter Pablo Neira Ayuso
  7 siblings, 0 replies; 9+ messages in thread
From: Ian Morris @ 2015-10-11 16:32 UTC (permalink / raw)
  To: netfilter-devel, netdev; +Cc: Ian Morris

Correct whitespace layout of a pointer casting.

No changes detected by objdiff.

Signed-off-by: Ian Morris <ipm@chirality.org.uk>
---
 net/ipv6/netfilter/nf_conntrack_reasm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/ipv6/netfilter/nf_conntrack_reasm.c b/net/ipv6/netfilter/nf_conntrack_reasm.c
index cfcc71f..deab0a1 100644
--- a/net/ipv6/netfilter/nf_conntrack_reasm.c
+++ b/net/ipv6/netfilter/nf_conntrack_reasm.c
@@ -59,7 +59,7 @@ struct nf_ct_frag6_skb_cb
 	struct sk_buff		*orig;
 };
 
-#define NFCT_FRAG6_CB(skb)	((struct nf_ct_frag6_skb_cb*)((skb)->cb))
+#define NFCT_FRAG6_CB(skb)	((struct nf_ct_frag6_skb_cb *)((skb)->cb))
 
 static struct inet_frags nf_frags;
 
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [PATCH nf-next 0/7] coding style improvements for netfilter
  2015-10-11 16:32 [PATCH nf-next 0/7] coding style improvements for netfilter Ian Morris
                   ` (6 preceding siblings ...)
  2015-10-11 16:32 ` [PATCH nf-next 7/7] netfilter-ipv6: pointer cast layout Ian Morris
@ 2015-10-14 10:40 ` Pablo Neira Ayuso
  7 siblings, 0 replies; 9+ messages in thread
From: Pablo Neira Ayuso @ 2015-10-14 10:40 UTC (permalink / raw)
  To: Ian Morris; +Cc: netfilter-devel, netdev

On Sun, Oct 11, 2015 at 05:32:13PM +0100, Ian Morris wrote:
> This series of patches improves the coding style of the netfilter-ipv6 
> code by addressing some issues detected by checkpatch.
> 
> The changes were previously submitted as part of a larger monolithic 
> patch but on advice from Pablo, these are being re-sent in smaller, 
> more structured batches.

Applied with minor changes. Thanks.

--- a/net/ipv6/netfilter/ip6_tables.c
+++ b/net/ipv6/netfilter/ip6_tables.c
@@ -117,7 +117,7 @@ ip6_packet_match(const struct sk_buff *skb,
        if (FWINV(ret != 0, IP6T_INV_VIA_IN)) {
                dprintf("VIA in mismatch (%s vs %s).%s\n",
                        indev, ip6info->iniface,
-                       ip6info->invflags&IP6T_INV_VIA_IN ?" (INV)":"");
+                       ip6info->invflags&IP6T_INV_VIA_IN ? " (INV)" :
"");
                return false;
        }


I have updated this to:

+                       ip6info->invflags & IP6T_INV_VIA_IN ? " (INV)" :
                                         ^ ^

checkpatch was complaining, and given that we were already updating
this line...

@@ -151,7 +151,7 @@ ip6_packet_match(const struct sk_buff *skb,
                                ip6info->proto);

                if (ip6info->proto == protohdr) {
-                       if(ip6info->invflags & IP6T_INV_PROTO) {
+                       if (ip6info->invflags & IP6T_INV_PROTO) {
                                return false;
                        }
                        return true;

Removed the unnecessary brackets for single statement in the if
branch above. It just added one extra line removal to the patch.

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2015-10-14 10:33 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-10-11 16:32 [PATCH nf-next 0/7] coding style improvements for netfilter Ian Morris
2015-10-11 16:32 ` [PATCH nf-next 1/7] netfilter-ipv6: label placement Ian Morris
2015-10-11 16:32 ` [PATCH nf-next 2/7] netfilter-ipv6: function definition layout Ian Morris
2015-10-11 16:32 ` [PATCH nf-next 3/7] netfilter-ipv6: code indentation Ian Morris
2015-10-11 16:32 ` [PATCH nf-next 4/7] netfilter-ipv6: whitespace around operators Ian Morris
2015-10-11 16:32 ` [PATCH nf-next 5/7] netfilter-ipv6: ternary operator layout Ian Morris
2015-10-11 16:32 ` [PATCH nf-next 6/7] netfilter-ipv6: improve if statements Ian Morris
2015-10-11 16:32 ` [PATCH nf-next 7/7] netfilter-ipv6: pointer cast layout Ian Morris
2015-10-14 10:40 ` [PATCH nf-next 0/7] coding style improvements for netfilter Pablo Neira Ayuso

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).