Re: bgpd/bgpctl report number of pending updates/withdraws

2022-08-29 Thread Claudio Jeker
On Mon, Aug 29, 2022 at 04:47:51PM +0200, Theo Buehler wrote:
> On Mon, Aug 29, 2022 at 04:41:56PM +0200, Claudio Jeker wrote:
> > The RDE has a queue of pending updates and withdraws. Those are already
> > counted but not shown. On big setups it may be helpful to know about the
> > queue progress.
> 
> I'm not sure "withdraws" is correct English. Shouldn't that be
> "withdrawals"?

Correct English would be "withdrawals". But all of the tree should be
fixed if want to.
 
> Apart from that, ok
> 
> > 
> > -- 
> > :wq Claudio
> > 
> > Index: bgpctl/output.c
> > ===
> > RCS file: /cvs/src/usr.sbin/bgpctl/output.c,v
> > retrieving revision 1.26
> > diff -u -p -r1.26 output.c
> > --- bgpctl/output.c 10 Aug 2022 10:21:47 -  1.26
> > +++ bgpctl/output.c 29 Aug 2022 14:38:09 -
> > @@ -221,13 +221,16 @@ show_neighbor_msgstats(struct peer *p)
> > p->stats.msg_rcvd_update + p->stats.msg_rcvd_keepalive +
> > p->stats.msg_rcvd_rrefresh);
> > printf("  Update statistics:\n");
> > -   printf("  %-15s %-10s %-10s\n", "", "Sent", "Received");
> > +   printf("  %-15s %-10s %-10s %-10s\n", "", "Sent", "Received",
> > +   "Pending");
> > printf("  %-15s %10u %10u\n", "Prefixes",
> > p->stats.prefix_out_cnt, p->stats.prefix_cnt);
> > -   printf("  %-15s %10llu %10llu\n", "Updates",
> > -   p->stats.prefix_sent_update, p->stats.prefix_rcvd_update);
> > -   printf("  %-15s %10llu %10llu\n", "Withdraws",
> > -   p->stats.prefix_sent_withdraw, p->stats.prefix_rcvd_withdraw);
> > +   printf("  %-15s %10llu %10llu %10u\n", "Updates",
> > +   p->stats.prefix_sent_update, p->stats.prefix_rcvd_update,
> > +   p->stats.pending_update);
> > +   printf("  %-15s %10llu %10llu %10u\n", "Withdraws",
> > +   p->stats.prefix_sent_withdraw, p->stats.prefix_rcvd_withdraw,
> > +   p->stats.pending_withdraw);
> > printf("  %-15s %10llu %10llu\n", "End-of-Rib",
> > p->stats.prefix_sent_eor, p->stats.prefix_rcvd_eor);
> > printf("  Route Refresh statistics:\n");
> > Index: bgpctl/output_json.c
> > ===
> > RCS file: /cvs/src/usr.sbin/bgpctl/output_json.c,v
> > retrieving revision 1.20
> > diff -u -p -r1.20 output_json.c
> > --- bgpctl/output_json.c28 Jul 2022 10:40:25 -  1.20
> > +++ bgpctl/output_json.c29 Aug 2022 14:38:09 -
> > @@ -190,6 +190,11 @@ json_neighbor_stats(struct peer *p)
> > json_do_uint("eor", p->stats.prefix_rcvd_eor);
> > json_do_end();
> >  
> > +   json_do_object("pending");
> > +   json_do_uint("updates", p->stats.pending_update);
> > +   json_do_uint("withdraws", p->stats.pending_withdraw);
> > +   json_do_end();
> > +
> > json_do_end();
> >  
> > json_do_object("route-refresh");
> > Index: bgpd/rde.c
> > ===
> > RCS file: /cvs/src/usr.sbin/bgpd/rde.c,v
> > retrieving revision 1.565
> > diff -u -p -r1.565 rde.c
> > --- bgpd/rde.c  26 Aug 2022 14:10:52 -  1.565
> > +++ bgpd/rde.c  29 Aug 2022 14:39:17 -
> > @@ -623,6 +623,8 @@ badnetdel:
> > peer->prefix_sent_withdraw;
> > p.stats.prefix_sent_eor =
> > peer->prefix_sent_eor;
> > +   p.stats.pending_update = peer->up_nlricnt;
> > +   p.stats.pending_withdraw = peer->up_wcnt;
> > }
> > imsg_compose(ibuf_se_ctl, IMSG_CTL_SHOW_NEIGHBOR, 0,
> > imsg.hdr.pid, -1, , sizeof(struct peer));
> > Index: bgpd/session.h
> > ===
> > RCS file: /cvs/src/usr.sbin/bgpd/session.h,v
> > retrieving revision 1.157
> > diff -u -p -r1.157 session.h
> > --- bgpd/session.h  28 Jul 2022 13:11:51 -  1.157
> > +++ bgpd/session.h  29 Aug 2022 14:38:43 -
> > @@ -179,6 +179,8 @@ struct peer_stats {
> > time_t   last_write;
> > uint32_t prefix_cnt;
> > uint32_t prefix_out_cnt;
> > +   uint32_t pending_update;
> > +   uint32_t pending_withdraw;
> > uint8_t  last_sent_errcode;
> > uint8_t  last_sent_suberr;
> > uint8_t  last_rcvd_errcode;
> > 
> 

-- 
:wq Claudio



Re: bgpd/bgpctl report number of pending updates/withdraws

2022-08-29 Thread Theo Buehler
On Mon, Aug 29, 2022 at 04:41:56PM +0200, Claudio Jeker wrote:
> The RDE has a queue of pending updates and withdraws. Those are already
> counted but not shown. On big setups it may be helpful to know about the
> queue progress.

I'm not sure "withdraws" is correct English. Shouldn't that be
"withdrawals"?

Apart from that, ok

> 
> -- 
> :wq Claudio
> 
> Index: bgpctl/output.c
> ===
> RCS file: /cvs/src/usr.sbin/bgpctl/output.c,v
> retrieving revision 1.26
> diff -u -p -r1.26 output.c
> --- bgpctl/output.c   10 Aug 2022 10:21:47 -  1.26
> +++ bgpctl/output.c   29 Aug 2022 14:38:09 -
> @@ -221,13 +221,16 @@ show_neighbor_msgstats(struct peer *p)
>   p->stats.msg_rcvd_update + p->stats.msg_rcvd_keepalive +
>   p->stats.msg_rcvd_rrefresh);
>   printf("  Update statistics:\n");
> - printf("  %-15s %-10s %-10s\n", "", "Sent", "Received");
> + printf("  %-15s %-10s %-10s %-10s\n", "", "Sent", "Received",
> + "Pending");
>   printf("  %-15s %10u %10u\n", "Prefixes",
>   p->stats.prefix_out_cnt, p->stats.prefix_cnt);
> - printf("  %-15s %10llu %10llu\n", "Updates",
> - p->stats.prefix_sent_update, p->stats.prefix_rcvd_update);
> - printf("  %-15s %10llu %10llu\n", "Withdraws",
> - p->stats.prefix_sent_withdraw, p->stats.prefix_rcvd_withdraw);
> + printf("  %-15s %10llu %10llu %10u\n", "Updates",
> + p->stats.prefix_sent_update, p->stats.prefix_rcvd_update,
> + p->stats.pending_update);
> + printf("  %-15s %10llu %10llu %10u\n", "Withdraws",
> + p->stats.prefix_sent_withdraw, p->stats.prefix_rcvd_withdraw,
> + p->stats.pending_withdraw);
>   printf("  %-15s %10llu %10llu\n", "End-of-Rib",
>   p->stats.prefix_sent_eor, p->stats.prefix_rcvd_eor);
>   printf("  Route Refresh statistics:\n");
> Index: bgpctl/output_json.c
> ===
> RCS file: /cvs/src/usr.sbin/bgpctl/output_json.c,v
> retrieving revision 1.20
> diff -u -p -r1.20 output_json.c
> --- bgpctl/output_json.c  28 Jul 2022 10:40:25 -  1.20
> +++ bgpctl/output_json.c  29 Aug 2022 14:38:09 -
> @@ -190,6 +190,11 @@ json_neighbor_stats(struct peer *p)
>   json_do_uint("eor", p->stats.prefix_rcvd_eor);
>   json_do_end();
>  
> + json_do_object("pending");
> + json_do_uint("updates", p->stats.pending_update);
> + json_do_uint("withdraws", p->stats.pending_withdraw);
> + json_do_end();
> +
>   json_do_end();
>  
>   json_do_object("route-refresh");
> Index: bgpd/rde.c
> ===
> RCS file: /cvs/src/usr.sbin/bgpd/rde.c,v
> retrieving revision 1.565
> diff -u -p -r1.565 rde.c
> --- bgpd/rde.c26 Aug 2022 14:10:52 -  1.565
> +++ bgpd/rde.c29 Aug 2022 14:39:17 -
> @@ -623,6 +623,8 @@ badnetdel:
>   peer->prefix_sent_withdraw;
>   p.stats.prefix_sent_eor =
>   peer->prefix_sent_eor;
> + p.stats.pending_update = peer->up_nlricnt;
> + p.stats.pending_withdraw = peer->up_wcnt;
>   }
>   imsg_compose(ibuf_se_ctl, IMSG_CTL_SHOW_NEIGHBOR, 0,
>   imsg.hdr.pid, -1, , sizeof(struct peer));
> Index: bgpd/session.h
> ===
> RCS file: /cvs/src/usr.sbin/bgpd/session.h,v
> retrieving revision 1.157
> diff -u -p -r1.157 session.h
> --- bgpd/session.h28 Jul 2022 13:11:51 -  1.157
> +++ bgpd/session.h29 Aug 2022 14:38:43 -
> @@ -179,6 +179,8 @@ struct peer_stats {
>   time_t   last_write;
>   uint32_t prefix_cnt;
>   uint32_t prefix_out_cnt;
> + uint32_t pending_update;
> + uint32_t pending_withdraw;
>   uint8_t  last_sent_errcode;
>   uint8_t  last_sent_suberr;
>   uint8_t  last_rcvd_errcode;
> 



bgpd/bgpctl report number of pending updates/withdraws

2022-08-29 Thread Claudio Jeker
The RDE has a queue of pending updates and withdraws. Those are already
counted but not shown. On big setups it may be helpful to know about the
queue progress.

-- 
:wq Claudio

Index: bgpctl/output.c
===
RCS file: /cvs/src/usr.sbin/bgpctl/output.c,v
retrieving revision 1.26
diff -u -p -r1.26 output.c
--- bgpctl/output.c 10 Aug 2022 10:21:47 -  1.26
+++ bgpctl/output.c 29 Aug 2022 14:38:09 -
@@ -221,13 +221,16 @@ show_neighbor_msgstats(struct peer *p)
p->stats.msg_rcvd_update + p->stats.msg_rcvd_keepalive +
p->stats.msg_rcvd_rrefresh);
printf("  Update statistics:\n");
-   printf("  %-15s %-10s %-10s\n", "", "Sent", "Received");
+   printf("  %-15s %-10s %-10s %-10s\n", "", "Sent", "Received",
+   "Pending");
printf("  %-15s %10u %10u\n", "Prefixes",
p->stats.prefix_out_cnt, p->stats.prefix_cnt);
-   printf("  %-15s %10llu %10llu\n", "Updates",
-   p->stats.prefix_sent_update, p->stats.prefix_rcvd_update);
-   printf("  %-15s %10llu %10llu\n", "Withdraws",
-   p->stats.prefix_sent_withdraw, p->stats.prefix_rcvd_withdraw);
+   printf("  %-15s %10llu %10llu %10u\n", "Updates",
+   p->stats.prefix_sent_update, p->stats.prefix_rcvd_update,
+   p->stats.pending_update);
+   printf("  %-15s %10llu %10llu %10u\n", "Withdraws",
+   p->stats.prefix_sent_withdraw, p->stats.prefix_rcvd_withdraw,
+   p->stats.pending_withdraw);
printf("  %-15s %10llu %10llu\n", "End-of-Rib",
p->stats.prefix_sent_eor, p->stats.prefix_rcvd_eor);
printf("  Route Refresh statistics:\n");
Index: bgpctl/output_json.c
===
RCS file: /cvs/src/usr.sbin/bgpctl/output_json.c,v
retrieving revision 1.20
diff -u -p -r1.20 output_json.c
--- bgpctl/output_json.c28 Jul 2022 10:40:25 -  1.20
+++ bgpctl/output_json.c29 Aug 2022 14:38:09 -
@@ -190,6 +190,11 @@ json_neighbor_stats(struct peer *p)
json_do_uint("eor", p->stats.prefix_rcvd_eor);
json_do_end();
 
