All of lore.kernel.org
 help / color / mirror / Atom feed
* mac addresses of local interfaces do not obey setageing 0
@ 2011-02-09 18:17 ` Veaceslav Falico
  0 siblings, 0 replies; 6+ messages in thread
From: Veaceslav Falico @ 2011-02-09 18:17 UTC (permalink / raw)
  To: netdev; +Cc: Stephen Hemminger, bridge

Hello,

I have a host and a VM inside this host bridged. I've set ageing_time and
forward_delay to 0 and trying to capture all the traffic that goes through that
bridge from my VM, but it fails to capture the traffic that has dst ether
address the same as the hosts address (i.e. I can't capture the traffic to the
host).

>From the code, I see that br->ageing_time doesn't really work with local mac
addresses - has_expired() function never says that a local interface mac address
is expired, because it verifies if fdb->is_static is set and returns right away.

Is this the desired behaviour? If so, is there a way to capture packets with
destination to a local interface from another interface?

I've also done a small patch and it seems to fix the situation, but I am not
sure if it's the right way to do it.


Regards,
Veaceslav

---
 net/bridge/br_fdb.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/net/bridge/br_fdb.c b/net/bridge/br_fdb.c
index 88485cc..3d380c2 100644
--- a/net/bridge/br_fdb.c
+++ b/net/bridge/br_fdb.c
@@ -61,8 +61,8 @@ static inline unsigned long hold_time(const struct net_bridge *br)
 static inline int has_expired(const struct net_bridge *br,
 				  const struct net_bridge_fdb_entry *fdb)
 {
-	return !fdb->is_static &&
-		time_before_eq(fdb->ageing_timer + hold_time(br), jiffies);
+	return (br->ageing_time == 0) || (!fdb->is_static &&
+		time_before_eq(fdb->ageing_timer + hold_time(br), jiffies));
 }
 
 static inline int br_mac_hash(const unsigned char *mac)

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

* [Bridge] mac addresses of local interfaces do not obey setageing 0
@ 2011-02-09 18:17 ` Veaceslav Falico
  0 siblings, 0 replies; 6+ messages in thread
From: Veaceslav Falico @ 2011-02-09 18:17 UTC (permalink / raw)
  To: netdev; +Cc: bridge

Hello,

I have a host and a VM inside this host bridged. I've set ageing_time and
forward_delay to 0 and trying to capture all the traffic that goes through that
bridge from my VM, but it fails to capture the traffic that has dst ether
address the same as the hosts address (i.e. I can't capture the traffic to the
host).

From the code, I see that br->ageing_time doesn't really work with local mac
addresses - has_expired() function never says that a local interface mac address
is expired, because it verifies if fdb->is_static is set and returns right away.

Is this the desired behaviour? If so, is there a way to capture packets with
destination to a local interface from another interface?

I've also done a small patch and it seems to fix the situation, but I am not
sure if it's the right way to do it.


Regards,
Veaceslav

---
 net/bridge/br_fdb.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/net/bridge/br_fdb.c b/net/bridge/br_fdb.c
index 88485cc..3d380c2 100644
--- a/net/bridge/br_fdb.c
+++ b/net/bridge/br_fdb.c
@@ -61,8 +61,8 @@ static inline unsigned long hold_time(const struct net_bridge *br)
 static inline int has_expired(const struct net_bridge *br,
 				  const struct net_bridge_fdb_entry *fdb)
 {
-	return !fdb->is_static &&
-		time_before_eq(fdb->ageing_timer + hold_time(br), jiffies);
+	return (br->ageing_time == 0) || (!fdb->is_static &&
+		time_before_eq(fdb->ageing_timer + hold_time(br), jiffies));
 }
 
 static inline int br_mac_hash(const unsigned char *mac)

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

* Re: mac addresses of local interfaces do not obey setageing 0
  2011-02-09 18:17 ` [Bridge] " Veaceslav Falico
@ 2011-02-15 18:25   ` Stephen Hemminger
  -1 siblings, 0 replies; 6+ messages in thread
From: Stephen Hemminger @ 2011-02-15 18:25 UTC (permalink / raw)
  To: Veaceslav Falico; +Cc: netdev, bridge

On Wed, 9 Feb 2011 19:17:52 +0100
Veaceslav Falico <vfalico@redhat.com> wrote:

