@@ -2046,14 +2046,12 @@
unsigned int tuntap = 0;
struct event_set_return esr[4];
- /* These shifts all depend on EVENT_READ (=1) and EVENT_WRITE (=2)
- * and are added to the shift. Check openvpn.h for more details.
- */
- static int socket_shift = SOCKET_SHIFT;
- static int tun_shift = TUN_SHIFT;
- static int err_shift = ERR_SHIFT;
+ /* These shifts all depend on EVENT_READ and EVENT_WRITE */
+ static uintptr_t socket_shift = 0; /* depends on SOCKET_READ and SOCKET_WRITE */
+ static uintptr_t tun_shift = 2; /* depends on TUN_READ and TUN_WRITE */
+ static uintptr_t err_shift = 4; /* depends on ES_ERROR */
#ifdef ENABLE_MANAGEMENT
- static int management_shift = MANAGEMENT_SHIFT;
+ static uintptr_t management_shift = 6; /* depends on MANAGEMENT_READ and MANAGEMENT_WRITE */
#endif
#ifdef ENABLE_ASYNC_PUSH
static int file_shift = FILE_SHIFT;
@@ -2073,7 +2071,7 @@
*/
if (flags & IOW_WAIT_SIGNAL)
{
- wait_signal(c->c2.event_set, (void *)&err_shift);
+ wait_signal(c->c2.event_set, (void *)err_shift);
}
/*
@@ -2167,7 +2165,7 @@
* Configure event wait based on socket, tuntap flags.
*/
socket_set(c->c2.link_socket, c->c2.event_set, socket, (void *)&socket_shift, NULL);
- tun_set(c->c1.tuntap, c->c2.event_set, tuntap, (void *)&tun_shift, NULL);
+ tun_set(c->c1.tuntap, c->c2.event_set, tuntap, (void *)tun_shift, NULL);
#if defined(TARGET_LINUX) || defined(TARGET_FREEBSD)
if (socket & EVENT_READ && c->c2.did_open_tun)
{
@@ -2178,7 +2176,7 @@
#ifdef ENABLE_MANAGEMENT
if (management)
{
- management_socket_set(management, c->c2.event_set, (void *)&management_shift, NULL);
+ management_socket_set(management, c->c2.event_set, (void *)management_shift, NULL);
}
#endif
@@ -2229,7 +2227,7 @@
for (i = 0; i < status; ++i)
{
const struct event_set_return *e = &esr[i];
- c->c2.event_set_status |= ((e->rwflags & 3) << *((int *)e->arg));
+ c->c2.event_set_status |= ((e->rwflags & 3) << (uintptr_t)e->arg);
}
}
else if (status == 0)
@@ -720,6 +720,7 @@
multi_tcp_action(m, mi, TA_SOCKET_READ, false);
}
break;
+
/* new incoming TCP client attempting to connect? */
case EVENT_ARG_LINK_SOCKET:
ASSERT(m->top.c2.link_socket);
@@ -4,8 +4,8 @@
*
* Copyright (C) 2019-2023 OpenVPN, Inc.
*
- * Author: James Yonan <james@openvpn.net>
- * Antonio Quartulli <antonio@openvpn.net>
+ * Author: James Yonan <james@openvpn.net>
+ * Antonio Quartulli <antonio@openvpn.net>
*/
#ifndef _UAPI_LINUX_OVPN_DCO_H_
@@ -19,238 +19,238 @@
* enum ovpn_nl_commands - supported netlink commands
*/
enum ovpn_nl_commands {
- /**
- * @OVPN_CMD_UNSPEC: unspecified command to catch errors
- */
- OVPN_CMD_UNSPEC = 0,
+ /**
+ * @OVPN_CMD_UNSPEC: unspecified command to catch errors
+ */
+ OVPN_CMD_UNSPEC = 0,
- /**
- * @OVPN_CMD_NEW_PEER: Configure peer with its crypto keys
- */
- OVPN_CMD_NEW_PEER,
+ /**
+ * @OVPN_CMD_NEW_PEER: Configure peer with its crypto keys
+ */
+ OVPN_CMD_NEW_PEER,
- /**
- * @OVPN_CMD_SET_PEER: Tweak parameters for an existing peer
- */
- OVPN_CMD_SET_PEER,
+ /**
+ * @OVPN_CMD_SET_PEER: Tweak parameters for an existing peer
+ */
+ OVPN_CMD_SET_PEER,
- /**
- * @OVPN_CMD_DEL_PEER: Remove peer from internal table
- */
- OVPN_CMD_DEL_PEER,
+ /**
+ * @OVPN_CMD_DEL_PEER: Remove peer from internal table
+ */
+ OVPN_CMD_DEL_PEER,
- OVPN_CMD_NEW_KEY,
+ OVPN_CMD_NEW_KEY,
- OVPN_CMD_SWAP_KEYS,
+ OVPN_CMD_SWAP_KEYS,
- OVPN_CMD_DEL_KEY,
+ OVPN_CMD_DEL_KEY,
- /**
- * @OVPN_CMD_GET_PEER: Retrieve the status of a peer or all peers
- */
- OVPN_CMD_GET_PEER,
+ /**
+ * @OVPN_CMD_GET_PEER: Retrieve the status of a peer or all peers
+ */
+ OVPN_CMD_GET_PEER,
};
enum ovpn_cipher_alg {
- /**
- * @OVPN_CIPHER_ALG_NONE: No encryption - reserved for debugging only
- */
- OVPN_CIPHER_ALG_NONE = 0,
- /**
- * @OVPN_CIPHER_ALG_AES_GCM: AES-GCM AEAD cipher with any allowed key size
- */
- OVPN_CIPHER_ALG_AES_GCM,
- /**
- * @OVPN_CIPHER_ALG_CHACHA20_POLY1305: ChaCha20Poly1305 AEAD cipher
- */
- OVPN_CIPHER_ALG_CHACHA20_POLY1305,
+ /**
+ * @OVPN_CIPHER_ALG_NONE: No encryption - reserved for debugging only
+ */
+ OVPN_CIPHER_ALG_NONE = 0,
+ /**
+ * @OVPN_CIPHER_ALG_AES_GCM: AES-GCM AEAD cipher with any allowed key size
+ */
+ OVPN_CIPHER_ALG_AES_GCM,
+ /**
+ * @OVPN_CIPHER_ALG_CHACHA20_POLY1305: ChaCha20Poly1305 AEAD cipher
+ */
+ OVPN_CIPHER_ALG_CHACHA20_POLY1305,
};
enum ovpn_del_peer_reason {
- __OVPN_DEL_PEER_REASON_FIRST,
- OVPN_DEL_PEER_REASON_TEARDOWN = __OVPN_DEL_PEER_REASON_FIRST,
- OVPN_DEL_PEER_REASON_USERSPACE,
- OVPN_DEL_PEER_REASON_EXPIRED,
- OVPN_DEL_PEER_REASON_TRANSPORT_ERROR,
- OVPN_DEL_PEER_REASON_TRANSPORT_DISCONNECT,
- __OVPN_DEL_PEER_REASON_AFTER_LAST
+ __OVPN_DEL_PEER_REASON_FIRST,
+ OVPN_DEL_PEER_REASON_TEARDOWN = __OVPN_DEL_PEER_REASON_FIRST,
+ OVPN_DEL_PEER_REASON_USERSPACE,
+ OVPN_DEL_PEER_REASON_EXPIRED,
+ OVPN_DEL_PEER_REASON_TRANSPORT_ERROR,
+ OVPN_DEL_PEER_REASON_TRANSPORT_DISCONNECT,
+ __OVPN_DEL_PEER_REASON_AFTER_LAST
};
enum ovpn_key_slot {
- __OVPN_KEY_SLOT_FIRST,
- OVPN_KEY_SLOT_PRIMARY = __OVPN_KEY_SLOT_FIRST,
- OVPN_KEY_SLOT_SECONDARY,
- __OVPN_KEY_SLOT_AFTER_LAST,
+ __OVPN_KEY_SLOT_FIRST,
+ OVPN_KEY_SLOT_PRIMARY = __OVPN_KEY_SLOT_FIRST,
+ OVPN_KEY_SLOT_SECONDARY,
+ __OVPN_KEY_SLOT_AFTER_LAST,
};
enum ovpn_netlink_attrs {
- OVPN_ATTR_UNSPEC = 0,
- OVPN_ATTR_IFINDEX,
- OVPN_ATTR_NEW_PEER,
- OVPN_ATTR_SET_PEER,
- OVPN_ATTR_DEL_PEER,
- OVPN_ATTR_NEW_KEY,
- OVPN_ATTR_SWAP_KEYS,
- OVPN_ATTR_DEL_KEY,
- OVPN_ATTR_GET_PEER,
+ OVPN_ATTR_UNSPEC = 0,
+ OVPN_ATTR_IFINDEX,
+ OVPN_ATTR_NEW_PEER,
+ OVPN_ATTR_SET_PEER,
+ OVPN_ATTR_DEL_PEER,
+ OVPN_ATTR_NEW_KEY,
+ OVPN_ATTR_SWAP_KEYS,
+ OVPN_ATTR_DEL_KEY,
+ OVPN_ATTR_GET_PEER,
- __OVPN_ATTR_AFTER_LAST,
- OVPN_ATTR_MAX = __OVPN_ATTR_AFTER_LAST - 1,
+ __OVPN_ATTR_AFTER_LAST,
+ OVPN_ATTR_MAX = __OVPN_ATTR_AFTER_LAST - 1,
};
enum ovpn_netlink_key_dir_attrs {
- OVPN_KEY_DIR_ATTR_UNSPEC = 0,
- OVPN_KEY_DIR_ATTR_CIPHER_KEY,
- OVPN_KEY_DIR_ATTR_NONCE_TAIL,
+ OVPN_KEY_DIR_ATTR_UNSPEC = 0,
+ OVPN_KEY_DIR_ATTR_CIPHER_KEY,
+ OVPN_KEY_DIR_ATTR_NONCE_TAIL,
- __OVPN_KEY_DIR_ATTR_AFTER_LAST,
- OVPN_KEY_DIR_ATTR_MAX = __OVPN_KEY_DIR_ATTR_AFTER_LAST - 1,
+ __OVPN_KEY_DIR_ATTR_AFTER_LAST,
+ OVPN_KEY_DIR_ATTR_MAX = __OVPN_KEY_DIR_ATTR_AFTER_LAST - 1,
};
enum ovpn_netlink_new_key_attrs {
- OVPN_NEW_KEY_ATTR_UNSPEC = 0,
- OVPN_NEW_KEY_ATTR_PEER_ID,
- OVPN_NEW_KEY_ATTR_KEY_SLOT,
- OVPN_NEW_KEY_ATTR_KEY_ID,
- OVPN_NEW_KEY_ATTR_CIPHER_ALG,
- OVPN_NEW_KEY_ATTR_ENCRYPT_KEY,
- OVPN_NEW_KEY_ATTR_DECRYPT_KEY,
+ OVPN_NEW_KEY_ATTR_UNSPEC = 0,
+ OVPN_NEW_KEY_ATTR_PEER_ID,
+ OVPN_NEW_KEY_ATTR_KEY_SLOT,
+ OVPN_NEW_KEY_ATTR_KEY_ID,
+ OVPN_NEW_KEY_ATTR_CIPHER_ALG,
+ OVPN_NEW_KEY_ATTR_ENCRYPT_KEY,
+ OVPN_NEW_KEY_ATTR_DECRYPT_KEY,
- __OVPN_NEW_KEY_ATTR_AFTER_LAST,
- OVPN_NEW_KEY_ATTR_MAX = __OVPN_NEW_KEY_ATTR_AFTER_LAST - 1,
+ __OVPN_NEW_KEY_ATTR_AFTER_LAST,
+ OVPN_NEW_KEY_ATTR_MAX = __OVPN_NEW_KEY_ATTR_AFTER_LAST - 1,
};
enum ovpn_netlink_del_key_attrs {
- OVPN_DEL_KEY_ATTR_UNSPEC = 0,
- OVPN_DEL_KEY_ATTR_PEER_ID,
- OVPN_DEL_KEY_ATTR_KEY_SLOT,
+ OVPN_DEL_KEY_ATTR_UNSPEC = 0,
+ OVPN_DEL_KEY_ATTR_PEER_ID,
+ OVPN_DEL_KEY_ATTR_KEY_SLOT,
- __OVPN_DEL_KEY_ATTR_AFTER_LAST,
- OVPN_DEL_KEY_ATTR_MAX = __OVPN_DEL_KEY_ATTR_AFTER_LAST - 1,
+ __OVPN_DEL_KEY_ATTR_AFTER_LAST,
+ OVPN_DEL_KEY_ATTR_MAX = __OVPN_DEL_KEY_ATTR_AFTER_LAST - 1,
};
enum ovpn_netlink_swap_keys_attrs {
- OVPN_SWAP_KEYS_ATTR_UNSPEC = 0,
- OVPN_SWAP_KEYS_ATTR_PEER_ID,
+ OVPN_SWAP_KEYS_ATTR_UNSPEC = 0,
+ OVPN_SWAP_KEYS_ATTR_PEER_ID,
- __OVPN_SWAP_KEYS_ATTR_AFTER_LAST,
- OVPN_SWAP_KEYS_ATTR_MAX = __OVPN_SWAP_KEYS_ATTR_AFTER_LAST - 1,
+ __OVPN_SWAP_KEYS_ATTR_AFTER_LAST,
+ OVPN_SWAP_KEYS_ATTR_MAX = __OVPN_SWAP_KEYS_ATTR_AFTER_LAST - 1,
};
enum ovpn_netlink_new_peer_attrs {
- OVPN_NEW_PEER_ATTR_UNSPEC = 0,
- OVPN_NEW_PEER_ATTR_PEER_ID,
- OVPN_NEW_PEER_ATTR_SOCKADDR_REMOTE,
- OVPN_NEW_PEER_ATTR_SOCKET,
- OVPN_NEW_PEER_ATTR_IPV4,
- OVPN_NEW_PEER_ATTR_IPV6,
- OVPN_NEW_PEER_ATTR_LOCAL_IP,
+ OVPN_NEW_PEER_ATTR_UNSPEC = 0,
+ OVPN_NEW_PEER_ATTR_PEER_ID,
+ OVPN_NEW_PEER_ATTR_SOCKADDR_REMOTE,
+ OVPN_NEW_PEER_ATTR_SOCKET,
+ OVPN_NEW_PEER_ATTR_IPV4,
+ OVPN_NEW_PEER_ATTR_IPV6,
+ OVPN_NEW_PEER_ATTR_LOCAL_IP,
- __OVPN_NEW_PEER_ATTR_AFTER_LAST,
- OVPN_NEW_PEER_ATTR_MAX = __OVPN_NEW_PEER_ATTR_AFTER_LAST - 1,
+ __OVPN_NEW_PEER_ATTR_AFTER_LAST,
+ OVPN_NEW_PEER_ATTR_MAX = __OVPN_NEW_PEER_ATTR_AFTER_LAST - 1,
};
enum ovpn_netlink_set_peer_attrs {
- OVPN_SET_PEER_ATTR_UNSPEC = 0,
- OVPN_SET_PEER_ATTR_PEER_ID,
- OVPN_SET_PEER_ATTR_KEEPALIVE_INTERVAL,
- OVPN_SET_PEER_ATTR_KEEPALIVE_TIMEOUT,
+ OVPN_SET_PEER_ATTR_UNSPEC = 0,
+ OVPN_SET_PEER_ATTR_PEER_ID,
+ OVPN_SET_PEER_ATTR_KEEPALIVE_INTERVAL,
+ OVPN_SET_PEER_ATTR_KEEPALIVE_TIMEOUT,
- __OVPN_SET_PEER_ATTR_AFTER_LAST,
- OVPN_SET_PEER_ATTR_MAX = __OVPN_SET_PEER_ATTR_AFTER_LAST - 1,
+ __OVPN_SET_PEER_ATTR_AFTER_LAST,
+ OVPN_SET_PEER_ATTR_MAX = __OVPN_SET_PEER_ATTR_AFTER_LAST - 1,
};
enum ovpn_netlink_del_peer_attrs {
- OVPN_DEL_PEER_ATTR_UNSPEC = 0,
- OVPN_DEL_PEER_ATTR_REASON,
- OVPN_DEL_PEER_ATTR_PEER_ID,
+ OVPN_DEL_PEER_ATTR_UNSPEC = 0,
+ OVPN_DEL_PEER_ATTR_REASON,
+ OVPN_DEL_PEER_ATTR_PEER_ID,
- __OVPN_DEL_PEER_ATTR_AFTER_LAST,
- OVPN_DEL_PEER_ATTR_MAX = __OVPN_DEL_PEER_ATTR_AFTER_LAST - 1,
+ __OVPN_DEL_PEER_ATTR_AFTER_LAST,
+ OVPN_DEL_PEER_ATTR_MAX = __OVPN_DEL_PEER_ATTR_AFTER_LAST - 1,
};
enum ovpn_netlink_get_peer_attrs {
- OVPN_GET_PEER_ATTR_UNSPEC = 0,
- OVPN_GET_PEER_ATTR_PEER_ID,
+ OVPN_GET_PEER_ATTR_UNSPEC = 0,
+ OVPN_GET_PEER_ATTR_PEER_ID,
- __OVPN_GET_PEER_ATTR_AFTER_LAST,
- OVPN_GET_PEER_ATTR_MAX = __OVPN_GET_PEER_ATTR_AFTER_LAST - 1,
+ __OVPN_GET_PEER_ATTR_AFTER_LAST,
+ OVPN_GET_PEER_ATTR_MAX = __OVPN_GET_PEER_ATTR_AFTER_LAST - 1,
};
enum ovpn_netlink_get_peer_response_attrs {
- OVPN_GET_PEER_RESP_ATTR_UNSPEC = 0,
- OVPN_GET_PEER_RESP_ATTR_PEER_ID,
- OVPN_GET_PEER_RESP_ATTR_SOCKADDR_REMOTE,
- OVPN_GET_PEER_RESP_ATTR_IPV4,
- OVPN_GET_PEER_RESP_ATTR_IPV6,
- OVPN_GET_PEER_RESP_ATTR_LOCAL_IP,
- OVPN_GET_PEER_RESP_ATTR_LOCAL_PORT,
- OVPN_GET_PEER_RESP_ATTR_KEEPALIVE_INTERVAL,
- OVPN_GET_PEER_RESP_ATTR_KEEPALIVE_TIMEOUT,
- OVPN_GET_PEER_RESP_ATTR_VPN_RX_BYTES,
- OVPN_GET_PEER_RESP_ATTR_VPN_TX_BYTES,
- OVPN_GET_PEER_RESP_ATTR_VPN_RX_PACKETS,
- OVPN_GET_PEER_RESP_ATTR_VPN_TX_PACKETS,
- OVPN_GET_PEER_RESP_ATTR_LINK_RX_BYTES,
- OVPN_GET_PEER_RESP_ATTR_LINK_TX_BYTES,
- OVPN_GET_PEER_RESP_ATTR_LINK_RX_PACKETS,
- OVPN_GET_PEER_RESP_ATTR_LINK_TX_PACKETS,
+ OVPN_GET_PEER_RESP_ATTR_UNSPEC = 0,
+ OVPN_GET_PEER_RESP_ATTR_PEER_ID,
+ OVPN_GET_PEER_RESP_ATTR_SOCKADDR_REMOTE,
+ OVPN_GET_PEER_RESP_ATTR_IPV4,
+ OVPN_GET_PEER_RESP_ATTR_IPV6,
+ OVPN_GET_PEER_RESP_ATTR_LOCAL_IP,
+ OVPN_GET_PEER_RESP_ATTR_LOCAL_PORT,
+ OVPN_GET_PEER_RESP_ATTR_KEEPALIVE_INTERVAL,
+ OVPN_GET_PEER_RESP_ATTR_KEEPALIVE_TIMEOUT,
+ OVPN_GET_PEER_RESP_ATTR_VPN_RX_BYTES,
+ OVPN_GET_PEER_RESP_ATTR_VPN_TX_BYTES,
+ OVPN_GET_PEER_RESP_ATTR_VPN_RX_PACKETS,
+ OVPN_GET_PEER_RESP_ATTR_VPN_TX_PACKETS,
+ OVPN_GET_PEER_RESP_ATTR_LINK_RX_BYTES,
+ OVPN_GET_PEER_RESP_ATTR_LINK_TX_BYTES,
+ OVPN_GET_PEER_RESP_ATTR_LINK_RX_PACKETS,
+ OVPN_GET_PEER_RESP_ATTR_LINK_TX_PACKETS,
- __OVPN_GET_PEER_RESP_ATTR_AFTER_LAST,
- OVPN_GET_PEER_RESP_ATTR_MAX = __OVPN_GET_PEER_RESP_ATTR_AFTER_LAST - 1,
+ __OVPN_GET_PEER_RESP_ATTR_AFTER_LAST,
+ OVPN_GET_PEER_RESP_ATTR_MAX = __OVPN_GET_PEER_RESP_ATTR_AFTER_LAST - 1,
};
enum ovpn_netlink_peer_stats_attrs {
- OVPN_PEER_STATS_ATTR_UNSPEC = 0,
- OVPN_PEER_STATS_BYTES,
- OVPN_PEER_STATS_PACKETS,
+ OVPN_PEER_STATS_ATTR_UNSPEC = 0,
+ OVPN_PEER_STATS_BYTES,
+ OVPN_PEER_STATS_PACKETS,
- __OVPN_PEER_STATS_ATTR_AFTER_LAST,
- OVPN_PEER_STATS_ATTR_MAX = __OVPN_PEER_STATS_ATTR_AFTER_LAST - 1,
+ __OVPN_PEER_STATS_ATTR_AFTER_LAST,
+ OVPN_PEER_STATS_ATTR_MAX = __OVPN_PEER_STATS_ATTR_AFTER_LAST - 1,
};
enum ovpn_netlink_peer_attrs {
- OVPN_PEER_ATTR_UNSPEC = 0,
- OVPN_PEER_ATTR_PEER_ID,
- OVPN_PEER_ATTR_SOCKADDR_REMOTE,
- OVPN_PEER_ATTR_IPV4,
- OVPN_PEER_ATTR_IPV6,
- OVPN_PEER_ATTR_LOCAL_IP,
- OVPN_PEER_ATTR_KEEPALIVE_INTERVAL,
- OVPN_PEER_ATTR_KEEPALIVE_TIMEOUT,
- OVPN_PEER_ATTR_ENCRYPT_KEY,
- OVPN_PEER_ATTR_DECRYPT_KEY,
- OVPN_PEER_ATTR_RX_STATS,
- OVPN_PEER_ATTR_TX_STATS,
+ OVPN_PEER_ATTR_UNSPEC = 0,
+ OVPN_PEER_ATTR_PEER_ID,
+ OVPN_PEER_ATTR_SOCKADDR_REMOTE,
+ OVPN_PEER_ATTR_IPV4,
+ OVPN_PEER_ATTR_IPV6,
+ OVPN_PEER_ATTR_LOCAL_IP,
+ OVPN_PEER_ATTR_KEEPALIVE_INTERVAL,
+ OVPN_PEER_ATTR_KEEPALIVE_TIMEOUT,
+ OVPN_PEER_ATTR_ENCRYPT_KEY,
+ OVPN_PEER_ATTR_DECRYPT_KEY,
+ OVPN_PEER_ATTR_RX_STATS,
+ OVPN_PEER_ATTR_TX_STATS,
- __OVPN_PEER_ATTR_AFTER_LAST,
- OVPN_PEER_ATTR_MAX = __OVPN_PEER_ATTR_AFTER_LAST - 1,
+ __OVPN_PEER_ATTR_AFTER_LAST,
+ OVPN_PEER_ATTR_MAX = __OVPN_PEER_ATTR_AFTER_LAST - 1,
};
enum ovpn_netlink_packet_attrs {
- OVPN_PACKET_ATTR_UNSPEC = 0,
- OVPN_PACKET_ATTR_PACKET,
- OVPN_PACKET_ATTR_PEER_ID,
+ OVPN_PACKET_ATTR_UNSPEC = 0,
+ OVPN_PACKET_ATTR_PACKET,
+ OVPN_PACKET_ATTR_PEER_ID,
- __OVPN_PACKET_ATTR_AFTER_LAST,
- OVPN_PACKET_ATTR_MAX = __OVPN_PACKET_ATTR_AFTER_LAST - 1,
+ __OVPN_PACKET_ATTR_AFTER_LAST,
+ OVPN_PACKET_ATTR_MAX = __OVPN_PACKET_ATTR_AFTER_LAST - 1,
};
enum ovpn_ifla_attrs {
- IFLA_OVPN_UNSPEC = 0,
- IFLA_OVPN_MODE,
+ IFLA_OVPN_UNSPEC = 0,
+ IFLA_OVPN_MODE,
- __IFLA_OVPN_AFTER_LAST,
- IFLA_OVPN_MAX = __IFLA_OVPN_AFTER_LAST - 1,
+ __IFLA_OVPN_AFTER_LAST,
+ IFLA_OVPN_MAX = __IFLA_OVPN_AFTER_LAST - 1,
};
enum ovpn_mode {
- __OVPN_MODE_FIRST = 0,
- OVPN_MODE_P2P = __OVPN_MODE_FIRST,
- OVPN_MODE_MP,
+ __OVPN_MODE_FIRST = 0,
+ OVPN_MODE_P2P = __OVPN_MODE_FIRST,
+ OVPN_MODE_MP,
- __OVPN_MODE_AFTER_LAST,
+ __OVPN_MODE_AFTER_LAST,
};
#endif /* _UAPI_LINUX_OVPN_DCO_H_ */
@@ -3,7 +3,7 @@
*
* Copyright (C) 2020-2021 OpenVPN Inc <sales@openvpn.net>
*
- * Author: Lev Stipakov <lev@openvpn.net>
+ * Author: Lev Stipakov <lev@openvpn.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2
@@ -29,76 +29,76 @@
#include <ws2ipdef.h>
typedef enum {
- OVPN_PROTO_UDP,
- OVPN_PROTO_TCP
+ OVPN_PROTO_UDP,
+ OVPN_PROTO_TCP
} OVPN_PROTO;
typedef struct _OVPN_NEW_PEER {
- union {
- SOCKADDR_IN Addr4;
- SOCKADDR_IN6 Addr6;
- } Local;
+ union {
+ SOCKADDR_IN Addr4;
+ SOCKADDR_IN6 Addr6;
+ } Local;
- union {
- SOCKADDR_IN Addr4;
- SOCKADDR_IN6 Addr6;
- } Remote;
+ union {
+ SOCKADDR_IN Addr4;
+ SOCKADDR_IN6 Addr6;
+ } Remote;
- OVPN_PROTO Proto;
-} OVPN_NEW_PEER, * POVPN_NEW_PEER;
+ OVPN_PROTO Proto;
+} OVPN_NEW_PEER, *POVPN_NEW_PEER;
typedef struct _OVPN_STATS {
- LONG LostInControlPackets;
- LONG LostOutControlPackets;
+ LONG LostInControlPackets;
+ LONG LostOutControlPackets;
- LONG LostInDataPackets;
- LONG LostOutDataPackets;
+ LONG LostInDataPackets;
+ LONG LostOutDataPackets;
- LONG ReceivedDataPackets;
- LONG ReceivedControlPackets;
+ LONG ReceivedDataPackets;
+ LONG ReceivedControlPackets;
- LONG SentControlPackets;
- LONG SentDataPackets;
+ LONG SentControlPackets;
+ LONG SentDataPackets;
- LONG64 TransportBytesSent;
- LONG64 TransportBytesReceived;
+ LONG64 TransportBytesSent;
+ LONG64 TransportBytesReceived;
- LONG64 TunBytesSent;
- LONG64 TunBytesReceived;
-} OVPN_STATS, * POVPN_STATS;
+ LONG64 TunBytesSent;
+ LONG64 TunBytesReceived;
+} OVPN_STATS, *POVPN_STATS;
typedef enum _OVPN_KEY_SLOT {
- OVPN_KEY_SLOT_PRIMARY,
- OVPN_KEY_SLOT_SECONDARY
+ OVPN_KEY_SLOT_PRIMARY,
+ OVPN_KEY_SLOT_SECONDARY
} OVPN_KEY_SLOT;
typedef enum _OVPN_CIPHER_ALG {
- OVPN_CIPHER_ALG_NONE,
- OVPN_CIPHER_ALG_AES_GCM,
- OVPN_CIPHER_ALG_CHACHA20_POLY1305
+ OVPN_CIPHER_ALG_NONE,
+ OVPN_CIPHER_ALG_AES_GCM,
+ OVPN_CIPHER_ALG_CHACHA20_POLY1305
} OVPN_CIPHER_ALG;
typedef struct _OVPN_KEY_DIRECTION
{
- unsigned char Key[32];
- unsigned char KeyLen; // 16/24/32 -> AES-128-GCM/AES-192-GCM/AES-256-GCM
- unsigned char NonceTail[8];
+ unsigned char Key[32];
+ unsigned char KeyLen; /* 16/24/32 -> AES-128-GCM/AES-192-GCM/AES-256-GCM */
+ unsigned char NonceTail[8];
} OVPN_KEY_DIRECTION;
typedef struct _OVPN_CRYPTO_DATA {
- OVPN_KEY_DIRECTION Encrypt;
- OVPN_KEY_DIRECTION Decrypt;
- OVPN_KEY_SLOT KeySlot;
- OVPN_CIPHER_ALG CipherAlg;
- unsigned char KeyId;
- int PeerId;
-} OVPN_CRYPTO_DATA, * POVPN_CRYPTO_DATA;
+ OVPN_KEY_DIRECTION Encrypt;
+ OVPN_KEY_DIRECTION Decrypt;
+ OVPN_KEY_SLOT KeySlot;
+ OVPN_CIPHER_ALG CipherAlg;
+ unsigned char KeyId;
+ int PeerId;
+} OVPN_CRYPTO_DATA, *POVPN_CRYPTO_DATA;
typedef struct _OVPN_SET_PEER {
- LONG KeepaliveInterval;
- LONG KeepaliveTimeout;
- LONG MSS;
-} OVPN_SET_PEER, * POVPN_SET_PEER;
+ LONG KeepaliveInterval;
+ LONG KeepaliveTimeout;
+ LONG MSS;
+} OVPN_SET_PEER, *POVPN_SET_PEER;
typedef struct _OVPN_VERSION {
LONG Major;
Attention is currently required from: flichtenheld, plaisthos. Hello plaisthos, flichtenheld, I'd like you to do a code review. Please visit http://gerrit.openvpn.net/c/openvpn/+/432?usp=email to review the following change. Change subject: io_work: convert shift argument to uintptr_t ...................................................................... io_work: convert shift argument to uintptr_t Instead of passing the shift argument as pointer, pass directly its integer value. This will allow the code to distinguish a shift value from a real object pointer, like we already do in multi_tcp_process_io(). This change will allow us later to pass an event_arg object as event handler argument instead of a simple integer value. Change-Id: Id5c50dc754837ddb9a9414d8f38982f75e99bace Signed-off-by: Antonio Quartulli <a@unstable.cc> --- M src/openvpn/forward.c M src/openvpn/mtcp.c M src/openvpn/ovpn_dco_linux.h M src/openvpn/ovpn_dco_win.h 4 files changed, 212 insertions(+), 213 deletions(-) git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/32/432/1