All of lore.kernel.org
 help / color / mirror / Atom feed
* [Bridge] Question about using brctl and changing MAC addresses
@ 2008-03-10 18:05 Philip Prindeville
  2008-03-11 15:23 ` Stephen Hemminger
  0 siblings, 1 reply; 11+ messages in thread
From: Philip Prindeville @ 2008-03-10 18:05 UTC (permalink / raw)
  To: bridge

I'm using Linux 2.6.20 (yes, I'll be upgrading to 2.6.24 as soon as it's
stable).

I have 4 VIA rhine ethernet controllers on my Soekris net5501, plus an
ADSL PCI card (a Sangoma S-518) that runs in AAL5-SNAP mode, so it looks
like an Ethernet controller.

I'm trying to bridge eth0 and w1ad (the ADSL interface) into "br0".  And
I'm trying to force the traffic on br0 to have the MAC address that my
ISP insists I use (i.e. that of the crappy little Westell 6100 modem
they sent me).

The issue is the following.  If I do:

ifconfig w1ad down hw ether x:x:x:x:x:x up

followed by either:

brctl addbr br0
brctl addif br0 eth0
brctl addif br0 w1ad

or:

brctl addbr br0
brctl addif br0 w1ad
brctl addif br0 eth0

the bridge ends up taking the MAC address of eth0 either way, which I
don't get (how does it decide which to use?).

I can clone the same MAC address to both eth0 and w1ad, but I don't know
if that would cause me any problems or not (I haven't read the STP spec
in about 15 years).

What's the solution?

Is there a way to explicitly set the MAC address of the bridge interface?

I tried:

ifconfig br0 down hw ether x:x:x:x:x:x up

but that just results in:

ifconfig: SIOCSIFHWADDR: Cannot assign requested address

So, I'm not clear what the best solution is.

Any guidance is appreciated.

Thanks,

-Philip

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

* Re: [Bridge] Question about using brctl and changing MAC addresses
  2008-03-10 18:05 [Bridge] Question about using brctl and changing MAC addresses Philip Prindeville
@ 2008-03-11 15:23 ` Stephen Hemminger
  2008-03-12  3:29   ` Philip Prindeville
  0 siblings, 1 reply; 11+ messages in thread
From: Stephen Hemminger @ 2008-03-11 15:23 UTC (permalink / raw)
  To: Philip Prindeville; +Cc: bridge

On Mon, 10 Mar 2008 11:05:53 -0700
Philip Prindeville <philipp_subx@redfish-solutions.com> wrote:

> I'm using Linux 2.6.20 (yes, I'll be upgrading to 2.6.24 as soon as it's
> stable).
> 
> I have 4 VIA rhine ethernet controllers on my Soekris net5501, plus an
> ADSL PCI card (a Sangoma S-518) that runs in AAL5-SNAP mode, so it looks
> like an Ethernet controller.
> 
> I'm trying to bridge eth0 and w1ad (the ADSL interface) into "br0".  And
> I'm trying to force the traffic on br0 to have the MAC address that my
> ISP insists I use (i.e. that of the crappy little Westell 6100 modem
> they sent me).
> 
> The issue is the following.  If I do:
> 
> ifconfig w1ad down hw ether x:x:x:x:x:x up
> 
> followed by either:
> 
> brctl addbr br0
> brctl addif br0 eth0
> brctl addif br0 w1ad
> 
> or:
> 
> brctl addbr br0
> brctl addif br0 w1ad
> brctl addif br0 eth0
> 
> the bridge ends up taking the MAC address of eth0 either way, which I
> don't get (how does it decide which to use?).
> 
> I can clone the same MAC address to both eth0 and w1ad, but I don't know
> if that would cause me any problems or not (I haven't read the STP spec
> in about 15 years).
> 

Having the same mac address on both just is going to be problematic (impossible
to do STP), so don't if you don't have to.
But you can set address of bridge and eth0 to any address you want. So set these
to the ISP assigned address.  You probably will have to do it after bridge
is created.

brctl addbr br0
brctl addif br0 w1ad br0
ifconfig eth0 hw ether x:x:x:x:x:x up
ifconfig w1ad up
ifconfig br0 hw ether x:x:x:x:x:x up

ifconfig br0 A.B.C.D netmask 255.255.255.0 

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

* Re: [Bridge] Question about using brctl and changing MAC addresses
  2008-03-11 15:23 ` Stephen Hemminger
@ 2008-03-12  3:29   ` Philip Prindeville
  2008-03-12 14:46     ` Andy Gospodarek
  0 siblings, 1 reply; 11+ messages in thread
From: Philip Prindeville @ 2008-03-12  3:29 UTC (permalink / raw)
  To: Stephen Hemminger; +Cc: bridge

