ovpn: implement peer lookup logic
authorAntonio Quartulli <antonio@openvpn.net>
Tue, 15 Apr 2025 11:17:32 +0000 (13:17 +0200)
committerPaolo Abeni <pabeni@redhat.com>
Thu, 17 Apr 2025 10:30:03 +0000 (12:30 +0200)
commita3aaef8cd1730381392dcc4868b437da7d9ad5ac
tree8f8d257d70726c8115cc1546757d3b07211c3900
parent05003b408c201a33637a30b93dcca209be3b7878
ovpn: implement peer lookup logic

In a multi-peer scenario there are a number of situations when a
specific peer needs to be looked up.

We may want to lookup a peer by:
1. its ID
2. its VPN destination IP
3. its transport IP/port couple

For each of the above, there is a specific routing table referencing all
peers for fast look up.

Case 2. is a bit special in the sense that an outgoing packet may not be
sent to the peer VPN IP directly, but rather to a network behind it. For
this reason we first perform a nexthop lookup in the system routing
table and then we use the retrieved nexthop as peer search key.

Signed-off-by: Antonio Quartulli <antonio@openvpn.net>
Link: https://patch.msgid.link/20250415-b4-ovpn-v26-15-577f6097b964@openvpn.net
Reviewed-by: Sabrina Dubroca <sd@queasysnail.net>
Tested-by: Oleksandr Natalenko <oleksandr@natalenko.name>
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
drivers/net/ovpn/peer.c