From: Simon Rozman Date: Mon, 25 Nov 2019 09:44:19 +0000 Message-ID: <99D61A626FDA8A4B90A270669121BE10C9B08A55@...2294...> References: <1573148729-27339-1-git-send-email-lstipakov@...277...> <1573148729-27339-4-git-send-email-lstipakov@...277...> <99D61A626FDA8A4B90A270669121BE10C9AF9896@...2294...> In-Reply-To: Content-Language: en-US Content-Type: multipart/signed; protocol="application/x-pkcs7-signature"; micalg=2.16.840.1.101.3.4.2.1; boundary="----=_NextPart_000_0025_01D5A37D.49D31F30" MIME-Version: 1.0 Subject: Re: [Openvpn-devel] [PATCH v2 3/7] wintun: implement opening wintun device List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Lev Stipakov , Selva Nair Cc: openvpn-devel ------=_NextPart_000_0025_01D5A37D.49D31F30 Content-Type: multipart/alternative; boundary="----=_NextPart_001_0026_01D5A37D.49D31F30" ------=_NextPart_001_0026_01D5A37D.49D31F30 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable I know. The tap.c code needs an upgrade, not to evaluate all drivers, but j= ust compatible drivers when creating a new adapter. This speeds things a lo= t. There's a flag that needs to be changed. Somewhere deep on my TODO lists. =20 I would suggest against temporary adapters on Windows. This is OK on Linux,= but Windows is not Linux. Apart from the time penalty you already discover= ed, there are more annoying issues with temporary adapters: adapters always= get a new GUID on creation, making NLA think it's a new network each time.= This will keep resetting the firewall profile assigned to the adapter and = piling up network IDs in user registry at each connection attempt. Also, ch= anging bindings on adapters don't persist (vmWare, VirtualBox, Hyper-V bind= ings comes to my mind)=E2=80=A6 =20 I am testing an intermediate approach to adapter management on Windows, ins= pired by Microsoft's own way how Windows handle dial-up adapters: 1. if adapter "My VPN Connection" doesn't exist, create it. 2. else enable it 3. use it 4. disable it =20 In my observation, this is the most streamlined approach on Windows. It avo= ids adapter creation burden, while still (re)creates it on demand. Disablin= g adapter when it is not in use releases the resources, removes the adapter= from the network stack, halts the adapter, unloads the driver when the las= t of the adapters (of the same driver) is disabled=E2=80=A6 Like adapter wa= s deleted, only its settings persist in registry. =20 An annoyance here is, the adapters pile up over time. On multi-user compute= rs, OpenVPN GUI don't have a complete overview which one are stale (no corr= esponding .ovpn file exist anymore) to clean them. Cleaning requires elevat= ion=E2=80=A6 An admin user may use Device manager to clean them, uninstalle= r should clean them. Both are not ideal. On test computers with lots of con= figuration fuss that might be a problem. On production computers this shoul= dn't be a big issue. Mind that even Hyper-V doesn't clean up adapters if yo= u install and uninstall it on Windows. =20 Maybe we could save the absolute path to .ovpn file in the adapter registry= to assign it to a particular profile. Interactive service could periodical= ly delete orphaned adapters. I'm not worried about .ovpn-less tunnels: user= s running openvpn.exe specifying all settings in the command line know what= they're doing. =20 Best regards, Simon =20 From: Lev Stipakov =20 Sent: Monday, November 25, 2019 10:04 AM To: Selva Nair Cc: openvpn-devel Subject: Re: [Openvpn-devel] [PATCH v2 3/7] wintun: implement opening wintu= n device =20 Hi, =20 (cc:ed to -devel) =20 I would vote for B and not the combination. =20 With wintun there is no backwards compatibility requirements, so we could u= se a cleaner, consistent and simpler approach (i.e B). Do not create any ad= apter during installation and dynamically create a temporary adapter at con= nection time. =20 My main concern with creating tun adapter on demand is that it is far from = instant: =20 $ time ./tapctl.exe create --hwid wintun {D9F56B7A-3054-4ADC-9457-61030F0B469D} real 0m2,090s =20 I don't think we want to add it to connection time. =20 Creating one persistent adapter per profile (as viscosity does for tapwindo= ws and wireguard seems to do for wintun) =20 If I remember right, wireguard doesn't create persistent adapter, instead i= t adds/removes it on demand. =20 If --dev-node is specified, we open the named adapter which the user is sup= posed to have created as we do for tapwindows. =20 Yes, I plan to add support for --dev-node for wintun.=20 =20 --=20 -Lev ------=_NextPart_001_0026_01D5A37D.49D31F30 Content-Type: text/html; charset="utf-8" Content-Transfer-Encoding: quoted-printable

I know. The tap.c code needs = an upgrade, not to evaluate all drivers, but just compatible drivers when c= reating a new adapter. This speeds things a lot. There's a flag that needs = to be changed. Somewhere deep on my TODO lists.

 