Stephen Hemminger wrote:
> On Mon, 10 Mar 2008 11:05:53 -0700
> Philip Prindeville <philipp_subx@redfish-solutions.com> wrote:
>
>   
>> I'm using Linux 2.6.20 (yes, I'll be upgrading to 2.6.24 as soon as it's
>> stable).
>>
>> I have 4 VIA rhine ethernet controllers on my Soekris net5501, plus an
>> ADSL PCI card (a Sangoma S-518) that runs in AAL5-SNAP mode, so it looks
>> like an Ethernet controller.
>>
>> I'm trying to bridge eth0 and w1ad (the ADSL interface) into "br0".  And
>> I'm trying to force the traffic on br0 to have the MAC address that my
>> ISP insists I use (i.e. that of the crappy little Westell 6100 modem
>> they sent me).
>>
>> The issue is the following.  If I do:
>>
>> ifconfig w1ad down hw ether x:x:x:x:x:x up
>>
>> followed by either:
>>
>> brctl addbr br0
>> brctl addif br0 eth0
>> brctl addif br0 w1ad
>>
>> or:
>>
>> brctl addbr br0
>> brctl addif br0 w1ad
>> brctl addif br0 eth0
>>
>> the bridge ends up taking the MAC address of eth0 either way, which I
>> don't get (how does it decide which to use?).
>>
>> I can clone the same MAC address to both eth0 and w1ad, but I don't know
>> if that would cause me any problems or not (I haven't read the STP spec
>> in about 15 years).
>>
>>     
>
> Having the same mac address on both just is going to be problematic (impossible
> to do STP), so don't if you don't have to.
> But you can set address of bridge and eth0 to any address you want. So set these
> to the ISP assigned address.  You probably will have to do it after bridge
> is created.
>
> brctl addbr br0
> brctl addif br0 w1ad br0
> ifconfig eth0 hw ether x:x:x:x:x:x up
> ifconfig w1ad up
> ifconfig br0 hw ether x:x:x:x:x:x up
>
> ifconfig br0 A.B.C.D netmask 255.255.255.0 
>   

That seems to not work.  I get:

# ifconfig br0 hw ether "00:18:3A:55:15:35"
ifconfig: SIOCSIFHWADDR: Cannot assign requested address
#

Any ideas why?  I'm doing this before an IP address has even been 
assigned...

-Philip


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

* Re: [Bridge] Question about using brctl and changing MAC addresses
  2008-03-12  3:29   ` Philip Prindeville
@ 2008-03-12 14:46     ` Andy Gospodarek
  2008-03-12 15:14       ` Stephen Hemminger
  0 siblings, 1 reply; 11+ messages in thread
From: Andy Gospodarek @ 2008-03-12 14:46 UTC (permalink / raw)
  To: Philip Prindeville; +Cc: bridge

On Tue, Mar 11, 2008 at 11:29 PM, Philip Prindeville
<philipp_subx@redfish-solutions.com> wrote:
>
> Stephen Hemminger wrote:
>  > On Mon, 10 Mar 2008 11:05:53 -0700
>  > Philip Prindeville <philipp_subx@redfish-solutions.com> wrote:
>  >
>  >
>  >> I'm using Linux 2.6.20 (yes, I'll be upgrading to 2.6.24 as soon as it's
>  >> stable).
>  >>
>  >> I have 4 VIA rhine ethernet controllers on my Soekris net5501, plus an
>  >> ADSL PCI card (a Sangoma S-518) that runs in AAL5-SNAP mode, so it looks
>  >> like an Ethernet controller.
>  >>
>  >> I'm trying to bridge eth0 and w1ad (the ADSL interface) into "br0".  And
>  >> I'm trying to force the traffic on br0 to have the MAC address that my
>  >> ISP insists I use (i.e. that of the crappy little Westell 6100 modem
>  >> they sent me).
>  >>
>  >> The issue is the following.  If I do:
>  >>
>  >> ifconfig w1ad down hw ether x:x:x:x:x:x up
>  >>
>  >> followed by either:
>  >>
>  >> brctl addbr br0
>  >> brctl addif br0 eth0
>  >> brctl addif br0 w1ad
>  >>
>  >> or:
>  >>
>  >> brctl addbr br0
>  >> brctl addif br0 w1ad
>  >> brctl addif br0 eth0
>  >>
>  >> the bridge ends up taking the MAC address of eth0 either way, which I
>  >> don't get (how does it decide which to use?).
>  >>
>  >> I can clone the same MAC address to both eth0 and w1ad, but I don't know
>  >> if that would cause me any problems or not (I haven't read the STP spec
>  >> in about 15 years).
>  >>
>  >>
>  >
>  > Having the same mac address on both just is going to be problematic (impossible
>  > to do STP), so don't if you don't have to.
>  > But you can set address of bridge and eth0 to any address you want. So set these
>  > to the ISP assigned address.  You probably will have to do it after bridge
>  > is created.
>  >
>  > brctl addbr br0
>  > brctl addif br0 w1ad br0
>  > ifconfig eth0 hw ether x:x:x:x:x:x up
>  > ifconfig w1ad up
>  > ifconfig br0 hw ether x:x:x:x:x:x up
>  >
>  > ifconfig br0 A.B.C.D netmask 255.255.255.0
>  >
>
>  That seems to not work.  I get:
>
>  # ifconfig br0 hw ether "00:18:3A:55:15:35"
>
> ifconfig: SIOCSIFHWADDR: Cannot assign requested address
>  #
>
>  Any ideas why?  I'm doing this before an IP address has even been
>  assigned...
>
>  -Philip
>
>
>

Was the interface reported as 'UP' by ifconfig?

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

* Re: [Bridge] Question about using brctl and changing MAC addresses
  2008-03-12 14:46     ` Andy Gospodarek
@ 2008-03-12 15:14       ` Stephen Hemminger
  2008-03-12 18:45         ` Philip Prindeville
  0 siblings, 1 reply; 11+ messages in thread
From: Stephen Hemminger @ 2008-03-12 15:14 UTC (permalink / raw)
  To: Andy Gospodarek; +Cc: Philip Prindeville, bridge

On Wed, 12 Mar 2008 10:46:48 -0400
"Andy Gospodarek" <andy@greyhouse.net> wrote:

> On Tue, Mar 11, 2008 at 11:29 PM, Philip Prindeville
> <philipp_subx@redfish-solutions.com> wrote:
> >
> > Stephen Hemminger wrote:
> >  > On Mon, 10 Mar 2008 11:05:53 -0700
> >  > Philip Prindeville <philipp_subx@redfish-solutions.com> wrote:
> >  >
> >  >
> >  >> I'm using Linux 2.6.20 (yes, I'll be upgrading to 2.6.24 as soon as it's
> >  >> stable).
> >  >>
> >  >> I have 4 VIA rhine ethernet controllers on my Soekris net5501, plus an
> >  >> ADSL PCI card (a Sangoma S-518) that runs in AAL5-SNAP mode, so it looks
> >  >> like an Ethernet controller.
> >  >>
> >  >> I'm trying to bridge eth0 and w1ad (the ADSL interface) into "br0".  And
> >  >> I'm trying to force the traffic on br0 to have the MAC address that my
> >  >> ISP insists I use (i.e. that of the crappy little Westell 6100 modem
> >  >> they sent me).
> >  >>
> >  >> The issue is the following.  If I do:
> >  >>
> >  >> ifconfig w1ad down hw ether x:x:x:x:x:x up
> >  >>
> >  >> followed by either:
> >  >>
> >  >> brctl addbr br0
> >  >> brctl addif br0 eth0
> >  >> brctl addif br0 w1ad
> >  >>
> >  >> or:
> >  >>
> >  >> brctl addbr br0
> >  >> brctl addif br0 w1ad
> >  >> brctl addif br0 eth0
> >  >>
> >  >> the bridge ends up taking the MAC address of eth0 either way, which I
> >  >> don't get (how does it decide which to use?).
> >  >>
> >  >> I can clone the same MAC address to both eth0 and w1ad, but I don't know
> >  >> if that would cause me any problems or not (I haven't read the STP spec
> >  >> in about 15 years).
> >  >>
> >  >>
> >  >
> >  > Having the same mac address on both just is going to be problematic (impossible
> >  > to do STP), so don't if you don't have to.
> >  > But you can set address of bridge and eth0 to any address you want. So set these
> >  > to the ISP assigned address.  You probably will have to do it after bridge
> >  > is created.
> >  >
> >  > brctl addbr br0
> >  > brctl addif br0 w1ad br0
> >  > ifconfig eth0 hw ether x:x:x:x:x:x up
> >  > ifconfig w1ad up
> >  > ifconfig br0 hw ether x:x:x:x:x:x up
> >  >
> >  > ifconfig br0 A.B.C.D netmask 255.255.255.0
> >  >
> >
> >  That seems to not work.  I get:
> >
> >  # ifconfig br0 hw ether "00:18:3A:55:15:35"
> >
> > ifconfig: SIOCSIFHWADDR: Cannot assign requested address
> >  #
> >
> >  Any ideas why?  I'm doing this before an IP address has even been
> >  assigned...

Assign the hardware address of the bridge was only added in later kernels.

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