> Hello,
> 
> I have a host and a VM inside this host bridged. I've set ageing_time and
> forward_delay to 0 and trying to capture all the traffic that goes through that
> bridge from my VM, but it fails to capture the traffic that has dst ether
> address the same as the hosts address (i.e. I can't capture the traffic to the
> host).
> 
> From the code, I see that br->ageing_time doesn't really work with local mac
> addresses - has_expired() function never says that a local interface mac address
> is expired, because it verifies if fdb->is_static is set and returns right away.
> 
> Is this the desired behaviour? If so, is there a way to capture packets with
> destination to a local interface from another interface?
> 
> I've also done a small patch and it seems to fix the situation, but I am not
> sure if it's the right way to do it.
> 
> 
> Regards,
> Veaceslav
> 
> ---
>  net/bridge/br_fdb.c |    4 ++--
>  1 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/net/bridge/br_fdb.c b/net/bridge/br_fdb.c
> index 88485cc..3d380c2 100644
> --- a/net/bridge/br_fdb.c
> +++ b/net/bridge/br_fdb.c
> @@ -61,8 +61,8 @@ static inline unsigned long hold_time(const struct net_bridge *br)
>  static inline int has_expired(const struct net_bridge *br,
>  				  const struct net_bridge_fdb_entry *fdb)
>  {
> -	return !fdb->is_static &&
> -		time_before_eq(fdb->ageing_timer + hold_time(br), jiffies);
> +	return (br->ageing_time == 0) || (!fdb->is_static &&
> +		time_before_eq(fdb->ageing_timer + hold_time(br), jiffies));
>  }
>  

No.
Local addresses should never age.

The proper way to capture packet is to us AF_PACKET or tc actions.
-- 

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

* Re: [Bridge] mac addresses of local interfaces do not obey setageing 0
@ 2011-02-15 18:25   ` Stephen Hemminger
  0 siblings, 0 replies; 6+ messages in thread
From: Stephen Hemminger @ 2011-02-15 18:25 UTC (permalink / raw)
  To: Veaceslav Falico; +Cc: netdev, bridge

On Wed, 9 Feb 2011 19:17:52 +0100
Veaceslav Falico <vfalico@redhat.com> wrote:

> Hello,
> 
> I have a host and a VM inside this host bridged. I've set ageing_time and
> forward_delay to 0 and trying to capture all the traffic that goes through that
> bridge from my VM, but it fails to capture the traffic that has dst ether
> address the same as the hosts address (i.e. I can't capture the traffic to the
> host).
> 
> From the code, I see that br->ageing_time doesn't really work with local mac
> addresses - has_expired() function never says that a local interface mac address
> is expired, because it verifies if fdb->is_static is set and returns right away.
> 
> Is this the desired behaviour? If so, is there a way to capture packets with
> destination to a local interface from another interface?
> 
> I've also done a small patch and it seems to fix the situation, but I am not
> sure if it's the right way to do it.
> 
> 
> Regards,
> Veaceslav
> 
> ---
>  net/bridge/br_fdb.c |    4 ++--
>  1 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/net/bridge/br_fdb.c b/net/bridge/br_fdb.c
> index 88485cc..3d380c2 100644
> --- a/net/bridge/br_fdb.c
> +++ b/net/bridge/br_fdb.c
> @@ -61,8 +61,8 @@ static inline unsigned long hold_time(const struct net_bridge *br)
>  static inline int has_expired(const struct net_bridge *br,
>  				  const struct net_bridge_fdb_entry *fdb)
>  {
> -	return !fdb->is_static &&
> -		time_before_eq(fdb->ageing_timer + hold_time(br), jiffies);
> +	return (br->ageing_time == 0) || (!fdb->is_static &&
> +		time_before_eq(fdb->ageing_timer + hold_time(br), jiffies));
>  }
>  

No.
Local addresses should never age.

The proper way to capture packet is to us AF_PACKET or tc actions.
-- 

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

* Re: mac addresses of local interfaces do not obey setageing 0
  2011-02-15 18:25   ` [Bridge] " Stephen Hemminger
