Re: [Openvpn-devel] [PATCH] dco_freebsd: use m->instances[] instead of m->hash

2023-03-22 Thread Antonio Quartulli
Hi, On 22/03/2023 08:14, Gert Doering wrote: Hi, On Wed, Mar 22, 2023 at 12:10:03AM +0100, Antonio Quartulli wrote: +struct multi_instance *mi = m->instances[peer_id]; +if (!mi) { This (and undoubtedly the same code in dco_linux.c) is trusting the kernel to never return peer_id

Re: [Openvpn-devel] [PATCH] dco_freebsd: use m->instances[] instead of m->hash

2023-03-22 Thread Gert Doering
Hi, On Wed, Mar 22, 2023 at 12:10:03AM +0100, Antonio Quartulli wrote: > +struct multi_instance *mi = m->instances[peer_id]; > +if (!mi) > { This (and undoubtedly the same code in dco_linux.c) is trusting the kernel to never return peer_id values that are outside the array boundarie

Re: [Openvpn-devel] [PATCH] dco_freebsd: use m->instances[] instead of m->hash

2023-03-21 Thread Arne Schwabe
Am 22.03.23 um 00:10 schrieb Antonio Quartulli: When retrieving the multi_instance of a specific peer, there is no need to peform a linear search across the whole m->hash list. We can directly access the needed object via m->instances[peer-id] in constant time (and just one line of code). Adapt

Re: [Openvpn-devel] [PATCH] dco_freebsd: use m->instances[] instead of m->hash

2023-03-21 Thread Antonio Quartulli
Hi, On 22/03/2023 00:10, Antonio Quartulli wrote: When retrieving the multi_instance of a specific peer, there is no need to peform a linear search across the whole m->hash list. We can directly access the needed object via m->instances[peer-id] in constant time (and just one line of code). Ada

[Openvpn-devel] [PATCH] dco_freebsd: use m->instances[] instead of m->hash

2023-03-21 Thread Antonio Quartulli
When retrieving the multi_instance of a specific peer, there is no need to peform a linear search across the whole m->hash list. We can directly access the needed object via m->instances[peer-id] in constant time (and just one line of code). Adapt the dco-freebsd code to do so. Cc: Kristof Provos