Message-ID: Date: Wed, 12 Oct 2022 22:54:32 +0200 MIME-Version: 1.0 Content-Language: en-US References: <20221012133457.1927871-1-arne@...1227...> <20221012133457.1927871-2-arne@...1227...> From: Antonio Quartulli In-Reply-To: Subject: Re: [Openvpn-devel] [PATCH 2/3] Use dedicated multi->dco_peer_id for DCO instead of multi->peer_id List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit To: Gert Doering , Arne Schwabe Cc: openvpn-devel@lists.sourceforge.net Hi, On 12/10/2022 22:43, Gert Doering wrote: > Hi, > > On Wed, Oct 12, 2022 at 03:34:55PM +0200, Arne Schwabe wrote: >> The lifetime and state machine of multi->peer_id does not exactly the >> lifetime/state of DCO. This is especially for p2p NCP where a reconnection >> can change the peer id. Also use this new field with value -1 to mean >> not installed, replacing the dco_peer_added field. > > The code seems to disagree with itself whether it's -1 or 0, if I > read this correctly... > >> @@ -461,10 +461,10 @@ dco_remove_peer(struct context *c) >> return; >> } >> >> - if (c->c1.tuntap && c->c2.tls_multi && c->c2.tls_multi->dco_peer_added) >> + if (c->c1.tuntap && c->c2.tls_multi && c->c2.tls_multi->dco_peer_id) >> { > > This checks for "not 0"... > >> - dco_del_peer(&c->c1.tuntap->dco, c->c2.tls_multi->peer_id); >> - c->c2.tls_multi->dco_peer_added = false; >> + dco_del_peer(&c->c1.tuntap->dco, c->c2.tls_multi->dco_peer_id); >> + c->c2.tls_multi->dco_peer_id = -1; > > ... but sets -1 here, which would evaluate to "true"...? > > (All the rest sets "-1", AFAICS, just the if() here is weird) Using -1 makes sense, because 0 is a valid peer ID. I presume just that if () is wrong. Cheers, > > gert > > > > _______________________________________________ > Openvpn-devel mailing list > Openvpn-devel@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/openvpn-devel -- Antonio Quartulli