All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stephen Hemminger <shemminger@vyatta.com>
To: Joakim Tjernlund <Joakim.Tjernlund@transmode.se>
Cc: bridge@lists.linux-foundation.org,
	Joakim Tjernlund <Joakim.Tjernlund@transmode.se>
Subject: Re: [Bridge] [PATCH] bridge: relay bridge multicast pkgs if !STP
Date: Tue, 12 May 2009 08:26:52 -0700	[thread overview]
Message-ID: <20090512082652.2dd6f2f8@nehalam> (raw)
In-Reply-To: <1242136934-8108-1-git-send-email-Joakim.Tjernlund@transmode.se>

On Tue, 12 May 2009 16:02:14 +0200
Joakim Tjernlund <Joakim.Tjernlund@transmode.se> wrote:

> Currently the bridge drops all STP pkgs when
> STP is off. This makes the bridge relay the Bridge Group
> multicast address, 01:80:c2:00:00:00, when STP is off.
> This allows for loop detection by other bridges doing STP.
> 
> Signed-off-by: Joakim Tjernlund <Joakim.Tjernlund@transmode.se>
> ---
>  net/bridge/br_input.c |   14 +++++++++++++-
>  1 files changed, 13 insertions(+), 1 deletions(-)
> 
> diff --git a/net/bridge/br_input.c b/net/bridge/br_input.c
> index 30b8877..8197823 100644
> --- a/net/bridge/br_input.c
> +++ b/net/bridge/br_input.c
> @@ -112,6 +112,17 @@ static inline int is_link_local(const unsigned char *dest)
>  	return ((a[0] ^ b[0]) | (a[1] ^ b[1]) | ((a[2] ^ b[2]) & m)) == 0;
>  }
>  
> +/* Does address match the Bride Group multicast address.
> + * 01:80:c2:00:00:00
> + */
> +static inline int is_bridge_group(const unsigned char *dest)
> +{
> +	__be16 *a = (__be16 *)dest;
> +	static const __be16 *b = (const __be16 *)br_group_address;
> +
> +	return ((a[0] ^ b[0]) | (a[1] ^ b[1]) | (a[2] ^ b[2])) == 0;
> +}
> +
>  /*
>   * Called via br_handle_frame_hook.
>   * Return NULL if skb is handled
> @@ -137,7 +148,8 @@ struct sk_buff *br_handle_frame(struct net_bridge_port *p, struct sk_buff *skb)
>  		if (NF_HOOK(PF_BRIDGE, NF_BR_LOCAL_IN, skb, skb->dev,
>  			    NULL, br_handle_local_finish))
>  			return NULL;	/* frame consumed by filter */
> -		else
> +		/* Relay Bridge Group address is STP is off */
> +		if (!(p->br->stp_enabled == BR_NO_STP && is_bridge_group(dest)))
>  			return skb;	/* continue processing */
>  	}
>  

First, you should have used compare_ether_addr.
Second, it needs to still obey state rules on port, so the return skb
should fall through to the switch statement.

-- 

  reply	other threads:[~2009-05-12 15:26 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-05-12 14:02 [Bridge] [PATCH] bridge: relay bridge multicast pkgs if !STP Joakim Tjernlund
2009-05-12 15:26 ` Stephen Hemminger [this message]
2009-05-12 17:17   ` Joakim Tjernlund
2009-05-12 17:36     ` Stephen Hemminger
2009-05-12 17:46       ` Joakim Tjernlund
     [not found]       ` <OFBD22D28E.3AFE4DD6-ONC12575B4.0060FF2A-C12575B4.0061A0B7@LocalDomain>
2009-05-13 15:29         ` Joakim Tjernlund
2009-05-13 17:48           ` Stephen Hemminger
  -- strict thread matches above, loose matches on Subject: below --
2009-05-12 17:34 [Bridge] [PATCH] bridge: Relay " Joakim Tjernlund

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=20090512082652.2dd6f2f8@nehalam \
    --to=shemminger@vyatta.com \
    --cc=Joakim.Tjernlund@transmode.se \
    --cc=bridge@lists.linux-foundation.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.