Re: [PATCH net-next v23 18/23] ovpn: implement peer add/get/dump/delete via netlink

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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.


...
> 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.

-- 
Sabrina




[Index of Archives]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]

  Powered by Linux