public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] bridge: make brctl showstp display port id
@ 2012-04-30  8:39 Joakim Tjernlund
  2012-04-30 16:07 ` Stephen Hemminger
  0 siblings, 1 reply; 7+ messages in thread
From: Joakim Tjernlund @ 2012-04-30  8:39 UTC (permalink / raw)
  To: netdev@vger.kernel.org; +Cc: Joakim Tjernlund

My brctl showstp br0 always shows a 0 port id:
eth2 (1)
 port id		0			state		       disabled
 designated root	8000.00069c00b2fb	path cost		 100

because port id is printed as a hex number in sys fs. Change the
two hex occurrences(port no and port id) to decimal, just like all
the other numbers in this area.

Signed-off-by: Joakim Tjernlund <Joakim.Tjernlund@transmode.se>
---
 net/bridge/br_sysfs_if.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/net/bridge/br_sysfs_if.c b/net/bridge/br_sysfs_if.c
index fd5799c..9c4c2eb 100644
--- a/net/bridge/br_sysfs_if.c
+++ b/net/bridge/br_sysfs_if.c
@@ -86,13 +86,13 @@ static BRPORT_ATTR(designated_cost, S_IRUGO, show_designated_cost, NULL);
 
 static ssize_t show_port_id(struct net_bridge_port *p, char *buf)
 {
-	return sprintf(buf, "0x%x\n", p->port_id);
+	return sprintf(buf, "%d\n", p->port_id);
 }
 static BRPORT_ATTR(port_id, S_IRUGO, show_port_id, NULL);
 
 static ssize_t show_port_no(struct net_bridge_port *p, char *buf)
 {
-	return sprintf(buf, "0x%x\n", p->port_no);
+	return sprintf(buf, "%d\n", p->port_no);
 }
 
 static BRPORT_ATTR(port_no, S_IRUGO, show_port_no, NULL);
-- 
1.7.3.4

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

* Re: [PATCH] bridge: make brctl showstp display port id
  2012-04-30  8:39 [PATCH] bridge: make brctl showstp display port id Joakim Tjernlund
@ 2012-04-30 16:07 ` Stephen Hemminger
  2012-05-01 14:38   ` Joakim Tjernlund
  0 siblings, 1 reply; 7+ messages in thread
From: Stephen Hemminger @ 2012-04-30 16:07 UTC (permalink / raw)
  To: Joakim Tjernlund; +Cc: netdev@vger.kernel.org

On Mon, 30 Apr 2012 10:39:08 +0200
Joakim Tjernlund <Joakim.Tjernlund@transmode.se> wrote:

> My brctl showstp br0 always shows a 0 port id:
> eth2 (1)
>  port id		0			state		       disabled
>  designated root	8000.00069c00b2fb	path cost		 100
> 
> because port id is printed as a hex number in sys fs. Change the
> two hex occurrences(port no and port id) to decimal, just like all
> the other numbers in this area.
> 
> Signed-off-by: Joakim Tjernlund <Joakim.Tjernlund@transmode.se>
> ---
>  net/bridge/br_sysfs_if.c |    4 ++--
>  1 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/net/bridge/br_sysfs_if.c b/net/bridge/br_sysfs_if.c
> index fd5799c..9c4c2eb 100644
> --- a/net/bridge/br_sysfs_if.c
> +++ b/net/bridge/br_sysfs_if.c
> @@ -86,13 +86,13 @@ static BRPORT_ATTR(designated_cost, S_IRUGO, show_designated_cost, NULL);
>  
>  static ssize_t show_port_id(struct net_bridge_port *p, char *buf)
>  {
> -	return sprintf(buf, "0x%x\n", p->port_id);
> +	return sprintf(buf, "%d\n", p->port_id);
>  }
>  static BRPORT_ATTR(port_id, S_IRUGO, show_port_id, NULL);
>  
>  static ssize_t show_port_no(struct net_bridge_port *p, char *buf)
>  {
> -	return sprintf(buf, "0x%x\n", p->port_no);
> +	return sprintf(buf, "%d\n", p->port_no);
>  }
>  
>  static BRPORT_ATTR(port_no, S_IRUGO, show_port_no, NULL);

No. This would be a visible change to applications.
The bridge utilities should be fixed instead.

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

* Re: [PATCH] bridge: make brctl showstp display port id
  2012-04-30 16:07 ` Stephen Hemminger
