All of lore.kernel.org
 help / color / mirror / Atom feed
From: Antonio Quartulli <a@unstable.cc>
To: davem@davemloft.net
Cc: netdev@vger.kernel.org, b.a.t.m.a.n@lists.open-mesh.org,
	Marek Lindner <mareklindner@neomailbox.ch>,
	Antonio Quartulli <a@unstable.cc>
Subject: [PATCH 16/17] batman-adv: replace ethertype variable with ETH_P_BATMAN for readability
Date: Wed, 11 May 2016 03:30:04 +0800	[thread overview]
Message-ID: <1462908605-27412-17-git-send-email-a__7059.97927948392$1462909141$gmane$org@unstable.cc> (raw)
In-Reply-To: <1462908605-27412-1-git-send-email-a@unstable.cc>

From: Marek Lindner <mareklindner@neomailbox.ch>

Signed-off-by: Marek Lindner <mareklindner@neomailbox.ch>
Reviewed-by: Sven Eckelmann <sven@narfation.org>
Signed-off-by: Antonio Quartulli <a@unstable.cc>
---
 net/batman-adv/soft-interface.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/net/batman-adv/soft-interface.c b/net/batman-adv/soft-interface.c
index 3a0fc3c18444..343d2c904399 100644
--- a/net/batman-adv/soft-interface.c
+++ b/net/batman-adv/soft-interface.c
@@ -186,7 +186,6 @@ static int batadv_interface_tx(struct sk_buff *skb,
 	struct batadv_priv *bat_priv = netdev_priv(soft_iface);
 	struct batadv_hard_iface *primary_if = NULL;
 	struct batadv_bcast_packet *bcast_packet;
-	__be16 ethertype = htons(ETH_P_BATMAN);
 	static const u8 stp_addr[ETH_ALEN] = {0x01, 0x80, 0xC2, 0x00,
 					      0x00, 0x00};
 	static const u8 ectp_addr[ETH_ALEN] = {0xCF, 0x00, 0x00, 0x00,
@@ -216,7 +215,8 @@ static int batadv_interface_tx(struct sk_buff *skb,
 	case ETH_P_8021Q:
 		vhdr = vlan_eth_hdr(skb);
 
-		if (vhdr->h_vlan_encapsulated_proto != ethertype) {
+		/* drop batman-in-batman packets to prevent loops */
+		if (vhdr->h_vlan_encapsulated_proto != htons(ETH_P_BATMAN)) {
 			network_offset += VLAN_HLEN;
 			break;
 		}
@@ -404,7 +404,6 @@ void batadv_interface_rx(struct net_device *soft_iface,
 {
 	struct batadv_bcast_packet *batadv_bcast_packet;
 	struct batadv_priv *bat_priv = netdev_priv(soft_iface);
-	__be16 ethertype = htons(ETH_P_BATMAN);
 	struct vlan_ethhdr *vhdr;
 	struct ethhdr *ethhdr;
 	unsigned short vid;
@@ -434,7 +433,8 @@ void batadv_interface_rx(struct net_device *soft_iface,
 
 		vhdr = (struct vlan_ethhdr *)skb->data;
 
-		if (vhdr->h_vlan_encapsulated_proto != ethertype)
+		/* drop batman-in-batman packets to prevent loops */
+		if (vhdr->h_vlan_encapsulated_proto != htons(ETH_P_BATMAN))
 			break;
 
 		/* fall through */
-- 
2.8.2

  parent reply	other threads:[~2016-05-10 19:38 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-10 19:29 [B.A.T.M.A.N.] pull request: batman-adv 20160511 Antonio Quartulli
2016-05-10 19:29 ` [PATCH 01/17] batman-adv: Remove unused parameter recv_if of batadv_interface_rx Antonio Quartulli
2016-05-10 19:29   ` [B.A.T.M.A.N.] " Antonio Quartulli
2016-05-10 19:29 ` [PATCH 02/17] batman-adv: Remove hdr_size skb size check in batadv_interface_rx Antonio Quartulli
2016-05-10 19:29   ` [B.A.T.M.A.N.] " Antonio Quartulli
2016-05-10 19:29 ` [PATCH 03/17] batman-adv: NETIF_F_NETNS_LOCAL feature to prevent netns moves Antonio Quartulli
2016-05-10 19:29 ` [B.A.T.M.A.N.] " Antonio Quartulli
2016-05-10 19:29 ` [PATCH 04/17] batman-adv: Create batman soft interfaces within correct netns Antonio Quartulli
2016-05-10 19:29   ` [B.A.T.M.A.N.] " Antonio Quartulli
2016-05-10 19:29 ` [PATCH 05/17] batman-adv: add detection for complex bridge loops Antonio Quartulli
2016-05-10 19:29   ` [B.A.T.M.A.N.] " Antonio Quartulli
2016-05-10 19:29 ` [PATCH 06/17] batman-adv: Check hard_iface refcnt before calling function Antonio Quartulli
2016-05-10 19:29   ` [B.A.T.M.A.N.] " Antonio Quartulli
2016-05-10 19:29 ` [PATCH 07/17] batman-adv: Check hard_iface refcnt when receiving skb Antonio Quartulli
2016-05-10 19:29   ` [B.A.T.M.A.N.] " Antonio Quartulli
2016-05-10 19:29 ` [PATCH 08/17] batman-adv: Increase hard_iface refcnt for ptype Antonio Quartulli
2016-05-10 19:29   ` [B.A.T.M.A.N.] " Antonio Quartulli
2016-05-10 19:29 ` [PATCH 09/17] batman-adv: Use kref_get for batadv_tvlv_container_get Antonio Quartulli
2016-05-10 19:29   ` [B.A.T.M.A.N.] " Antonio Quartulli
2016-05-10 19:29 ` [PATCH 10/17] batman-adv: Use kref_get for batadv_nc_get_nc_node Antonio Quartulli
2016-05-10 19:29   ` [B.A.T.M.A.N.] " Antonio Quartulli
2016-05-10 19:29 ` [PATCH 11/17] batman-adv: Use kref_get for batadv_gw_select Antonio Quartulli
2016-05-10 19:29   ` [B.A.T.M.A.N.] " Antonio Quartulli
2016-05-10 19:30 ` [PATCH 12/17] batman-adv: Use kref_get for batadv_gw_node_add Antonio Quartulli
2016-05-10 19:30   ` [B.A.T.M.A.N.] " Antonio Quartulli
2016-05-10 19:30 ` [PATCH 13/17] batman-adv: Use kref_get for hard_iface subfunctions Antonio Quartulli
2016-05-10 19:30   ` [B.A.T.M.A.N.] " Antonio Quartulli
2016-05-10 19:30 ` [B.A.T.M.A.N.] [PATCH 14/17] batman-adv: Use kref_get for _batadv_update_route Antonio Quartulli
2016-05-10 19:30 ` Antonio Quartulli
2016-05-10 19:30 ` [PATCH 15/17] batman-adv: Use bool as return type for boolean functions Antonio Quartulli
2016-05-10 19:30   ` [B.A.T.M.A.N.] " Antonio Quartulli
2016-05-10 19:30 ` [B.A.T.M.A.N.] [PATCH 16/17] batman-adv: replace ethertype variable with ETH_P_BATMAN for readability Antonio Quartulli
2016-05-10 19:30 ` Antonio Quartulli [this message]
2016-05-10 19:30 ` [PATCH 17/17] batman-adv: use batadv_compare_eth when possible Antonio Quartulli
2016-05-10 19:30   ` [B.A.T.M.A.N.] " Antonio Quartulli
     [not found] ` <1462908605-27412-1-git-send-email-a-2CpIooy/SPIKlTDg6p0iyA@public.gmane.org>
2016-05-11  3:36   ` pull request: batman-adv 20160511 David Miller
2016-05-11  3:36     ` [B.A.T.M.A.N.] " David Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='1462908605-27412-17-git-send-email-a__7059.97927948392$1462909141$gmane$org@unstable.cc' \
    --to=a@unstable.cc \
    --cc=b.a.t.m.a.n@lists.open-mesh.org \
    --cc=davem@davemloft.net \
    --cc=mareklindner@neomailbox.ch \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.