All of lore.kernel.org
 help / color / mirror / Atom feed
* bridge-utils: wrong sysfs path odds
@ 2015-11-25  0:15 Richard Weinberger
  2015-11-25  0:24 ` Richard Weinberger
  0 siblings, 1 reply; 9+ messages in thread
From: Richard Weinberger @ 2015-11-25  0:15 UTC (permalink / raw)
  To: netdev; +Cc: Ralf Baechle, Stephen Hemminger, manty

Hi!

Today I was hunting down an issue where "brctl stp br0 off"
always failed on mips64be with n32 userland.

It turned out that the ioctl(fd, SIOCDEVPRIVATE, &ifr) with BRCTL_SET_BRIDGE_STP_STATE
returned -EOPNOTSUPP.
First I thought that this is a plain ABI issue on mips as in old_dev_ioctl()
the ioctl() argument was 0x1 instead of the expected BRCTL_SET_BRIDGE_STP_STATE (0x14)

Further investigation showed that brctl first tries to open the sysfs file
"/sys/class/net/br0/stp_state" and falls back to the legacy ioctl() upon failure.

On my mips setup old_dev_ioctl() seems not to work. And the function's comment
is correct:
/*
 * Legacy ioctl's through SIOCDEVPRIVATE
 * This interface is deprecated because it was too difficult to
 * to do the translation for 32/64bit ioctl compatibility.
 */

Later I've realized that the sysfs path is wrong, the "bridge/" directory
part is missing.
On most setups nobody would notice as the fallback ioctl() works.

Debian's bridge-utils package carries a patch which fixes the sysfs paths.
Can we please have this patch also in upstream bridge-utils?

Thanks,
//richard

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

* Re: bridge-utils: wrong sysfs path odds
  2015-11-25  0:15 bridge-utils: wrong sysfs path odds Richard Weinberger
@ 2015-11-25  0:24 ` Richard Weinberger
  2015-11-25  0:37   ` Stephen Hemminger
  0 siblings, 1 reply; 9+ messages in thread
From: Richard Weinberger @ 2015-11-25  0:24 UTC (permalink / raw)
  To: netdev; +Cc: Ralf Baechle, Stephen Hemminger, manty

Am 25.11.2015 um 01:15 schrieb Richard Weinberger:
> Hi!
> 
> Today I was hunting down an issue where "brctl stp br0 off"
> always failed on mips64be with n32 userland.
> 
> It turned out that the ioctl(fd, SIOCDEVPRIVATE, &ifr) with BRCTL_SET_BRIDGE_STP_STATE
> returned -EOPNOTSUPP.
> First I thought that this is a plain ABI issue on mips as in old_dev_ioctl()
> the ioctl() argument was 0x1 instead of the expected BRCTL_SET_BRIDGE_STP_STATE (0x14)

Should be 0xe and not 0x14. It is 14 in decimal. :)

Thanks,
//richard

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

* Re: bridge-utils: wrong sysfs path odds
  2015-11-25  0:24 ` Richard Weinberger
@ 2015-11-25  0:37   ` Stephen Hemminger
  2015-11-25  0:40     ` Richard Weinberger
  2015-11-25  9:21     ` Richard Weinberger
  0 siblings, 2 replies; 9+ messages in thread
From: Stephen Hemminger @ 2015-11-25  0:37 UTC (permalink / raw)
  To: Richard Weinberger; +Cc: netdev, Ralf Baechle, manty

On Wed, 25 Nov 2015 01:24:47 +0100
Richard Weinberger <richard@nod.at> wrote:

> Am 25.11.2015 um 01:15 schrieb Richard Weinberger:
> > Hi!
> > 
> > Today I was hunting down an issue where "brctl stp br0 off"
> > always failed on mips64be with n32 userland.
> > 
> > It turned out that the ioctl(fd, SIOCDEVPRIVATE, &ifr) with BRCTL_SET_BRIDGE_STP_STATE
> > returned -EOPNOTSUPP.
> > First I thought that this is a plain ABI issue on mips as in old_dev_ioctl()
> > the ioctl() argument was 0x1 instead of the expected BRCTL_SET_BRIDGE_STP_STATE (0x14)
> 
> Should be 0xe and not 0x14. It is 14 in decimal. :)
> 
> Thanks,
> //richard

Ask Debian maintainer to send his patches, I don't go patch hunting.

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

* Re: bridge-utils: wrong sysfs path odds
  2015-11-25  0:37   ` Stephen Hemminger