@ 2012-05-01 14:38   ` Joakim Tjernlund
  2012-05-01 16:53     ` Stephen Hemminger
  2012-05-01 17:39     ` Stephen Hemminger
  0 siblings, 2 replies; 7+ messages in thread
From: Joakim Tjernlund @ 2012-05-01 14:38 UTC (permalink / raw)
  To: Stephen Hemminger; +Cc: netdev@vger.kernel.org

Stephen Hemminger <shemminger@vyatta.com> wrote on 2012/04/30 18:07:47:
>
> On Mon, 30 Apr 2012 10:39:08 +0200
> Joakim Tjernlund <Joakim.Tjernlund@transmode.se> wrote:
>
> > My brctl showstp br0 always shows a 0 port id:
> > eth2 (1)
> >  port id      0         state             disabled
> >  designated root   8000.00069c00b2fb   path cost       100
> >
> > because port id is printed as a hex number in sys fs. Change the
> > two hex occurrences(port no and port id) to decimal, just like all
> > the other numbers in this area.
> >
> > Signed-off-by: Joakim Tjernlund <Joakim.Tjernlund@transmode.se>
> > ---
> >  net/bridge/br_sysfs_if.c |    4 ++--
> >  1 files changed, 2 insertions(+), 2 deletions(-)
> >
> > diff --git a/net/bridge/br_sysfs_if.c b/net/bridge/br_sysfs_if.c
> > index fd5799c..9c4c2eb 100644
> > --- a/net/bridge/br_sysfs_if.c
> > +++ b/net/bridge/br_sysfs_if.c
> > @@ -86,13 +86,13 @@ static BRPORT_ATTR(designated_cost, S_IRUGO, show_designated_cost, NULL);
> >
> >  static ssize_t show_port_id(struct net_bridge_port *p, char *buf)
> >  {
> > -   return sprintf(buf, "0x%x\n", p->port_id);
> > +   return sprintf(buf, "%d\n", p->port_id);
> >  }
> >  static BRPORT_ATTR(port_id, S_IRUGO, show_port_id, NULL);
> >
> >  static ssize_t show_port_no(struct net_bridge_port *p, char *buf)
> >  {
> > -   return sprintf(buf, "0x%x\n", p->port_no);
> > +   return sprintf(buf, "%d\n", p->port_no);
> >  }
> >
> >  static BRPORT_ATTR(port_no, S_IRUGO, show_port_no, NULL);
>
> No. This would be a visible change to applications.
> The bridge utilities should be fixed instead.

Well, my reasoning was that if not the native tools got this right, what are the
chances that other apps got it right? I don't know any other apps than
brctl using this info, do you? We could check one or two apps to see what they do.

 Jocke

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

* Re: [PATCH] bridge: make brctl showstp display port id
  2012-05-01 14:38   ` Joakim Tjernlund
@ 2012-05-01 16:53     ` Stephen Hemminger
  2012-05-01 17:39     ` Stephen Hemminger
  1 sibling, 0 replies; 7+ messages in thread
From: Stephen Hemminger @ 2012-05-01 16:53 UTC (permalink / raw)
  To: Joakim Tjernlund; +Cc: netdev@vger.kernel.org

On Tue, 1 May 2012 16:38:34 +0200
Joakim Tjernlund <joakim.tjernlund@transmode.se> wrote:

> Stephen Hemminger <shemminger@vyatta.com> wrote on 2012/04/30 18:07:47:
> >
> > On Mon, 30 Apr 2012 10:39:08 +0200
> > Joakim Tjernlund <Joakim.Tjernlund@transmode.se> wrote:
> >
> > > My brctl showstp br0 always shows a 0 port id:
> > > eth2 (1)
> > >  port id      0         state             disabled
> > >  designated root   8000.00069c00b2fb   path cost       100
> > >
> > > because port id is printed as a hex number in sys fs. Change the
> > > two hex occurrences(port no and port id) to decimal, just like all
> > > the other numbers in this area.
> > >
> > > Signed-off-by: Joakim Tjernlund <Joakim.Tjernlund@transmode.se>
> > > ---
> > >  net/bridge/br_sysfs_if.c |    4 ++--
> > >  1 files changed, 2 insertions(+), 2 deletions(-)
> > >
> > > diff --git a/net/bridge/br_sysfs_if.c b/net/bridge/br_sysfs_if.c
> > > index fd5799c..9c4c2eb 100644
> > > --- a/net/bridge/br_sysfs_if.c
> > > +++ b/net/bridge/br_sysfs_if.c
> > > @@ -86,13 +86,13 @@ static BRPORT_ATTR(designated_cost, S_IRUGO, show_designated_cost, NULL);
> > >
> > >  static ssize_t show_port_id(struct net_bridge_port *p, char *buf)
> > >  {
> > > -   return sprintf(buf, "0x%x\n", p->port_id);
> > > +   return sprintf(buf, "%d\n", p->port_id);
> > >  }
> > >  static BRPORT_ATTR(port_id, S_IRUGO, show_port_id, NULL);
> > >
> > >  static ssize_t show_port_no(struct net_bridge_port *p, char *buf)
> > >  {
> > > -   return sprintf(buf, "0x%x\n", p->port_no);
> > > +   return sprintf(buf, "%d\n", p->port_no);
> > >  }
> > >
> > >  static BRPORT_ATTR(port_no, S_IRUGO, show_port_no, NULL);
> >
> > No. This would be a visible change to applications.
> > The bridge utilities should be fixed instead.
> 
> Well, my reasoning was that if not the native tools got this right, what are the
> chances that other apps got it right? I don't know any other apps than
> brctl using this info, do you? We could check one or two apps to see what they do.

