Skip to contentSkip to conversation

netfilter: bridge coding style

PATCH Applied Ian Morris 2 participants 6 messages Oct 26, 2015 – Nov 23, 2015

Subsystems (3)
lore
Share & tools
lore

Ian Morris

author
#0 lore raw

cover netfilter: bridge coding style

This series of patches adddress coding style issues detected by checkpatch.

No changes in the resultant object arise from these changes.

Ian Morris (4):
netfilter-bridge: Cleanse indentation
netfilter-bridge: use netdev style comments
netfilter-bridge: brace placement
netfilter-bridge: layout of if statements

 net/bridge/netfilter/ebt_ip6.c        |   4 +-
 net/bridge/netfilter/ebt_log.c        |   9 +--
 net/bridge/netfilter/ebt_stp.c        |   2 +-
 net/bridge/netfilter/ebt_vlan.c       |  15 ++--
 net/bridge/netfilter/ebtable_filter.c |   2 +-
 net/bridge/netfilter/ebtable_nat.c    |   2 +-
 net/bridge/netfilter/ebtables.c       | 139 +++++++++++++++++-----------------
 7 files changed, 90 insertions(+), 83 deletions(-)
Signature · 1 line
1.9.1
author
#1 lore raw

PATCH 1/4 netfilter-bridge: Cleanse indentation

Fixes a bunch of issues detected by checkpatch with regards to code indentation.

No changes detected by objdiff.

---
 net/bridge/netfilter/ebt_stp.c        |  2 +-
 net/bridge/netfilter/ebtable_filter.c |  2 +-
 net/bridge/netfilter/ebtable_nat.c    |  2 +-
 net/bridge/netfilter/ebtables.c       | 44 +++++++++++++++++------------------
 4 files changed, 25 insertions(+), 25 deletions(-)
