bug#1210: [BusyBox] bug#1210: route does not show all routes

Vladimir N. Oleynik dzo at simtreas.ru
Mon Aug 27 11:00:03 UTC 2001


Jaspreet Singh wrote:
> 
> The patch I sent earlier on was applied incorrectly.
> 
> My modifications were:
> 
> if(flgs&1)
>       flags[ifl++]='U';
> else {
>       nl++;
>       continue;
> }
> 
> This allows for only printing routes that are Up.
> 
> not..
> 
>  if(nl==1) {
>        printf("Kernel IP routing table\n"
> "Destination     Gateway         Genmask         Flags Metric Ref    Use
> Iface\n
> ");
>  } else {
>        nl++;
>        continue;
> }
> 
> 
> "Vladimir N. Oleynik" wrote:
> >
> > Arne
> >
> > >
> > > Package: busybox
> > > Version: 0.60.1
> > > Severity: normal
> > >
> > > bb route has a little bug in it preventing it from showing the correct set
> > > of routes on a system. It only displays the first route!
> > >
> > > myrouter# route
> > > Kernel IP routing table
> > > Destination     Gateway         Genmask        Flags Metric Ref   Use Iface
> > > 192.168.2.0     *               255.255.255.0  U     0      0     0   eth1
> > >
> > > with GNU netstat:
> > > myrouter# netstat -rn
> > > Destination     Gateway         Genmask        Flags   MSS Window  irtt Iface
> > > 192.168.2.0     0.0.0.0         255.255.255.0  U       40  0          0 eth1
> > > 192.168.1.0     0.0.0.0         255.255.255.0  U       40  0          0 eth0
> > > 12.12.1.0       0.0.0.0         255.255.255.0  U       40  0          0 eth0
> > > 12.12.0.0       0.0.0.0         255.255.255.0  U       40  0          0 eth1
> > >
> > > (sorry for the formating, it not the real output, it was "done by hand").
> > >
> > > The very small attached patch fixes this
> >
> >
> > I too do not understand, 1.10 change what for was brought in function
> > displayroute()
> > (its author).
> >
> > All changes in displayroute() must remove.
> >
> > -} else {
> > -  nl++;
> > - continue;
> >  }
> 

I think it is necessary to show all the table from/proc and to add not getting
types (R D! and M).  

#define RTF_UP          0x0001          /* route usable                 */
#define RTF_GATEWAY     0x0002          /* destination is a gateway     */
#define RTF_HOST        0x0004          /* host entry (net otherwise)   */
#define RTF_REINSTATE   0x0008          /* reinstate route after tmout  */
#define RTF_DYNAMIC     0x0010          /* created dyn. (by redirect)   */
#define RTF_MODIFIED    0x0020          /* modified dyn. (by redirect)  */
#define RTF_MTU         0x0040          /* specific MTU for this route  */
#ifndef RTF_MSS
#define RTF_MSS         RTF_MTU         /* Compatibility :-(            */
#endif
#define RTF_WINDOW      0x0080          /* per route window clamping    */
#define RTF_IRTT        0x0100          /* Initial round trip time      */
#define RTF_REJECT      0x0200          /* Reject route                 */
   

I tomorrow shall add this all. Thanks for stimul ;)


--w
vodz






More information about the busybox mailing list