* Re: [Bridge] Question about using brctl and changing MAC addresses
  2008-03-12 15:14       ` Stephen Hemminger
@ 2008-03-12 18:45         ` Philip Prindeville
  2008-03-12 19:11           ` Andy Gospodarek
  0 siblings, 1 reply; 11+ messages in thread
From: Philip Prindeville @ 2008-03-12 18:45 UTC (permalink / raw)
  To: Stephen Hemminger; +Cc: bridge

Stephen Hemminger wrote:
> On Wed, 12 Mar 2008 10:46:48 -0400
> "Andy Gospodarek" <andy@greyhouse.net> wrote:
>
>   
>> On Tue, Mar 11, 2008 at 11:29 PM, Philip Prindeville
>> <philipp_subx@redfish-solutions.com> wrote:
>>     
>>> Stephen Hemminger wrote:
>>>  > On Mon, 10 Mar 2008 11:05:53 -0700
>>>  > Philip Prindeville <philipp_subx@redfish-solutions.com> wrote:
>>>  >
>>>  >
>>>  >> I'm using Linux 2.6.20 (yes, I'll be upgrading to 2.6.24 as soon as it's
>>>  >> stable).
>>>  >>
>>>  >> I have 4 VIA rhine ethernet controllers on my Soekris net5501, plus an
>>>  >> ADSL PCI card (a Sangoma S-518) that runs in AAL5-SNAP mode, so it looks
>>>  >> like an Ethernet controller.
>>>  >>
>>>  >> I'm trying to bridge eth0 and w1ad (the ADSL interface) into "br0".  And
>>>  >> I'm trying to force the traffic on br0 to have the MAC address that my
>>>  >> ISP insists I use (i.e. that of the crappy little Westell 6100 modem
>>>  >> they sent me).
>>>  >>
>>>  >> The issue is the following.  If I do:
>>>  >>
>>>  >> ifconfig w1ad down hw ether x:x:x:x:x:x up
>>>  >>
>>>  >> followed by either:
>>>  >>
>>>  >> brctl addbr br0
>>>  >> brctl addif br0 eth0
>>>  >> brctl addif br0 w1ad
>>>  >>
>>>  >> or:
>>>  >>
>>>  >> brctl addbr br0
>>>  >> brctl addif br0 w1ad
>>>  >> brctl addif br0 eth0
>>>  >>
>>>  >> the bridge ends up taking the MAC address of eth0 either way, which I
>>>  >> don't get (how does it decide which to use?).
>>>  >>
>>>  >> I can clone the same MAC address to both eth0 and w1ad, but I don't know
>>>  >> if that would cause me any problems or not (I haven't read the STP spec
>>>  >> in about 15 years).
>>>  >>
>>>  >>
>>>  >
>>>  > Having the same mac address on both just is going to be problematic (impossible
>>>  > to do STP), so don't if you don't have to.
>>>  > But you can set address of bridge and eth0 to any address you want. So set these
>>>  > to the ISP assigned address.  You probably will have to do it after bridge
>>>  > is created.
>>>  >
>>>  > brctl addbr br0
>>>  > brctl addif br0 w1ad br0
>>>  > ifconfig eth0 hw ether x:x:x:x:x:x up
>>>  > ifconfig w1ad up
>>>  > ifconfig br0 hw ether x:x:x:x:x:x up
>>>  >
>>>  > ifconfig br0 A.B.C.D netmask 255.255.255.0
>>>  >
>>>
>>>  That seems to not work.  I get:
>>>
>>>  # ifconfig br0 hw ether "00:18:3A:55:15:35"
>>>
>>> ifconfig: SIOCSIFHWADDR: Cannot assign requested address
>>>  #
>>>
>>>  Any ideas why?  I'm doing this before an IP address has even been
>>>  assigned...
>>>       
>
> Assign the hardware address of the bridge was only added in later kernels.
>   

Later being which kernel?

And to answer the earlier question, I was doing:

ifconfig brX down hw ether x:x:x:x:x:x up

so yes, the interface was down when I tried to change its address.

-Philip



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

* Re: [Bridge] Question about using brctl and changing MAC addresses
  2008-03-12 18:45         ` Philip Prindeville
@ 2008-03-12 19:11           ` Andy Gospodarek
  2008-03-13  4:39             ` Philip Prindeville
  0 siblings, 1 reply; 11+ messages in thread
From: Andy Gospodarek @ 2008-03-12 19:11 UTC (permalink / raw)
  To: Philip Prindeville; +Cc: bridge

