[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <9822899c-b8ac-45e0-8cbf-d105320ee0e4@openvpn.net>
Date: Wed, 3 Jul 2024 23:44:36 +0200
From: Antonio Quartulli <antonio@...nvpn.net>
To: Sabrina Dubroca <sd@...asysnail.net>
Cc: netdev@...r.kernel.org, kuba@...nel.org, ryazanov.s.a@...il.com,
pabeni@...hat.com, edumazet@...gle.com, andrew@...n.ch
Subject: Re: [PATCH net-next v5 06/25] ovpn: implement interface
creation/destruction via netlink
On 03/07/2024 23:27, Sabrina Dubroca wrote:
> 2024-06-27, 15:08:24 +0200, Antonio Quartulli wrote:
>> int ovpn_nl_new_iface_doit(struct sk_buff *skb, struct genl_info *info)
>> {
> [...]
>> + msg = nlmsg_new(NLMSG_DEFAULT_SIZE, GFP_KERNEL);
>> + if (!msg)
>> + return -ENOMEM;
>> +
>> + hdr = genlmsg_iput(msg, info);
>> + if (!hdr) {
>> + nlmsg_free(msg);
>> + return -ENOBUFS;
>> + }
>> +
>> + if (nla_put_string(msg, OVPN_A_IFNAME, dev->name)) {
>> + genlmsg_cancel(msg, hdr);
>> + nlmsg_free(msg);
>> + return -EMSGSIZE;
>> + }
>
> Maybe the ifindex as well? The notifications in later patches use that
> rather than the name, but I don't know how the client handles this reply.
Userspace will just throw the name in if_nametoindex().
However passing both doesn't hurt anybody, and actually spares the
conversion in userspace.
will add ifindex too.
Thanks!
>
>> + genlmsg_end(msg, hdr);
>> +
>> + return genlmsg_reply(msg, info);
>> }
>
--
Antonio Quartulli
OpenVPN Inc.
Powered by blists - more mailing lists