xref: /freebsd/sys/net/if_ovpn.h (revision fe75646a0234a261c0013bf1840fdac4acaf0cec)
1 /*-
2  * SPDX-License-Identifier: BSD-2-Clause
3  *
4  * Copyright (c) 2021-2022 Rubicon Communications, LLC (Netgate)
5  *
6  * Redistribution and use in source and binary forms, with or without
7  * modification, are permitted provided that the following conditions
8  * are met:
9  * 1. Redistributions of source code must retain the above copyright
10  *    notice, this list of conditions and the following disclaimer.
11  * 2. Redistributions in binary form must reproduce the above copyright
12  *    notice, this list of conditions and the following disclaimer in the
13  *    documentation and/or other materials provided with the distribution.
14  *
15  * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
16  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18  * ARE DISCLAIMED.  IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
19  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
21  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25  * SUCH DAMAGE.
26  */
27 
28 #ifndef _NET_IF_OVPN_H_
29 #define _NET_IF_OVPN_H_
30 
31 #include <sys/types.h>
32 #include <netinet/in.h>
33 
34 /* Maximum size of an ioctl request. */
35 #define OVPN_MAX_REQUEST_SIZE	4096
36 
37 enum ovpn_notif_type {
38 	OVPN_NOTIF_DEL_PEER,
39 	OVPN_NOTIF_ROTATE_KEY,
40 };
41 
42 enum ovpn_del_reason {
43 	OVPN_DEL_REASON_REQUESTED	= 0,
44 	OVPN_DEL_REASON_TIMEOUT		= 1
45 };
46 
47 enum ovpn_key_slot {
48 	OVPN_KEY_SLOT_PRIMARY	= 0,
49 	OVPN_KEY_SLOT_SECONDARY	= 1
50 };
51 
52 enum ovpn_key_cipher {
53 	OVPN_CIPHER_ALG_NONE			= 0,
54 	OVPN_CIPHER_ALG_AES_GCM			= 1,
55 	OVPN_CIPHER_ALG_CHACHA20_POLY1305	= 2
56 };
57 
58 #define OVPN_NEW_PEER		_IO  ('D', 1)
59 #define OVPN_DEL_PEER		_IO  ('D', 2)
60 #define OVPN_GET_STATS		_IO  ('D', 3)
61 #define OVPN_NEW_KEY		_IO  ('D', 4)
62 #define OVPN_SWAP_KEYS		_IO  ('D', 5)
63 #define OVPN_DEL_KEY		_IO  ('D', 6)
64 #define OVPN_SET_PEER		_IO  ('D', 7)
65 #define OVPN_START_VPN		_IO  ('D', 8)
66 /* OVPN_SEND_PKT		_IO  ('D', 9) */
67 #define OVPN_POLL_PKT		_IO  ('D', 10)
68 #define OVPN_GET_PKT		_IO  ('D', 11)
69 #define OVPN_SET_IFMODE		_IO  ('D', 12)
70 #define OVPN_GET_PEER_STATS	_IO  ('D', 13)
71 
72 #endif
73