[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <729e6413-98fb-439b-ad33-830bb10d1016@openvpn.net>
Date: Mon, 17 Mar 2025 14:13:23 +0100
From: Antonio Quartulli <antonio@...nvpn.net>
To: Sabrina Dubroca <sd@...asysnail.net>
Cc: netdev@...r.kernel.org, Eric Dumazet <edumazet@...gle.com>,
Jakub Kicinski <kuba@...nel.org>, Paolo Abeni <pabeni@...hat.com>,
Donald Hunter <donald.hunter@...il.com>, Shuah Khan <shuah@...nel.org>,
ryazanov.s.a@...il.com, Andrew Lunn <andrew+netdev@...n.ch>,
Simon Horman <horms@...nel.org>, linux-kernel@...r.kernel.org,
linux-kselftest@...r.kernel.org, Xiao Liang <shaw.leon@...il.com>
Subject: Re: [PATCH net-next v23 18/23] ovpn: implement peer
add/get/dump/delete via netlink
On 17/03/2025 13:47, Sabrina Dubroca wrote:
> Hello,
>
> A few comments since it seems you'll have to send one more version
> (otherwise they could be fixed later).
>
> 2025-03-12, 21:54:27 +0100, Antonio Quartulli wrote:
>> diff --git a/drivers/net/ovpn/netlink.c b/drivers/net/ovpn/netlink.c
>> index 8d267d4c82283d9b5f989478102086ce385195d5..407b5b908be431625a3c258e7887211ef0f4b197 100644
>> --- a/drivers/net/ovpn/netlink.c
>> +++ b/drivers/net/ovpn/netlink.c
> [...]
>> +static int ovpn_nl_peer_modify(struct ovpn_peer *peer, struct genl_info *info,
>> + struct nlattr **attrs)
>> +{
>> + struct sockaddr_storage ss = {};
>> + void *local_ip = NULL;
>> + u32 interv, timeout;
>> + bool rehash = false;
>> + int ret;
>> +
>> + spin_lock_bh(&peer->lock);
>> +
>> + if (ovpn_nl_attr_sockaddr_remote(attrs, &ss)) {
>> + /* we carry the local IP in a generic container.
>> + * ovpn_peer_reset_sockaddr() will properly interpret it
>> + * based on ss.ss_family
>> + */
>> + local_ip = ovpn_nl_attr_local_ip(attrs);
>> +
>> + /* set peer sockaddr */
>> + ret = ovpn_peer_reset_sockaddr(peer, &ss, local_ip);
>> + if (ret < 0) {
>> + NL_SET_ERR_MSG_FMT_MOD(info->extack,
>> + "cannot set peer sockaddr: %d",
>> + ret);
>> + goto err_unlock;
>> + }
>
> Similar to the floating case, this should reset the peer dst_cache? In
> both cases we're updating the remote peer's address and our local
> address.
>
makes sense.
Then I should probably move the call to dst_cache_reset() to
ovpn_peer_reset_sockaddr() and slightly adjust
ovpn_peer_endpoints_update() to avoid a double invocation.
>
> ...
>> diff --git a/drivers/net/ovpn/peer.c b/drivers/net/ovpn/peer.c
>> index 0d8b12fd5de4cd6fe15455b435c7d6807203a825..aead1d75400a604a320c886aed5308fb20475da3 100644
>> --- a/drivers/net/ovpn/peer.c
>> +++ b/drivers/net/ovpn/peer.c
> ...
>> @@ -1335,8 +1356,11 @@ void ovpn_peer_keepalive_work(struct work_struct *work)
>> netdev_dbg(ovpn->dev,
>> "scheduling keepalive work: now=%llu next_run=%llu delta=%llu\n",
>> next_run, now, next_run - now);
>> + /* due to the waiting above, the next_run deadline may have
>> + * passed: in this case we reschedule the worker immediately
>> + */
>> schedule_delayed_work(&ovpn->keepalive_work,
>> - (next_run - now) * HZ);
>> + (now - next_run) * HZ);
>
> This whole hunk should be dropped, no? The comment is outdated, and
> the sign swap is confusing me.
ouch right. fix-during-rebase gone slightly wrong.
Thanks!
>
--
Antonio Quartulli
OpenVPN Inc.
Powered by blists - more mailing lists