Unfortunately, that isn't really possible. API's get very hard to change
safely. It isn't worth the effort.

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

* Re: [PATCH] bridge: make brctl showstp display port id
  2012-05-01 14:38   ` Joakim Tjernlund
  2012-05-01 16:53     ` Stephen Hemminger
@ 2012-05-01 17:39     ` Stephen Hemminger
  2012-05-01 17:47       ` Joakim Tjernlund
  1 sibling, 1 reply; 7+ messages in thread
From: Stephen Hemminger @ 2012-05-01 17:39 UTC (permalink / raw)
  To: Joakim Tjernlund; +Cc: netdev@vger.kernel.org

On Tue, 1 May 2012 16:38:34 +0200
Joakim Tjernlund <joakim.tjernlund@transmode.se> wrote:

> Stephen Hemminger <shemminger@vyatta.com> wrote on 2012/04/30 18:07:47:
> >
> > On Mon, 30 Apr 2012 10:39:08 +0200
> > Joakim Tjernlund <Joakim.Tjernlund@transmode.se> wrote:
> >
> > > My brctl showstp br0 always shows a 0 port id:
> > > eth2 (1)
> > >  port id      0         state             disabled
> > >  designated root   8000.00069c00b2fb   path cost       100
> > >
> > > because port id is printed as a hex number in sys fs. Change the
> > > two hex occurrences(port no and port id) to decimal, just like all
> > > the other numbers in this area.
> > >
> > > Signed-off-by: Joakim Tjernlund <Joakim.Tjernlund@transmode.se>
> > > ---
> > >  net/bridge/br_sysfs_if.c |    4 ++--
> > >  1 files changed, 2 insertions(+), 2 deletions(-)
> > >
> > > diff --git a/net/bridge/br_sysfs_if.c b/net/bridge/br_sysfs_if.c
> > > index fd5799c..9c4c2eb 100644
> > > --- a/net/bridge/br_sysfs_if.c
> > > +++ b/net/bridge/br_sysfs_if.c
> > > @@ -86,13 +86,13 @@ static BRPORT_ATTR(designated_cost, S_IRUGO, show_designated_cost, NULL);
> > >
> > >  static ssize_t show_port_id(struct net_bridge_port *p, char *buf)
> > >  {
> > > -   return sprintf(buf, "0x%x\n", p->port_id);
> > > +   return sprintf(buf, "%d\n", p->port_id);
> > >  }
> > >  static BRPORT_ATTR(port_id, S_IRUGO, show_port_id, NULL);
> > >
> > >  static ssize_t show_port_no(struct net_bridge_port *p, char *buf)
> > >  {
> > > -   return sprintf(buf, "0x%x\n", p->port_no);
> > > +   return sprintf(buf, "%d\n", p->port_no);
> > >  }
> > >
> > >  static BRPORT_ATTR(port_no, S_IRUGO, show_port_no, NULL);
> >
> > No. This would be a visible change to applications.
> > The bridge utilities should be fixed instead.
> 
> Well, my reasoning was that if not the native tools got this right, what are the
> chances that other apps got it right? I don't know any other apps than
> brctl using this info, do you? We could check one or two apps to see what they do.
> 
>  Jocke
> 

Current bridge-utils does not have the issue. It has been fixed
for 5 years. The problem was fixed by:

