Am 12.10.22 um 22:54 schrieb Antonio Quartulli:
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.

Yes. Will update the patch with a correct if.

Arne



_______________________________________________
Openvpn-devel mailing list
Openvpn-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openvpn-devel

Reply via email to