diff options
Diffstat (limited to 'src/tun.h')
| -rw-r--r-- | src/tun.h | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/tun.h b/src/tun.h new file mode 100644 index 0000000..98a307d --- /dev/null +++ b/src/tun.h @@ -0,0 +1,14 @@ +/* SPDX-License-Identifier: GPL-3.0-or-later */ + +#pragma once + +// +// This module implements a Linux tun device. The tun_alloc() functions creates a tun device +// with a given name, IP address, subnet mask and MTU. +// + +#include <linux/if.h> + +/// Allocate a tun device with the given CIDR (e.g. "172.16.0.1/24") and MTU. +/// Returns fd on success, -1 on failure (errno is set). +int tun_alloc(const char* ifname, const char* cidr, int mtu); |