I would suggest against temporary adapters on Win= dows. This is OK on Linux, but Windows is not Linux. Apart from the time pe= nalty you already discovered, there are more annoying issues with temporary= adapters: adapters always get a new GUID on creation, making NLA think it'= s a new network each time. This will keep resetting the firewall profile as= signed to the adapter and piling up network IDs in user registry at each co= nnection attempt. Also, changing bindings on adapters don't persist (vmWare= , VirtualBox, Hyper-V bindings comes to my mind)=E2=80=A6=

 

I am testing an intermediate approach t= o adapter management on Windows, inspired by Microsoft's own way how Window= s handle dial-up adapters:

  1. if adapter "My VPN Connection" doesn't exist, create it.
  2. else enable it
  3. use it
  4. disable it
  5. <= /ol>

     

    In my observation, this is the most str= eamlined approach on Windows. It avoids adapter creation burden, while stil= l (re)creates it on demand. Disabling adapter when it is not in use release= s the resources, removes the adapter from the network stack, halts the adap= ter, unloads the driver when the last of the adapters (of the same driver) = is disabled=E2=80=A6 Like adapter was deleted, only its settings persist in= registry.

     

    An annoyanc= e here is, the adapters pile up over time. On multi-user computers, OpenVPN= GUI don't have a complete overview which one are stale (no corresponding .= ovpn file exist anymore) to clean them. Cleaning requires elevation=E2=80= =A6 An admin user may use Device manager to clean them, uninstaller should = clean them. Both are not ideal. On test computers with lots of configuratio= n fuss that might be a problem. On production computers this shouldn't be a= big issue. Mind that even Hyper-V doesn't clean up adapters if you install= and uninstall it on Windows.

     

    Maybe we could save the absolute path to .ovpn file in the adapter = registry to assign it to a particular profile. Interactive service could pe= riodically delete orphaned adapters. I'm not worried about .ovpn-less tunne= ls: users running openvpn.exe specifying all settings in the command line k= now what they're doing.

     

    Best regards,

    Simon

    &nbs= p;

    From: Lev Stipakov <lstipakov@...493...= 277...>
    Sent: Monday, November 25, 2019 10:04 AM
    To: Selva Nair <selva.nair@...277...>
    Cc: openvpn-devel <o= penvpn-devel@lists.sourceforge.net>
    Subject: Re: [Openvpn-deve= l] [PATCH v2 3/7] wintun: implement opening wintun device
    =

     

    Hi,

    &= nbsp;

    (cc:ed to -devel)=

     

    I would vote for B and not the combination.

     

    With w= intun there is no backwards compatibility requirements, so we could use a c= leaner, consistent and simpler approach (i.e B). Do not create any adapter = during installation and dynamically create a temporary adapter at connectio= n time.

     

    My main concern wi= th creating tun adapter on demand is that it is far from instant:

     

    $ time ./tapctl.exe create --hwid wintun
    {D9F56B7A-3054-4= ADC-9457-61030F0B469D}

    real    0m2,090s

     

    I don't think we want to add it to connection time.

     

    Crea= ting one persistent adapter per profile (as viscosity does for tapwindows a= nd wireguard seems to do for wintun)

     

    If I remember right, wireguard doesn't create persistent adapt= er, instead it adds/removes it on demand.

     

    If --dev-node is speci= fied, we open the named adapter which the user is supposed to have created = as we do for tapwindows.

    =

     

    Y= es, I plan to add support for --dev-node for wintun. 

     

    --

    -Lev

    = ------=_NextPart_001_0026_01D5A37D.49D31F30-- ------=_NextPart_000_0025_01D5A37D.49D31F30 Content-Type: application/pkcs7-signature; name="smime.p7s" Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="smime.p7s" MIAGCSqGSIb3DQEHAqCAMIACAQExDzANBglghkgBZQMEAgEFADCABgkqhkiG9w0BBwEAAKCCD9Qw ggSKMIIC8qADAgECAg0AkK53dgAAAABXHdBvMA0GCSqGSIb3DQEBCwUAMFwxCzAJBgNVBAYTAlNJ MRwwGgYDVQQKExNSZXB1Ymxpa2EgU2xvdmVuaWphMRcwFQYDVQRhEw5WQVRTSS0xNzY1OTk1NzEW MBQGA1UEAxMNU0ktVFJVU1QgUm9vdDAeFw0xNjA0MjUwNzM4MTdaFw0zNzEyMjUwODA4MTdaMFwx CzAJBgNVBAYTAlNJMRwwGgYDVQQKExNSZXB1Ymxpa2EgU2xvdmVuaWphMRcwFQYDVQRhEw5WQVRT SS0xNzY1OTk1NzEWMBQGA1UEAxMNU0ktVFJVU1QgUm9vdDCCAaIwDQYJKoZIhvcNAQEBBQADggGP ADCCAYoCggGBANPLnC3C4DBDZTEk/0uwONmpU9c10du3S5O0co3xy5XSUyt0mzKapC8+Agbdr3AV oarPEYeKZnvLzB1wRFyPrMrmw1sntI2jjhC/blR0CHCKI+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