+   json_do_object("pending");
+   json_do_uint("updates", p->stats.pending_update);
+   json_do_uint("withdraws", p->stats.pending_withdraw);
+   json_do_end();
+
json_do_end();
 
json_do_object("route-refresh");
Index: bgpd/rde.c
===
RCS file: /cvs/src/usr.sbin/bgpd/rde.c,v
retrieving revision 1.565
diff -u -p -r1.565 rde.c
--- bgpd/rde.c  26 Aug 2022 14:10:52 -  1.565
+++ bgpd/rde.c  29 Aug 2022 14:39:17 -
@@ -623,6 +623,8 @@ badnetdel:
peer->prefix_sent_withdraw;
p.stats.prefix_sent_eor =
peer->prefix_sent_eor;
+   p.stats.pending_update = peer->up_nlricnt;
+   p.stats.pending_withdraw = peer->up_wcnt;
}
imsg_compose(ibuf_se_ctl, IMSG_CTL_SHOW_NEIGHBOR, 0,
imsg.hdr.pid, -1, , sizeof(struct peer));
Index: bgpd/session.h
===
RCS file: /cvs/src/usr.sbin/bgpd/session.h,v
retrieving revision 1.157
diff -u -p -r1.157 session.h
--- bgpd/session.h  28 Jul 2022 13:11:51 -  1.157
+++ bgpd/session.h  29 Aug 2022 14:38:43 -
@@ -179,6 +179,8 @@ struct peer_stats {
time_t   last_write;
uint32_t prefix_cnt;
uint32_t prefix_out_cnt;
+   uint32_t pending_update;
+   uint32_t pending_withdraw;
uint8_t  last_sent_errcode;
uint8_t  last_sent_suberr;
uint8_t  last_rcvd_errcode;