@ 2011-02-17  9:56     ` David Lamparter
  -1 siblings, 0 replies; 6+ messages in thread
From: David Lamparter @ 2011-02-17  9:56 UTC (permalink / raw)
  To: Veaceslav Falico; +Cc: Stephen Hemminger, netdev, bridge

[-- Attachment #1: Type: text/plain, Size: 1663 bytes --]

On Tue, Feb 15, 2011 at 10:25:38AM -0800, Stephen Hemminger wrote:
> On Wed, 9 Feb 2011 19:17:52 +0100
> Veaceslav Falico <vfalico@redhat.com> wrote:
> 
> > Hello,
> > 
> > I have a host and a VM inside this host bridged. I've set ageing_time and
> > forward_delay to 0 and trying to capture all the traffic that goes through that
> > bridge from my VM, but it fails to capture the traffic that has dst ether
> > address the same as the hosts address (i.e. I can't capture the traffic to the
> > host).
> > 
> > From the code, I see that br->ageing_time doesn't really work with local mac
> > addresses - has_expired() function never says that a local interface mac address
> > is expired, because it verifies if fdb->is_static is set and returns right away.
> > 
> > Is this the desired behaviour? If so, is there a way to capture packets with
> > destination to a local interface from another interface?
> > 
> > I've also done a small patch and it seems to fix the situation, but I am not
> > sure if it's the right way to do it.
> 
> No.
> Local addresses should never age.
> 
> The proper way to capture packet is to us AF_PACKET or tc actions.

If you really want to use a bridge for this kind of traffic capturing,
you can attach one side of a veth pair as third interface to the bridge,
clear off all the mac addresses (and have no higher-layer addresses on
the bridge either) and use the other side of the veth pair for your
host. Since the "far" side of the veth is not on the bridge, the bridge
will not treat its address any special.

(This is somewhat of a funny hack though. Use AF_PACKET really...)


-David


[-- Attachment #2: Type: application/pgp-signature, Size: 198 bytes --]

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

* Re: [Bridge] mac addresses of local interfaces do not obey setageing 0
@ 2011-02-17  9:56     ` David Lamparter
  0 siblings, 0 replies; 6+ messages in thread
From: David Lamparter @ 2011-02-17  9:56 UTC (permalink / raw)
  To: Veaceslav Falico; +Cc: netdev, Stephen Hemminger, bridge

[-- Attachment #1: Type: text/plain, Size: 1663 bytes --]

On Tue, Feb 15, 2011 at 10:25:38AM -0800, Stephen Hemminger wrote:
> On Wed, 9 Feb 2011 19:17:52 +0100
> Veaceslav Falico <vfalico@redhat.com> wrote:
> 
> > Hello,
> > 
> > I have a host and a VM inside this host bridged. I've set ageing_time and
> > forward_delay to 0 and trying to capture all the traffic that goes through that
> > bridge from my VM, but it fails to capture the traffic that has dst ether
> > address the same as the hosts address (i.e. I can't capture the traffic to the
> > host).
> > 
> > From the code, I see that br->ageing_time doesn't really work with local mac
> > addresses - has_expired() function never says that a local interface mac address
> > is expired, because it verifies if fdb->is_static is set and returns right away.
> > 
> > Is this the desired behaviour? If so, is there a way to capture packets with
> > destination to a local interface from another interface?
> > 
> > I've also done a small patch and it seems to fix the situation, but I am not
> > sure if it's the right way to do it.
> 
> No.
> Local addresses should never age.
> 
> The proper way to capture packet is to us AF_PACKET or tc actions.

If you really want to use a bridge for this kind of traffic capturing,
you can attach one side of a veth pair as third interface to the bridge,
clear off all the mac addresses (and have no higher-layer addresses on
the bridge either) and use the other side of the veth pair for your
host. Since the "far" side of the veth is not on the bridge, the bridge
will not treat its address any special.

(This is somewhat of a funny hack though. Use AF_PACKET really...)


-David


[-- Attachment #2: Type: application/pgp-signature, Size: 198 bytes --]

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

end of thread, other threads:[~2011-02-17  9:56 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-02-09 18:17 mac addresses of local interfaces do not obey setageing 0 Veaceslav Falico
2011-02-09 18:17 ` [Bridge] " Veaceslav Falico
2011-02-15 18:25 ` Stephen Hemminger
2011-02-15 18:25   ` [Bridge] " Stephen Hemminger
2011-02-17  9:56   ` David Lamparter
2011-02-17  9:56     ` [Bridge] " David Lamparter

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.