[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <d72b7ace0712200821k7cde0834rf1187b30c68cd1ce@mail.gmail.com>
Date: Fri, 21 Dec 2007 01:21:02 +0900
From: "Satoru SATOH" <satoru.satoh@...il.com>
To: "Jarek Poplawski" <jarkao2@...il.com>
Cc: netdev@...r.kernel.org
Subject: Re: [PATCH] [IPROUTE]: A workaround to make larger rto_min printed correctly
i see. HZ can be < 1000.. i should be wrong.
however, i got the following,
[root iproute2.org]# ./ip/ip route change 192.168.140.0/24 dev eth1 rto_min 4s
[root iproute2.org]# gdb -q ./ip/ip
Using host libthread_db library "/lib/libthread_db.so.1".
(gdb) br iproute.c:512
Breakpoint 1 at 0x804fc8d: file iproute.c, line 512.
(gdb) r route show dev eth1
Starting program: /root/iproute2.org/ip/ip route show dev eth1
Breakpoint 1, print_route (who=0xbfb9854c, n=0xbfb94528, arg=0x6404c0)
at iproute.c:512
512 unsigned val =
*(unsigned*)RTA_DATA(mxrta[i]);
(gdb) l 512,522
512 unsigned val =
*(unsigned*)RTA_DATA(mxrta[i]);
513
514 val *= 1000;
515 if (i == RTAX_RTT)
516 val /= 8;
517 else if (i == RTAX_RTTVAR)
518 val /= 4;
519 if (val >= hz)
520 fprintf(fp, " %ums", val/hz);
521 else
522 fprintf(fp, " %.2fms",
(float)val/hz);
(gdb) p hz
$1 = 1000000000
(gdb) n
514 val *= 1000;
(gdb) p val
$2 = 4000000000
(gdb) p val/ (hz / 1000)
$3 = 4000
(gdb) n
515 if (i == RTAX_RTT)
(gdb) p val
$4 = 1385447424
(gdb) c
Continuing.
192.168.140.0/24 scope link rto_min lock 1ms
Program exited normally.
(gdb)
Thanks,
Satoru SATOH
2007/12/20, Jarek Poplawski <jarkao2@...il.com>:
> On 20-12-2007 04:31, Satoru SATOH wrote:
> > "ip route show" does not print correct value when larger rto_min is
> > set (e.g. 3sec).
> >
> > This problem is because of overflow in print_route() and
> > the patch below is a workaround fix for that.
> >
> ...
> > --- a/ip/iproute.c
> > +++ b/ip/iproute.c
> > @@ -510,16 +510,16 @@ int print_route(const struct sockaddr_nl *who,
> > struct nlmsghdr *n, void *arg)
> > fprintf(fp, " %u",
> > *(unsigned*)RTA_DATA(mxrta[i]));
> > else {
> > unsigned val = *(unsigned*)RTA_DATA(mxrta[i]);
> > + unsigned hz1 = hz / 1000;
> ...
> > + if (val >= hz1)
> > + fprintf(fp, " %ums", val/hz1);
> ...
>
> Probably I miss something or my iproute sources are too old, but:
> does this work with hz < 1000?
>
> Regards,
> Jarek P.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists