Thread (71 messages) 71 messages, 4 authors, 2024-07-19

Re: [PATCH net-next v5 16/25] ovpn: implement peer lookup logic

From: Sabrina Dubroca <sd@queasysnail.net>
Date: 2024-07-15 13:11:37

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/

[...]
quoted hunk ↗ jump to hunk
@@ -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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help