On 21/11/2024 17:02, Sabrina Dubroca wrote:
[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/ ?

cr0p. very good catch!
Thanks



+               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/ ?

ThanksĀ²
This is what happens when you copy/paste code around.



+               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);
+       }
+}


Regards,

--
Antonio Quartulli
OpenVPN Inc.


Reply via email to