Re: bgpd, log updates and invalid path

2018-08-29 Thread Denis Fondras
On Wed, Aug 29, 2018 at 11:49:16AM +0200, Claudio Jeker wrote:
> Currently if a path is rejected because of parse errors there is only
> a generic error message logged but it is not clear which prefix caused it.
> Lets make this at least more obvious when 'log updates' is used.
> 
> OK?

OK denis@


> -- 
> :wq Claudio
> 
> Index: rde.c
> ===
> RCS file: /cvs/src/usr.sbin/bgpd/rde.c,v
> retrieving revision 1.414
> diff -u -p -r1.414 rde.c
> --- rde.c 9 Aug 2018 12:54:06 -   1.414
> +++ rde.c 29 Aug 2018 09:19:05 -
> @@ -1310,6 +1310,7 @@ rde_update_update(struct rde_peer *peer,
>   struct prefix   *p;
>   enum filter_actions  action;
>   u_int16_ti;
> + const char  *wmsg = "filtered, withdraw";
>  
>   peer->prefix_rcvd_update++;
>   /* add original path to the Adj-RIB-In */
> @@ -1324,6 +1325,9 @@ rde_update_update(struct rde_peer *peer,
>   return (-1);
>   }
>  
> + if (in->aspath.flags & F_ATTR_PARSE_ERR)
> + wmsg = "path invalid, withdraw";
> +
>   p = prefix_get([RIB_ADJ_IN].rib, peer, prefix, prefixlen, 0);
>   if (p == NULL)
>   fatalx("rde_update_update: no prefix in Adj-RIB-In");
> @@ -1344,7 +1348,7 @@ rde_update_update(struct rde_peer *peer,
>   prefixlen, 0);
>   } else if (prefix_remove([i].rib, peer, prefix, prefixlen,
>   0)) {
> - rde_update_log("filtered withdraw", i, peer,
> + rde_update_log(wmsg, i, peer,
>   NULL, prefix, prefixlen);
>   }
>  
> 



bgpd, log updates and invalid path

2018-08-29 Thread Claudio Jeker
Currently if a path is rejected because of parse errors there is only
a generic error message logged but it is not clear which prefix caused it.
Lets make this at least more obvious when 'log updates' is used.

OK?
-- 
:wq Claudio

Index: rde.c
===
RCS file: /cvs/src/usr.sbin/bgpd/rde.c,v
retrieving revision 1.414
diff -u -p -r1.414 rde.c
--- rde.c   9 Aug 2018 12:54:06 -   1.414
+++ rde.c   29 Aug 2018 09:19:05 -
@@ -1310,6 +1310,7 @@ rde_update_update(struct rde_peer *peer,
struct prefix   *p;
enum filter_actions  action;
u_int16_ti;
+   const char  *wmsg = "filtered, withdraw";
 
peer->prefix_rcvd_update++;
/* add original path to the Adj-RIB-In */
@@ -1324,6 +1325,9 @@ rde_update_update(struct rde_peer *peer,
return (-1);
}
 
+   if (in->aspath.flags & F_ATTR_PARSE_ERR)
+   wmsg = "path invalid, withdraw";
+
p = prefix_get([RIB_ADJ_IN].rib, peer, prefix, prefixlen, 0);
if (p == NULL)
fatalx("rde_update_update: no prefix in Adj-RIB-In");
@@ -1344,7 +1348,7 @@ rde_update_update(struct rde_peer *peer,
prefixlen, 0);
} else if (prefix_remove([i].rib, peer, prefix, prefixlen,
0)) {
-   rde_update_log("filtered withdraw", i, peer,
+   rde_update_log(wmsg, i, peer,
NULL, prefix, prefixlen);
}