@ 2015-11-25  0:40     ` Richard Weinberger
  2015-11-25  9:21     ` Richard Weinberger
  1 sibling, 0 replies; 9+ messages in thread
From: Richard Weinberger @ 2015-11-25  0:40 UTC (permalink / raw)
  To: Stephen Hemminger; +Cc: netdev, Ralf Baechle, manty

Am 25.11.2015 um 01:37 schrieb Stephen Hemminger:
> On Wed, 25 Nov 2015 01:24:47 +0100
> Richard Weinberger <richard@nod.at> wrote:
> 
>> Am 25.11.2015 um 01:15 schrieb Richard Weinberger:
>>> Hi!
>>>
>>> Today I was hunting down an issue where "brctl stp br0 off"
>>> always failed on mips64be with n32 userland.
>>>
>>> It turned out that the ioctl(fd, SIOCDEVPRIVATE, &ifr) with BRCTL_SET_BRIDGE_STP_STATE
>>> returned -EOPNOTSUPP.
>>> First I thought that this is a plain ABI issue on mips as in old_dev_ioctl()
>>> the ioctl() argument was 0x1 instead of the expected BRCTL_SET_BRIDGE_STP_STATE (0x14)
>>
>> Should be 0xe and not 0x14. It is 14 in decimal. :)
>>
>> Thanks,
>> //richard
> 
> Ask Debian maintainer to send his patches, I don't go patch hunting.

He is Cc'ed :-)

Thanks,
//richard

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

* Re: bridge-utils: wrong sysfs path odds
  2015-11-25  0:37   ` Stephen Hemminger
  2015-11-25  0:40     ` Richard Weinberger
@ 2015-11-25  9:21     ` Richard Weinberger
  2015-11-25 22:38       ` Florian Fainelli
       [not found]       ` <CAJk_L2GSvNUGiexawakMHdm+v5ndv=qLXB9TD7xxn7z9c-ZMsg@mail.gmail.com>
  1 sibling, 2 replies; 9+ messages in thread
From: Richard Weinberger @ 2015-11-25  9:21 UTC (permalink / raw)
  To: Stephen Hemminger; +Cc: netdev, Ralf Baechle, manty

Am 25.11.2015 um 01:37 schrieb Stephen Hemminger:
> On Wed, 25 Nov 2015 01:24:47 +0100
> Richard Weinberger <richard@nod.at> wrote:
> 
>> Am 25.11.2015 um 01:15 schrieb Richard Weinberger:
>>> Hi!
>>>
>>> Today I was hunting down an issue where "brctl stp br0 off"
>>> always failed on mips64be with n32 userland.
>>>
>>> It turned out that the ioctl(fd, SIOCDEVPRIVATE, &ifr) with BRCTL_SET_BRIDGE_STP_STATE
>>> returned -EOPNOTSUPP.
>>> First I thought that this is a plain ABI issue on mips as in old_dev_ioctl()
>>> the ioctl() argument was 0x1 instead of the expected BRCTL_SET_BRIDGE_STP_STATE (0x14)
>>
>> Should be 0xe and not 0x14. It is 14 in decimal. :)
>>
>> Thanks,
>> //richard
> 
> Ask Debian maintainer to send his patches, I don't go patch hunting.
> 

While looking what other distros do I came across this patch:
https://pkgs.fedoraproject.org/cgit/bridge-utils.git/tree/bridge-utils-1.5-check-error-returns-from-write-to-sysfs.patch

Beside of checking return errors is fixes also the sysfs path in br_set().
Can you please merge it upstream?

Distros seems to carry more patches for that package, if it helps I can do the patch hunting for you.
It would be nice to have a recent bridge-utils release. The last one is from 2011.

Thanks,
//richard

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

* Re: bridge-utils: wrong sysfs path odds
       [not found]       ` <CAJk_L2GSvNUGiexawakMHdm+v5ndv=qLXB9TD7xxn7z9c-ZMsg@mail.gmail.com>
