Index | Thread | Search

From:
Theo Buehler <tb@theobuehler.org>
Subject:
Re: bgpd: improve log_ext_subtype()
To:
tech@openbsd.org
Date:
Mon, 30 Sep 2024 12:16:24 +0200

Download raw body.

Thread
On Mon, Sep 30, 2024 at 11:40:25AM +0200, Claudio Jeker wrote:
> log_ext_subtype() is not printing the full information at the moment.
> Also modern gcc warns about a possible snprintf() overflow (which as usual
> is humbug but gcc is just not smart enough).
> 
> Anyway lets make this better.  log_ext_subtype() can be called with
> type == -1 (but I think this actually never happens). In that case only
> the subtype needs to match (which again should always happen for the -1
> case). So if type is -1 and the for loop did not match just return "???"
> since we have no clue what subtype this is.
> 
> log_ext_subtype() can also be called with a completely unknown
> ext-community (which we get from the wire). In that case type is actually
> a uint8_t and we want to return both type and subtype value.
> So do that even though this again should not happen (since the only place
> that is possible is in bgpctl and there we just print the 64bit value).
> 
> So in the end, nothing of this is really needed but I think it is good to
> make log_ext_subtype() cope with all inputs.

Sure.

ok tb