On Wed, Mar 12, 2008 at 2:45 PM, Philip Prindeville
<philipp_subx@redfish-solutions.com> wrote:
>
> Stephen Hemminger wrote:
>  > On Wed, 12 Mar 2008 10:46:48 -0400
>  > "Andy Gospodarek" <andy@greyhouse.net> wrote:
>  >
>  >
>  >> On Tue, Mar 11, 2008 at 11:29 PM, Philip Prindeville
>  >> <philipp_subx@redfish-solutions.com> wrote:
>  >>
>  >>> Stephen Hemminger wrote:
>  >>>  > On Mon, 10 Mar 2008 11:05:53 -0700
>  >>>  > Philip Prindeville <philipp_subx@redfish-solutions.com> wrote:
>  >>>  >
>  >>>  >
>  >>>  >> I'm using Linux 2.6.20 (yes, I'll be upgrading to 2.6.24 as soon as it's
>  >>>  >> stable).
>  >>>  >>
>  >>>  >> I have 4 VIA rhine ethernet controllers on my Soekris net5501, plus an
>  >>>  >> ADSL PCI card (a Sangoma S-518) that runs in AAL5-SNAP mode, so it looks
>  >>>  >> like an Ethernet controller.
>  >>>  >>
>  >>>  >> I'm trying to bridge eth0 and w1ad (the ADSL interface) into "br0".  And
>  >>>  >> I'm trying to force the traffic on br0 to have the MAC address that my
>  >>>  >> ISP insists I use (i.e. that of the crappy little Westell 6100 modem
>  >>>  >> they sent me).
>  >>>  >>
>  >>>  >> The issue is the following.  If I do:
>  >>>  >>
>  >>>  >> ifconfig w1ad down hw ether x:x:x:x:x:x up
>  >>>  >>
>  >>>  >> followed by either:
>  >>>  >>
>  >>>  >> brctl addbr br0
>  >>>  >> brctl addif br0 eth0
>  >>>  >> brctl addif br0 w1ad
>  >>>  >>
>  >>>  >> or:
>  >>>  >>
>  >>>  >> brctl addbr br0
>  >>>  >> brctl addif br0 w1ad
>  >>>  >> brctl addif br0 eth0
>  >>>  >>
>  >>>  >> the bridge ends up taking the MAC address of eth0 either way, which I
>  >>>  >> don't get (how does it decide which to use?).
>  >>>  >>
>  >>>  >> I can clone the same MAC address to both eth0 and w1ad, but I don't know
>  >>>  >> if that would cause me any problems or not (I haven't read the STP spec
>  >>>  >> in about 15 years).
>  >>>  >>
>  >>>  >>
>  >>>  >
>  >>>  > Having the same mac address on both just is going to be problematic (impossible
>  >>>  > to do STP), so don't if you don't have to.
>  >>>  > But you can set address of bridge and eth0 to any address you want. So set these
>  >>>  > to the ISP assigned address.  You probably will have to do it after bridge
>  >>>  > is created.
>  >>>  >
>  >>>  > brctl addbr br0
>  >>>  > brctl addif br0 w1ad br0
>  >>>  > ifconfig eth0 hw ether x:x:x:x:x:x up
>  >>>  > ifconfig w1ad up
>  >>>  > ifconfig br0 hw ether x:x:x:x:x:x up
>  >>>  >
>  >>>  > ifconfig br0 A.B.C.D netmask 255.255.255.0
>  >>>  >
>  >>>
>  >>>  That seems to not work.  I get:
>  >>>
>  >>>  # ifconfig br0 hw ether "00:18:3A:55:15:35"
>  >>>
>  >>> ifconfig: SIOCSIFHWADDR: Cannot assign requested address
>  >>>  #
>  >>>
>  >>>  Any ideas why?  I'm doing this before an IP address has even been
>  >>>  assigned...
>  >>>
>  >
>  > Assign the hardware address of the bridge was only added in later kernels.
>  >
>
>  Later being which kernel?

It looks like this commit did it:

commit 4505a3ef720845b5db3ddb440de13cd4800fd508
Author: Stephen Hemminger <shemminger@osdl.org>
Date:   Wed Dec 21 18:51:49 2005 -0800

    [BRIDGE]: allow setting hardware address of bridge pseudo-dev

    Some people are using bridging to hide multiple machines from an ISP
    that restricts by MAC address. So in that case allow the bridge mac
    address to be set to any of the existing interfaces.  I don't want to
    allow any arbitrary value and confuse STP.

    Signed-off-by: Stephen Hemminger <shemminger@osdl.org>
    Signed-off-by: David S. Miller <davem@davemloft.net>

So that should mean it is in 2.6.15 and later (presuming this patch
added all the needed functionality).



>  And to answer the earlier question, I was doing:
>
>  ifconfig brX down hw ether x:x:x:x:x:x up
>
>  so yes, the interface was down when I tried to change its address.
>
>  -Philip
>
>
>

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

* Re: [Bridge] Question about using brctl and changing MAC addresses
  2008-03-12 19:11           ` Andy Gospodarek
@ 2008-03-13  4:39             ` Philip Prindeville
  2008-03-13  7:11               ` Srinivas M.A.
       [not found]               ` <fed120860803130008t7230f5b4m3b656d03b03cad28@mail.gmail.com>
  0 siblings, 2 replies; 11+ messages in thread
From: Philip Prindeville @ 2008-03-13  4:39 UTC (permalink / raw)
  To: Andy Gospodarek; +Cc: bridge

