Re: ldpctl(8) fix invalid uptime
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 AddressState Linkstate Uptime > > re0 192.168.1.40/24ACTIVE no carrier 2210w1d0 > > > > Expected result: > > Interface AddressState Linkstate Uptime > > re0 192.168.1.40/24ACTIVE 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 - 1.8 > > +++ interface.c 11 May 2012 02:52:26 - > > @@ -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
Re: ldpctl(8) fix invalid uptime
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? 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 AddressState Linkstate Uptime > re0 192.168.1.40/24ACTIVE no carrier 2210w1d0 > > Expected result: > Interface AddressState Linkstate Uptime > re0 192.168.1.40/24ACTIVE 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 - 1.8 > +++ interface.c 11 May 2012 02:52:26 - > @@ -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;
ldpctl(8) fix invalid uptime
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 AddressState Linkstate Uptime re0 192.168.1.40/24ACTIVE no carrier 2210w1d0 Expected result: Interface AddressState Linkstate Uptime re0 192.168.1.40/24ACTIVE 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 - 1.8 +++ interface.c 11 May 2012 02:52:26 - @@ -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;