On Wed, Aug 29, 2018 at 01:07:33PM +0200, Claudio Jeker wrote:
> This is the bgpd diff that allows bgpctl to show invalid / error paths
> which act as an implicit withdraw.
> 
> While there also fix 'bgpctl show rib in nei foo' since until now that
> code actually printed the same as 'bgpctl show rib nei foo'.
> 
> The code is a bit shuffled to make the if statement in rde_dump_filter()
> simpler.
> 

And here are the bgpctl bits for the same. With this you should be able to
see invalid path with 'bgpctl show rib error'.
Now I would have liked to use 'invalid' but the table driven parser does
not allow that because it conflicts with 'in' (gnarf).
Hope this is still OK.

This also removes a lie from the manual page. Softreconfig is on by
default since a while.
-- 
:wq Claudio

Index: bgpctl.8
===================================================================
RCS file: /cvs/src/usr.sbin/bgpctl/bgpctl.8,v
retrieving revision 1.79
diff -u -p -r1.79 bgpctl.8
--- bgpctl.8    15 Oct 2017 20:44:21 -0000      1.79
+++ bgpctl.8    29 Aug 2018 10:47:43 -0000
@@ -363,6 +363,8 @@ are defined:
 .It Cm best
 Alias for
 .Ic selected .
+.It Cm error
+Show only prefixes which are maked invalid and are treated as withdraw.
 .It Cm selected
 Show only selected routes.
 .It Cm ssv
@@ -376,9 +378,6 @@ Show more detailed output for matching r
 Limit the output to the given address family.
 .It Cm in
 Show routes from the unfiltered Adj-RIB-In.
-This is only possible if
-.Em softreconfig in
-is enabled for the neighbor.
 The
 .Cm neighbor
 needs to be specified.
Index: bgpctl.c
===================================================================
RCS file: /cvs/src/usr.sbin/bgpctl/bgpctl.c,v
retrieving revision 1.210
diff -u -p -r1.210 bgpctl.c
--- bgpctl.c    29 Jul 2018 13:02:01 -0000      1.210
+++ bgpctl.c    29 Aug 2018 10:47:55 -0000
@@ -1181,8 +1181,8 @@ show_interface_msg(struct imsg *imsg)
 void
 show_rib_summary_head(void)
 {
-       printf("flags: * = Valid, > = Selected, I = via IBGP, A = Announced, "
-           "S = Stale\n");
+       printf("flags: * = Valid, > = Selected, I = via IBGP, A = Announced,\n"
+           "       S = Stale, E = Error\n");
        printf("origin: i = IGP, e = EGP, ? = Incomplete\n\n");
        printf("%-5s %-20s %-15s  %5s %5s %s\n", "flags", "destination",
            "gateway", "lpref", "med", "aspath origin");
@@ -1222,6 +1222,8 @@ print_flags(u_int8_t flags, int sum)
        char    *p = flagstr;
 
        if (sum) {
+               if (flags & F_PREF_INVALID)
+                       *p++ = 'E';
                if (flags & F_PREF_ANNOUNCE)
                        *p++ = 'A';
                if (flags & F_PREF_INTERNAL)
Index: parser.c
===================================================================
RCS file: /cvs/src/usr.sbin/bgpctl/parser.c,v
retrieving revision 1.82
diff -u -p -r1.82 parser.c
--- parser.c    10 Jul 2018 13:03:06 -0000      1.82
+++ parser.c    29 Aug 2018 10:51:33 -0000
@@ -177,6 +177,7 @@ static const struct token t_show_rib[] =
        { FLAG,         "best",         F_CTL_ACTIVE,   t_show_rib},
        { FLAG,         "selected",     F_CTL_ACTIVE,   t_show_rib},
        { FLAG,         "detail",       F_CTL_DETAIL,   t_show_rib},
+       { FLAG,         "error",        F_CTL_INVALID,  t_show_rib},
        { FLAG,         "ssv"   ,       F_CTL_SSV,      t_show_rib},
        { FLAG,         "in",           F_CTL_ADJ_IN,   t_show_rib},
        { FLAG,         "out",          F_CTL_ADJ_OUT,  t_show_rib},

Reply via email to