net/bridge/netfilter/ebt_stp.c +1 -1
index 0c40570..6b731e1 100644
@@ -41,7 +41,7 @@ struct stp_config_pdu {
 #define NR32(p) ((p[0] << 24) | (p[1] << 16) | (p[2] << 8) | p[3])
 
 static bool ebt_filter_config(const struct ebt_stp_info *info,
-   const struct stp_config_pdu *stpc)
+			      const struct stp_config_pdu *stpc)
 {
 	const struct ebt_stp_config_info *c;
 	uint16_t v16;
net/bridge/netfilter/ebtable_filter.c +1 -1
index 32eccd1..593a1bdc 100644
@@ -12,7 +12,7 @@
 #include <linux/module.h>
 
 #define FILTER_VALID_HOOKS ((1 << NF_BR_LOCAL_IN) | (1 << NF_BR_FORWARD) | \
-   (1 << NF_BR_LOCAL_OUT))
+			    (1 << NF_BR_LOCAL_OUT))
 
 static struct ebt_entries initial_chains[] = {
 	{
net/bridge/netfilter/ebtable_nat.c +1 -1
index ec55358..eb33919 100644
@@ -12,7 +12,7 @@
 #include <linux/module.h>
 
 #define NAT_VALID_HOOKS ((1 << NF_BR_PRE_ROUTING) | (1 << NF_BR_LOCAL_OUT) | \
-   (1 << NF_BR_POST_ROUTING))
+			 (1 << NF_BR_POST_ROUTING))
 
 static struct ebt_entries initial_chains[] = {
 	{
net/bridge/netfilter/ebtables.c +22 -22

134 lines not on this page · raw message

Signature · 1 line
1.9.1
author
#2 lore raw

PATCH 2/4 netfilter-bridge: use netdev style comments

In reply to Ian Morris

Changes comments to use netdev style.

No changes detected by objdiff.

---
 net/bridge/netfilter/ebt_log.c  |  3 +-
 net/bridge/netfilter/ebt_vlan.c | 15 +++++---
 net/bridge/netfilter/ebtables.c | 84 +++++++++++++++++++++--------------------
 3 files changed, 56 insertions(+), 46 deletions(-)
net/bridge/netfilter/ebt_log.c +2 -1
index 0ad639a..f22284d 100644
@@ -152,7 +152,8 @@ ebt_log_packet(struct net *net, u_int8_t pf, unsigned int hooknum,
 		       ntohs(ah->ar_op));
 
 		/* If it's for Ethernet and the lengths are OK,
-		 * then log the ARP payload */
+		 * then log the ARP payload
+		 */
 		if (ah->ar_hrd == htons(1) &&
 		    ah->ar_hln == ETH_ALEN &&
 		    ah->ar_pln == sizeof(__be32)) {
net/bridge/netfilter/ebt_vlan.c +10 -5
index 6185688..98c221d 100644
@@ -66,7 +66,8 @@ ebt_vlan_mt(const struct sk_buff *skb, struct xt_action_param *par)
 	 * - Canonical Format Indicator (CFI). The Canonical Format Indicator
 	 * (CFI) is a single bit flag value. Currently ignored.
 	 * - VLAN Identifier (VID). The VID is encoded as
-	 * an unsigned binary number. */
+	 * an unsigned binary number.
+	 */
 	id = TCI & VLAN_VID_MASK;
 	prio = (TCI >> 13) & 0x7;
 
@@ -98,7 +99,8 @@ static int ebt_vlan_mt_check(const struct xt_mtchk_param *par)
 	}
 
 	/* Check for bitmask range
-	 * True if even one bit is out of mask */
+	 * True if even one bit is out of mask
+	 */
 	if (info->bitmask & ~EBT_VLAN_MASK) {
 		pr_debug("bitmask %2X is out of mask (%2X)\n",
 			 info->bitmask, EBT_VLAN_MASK);
@@ -117,7 +119,8 @@ static int ebt_vlan_mt_check(const struct xt_mtchk_param *par)
 	 * 0 - The null VLAN ID.
 	 * 1 - The default Port VID (PVID)
 	 * 0x0FFF - Reserved for implementation use.
-	 * if_vlan.h: VLAN_N_VID 4096. */
+	 * if_vlan.h: VLAN_N_VID 4096.
+	 */
 	if (GET_BITMASK(EBT_VLAN_ID)) {
 		if (!!info->id) { /* if id!=0 => check vid range */
 			if (info->id > VLAN_N_VID) {
@@ -128,7 +131,8 @@ static int ebt_vlan_mt_check(const struct xt_mtchk_param *par)
 			/* Note: This is valid VLAN-tagged frame point.
 			 * Any value of user_priority are acceptable,
 			 * but should be ignored according to 802.1Q Std.
-			 * So we just drop the prio flag. */
+			 * So we just drop the prio flag.
+			 */
 			info->bitmask &= ~EBT_VLAN_PRIO;
 		}
 		/* Else, id=0 (null VLAN ID)  => user_priority range (any?) */
@@ -143,7 +147,8 @@ static int ebt_vlan_mt_check(const struct xt_mtchk_param *par)
 	}
 	/* Check for encapsulated proto range - it is possible to be
 	 * any value for u_short range.
-	 * if_ether.h:  ETH_ZLEN        60   -  Min. octets in frame sans FCS */
+	 * if_ether.h:  ETH_ZLEN        60   -  Min. octets in frame sans FCS
+	 */
 	if (GET_BITMASK(EBT_VLAN_ENCAP)) {
 		if ((unsigned short) ntohs(info->encap) < ETH_ZLEN) {
 			pr_debug("encap frame length %d is less than "
net/bridge/netfilter/ebtables.c +44 -40

208 lines not on this page · raw message

Signature · 6 lines
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
author
#3 lore raw

PATCH 3/4 netfilter-bridge: brace placement

In reply to Ian Morris

Change brace placement to eliminate checkpatch error.

No changes detected by objdiff.

---
 net/bridge/netfilter/ebt_log.c  | 6 ++----
 net/bridge/netfilter/ebtables.c | 3 +--
 2 files changed, 3 insertions(+), 6 deletions(-)
net/bridge/netfilter/ebt_log.c +2 -4
index f22284d..152300d 100644
@@ -36,14 +36,12 @@ static int ebt_log_tg_check(const struct xt_tgchk_param *par)
 	return 0;
 }
 
-struct tcpudphdr
-{
+struct tcpudphdr {
 	__be16 src;
 	__be16 dst;
 };
 
-struct arppayload
-{
+struct arppayload {
 	unsigned char mac_src[ETH_ALEN];
 	unsigned char ip_src[4];
 	unsigned char mac_dst[ETH_ALEN];
net/bridge/netfilter/ebtables.c +1 -2
index 62090e2..b13ea69 100644
@@ -551,8 +551,7 @@ ebt_check_entry_size_and_hooks(const struct ebt_entry *e,
 	return 0;
 }
 
-struct ebt_cl_stack
-{
+struct ebt_cl_stack {
 	struct ebt_chainstack cs;
 	int from;
 	unsigned int hookmask;
Signature · 1 line
1.9.1
author
#4 lore raw

PATCH 4/4 netfilter-bridge: layout of if statements

In reply to Ian Morris

Eliminate some checkpatch issues by improved layout of if statements.

No changes detected by objdiff.

---
 net/bridge/netfilter/ebt_ip6.c  | 4 ++--
 net/bridge/netfilter/ebtables.c | 8 ++++----
 2 files changed, 6 insertions(+), 6 deletions(-)
net/bridge/netfilter/ebt_ip6.c +2 -2
index 17fd5f2..98de6e7 100644
@@ -65,8 +65,8 @@ ebt_ip6_mt(const struct sk_buff *skb, struct xt_action_param *par)
 			return false;
 		if (FWINV(info->protocol != nexthdr, EBT_IP6_PROTO))
 			return false;
-		if (!(info->bitmask & ( EBT_IP6_DPORT |
-					EBT_IP6_SPORT | EBT_IP6_ICMP6)))
+		if (!(info->bitmask & (EBT_IP6_DPORT |
+				       EBT_IP6_SPORT | EBT_IP6_ICMP6)))
 			return true;
 
 		/* min icmpv6 headersize is 4, so sizeof(_pkthdr) is ok. */
net/bridge/netfilter/ebtables.c +4 -4
index b13ea69..67b2e27 100644
@@ -161,7 +161,7 @@ ebt_basic_match(const struct ebt_entry *e, const struct sk_buff *skb,
 		for (i = 0; i < 6; i++)
 			verdict |= (h->h_source[i] ^ e->sourcemac[i]) &
 			   e->sourcemsk[i];
-		if (FWINV2(verdict != 0, EBT_ISOURCE) )
+		if (FWINV2(verdict != 0, EBT_ISOURCE))
 			return 1;
 	}
 	if (e->bitmask & EBT_DESTMAC) {
@@ -169,7 +169,7 @@ ebt_basic_match(const struct ebt_entry *e, const struct sk_buff *skb,
 		for (i = 0; i < 6; i++)
 			verdict |= (h->h_dest[i] ^ e->destmac[i]) &
 			   e->destmsk[i];
-		if (FWINV2(verdict != 0, EBT_IDEST) )
+		if (FWINV2(verdict != 0, EBT_IDEST))
 			return 1;
 	}
 	return 0;
@@ -673,7 +673,7 @@ ebt_check_entry(struct ebt_entry *e, struct net *net,
 		BUGPRINT("Unknown flag for inv bitmask\n");
 		return -EINVAL;
 	}
-	if ( (e->bitmask & EBT_NOPROTO) && (e->bitmask & EBT_802_3) ) {
+	if ((e->bitmask & EBT_NOPROTO) && (e->bitmask & EBT_802_3)) {
 		BUGPRINT("NOPROTO & 802_3 not allowed\n");
 		return -EINVAL;
 	}
@@ -1370,7 +1370,7 @@ static inline int ebt_make_watchername(const struct ebt_entry_watcher *w,
 	char name[EBT_FUNCTION_MAXNAMELEN] = {};
 
 	strlcpy(name, w->u.watcher->name, sizeof(name));
-	if (copy_to_user(hlp , name, EBT_FUNCTION_MAXNAMELEN))
+	if (copy_to_user(hlp, name, EBT_FUNCTION_MAXNAMELEN))
 		return -EFAULT;
 	return 0;
 }
Signature · 1 line
1.9.1
maintainer Applied
#5 lore raw
In reply to Ian Morris
Quoted 3 lines · Ian Morris

This series of patches adddress coding style issues detected by checkpatch.

No changes in the resultant object arise from these changes.

Applied.