Andy Gospodarek wrote:
> On Wed, Mar 12, 2008 at 2:45 PM, Philip Prindeville
> <philipp_subx@redfish-solutions.com> wrote:
>   
>> Stephen Hemminger wrote:
>>  > On Wed, 12 Mar 2008 10:46:48 -0400
>>  > "Andy Gospodarek" <andy@greyhouse.net> wrote:
>>  >
>>  >
>>  >> On Tue, Mar 11, 2008 at 11:29 PM, Philip Prindeville
>>  >> <philipp_subx@redfish-solutions.com> wrote:
>>  >>
>>  >>> Stephen Hemminger wrote:
>>  >>>  > On Mon, 10 Mar 2008 11:05:53 -0700
>>  >>>  > Philip Prindeville <philipp_subx@redfish-solutions.com> wrote:
>>  >>>  >
>>  >>>  >
>>  >>>  >> I'm using Linux 2.6.20 (yes, I'll be upgrading to 2.6.24 as soon as it's
>>  >>>  >> stable).
>>  >>>  >>
>>  >>>  >> I have 4 VIA rhine ethernet controllers on my Soekris net5501, plus an
>>  >>>  >> ADSL PCI card (a Sangoma S-518) that runs in AAL5-SNAP mode, so it looks
>>  >>>  >> like an Ethernet controller.
>>  >>>  >>
>>  >>>  >> I'm trying to bridge eth0 and w1ad (the ADSL interface) into "br0".  And
>>  >>>  >> I'm trying to force the traffic on br0 to have the MAC address that my
>>  >>>  >> ISP insists I use (i.e. that of the crappy little Westell 6100 modem
>>  >>>  >> they sent me).
>>  >>>  >>
>>  >>>  >> The issue is the following.  If I do:
>>  >>>  >>
>>  >>>  >> ifconfig w1ad down hw ether x:x:x:x:x:x up
>>  >>>  >>
>>  >>>  >> followed by either:
>>  >>>  >>
>>  >>>  >> brctl addbr br0
>>  >>>  >> brctl addif br0 eth0
>>  >>>  >> brctl addif br0 w1ad
>>  >>>  >>
>>  >>>  >> or:
>>  >>>  >>
>>  >>>  >> brctl addbr br0
>>  >>>  >> brctl addif br0 w1ad
>>  >>>  >> brctl addif br0 eth0
>>  >>>  >>
>>  >>>  >> the bridge ends up taking the MAC address of eth0 either way, which I
>>  >>>  >> don't get (how does it decide which to use?).
>>  >>>  >>
>>  >>>  >> I can clone the same MAC address to both eth0 and w1ad, but I don't know
>>  >>>  >> if that would cause me any problems or not (I haven't read the STP spec
>>  >>>  >> in about 15 years).
>>  >>>  >>
>>  >>>  >>
>>  >>>  >
>>  >>>  > Having the same mac address on both just is going to be problematic (impossible
>>  >>>  > to do STP), so don't if you don't have to.
>>  >>>  > But you can set address of bridge and eth0 to any address you want. So set these
>>  >>>  > to the ISP assigned address.  You probably will have to do it after bridge
>>  >>>  > is created.
>>  >>>  >
>>  >>>  > brctl addbr br0
>>  >>>  > brctl addif br0 w1ad br0
>>  >>>  > ifconfig eth0 hw ether x:x:x:x:x:x up
>>  >>>  > ifconfig w1ad up
>>  >>>  > ifconfig br0 hw ether x:x:x:x:x:x up
>>  >>>  >
>>  >>>  > ifconfig br0 A.B.C.D netmask 255.255.255.0
>>  >>>  >
>>  >>>
>>  >>>  That seems to not work.  I get:
>>  >>>
>>  >>>  # ifconfig br0 hw ether "00:18:3A:55:15:35"
>>  >>>
>>  >>> ifconfig: SIOCSIFHWADDR: Cannot assign requested address
>>  >>>  #
>>  >>>
>>  >>>  Any ideas why?  I'm doing this before an IP address has even been
>>  >>>  assigned...
>>  >>>
>>  >
>>  > Assign the hardware address of the bridge was only added in later kernels.
>>  >
>>
>>  Later being which kernel?
>>     
>
> It looks like this commit did it:
>
> commit 4505a3ef720845b5db3ddb440de13cd4800fd508
> Author: Stephen Hemminger <shemminger@osdl.org>
> Date:   Wed Dec 21 18:51:49 2005 -0800
>
>     [BRIDGE]: allow setting hardware address of bridge pseudo-dev
>
>     Some people are using bridging to hide multiple machines from an ISP
>     that restricts by MAC address. So in that case allow the bridge mac
>     address to be set to any of the existing interfaces.  I don't want to
>     allow any arbitrary value and confuse STP.
>
>     Signed-off-by: Stephen Hemminger <shemminger@osdl.org>
>     Signed-off-by: David S. Miller <davem@davemloft.net>
>
> So that should mean it is in 2.6.15 and later (presuming this patch
> added all the needed functionality).
>   

Well, I don't get it then.

