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

From: Sabrina Dubroca
Date: Thu Nov 21 2024 - 11:02:38 EST


[I'm still thinking about the locking problems for ovpn_peer_float,
but just noticed this while staring at the rehash code]

2024-10-29, 11:47:31 +0100, Antonio Quartulli wrote:
> +void ovpn_peer_hash_vpn_ip(struct ovpn_peer *peer)
> + __must_hold(&peer->ovpn->peers->lock)
> +{
> + struct hlist_nulls_head *nhead;
> +
> + if (peer->vpn_addrs.ipv4.s_addr != htonl(INADDR_ANY)) {
> + /* remove potential old hashing */
> + hlist_nulls_del_init_rcu(&peer->hash_entry_transp_addr);

s/hash_entry_transp_addr/hash_entry_addr4/ ?


> + nhead = ovpn_get_hash_head(peer->ovpn->peers->by_vpn_addr,
> + &peer->vpn_addrs.ipv4,
> + sizeof(peer->vpn_addrs.ipv4));
> + hlist_nulls_add_head_rcu(&peer->hash_entry_addr4, nhead);
> + }
> +
> + if (!ipv6_addr_any(&peer->vpn_addrs.ipv6)) {
> + /* remove potential old hashing */
> + hlist_nulls_del_init_rcu(&peer->hash_entry_transp_addr);

s/hash_entry_transp_addr/hash_entry_addr6/ ?


> + nhead = ovpn_get_hash_head(peer->ovpn->peers->by_vpn_addr,
> + &peer->vpn_addrs.ipv6,
> + sizeof(peer->vpn_addrs.ipv6));
> + hlist_nulls_add_head_rcu(&peer->hash_entry_addr6, nhead);
> + }
> +}

--
Sabrina