@ 2015-11-25 22:37         ` Richard Weinberger
  2015-11-25 22:44         ` Fwd: " Santiago Garcia Mantinan
  1 sibling, 0 replies; 9+ messages in thread
From: Richard Weinberger @ 2015-11-25 22:37 UTC (permalink / raw)
  To: Santiago Garcia Mantinan; +Cc: Stephen Hemminger, netdev, Ralf Baechle

Hi!

Am 25.11.2015 um 23:30 schrieb Santiago Garcia Mantinan:
> Hi!
> 
>> Ask Debian maintainer to send his patches, I don't go patch hunting.
> 
> 
>     While looking what other distros do I came across this patch:
>     https://pkgs.fedoraproject.org/cgit/bridge-utils.git/tree/bridge-utils-1.5-check-error-returns-from-write-to-sysfs.patch
> 
> 
> Don't know about the fedora guys but at least I did send some patches which include this /bridge addition, and Stephen did even ack it as you can read on:
> http://lists.linuxfoundation.org/pipermail/bridge/2011-May/007646.html

Meanwhile I've found https://git.kernel.org/cgit/linux/kernel/git/shemminger/bridge-utils.git/
It contains some fixes.
So, the problem is that we have fixes but no release which contains these.
Stephen, can you do a maintenance release? Maybe 1.5.1?

Thanks,
//richard

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

* Re: bridge-utils: wrong sysfs path odds
  2015-11-25  9:21     ` Richard Weinberger
@ 2015-11-25 22:38       ` Florian Fainelli
  2015-11-25 22:41         ` Richard Weinberger
       [not found]       ` <CAJk_L2GSvNUGiexawakMHdm+v5ndv=qLXB9TD7xxn7z9c-ZMsg@mail.gmail.com>
  1 sibling, 1 reply; 9+ messages in thread
From: Florian Fainelli @ 2015-11-25 22:38 UTC (permalink / raw)
  To: Richard Weinberger, Stephen Hemminger; +Cc: netdev, Ralf Baechle, manty

On 25/11/15 01:21, Richard Weinberger wrote:
> Am 25.11.2015 um 01:37 schrieb Stephen Hemminger:
>> On Wed, 25 Nov 2015 01:24:47 +0100
>> Richard Weinberger <richard@nod.at> wrote:
>>
>>> Am 25.11.2015 um 01:15 schrieb Richard Weinberger:
>>>> Hi!
>>>>
>>>> Today I was hunting down an issue where "brctl stp br0 off"
>>>> always failed on mips64be with n32 userland.
>>>>
>>>> It turned out that the ioctl(fd, SIOCDEVPRIVATE, &ifr) with BRCTL_SET_BRIDGE_STP_STATE
>>>> returned -EOPNOTSUPP.
>>>> First I thought that this is a plain ABI issue on mips as in old_dev_ioctl()
>>>> the ioctl() argument was 0x1 instead of the expected BRCTL_SET_BRIDGE_STP_STATE (0x14)
>>>
>>> Should be 0xe and not 0x14. It is 14 in decimal. :)
>>>
>>> Thanks,
>>> //richard
>>
>> Ask Debian maintainer to send his patches, I don't go patch hunting.
>>
> 
> While looking what other distros do I came across this patch:
> https://pkgs.fedoraproject.org/cgit/bridge-utils.git/tree/bridge-utils-1.5-check-error-returns-from-write-to-sysfs.patch
> 
> Beside of checking return errors is fixes also the sysfs path in br_set().
> Can you please merge it upstream?
> 
> Distros seems to carry more patches for that package, if it helps I can do the patch hunting for you.
> It would be nice to have a recent bridge-utils release. The last one is from 2011.

Most of what bridge-utils does can be done by iproute2's bridge
sub-command FWIW.
-- 
Florian

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

* Re: bridge-utils: wrong sysfs path odds
  2015-11-25 22:38       ` Florian Fainelli
@ 2015-11-25 22:41         ` Richard Weinberger
  0 siblings, 0 replies; 9+ messages in thread
From: Richard Weinberger @ 2015-11-25 22:41 UTC (permalink / raw)
  To: Florian Fainelli, Stephen Hemminger; +Cc: netdev, Ralf Baechle, manty

