Re: [PATCH 09/45] vpn: Add VPN agent use callback for plugins

Denis Kenzior <[email protected]> Fri, 8 Aug 2025 10:57:30 -0500
Newsgroups dev.linux.lists.connman
Message-ID <[email protected]>
Hi Jussi,

On 8/8/25 7:28 AM, Jussi Laakkonen wrote:
> Hi Denis,
> 
> On 8/1/25 22:39, Denis Kenzior wrote:
>> Hi Jussi,
>>
>> On 7/11/25 9:27 AM, Jussi Laakkonen wrote:
>>> Add callback that can be used by the VPN plugins to tell the vpn_driver
>>> whether it uses VPN agent or not. Default to using VPN agent if the
>>> function is not defined.
>>>
>>> This is done to accommodate the state transition in vpn-provider when
>>> the VPN does not utilize VPN agent.
>>
>> What about the case where previous credentials are cached?
> 
> This does not have anything to do with caching of credentials? It just makes it 
> possible to tell if the plugin uses or does not use agent. If there are issues 
> with caching it should be addressed elsewhere and in separate patch I think. 
> Sorry for not really understanding what you mean now.

So maybe I didn't fully follow the logic, so apologies if that's the case.  By 
my reading we have two possibilities:

1. driver has to ask for credentials.  So when .connect is invoked, core 
automatically puts the state into 'Association' and lets the driver report back 
when the credentials are obtained.
2. driver will never ask for credentials.  Core automatically puts the state 
into 'Association' and then 'Connecting' or whatever.

Are there situations where the driver might cache the credentials and not ask 
for them again on subsequent connects?  The core could then treat this as case 2 
above.

<snip>

>>
>> The only user of this would seem to be wireguard which blankly returns false. 
>> Can this be made into a boolean of a set of flags instead?
> 
> I simply followed the approach that is used by the VPNs in general. Seemed 
> simplest and most readable way to do it.

Hmm, but we already have:

#define VPN_FLAG_NO_TUN     1
#define VPN_FLAG_NO_DAEMON  2

Wouldn't this fit the existing pattern?

Regards,
-Denis