commit 0397c6aa48769505e6aa4481f0786c8f4eaaf890
Author: Jeremy Jackson <jerj@coplanar.net>
Date:   Tue May 8 11:10:34 2007 -0700

    I've noticed for a while that
    
    output is showing 0 for port_no and  port_id
    
    It seems that somewhere in 2.6 sysfs land the following items got
    printed in hexadecimal, and brctl code was parsing for decimal only
    
    doug:/sys/class/net/eth0/brport# cat port_id
    0x8001
    doug:/sys/class/net/eth0/brport# cat port_no
    0x1

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

* Re: [PATCH] bridge: make brctl showstp display port id
  2012-05-01 17:39     ` Stephen Hemminger
@ 2012-05-01 17:47       ` Joakim Tjernlund
  2012-05-01 17:57         ` Stephen Hemminger
  0 siblings, 1 reply; 7+ messages in thread
From: Joakim Tjernlund @ 2012-05-01 17:47 UTC (permalink / raw)
  To: Stephen Hemminger; +Cc: netdev@vger.kernel.org

Stephen Hemminger <shemminger@vyatta.com> wrote on 2012/05/01 19:39:55:
>
> > Stephen Hemminger <shemminger@vyatta.com> wrote on 2012/04/30 18:07:47:
> > >
> > > On Mon, 30 Apr 2012 10:39:08 +0200
> > > Joakim Tjernlund <Joakim.Tjernlund@transmode.se> wrote:
> > >
> > > > My brctl showstp br0 always shows a 0 port id:
> > > > eth2 (1)
> > > >  port id      0         state             disabled
> > > >  designated root   8000.00069c00b2fb   path cost       100
> > > >
> > > > because port id is printed as a hex number in sys fs. Change the
> > > > two hex occurrences(port no and port id) to decimal, just like all
> > > > the other numbers in this area.
> > > >
> > > > Signed-off-by: Joakim Tjernlund <Joakim.Tjernlund@transmode.se>
> > > > ---
> > > >  net/bridge/br_sysfs_if.c |    4 ++--
> > > >  1 files changed, 2 insertions(+), 2 deletions(-)
> > > >
> > > > diff --git a/net/bridge/br_sysfs_if.c b/net/bridge/br_sysfs_if.c
> > > > index fd5799c..9c4c2eb 100644
> > > > --- a/net/bridge/br_sysfs_if.c
> > > > +++ b/net/bridge/br_sysfs_if.c
> > > > @@ -86,13 +86,13 @@ static BRPORT_ATTR(designated_cost, S_IRUGO, show_designated_cost, NULL);
> > > >
> > > >  static ssize_t show_port_id(struct net_bridge_port *p, char *buf)
> > > >  {
> > > > -   return sprintf(buf, "0x%x\n", p->port_id);
> > > > +   return sprintf(buf, "%d\n", p->port_id);
> > > >  }
> > > >  static BRPORT_ATTR(port_id, S_IRUGO, show_port_id, NULL);
> > > >
> > > >  static ssize_t show_port_no(struct net_bridge_port *p, char *buf)
> > > >  {
> > > > -   return sprintf(buf, "0x%x\n", p->port_no);
> > > > +   return sprintf(buf, "%d\n", p->port_no);
> > > >  }
> > > >
> > > >  static BRPORT_ATTR(port_no, S_IRUGO, show_port_no, NULL);
> > >
> > > No. This would be a visible change to applications.
> > > The bridge utilities should be fixed instead.
> >
> > Well, my reasoning was that if not the native tools got this right, what are the
> > chances that other apps got it right? I don't know any other apps than
> > brctl using this info, do you? We could check one or two apps to see what they do.
> >
> >  Jocke
> >
>
> Current bridge-utils does not have the issue. It has been fixed
> for 5 years. The problem was fixed by:
>
> commit 0397c6aa48769505e6aa4481f0786c8f4eaaf890
> Author: Jeremy Jackson <jerj@coplanar.net>
> Date:   Tue May 8 11:10:34 2007 -0700
>
>     I've noticed for a while that
>
>     output is showing 0 for port_no and  port_id
>
>     It seems that somewhere in 2.6 sysfs land the following items got
>     printed in hexadecimal, and brctl code was parsing for decimal only
>
>     doug:/sys/class/net/eth0/brport# cat port_id
>     0x8001
>     doug:/sys/class/net/eth0/brport# cat port_no
>     0x1


Yeah, just noticed that too. On our embedded board we have the release just before that fix :(

 Jocke

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

* Re: [PATCH] bridge: make brctl showstp display port id
  2012-05-01 17:47       ` Joakim Tjernlund
