On Mon, May 14, 2012 at 10:02:53AM +0100, Stuart Henderson wrote:
> I can't test ldpd at the moment, but the same diff applies to ospfd
> and works there, any OK's for me to commit it to both?

OK claudio@
 
> On 2012/05/11 00:00, Rafael Zalamena wrote:
> > This patch fixes the invalid uptime for interface which are not active
> > (no link). When ldpd is running on an interface with no link it shows a
> > invalid value.
> > 
> > Steps to reproduce:
> > 1 - Configure ldpd on an interface without link
> > 2 - Start ldpd
> > 3 - Run 'ldpctl show interfaces'
> > 
> > Bugged result:
> > Interface   Address            State      Linkstate  Uptime  
> > re0         192.168.1.40/24    ACTIVE     no carrier 2210w1d0
> > 
> > Expected result:
> > Interface   Address            State      Linkstate  Uptime  
> > re0         192.168.1.40/24    ACTIVE     no carrier 00:00:00
> > 
> > 
> > Index: interface.c
> > ===================================================================
> > RCS file: /cvs/src/usr.sbin/ldpd/interface.c,v
> > retrieving revision 1.8
> > diff -u -p -r1.8 interface.c
> > --- interface.c     4 Jul 2011 04:34:14 -0000       1.8
> > +++ interface.c     11 May 2012 02:52:26 -0000
> > @@ -298,7 +298,8 @@ if_to_ctl(struct iface *iface)
> >     } else
> >             ictl.hello_timer = -1;
> >  
> > -   if (iface->state != IF_STA_DOWN) {
> > +   if (iface->state != IF_STA_DOWN &&
> > +       iface->uptime != 0) {
> >             ictl.uptime = now.tv_sec - iface->uptime;
> >     } else
> >             ictl.uptime = 0;
> 

-- 
:wq Claudio

Reply via email to