Am 25.11.2015 um 23:38 schrieb Florian Fainelli:
> On 25/11/15 01:21, Richard Weinberger wrote:
>> Am 25.11.2015 um 01:37 schrieb Stephen Hemminger:
>>> On Wed, 25 Nov 2015 01:24:47 +0100
>>> Richard Weinberger <richard@nod.at> wrote:
>>>
>>>> Am 25.11.2015 um 01:15 schrieb Richard Weinberger:
>>>>> Hi!
>>>>>
>>>>> Today I was hunting down an issue where "brctl stp br0 off"
>>>>> always failed on mips64be with n32 userland.
>>>>>
>>>>> It turned out that the ioctl(fd, SIOCDEVPRIVATE, &ifr) with BRCTL_SET_BRIDGE_STP_STATE
>>>>> returned -EOPNOTSUPP.
>>>>> First I thought that this is a plain ABI issue on mips as in old_dev_ioctl()
>>>>> the ioctl() argument was 0x1 instead of the expected BRCTL_SET_BRIDGE_STP_STATE (0x14)
>>>>
>>>> Should be 0xe and not 0x14. It is 14 in decimal. :)
>>>>
>>>> Thanks,
>>>> //richard
>>>
>>> Ask Debian maintainer to send his patches, I don't go patch hunting.
>>>
>>
>> While looking what other distros do I came across this patch:
>> https://pkgs.fedoraproject.org/cgit/bridge-utils.git/tree/bridge-utils-1.5-check-error-returns-from-write-to-sysfs.patch
>>
>> Beside of checking return errors is fixes also the sysfs path in br_set().
>> Can you please merge it upstream?
>>
>> Distros seems to carry more patches for that package, if it helps I can do the patch hunting for you.
>> It would be nice to have a recent bridge-utils release. The last one is from 2011.
> 
> Most of what bridge-utils does can be done by iproute2's bridge
> sub-command FWIW.

Sure, but a lot of userspace still depends on brctl.
And IMHO brctl is magnitudes easier to use than iproute's bridge tool.

Thanks,
//richard

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

* Fwd: bridge-utils: wrong sysfs path odds
       [not found]       ` <CAJk_L2GSvNUGiexawakMHdm+v5ndv=qLXB9TD7xxn7z9c-ZMsg@mail.gmail.com>
  2015-11-25 22:37         ` Richard Weinberger
@ 2015-11-25 22:44         ` Santiago Garcia Mantinan
  1 sibling, 0 replies; 9+ messages in thread
From: Santiago Garcia Mantinan @ 2015-11-25 22:44 UTC (permalink / raw)
  To: Richard Weinberger; +Cc: Stephen Hemminger, netdev, Ralf Baechle

(Message resent due to list rejection)

Hi!

> Ask Debian maintainer to send his patches, I don't go patch hunting.
>
>
> While looking what other distros do I came across this patch:
> https://pkgs.fedoraproject.org/cgit/bridge-utils.git/tree/bridge-utils-1.5-check-error-returns-from-write-to-sysfs.patch
>

Don't know about the fedora guys but at least I did send some patches
which include this /bridge addition, and Stephen did even ack it as
you can read on:
http://lists.linuxfoundation.org/pipermail/bridge/2011-May/007646.html

Regards.
-- 
Manty/BestiaTester -> http://manty.net

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

end of thread, other threads:[~2015-11-25 22:44 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-11-25  0:15 bridge-utils: wrong sysfs path odds Richard Weinberger
2015-11-25  0:24 ` Richard Weinberger
2015-11-25  0:37   ` Stephen Hemminger
2015-11-25  0:40     ` Richard Weinberger
2015-11-25  9:21     ` Richard Weinberger
2015-11-25 22:38       ` Florian Fainelli
2015-11-25 22:41         ` Richard Weinberger
     [not found]       ` <CAJk_L2GSvNUGiexawakMHdm+v5ndv=qLXB9TD7xxn7z9c-ZMsg@mail.gmail.com>
2015-11-25 22:37         ` Richard Weinberger
2015-11-25 22:44         ` Fwd: " Santiago Garcia Mantinan

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.