@ 2012-05-01 17:57         ` Stephen Hemminger
  0 siblings, 0 replies; 7+ messages in thread
From: Stephen Hemminger @ 2012-05-01 17:57 UTC (permalink / raw)
  To: Joakim Tjernlund; +Cc: netdev@vger.kernel.org

On Tue, 1 May 2012 19:47:33 +0200
Joakim Tjernlund <joakim.tjernlund@transmode.se> wrote:

> Stephen Hemminger <shemminger@vyatta.com> wrote on 2012/05/01 19:39:55:
> >
> > > Stephen Hemminger <shemminger@vyatta.com> wrote on 2012/04/30 18:07:47:
> > > >
> > > > On Mon, 30 Apr 2012 10:39:08 +0200
> > > > Joakim Tjernlund <Joakim.Tjernlund@transmode.se> wrote:
> > > >
> > > > > My brctl showstp br0 always shows a 0 port id:
> > > > > eth2 (1)
> > > > >  port id      0         state             disabled
> > > > >  designated root   8000.00069c00b2fb   path cost       100
> > > > >
> > > > > because port id is printed as a hex number in sys fs. Change the
> > > > > two hex occurrences(port no and port id) to decimal, just like all
> > > > > the other numbers in this area.
> > > > >
> > > > > Signed-off-by: Joakim Tjernlund <Joakim.Tjernlund@transmode.se>
> > > > > ---
> > > > >  net/bridge/br_sysfs_if.c |    4 ++--
> > > > >  1 files changed, 2 insertions(+), 2 deletions(-)
> > > > >
> > > > > diff --git a/net/bridge/br_sysfs_if.c b/net/bridge/br_sysfs_if.c
> > > > > index fd5799c..9c4c2eb 100644
> > > > > --- a/net/bridge/br_sysfs_if.c
> > > > > +++ b/net/bridge/br_sysfs_if.c
> > > > > @@ -86,13 +86,13 @@ static BRPORT_ATTR(designated_cost, S_IRUGO, show_designated_cost, NULL);
> > > > >
> > > > >  static ssize_t show_port_id(struct net_bridge_port *p, char *buf)
> > > > >  {
> > > > > -   return sprintf(buf, "0x%x\n", p->port_id);
> > > > > +   return sprintf(buf, "%d\n", p->port_id);
> > > > >  }
> > > > >  static BRPORT_ATTR(port_id, S_IRUGO, show_port_id, NULL);
> > > > >
> > > > >  static ssize_t show_port_no(struct net_bridge_port *p, char *buf)
> > > > >  {
> > > > > -   return sprintf(buf, "0x%x\n", p->port_no);
> > > > > +   return sprintf(buf, "%d\n", p->port_no);
> > > > >  }
> > > > >
> > > > >  static BRPORT_ATTR(port_no, S_IRUGO, show_port_no, NULL);
> > > >
> > > > No. This would be a visible change to applications.
> > > > The bridge utilities should be fixed instead.
> > >
> > > Well, my reasoning was that if not the native tools got this right, what are the
> > > chances that other apps got it right? I don't know any other apps than
> > > brctl using this info, do you? We could check one or two apps to see what they do.
> > >
> > >  Jocke
> > >
> >
> > Current bridge-utils does not have the issue. It has been fixed
> > for 5 years. The problem was fixed by:
> >
> > commit 0397c6aa48769505e6aa4481f0786c8f4eaaf890
> > Author: Jeremy Jackson <jerj@coplanar.net>
> > Date:   Tue May 8 11:10:34 2007 -0700
> >
> >     I've noticed for a while that
> >
> >     output is showing 0 for port_no and  port_id
> >
> >     It seems that somewhere in 2.6 sysfs land the following items got
> >     printed in hexadecimal, and brctl code was parsing for decimal only
> >
> >     doug:/sys/class/net/eth0/brport# cat port_id
> >     0x8001
> >     doug:/sys/class/net/eth0/brport# cat port_no
> >     0x1
> 
> 
> Yeah, just noticed that too. On our embedded board we have the release just before that fix :(

I couldnt help remembering...
Spock: I am endeavoring, ma'am, to construct a mnemonic memory circuit using stone knives and bearskins.

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

end of thread, other threads:[~2012-05-01 17:57 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-04-30  8:39 [PATCH] bridge: make brctl showstp display port id Joakim Tjernlund
2012-04-30 16:07 ` Stephen Hemminger
2012-05-01 14:38   ` Joakim Tjernlund
2012-05-01 16:53     ` Stephen Hemminger
2012-05-01 17:39     ` Stephen Hemminger
2012-05-01 17:47       ` Joakim Tjernlund
2012-05-01 17:57         ` Stephen Hemminger

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox