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