Hi Liu,

thanks for your patches.

Out of curiosity, why are you still on ovpn-dco-v2 and haven't transitioned to the new ovpn kernel module yet?

Best,

On 19/11/2026 05:40, Liu Chong via Openvpn-devel wrote:
In ovpn_peer_lookup_vpn_addr6() the word-by-word comparison uses
'continue' on mismatch, but it only skips to the next word of the
inner loop, not to the next peer. The comparison therefore has no
effect and the first holdable peer in the bucket is returned even
if its IPv6 address does not match.

In multi-peer mode a packet can be sent to the wrong peer whenever
two IPv6 peers share a hash bucket (with a single peer per bucket
the bug is masked).

Replace the broken loop with ipv6_addr_equal(), like in the IPv4
lookup path.

Fixes: 94581f0cb760 ("ovpn-dco: restructure code to allow supporting multiple link 
to peers")
Signed-off-by: Liu Chong <[email protected]>
---
  drivers/net/ovpn-dco/peer.c | 7 ++-----
  1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/drivers/net/ovpn-dco/peer.c b/drivers/net/ovpn-dco/peer.c
index cecbbb4..aee9f11 100644
--- a/drivers/net/ovpn-dco/peer.c
+++ b/drivers/net/ovpn-dco/peer.c
@@ -355,14 +355,11 @@ static struct ovpn_peer 
*ovpn_peer_lookup_vpn_addr4(struct hlist_head *head, __b
  static struct ovpn_peer *ovpn_peer_lookup_vpn_addr6(struct hlist_head *head, 
struct in6_addr *addr)
  {
        struct ovpn_peer *tmp, *peer = NULL;
-       int i;
rcu_read_lock();
        hlist_for_each_entry_rcu(tmp, head, hash_entry_addr6) {
-               for (i = 0; i < 4; i++) {
-                       if (addr->s6_addr32[i] != 
tmp->vpn_addrs.ipv6.s6_addr32[i])
-                               continue;
-               }
+               if (!ipv6_addr_equal(addr, &tmp->vpn_addrs.ipv6))
+                       continue;
if (!ovpn_peer_hold(tmp))
                        continue;

--
Antonio Quartulli



_______________________________________________
Openvpn-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openvpn-devel

Reply via email to