[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <57a773fc-dc1e-4f8b-b60b-13582e6d057c@openvpn.net>
Date: Tue, 26 Mar 2024 22:44:01 +0100
From: Antonio Quartulli <antonio@...nvpn.net>
To: Esben Haabendal <esben@...nix.com>
Cc: netdev@...r.kernel.org, Jakub Kicinski <kuba@...nel.org>,
Sergey Ryazanov <ryazanov.s.a@...il.com>, Paolo Abeni <pabeni@...hat.com>,
Eric Dumazet <edumazet@...gle.com>
Subject: Re: [PATCH net-next v2 05/22] ovpn: implement interface
creation/destruction via netlink
On 25/03/2024 16:01, Esben Haabendal wrote:
> Antonio Quartulli <antonio@...nvpn.net> writes:
>
>> Allow userspace to create and destroy an interface using netlink
>> commands.
>>
>> Signed-off-by: Antonio Quartulli <antonio@...nvpn.net>
>> ---
>> drivers/net/ovpn/netlink.c | 50 ++++++++++++++++++++++++++++++++++++++
>> 1 file changed, 50 insertions(+)
>>
>> diff --git a/drivers/net/ovpn/netlink.c b/drivers/net/ovpn/netlink.c
>> index 2e855ce145e7..02b41034f615 100644
>> --- a/drivers/net/ovpn/netlink.c
>> +++ b/drivers/net/ovpn/netlink.c
>> @@ -154,7 +154,57 @@ static void ovpn_post_doit(const struct genl_split_ops *ops, struct sk_buff *skb
>> dev_put(ovpn->dev);
>> }
>>
>> +static int ovpn_nl_new_iface(struct sk_buff *skb, struct genl_info *info)
>> +{
>> + enum ovpn_mode mode = OVPN_MODE_P2P;
>> + struct net_device *dev;
>> + char *ifname;
>> + int ret;
>> +
>> + if (!info->attrs[OVPN_A_IFNAME])
>> + return -EINVAL;
>> +
>> + ifname = nla_data(info->attrs[OVPN_A_IFNAME]);
>> +
>> + if (info->attrs[OVPN_A_MODE]) {
>> + mode = nla_get_u8(info->attrs[OVPN_A_MODE]);
>> + netdev_dbg(dev, "%s: setting device (%s) mode: %u\n", __func__, ifname,
>> + mode);
>
> Maybe print out the message even if the default mode is used, as the
> mode is applied in ovpn_iface_create anyways.
Being this a debug message, my reasoning was "let's print what we got
via netlink" (if nothing is printed, we know we are applying the default).
Otherwise, when printing "P2P" we wouldn't be able to understand if it
was set by default or received via netlink.
Does it make sense?
Cheers,
>
> /Esben
--
Antonio Quartulli
OpenVPN Inc.
Powered by blists - more mailing lists