Index | Thread | Search

From:
Vitaliy Makkoveev <mvs@openbsd.org>
Subject:
Re: wg(4) logging enhancement - revised patch
To:
ng2d68@proton.me, tech@openbsd.org
Date:
Thu, 23 Jan 2025 11:19:10 +0300

Download raw body.

Thread
On Thu, Jan 23, 2025 at 07:32:04AM +0000, Stuart Henderson wrote:
> On 2025/01/22 23:46, Kirill A. Korinsky wrote:
> > On Wed, 22 Jan 2025 22:36:23 +0100,
> > Lloyd <ng2d68@proton.me> wrote:
> > > 
> > > @@ -1238,8 +1260,12 @@ wg_send_initiation(void *_peer)
> > >  	if (wg_timers_check_handshake_last_sent(&peer->p_timers) != ETIMEDOUT)
> > >  		return;
> > >  
> > > -	DPRINTF(peer->p_sc, "Sending handshake initiation to peer %llu\n",
> > > -	    peer->p_id);
> > > +	char ipaddr[INET6_ADDRSTRLEN];
> > > +	
> > > +	WGPRINTF(LOG_INFO, peer->p_sc, &peer->p_endpoint_mtx, "Sending "
> > > +	    "handshake initiation to peer %llu (%s)\n", peer->p_id,
> > > +	    sockaddr_ntop(&peer->p_endpoint.e_remote.r_sa, ipaddr,
> > > +	        sizeof(ipaddr)));
> > 
> > I think you should move a declaration of ipaddr to the begining of the
> > functio, to match the style. Like you did it before.
> 
> Not just to match style - it will be rejected by some compilers.
> 

Please move this `ipaddr' declaration to the beginning of block. C99
allows that, but it violates style. The rest `ipaddr' declarations
pointed by kirill@ are fine because.