I'm running Linux 2.6.20, with bridge-utils-1.2, and I'm still seeing it.

Can you send me the link to the patch, and I'll make sure it's in my 
sources?

Thanks,

-Philip


>   
>>  And to answer the earlier question, I was doing:
>>
>>  ifconfig brX down hw ether x:x:x:x:x:x up
>>
>>  so yes, the interface was down when I tried to change its address.
>>
>>  -Philip
>>
>>
>>
>>     


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

* Re: [Bridge] Question about using brctl and changing MAC addresses
  2008-03-13  4:39             ` Philip Prindeville
@ 2008-03-13  7:11               ` Srinivas M.A.
  2008-03-13 12:24                 ` Andy Gospodarek
       [not found]               ` <fed120860803130008t7230f5b4m3b656d03b03cad28@mail.gmail.com>
  1 sibling, 1 reply; 11+ messages in thread
From: Srinivas M.A. @ 2008-03-13  7:11 UTC (permalink / raw)
  To: Philip Prindeville; +Cc: bridge

Philip, sorry for the duplicate email. Forgot to CC the list the first time.

Perhaps the needed patch is the following, which allows setting the
bridge hardware address to anything rather than just one of the port
interface addresses. Seems to have got in after Linux  2.6.21, so
should be in 2.6.22.

[~/git/linux-2.6] git-describe ffe1d49cc300f3dff990093aa952a2fbb371c1b6
v2.6.21-324-gffe1d49

[~/git/linux-2.6] git-diff-tree -p --pretty=fuller
ffe1d49cc300f3dff990093aa952a2fbb371c1b6
commit ffe1d49cc300f3dff990093aa952a2fbb371c1b6
Author:     Stephen Hemminger <shemminger@linux-foundation.org>
AuthorDate: Mon Apr 9 11:49:58 2007 -0700
Commit:     David S. Miller <davem@sunset.davemloft.net>
CommitDate: Wed Apr 25 22:28:50 2007 -0700

   bridge: allow changing hardware address to any valid address

   For case of bridging pseudo devices, the get created/destroyed (Xen)
   need to allow setting address to any valid value.

   Signed-off-by: Stephen Hemminger <shemminger@linux-foundation.org>

diff --git a/net/bridge/br_device.c b/net/bridge/br_device.c
index b22ada5..39b87da 100644
--- a/net/bridge/br_device.c
+++ b/net/bridge/br_device.c
@@ -83,27 +83,22 @@ static int br_change_mtu(struct net_device *dev,
int new_mtu)
       return 0;
 }

-/* Allow setting mac address of pseudo-bridge to be same as
- * any of the bound interfaces
- */
+/* Allow setting mac address to any valid ethernet address. */
 static int br_set_mac_address(struct net_device *dev, void *p)
 {
       struct net_bridge *br = netdev_priv(dev);
       struct sockaddr *addr = p;
       struct net_bridge_port *port;
-       int err = -EADDRNOTAVAIL;
+
+       if (!is_valid_ether_addr(addr->sa_data))
+               return -EINVAL;

       spin_lock_bh(&br->lock);
-       list_for_each_entry(port, &br->port_list, list) {
-               if (!compare_ether_addr(port->dev->dev_addr, addr->sa_data)) {
-                       br_stp_change_bridge_id(br, addr->sa_data);
-                       err = 0;
-                       break;
-               }
-       }
+       memcpy(dev->dev_addr, addr->sa_data, ETH_ALEN);
+       br_stp_change_bridge_id(br, addr->sa_data);
       spin_unlock_bh(&br->lock);

-       return err;
+       return 0;
 }

 static void br_getinfo(struct net_device *dev, struct ethtool_drvinfo *info)


On Thu, Mar 13, 2008 at 10:09 AM, Philip Prindeville
<philipp_subx@redfish-solutions.com> wrote:
>
>  Well, I don't get it then.
>
>  I'm running Linux 2.6.20, with bridge-utils-1.2, and I'm still seeing it.
>
>  Can you send me the link to the patch, and I'll make sure it's in my
>  sources?
>
>  Thanks,
>
>  -Philip

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

* Re: [Bridge] Question about using brctl and changing MAC addresses
       [not found]                 ` <47D8D35A.6020403@redfish-solutions.com>
@ 2008-03-13  7:24                   ` Srinivas M.A.
  0 siblings, 0 replies; 11+ messages in thread
From: Srinivas M.A. @ 2008-03-13  7:24 UTC (permalink / raw)
  To: Philip Prindeville; +Cc: bridge

Searching for the commit by name on kernel.org:
http://git.kernel.org/?p=linux%2Fkernel%2Fgit%2Ftorvalds%2Flinux-2.6.git&a=search&h=v2.6.22-rc1&st=commit&s=allow+changing+hardware+address+to+any+valid+address

and then the link to the commit page itself (from the search results):
http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=ffe1d49cc300f3dff990093aa952a2fbb371c1b6

