2025-04-15 13:17:19 +02:00
|
|
|
/* SPDX-License-Identifier: GPL-2.0-only */
|
|
|
|
/* OpenVPN data channel offload
|
|
|
|
*
|
|
|
|
* Copyright (C) 2019-2025 OpenVPN, Inc.
|
|
|
|
*
|
|
|
|
* Author: James Yonan <james@openvpn.net>
|
|
|
|
* Antonio Quartulli <antonio@openvpn.net>
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef _NET_OVPN_OVPNSTRUCT_H_
|
|
|
|
#define _NET_OVPN_OVPNSTRUCT_H_
|
|
|
|
|
2025-04-15 13:17:28 +02:00
|
|
|
#include <linux/workqueue.h>
|
2025-04-15 13:17:25 +02:00
|
|
|
#include <net/gro_cells.h>
|
2025-04-15 13:17:20 +02:00
|
|
|
#include <uapi/linux/if_link.h>
|
|
|
|
#include <uapi/linux/ovpn.h>
|
|
|
|
|
2025-04-15 13:17:31 +02:00
|
|
|
/**
|
|
|
|
* struct ovpn_peer_collection - container of peers for MultiPeer mode
|
|
|
|
* @by_id: table of peers index by ID
|
|
|
|
* @by_vpn_addr4: table of peers indexed by VPN IPv4 address (items can be
|
|
|
|
* rehashed on the fly due to peer IP change)
|
|
|
|
* @by_vpn_addr6: table of peers indexed by VPN IPv6 address (items can be
|
|
|
|
* rehashed on the fly due to peer IP change)
|
|
|
|
* @by_transp_addr: table of peers indexed by transport address (items can be
|
|
|
|
* rehashed on the fly due to peer IP change)
|
|
|
|
*/
|
|
|
|
struct ovpn_peer_collection {
|
|
|
|
DECLARE_HASHTABLE(by_id, 12);
|
|
|
|
struct hlist_nulls_head by_vpn_addr4[1 << 12];
|
|
|
|
struct hlist_nulls_head by_vpn_addr6[1 << 12];
|
|
|
|
struct hlist_nulls_head by_transp_addr[1 << 12];
|
|
|
|
};
|
|
|
|
|
2025-04-15 13:17:19 +02:00
|
|
|
/**
|
|
|
|
* struct ovpn_priv - per ovpn interface state
|
|
|
|
* @dev: the actual netdev representing the tunnel
|
2025-04-15 13:17:20 +02:00
|
|
|
* @mode: device operation mode (i.e. p2p, mp, ..)
|
2025-04-15 13:17:22 +02:00
|
|
|
* @lock: protect this object
|
2025-04-15 13:17:31 +02:00
|
|
|
* @peers: data structures holding multi-peer references
|
2025-04-15 13:17:22 +02:00
|
|
|
* @peer: in P2P mode, this is the only remote peer
|
2025-04-15 13:17:25 +02:00
|
|
|
* @gro_cells: pointer to the Generic Receive Offload cell
|
2025-04-15 13:17:33 +02:00
|
|
|
* @keepalive_work: struct used to schedule keepalive periodic job
|
2025-04-15 13:17:19 +02:00
|
|
|
*/
|
|
|
|
struct ovpn_priv {
|
|
|
|
struct net_device *dev;
|
2025-04-15 13:17:20 +02:00
|
|
|
enum ovpn_mode mode;
|
2025-04-15 13:17:22 +02:00
|
|
|
spinlock_t lock; /* protect writing to the ovpn_priv object */
|
2025-04-15 13:17:31 +02:00
|
|
|
struct ovpn_peer_collection *peers;
|
2025-04-15 13:17:22 +02:00
|
|
|
struct ovpn_peer __rcu *peer;
|
2025-04-15 13:17:25 +02:00
|
|
|
struct gro_cells gro_cells;
|
2025-04-15 13:17:33 +02:00
|
|
|
struct delayed_work keepalive_work;
|
2025-04-15 13:17:19 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif /* _NET_OVPN_OVPNSTRUCT_H_ */
|