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

Jussi Laakkonen <[email protected]> Fri, 8 Aug 2025 15:28:04 +0300
Newsgroups dev.linux.lists.connman
Message-ID <[email protected]>
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.

> 
>> ---
>>   vpn/plugins/vpn.c  | 22 ++++++++++++++++++++++
>>   vpn/plugins/vpn.h  |  1 +
>>   vpn/vpn-provider.h |  1 +
>>   3 files changed, 24 insertions(+)
>>
> 
> <snip>
> 
>> diff --git a/vpn/plugins/vpn.h b/vpn/plugins/vpn.h
>> index a8d24fc3..b24cbf9b 100644
>> --- a/vpn/plugins/vpn.h
>> +++ b/vpn/plugins/vpn.h
>> @@ -57,6 +57,7 @@ struct vpn_driver {
>>       int (*route_env_parse) (struct vpn_provider *provider, const 
>> char *key,
>>               int *family, unsigned long *idx,
>>               enum vpn_provider_route_type *type);
>> +    bool (*uses_vpn_agent) (struct vpn_provider *provider);
> 
> 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.

Sure, it can be extended to be a setup flag based system but it is then 
different of what the VPNs generally use, possibly requiring more changes.

> 
>>   };
>>   int vpn_register(const char *name, const struct vpn_driver *driver,
> 
> Regards,
> -Denis

BR,
  Jussi