Go to the "commitdiff" link and then "raw" which will give you the
file you can use as a patch.

On Thu, Mar 13, 2008 at 12:40 PM, Philip Prindeville
<philipp_subx@redfish-solutions.com> wrote:
>
>  Thanks.  Can you send me a link so I can download it?
>
>  -Philip
>

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

* Re: [Bridge] Question about using brctl and changing MAC addresses
  2008-03-13  7:11               ` Srinivas M.A.
@ 2008-03-13 12:24                 ` Andy Gospodarek
  0 siblings, 0 replies; 11+ messages in thread
From: Andy Gospodarek @ 2008-03-13 12:24 UTC (permalink / raw)
  To: Srinivas M.A.; +Cc: Philip Prindeville, bridge

On Thu, Mar 13, 2008 at 2:11 AM, Srinivas M.A. <srinivas.aji@gmail.com> wrote:
> Philip, sorry for the duplicate email. Forgot to CC the list the first time.
>
>  Perhaps the needed patch is the following, which allows setting the
>  bridge hardware address to anything rather than just one of the port
>  interface addresses. Seems to have got in after Linux  2.6.21, so
>  should be in 2.6.22.
>
>  [~/git/linux-2.6] git-describe ffe1d49cc300f3dff990093aa952a2fbb371c1b6
>  v2.6.21-324-gffe1d49
>
>  [~/git/linux-2.6] git-diff-tree -p --pretty=fuller
>  ffe1d49cc300f3dff990093aa952a2fbb371c1b6
>  commit ffe1d49cc300f3dff990093aa952a2fbb371c1b6
>  Author:     Stephen Hemminger <shemminger@linux-foundation.org>
>  AuthorDate: Mon Apr 9 11:49:58 2007 -0700
>  Commit:     David S. Miller <davem@sunset.davemloft.net>
>  CommitDate: Wed Apr 25 22:28:50 2007 -0700
>
>    bridge: allow changing hardware address to any valid address
>
>    For case of bridging pseudo devices, the get created/destroyed (Xen)
>    need to allow setting address to any valid value.
>
>    Signed-off-by: Stephen Hemminger <shemminger@linux-foundation.org>
>
>  diff --git a/net/bridge/br_device.c b/net/bridge/br_device.c
>  index b22ada5..39b87da 100644
>  --- a/net/bridge/br_device.c
>  +++ b/net/bridge/br_device.c
>  @@ -83,27 +83,22 @@ static int br_change_mtu(struct net_device *dev,
>  int new_mtu)
>        return 0;
>   }
>
>  -/* Allow setting mac address of pseudo-bridge to be same as
>  - * any of the bound interfaces
>  - */
>  +/* Allow setting mac address to any valid ethernet address. */
>   static int br_set_mac_address(struct net_device *dev, void *p)
>   {
>        struct net_bridge *br = netdev_priv(dev);
>        struct sockaddr *addr = p;
>        struct net_bridge_port *port;
>  -       int err = -EADDRNOTAVAIL;
>  +
>  +       if (!is_valid_ether_addr(addr->sa_data))
>  +               return -EINVAL;
>
>        spin_lock_bh(&br->lock);
>  -       list_for_each_entry(port, &br->port_list, list) {
>  -               if (!compare_ether_addr(port->dev->dev_addr, addr->sa_data)) {
>  -                       br_stp_change_bridge_id(br, addr->sa_data);
>  -                       err = 0;
>  -                       break;
>  -               }
>  -       }
>  +       memcpy(dev->dev_addr, addr->sa_data, ETH_ALEN);
>  +       br_stp_change_bridge_id(br, addr->sa_data);
>        spin_unlock_bh(&br->lock);
>
>  -       return err;
>  +       return 0;
>   }
>
>   static void br_getinfo(struct net_device *dev, struct ethtool_drvinfo *info)
>

Thanks, Srinivas!  There's the 'additional' patch I was referencing. :-)

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

end of thread, other threads:[~2008-03-13 12:24 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-03-10 18:05 [Bridge] Question about using brctl and changing MAC addresses Philip Prindeville
2008-03-11 15:23 ` Stephen Hemminger
2008-03-12  3:29   ` Philip Prindeville
2008-03-12 14:46     ` Andy Gospodarek
2008-03-12 15:14       ` Stephen Hemminger
2008-03-12 18:45         ` Philip Prindeville
2008-03-12 19:11           ` Andy Gospodarek
2008-03-13  4:39             ` Philip Prindeville
2008-03-13  7:11               ` Srinivas M.A.
2008-03-13 12:24                 ` Andy Gospodarek
     [not found]               ` <fed120860803130008t7230f5b4m3b656d03b03cad28@mail.gmail.com>
     [not found]                 ` <47D8D35A.6020403@redfish-solutions.com>
2008-03-13  7:24                   ` Srinivas M.A.

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.