On Sun, Apr 01, 2018 at 10:42:09AM +0200, Otto Moerbeek wrote:
> On Sun, Apr 01, 2018 at 10:39:39AM +0200, Florian Obser wrote:
> 
> > On a backbone router with many interfaces route show scrolls for quite
> > some time and it is difficult to see at a glance what is going on.
> > 
> > Colour coding is an obvious improvement.
> > 
> > The following diff sets the background colour to green for up routes
> > and black for down routes.
> > 
> > The default route has yellow text colour (because 10BASE5 yellow
> > cable), reject routes red and blackhole routes black text colour.
> > 
> > Host routes are underlined, multicast routes blink and multipath
> > routes blink fast.
> > 
> > I believe the colours are intuitively obvious so no need to document
> > the meaning.
> > 
> > OK?
> 
> Nope, this won't work on my teletype.
> 

Oh, good point. What capabilities does it have?

I guess colours are right out. But underline should work, no? How
about blink?

For reject routes, can we get it to generate a rattling sound or a high
pitched screaching noise?

>       -Otto
> 
> > 
> > diff --git show.c show.c
> > index 913baf6cdb6..0e5d1e780e2 100644
> > --- show.c
> > +++ show.c
> > @@ -278,6 +278,20 @@ p_rtentry(struct rt_msghdr *rtm)
> >     if ((sa = rti_info[RTAX_DST]) == NULL)
> >             return;
> >  
> > +   if (rtm->rtm_flags & RTF_UP)
> > +           printf("\e[42m");
> > +   if (!(rtm->rtm_flags & RTF_UP))
> > +           printf("\e[40m");
> > +   if (rtm->rtm_flags & RTF_REJECT)
> > +           printf("\e[31m");
> > +   if (rtm->rtm_flags & RTF_BLACKHOLE)
> > +           printf("\e[30m");
> > +   if (rtm->rtm_flags & RTF_MULTICAST)
> > +           printf("\e[5m");
> > +   if (rtm->rtm_flags & RTF_MPATH)
> > +           printf("\e[6m");
> > +   if (rtm->rtm_flags & RTF_HOST)
> > +           printf("\e[4m");
> >     p_sockaddr(sa, mask, rtm->rtm_flags, WID_DST(sa->sa_family));
> >     p_sockaddr_mpls(sa, rti_info[RTAX_SRC], rtm->rtm_mpls,
> >         WID_DST(sa->sa_family));
> > @@ -297,6 +311,7 @@ p_rtentry(struct rt_msghdr *rtm)
> >         if_indextoname(rtm->rtm_index, ifbuf));
> >     if (verbose && rti_info[RTAX_LABEL])
> >             printf(" %s", routename(rti_info[RTAX_LABEL]));
> > +   printf("\e[0m");
> >     putchar('\n');
> >  }
> >  
> > @@ -369,6 +384,10 @@ p_sockaddr(struct sockaddr *sa, struct sockaddr *mask, 
> > int flags, int width)
> >                     cp = netname(sa, mask);
> >             break;
> >     }
> > +
> > +   if (strcmp(cp, "default") == 0)
> > +           printf("\e[33m");
> > +
> >     if (width < 0)
> >             printf("%s", cp);
> >     else {
> > 
> > -- 
> > I'm not entirely sure you are real.
> 

-- 
I'm not entirely sure you are real.

Reply via email to