Index | Thread | Search

From:
Theo Buehler <tb@theobuehler.org>
Subject:
Re: bgpd: use unsigned long long for counters
To:
tech@openbsd.org
Date:
Tue, 21 Jul 2026 09:14:16 +0200

Download raw body.

Thread
On Tue, Jul 21, 2026 at 08:52:51AM +0200, Claudio Jeker wrote:
> I forgot to convert the rde_peer_stat from uint64_t to unsigned long long.
> uint64_t is a nightmare to printf since one needs to use %lu or %llu
> (or the garbage from inttypes.h). Using unsigned long long always works
> and the result is the same.

Sure.

It feels a bit weird to switch uint64_t to unsigned long long and mix it
with uint32_t, for which a similar problem exists (although it likely
won't trigger warnings on any of the platforms we support). Also, this
is already the case in peer_stats, so shrug.

> 
> -- 
> :wq Claudio
> 
> Index: bgpd.h
> ===================================================================
> RCS file: /cvs/src/usr.sbin/bgpd/bgpd.h,v
> diff -u -p -r1.544 bgpd.h
> --- bgpd.h	24 Jun 2026 06:01:13 -0000	1.544
> +++ bgpd.h	21 Jul 2026 06:48:14 -0000
> @@ -607,15 +607,15 @@ struct peer_stats {
>  };
>  
>  struct rde_peer_stats {
> -	uint64_t			 prefix_rcvd_update;
> -	uint64_t			 prefix_rcvd_withdraw;
> -	uint64_t			 prefix_rcvd_eor;
> -	uint64_t			 prefix_sent_update;
> -	uint64_t			 prefix_sent_withdraw;
> -	uint64_t			 prefix_sent_eor;
> -	uint64_t			 rib_entry_count;
> -	uint64_t			 ibufq_msg_count;
> -	uint64_t			 ibufq_payload_size;
> +	unsigned long long		 prefix_rcvd_update;
> +	unsigned long long		 prefix_rcvd_withdraw;
> +	unsigned long long		 prefix_rcvd_eor;
> +	unsigned long long		 prefix_sent_update;
> +	unsigned long long		 prefix_sent_withdraw;
> +	unsigned long long		 prefix_sent_eor;
> +	unsigned long long		 rib_entry_count;
> +	unsigned long long		 ibufq_msg_count;
> +	unsigned long long		 ibufq_payload_size;
>  	uint32_t			 prefix_cnt;
>  	uint32_t			 prefix_out_cnt;
>  	uint32_t			 pending_update;
>