[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ZpUf_1gdsZvoLYbn@hog>
Date: Mon, 15 Jul 2024 15:11:27 +0200
From: Sabrina Dubroca <sd@...asysnail.net>
To: Antonio Quartulli <antonio@...nvpn.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 16/25] ovpn: implement peer lookup logic
2024-06-27, 15:08:34 +0200, Antonio Quartulli wrote:
> /**
> * ovpn_peer_check_by_src - check that skb source is routed via peer
> * @ovpn: the openvpn instance to search
> * @skb: the packet to extra source address from
nit, just noticed now but should be fixed in patch 12: s/to extra/to extract/
[...]
> @@ -324,11 +576,11 @@ static int ovpn_peer_add_mp(struct ovpn_struct *ovpn, struct ovpn_peer *peer)
> struct sockaddr_storage sa = { 0 };
> struct sockaddr_in6 *sa6;
> struct sockaddr_in *sa4;
> + struct hlist_head *head;
> struct ovpn_bind *bind;
> struct ovpn_peer *tmp;
> size_t salen;
> int ret = 0;
> - u32 index;
>
> spin_lock_bh(&ovpn->peers->lock);
> /* do not add duplicates */
> @@ -364,30 +616,27 @@ static int ovpn_peer_add_mp(struct ovpn_struct *ovpn, struct ovpn_peer *peer)
> goto unlock;
> }
>
> - index = ovpn_peer_index(ovpn->peers->by_transp_addr, &sa,
> - salen);
> - hlist_add_head_rcu(&peer->hash_entry_transp_addr,
> - &ovpn->peers->by_transp_addr[index]);
> + head = ovpn_get_hash_head(ovpn->peers->by_transp_addr, &sa,
> + salen);
> + hlist_add_head_rcu(&peer->hash_entry_transp_addr, head);
> }
These changes to ovpn_peer_add_mp (and the replacement of
ovpn_peer_index with ovpn_get_hash_head) could be squashed into the
previous patch.
--
Sabrina
Powered by blists - more mailing lists