diff options
| author | PancakeTAS <pancake@mgnet.work> | 2026-06-13 22:33:14 +0200 |
|---|---|---|
| committer | PancakeTAS <pancake@mgnet.work> | 2026-06-14 16:27:32 +0200 |
| commit | e6308f6e28fe40312d9a99b8c3ce97a37c496b70 (patch) | |
| tree | 3724b13fd8a0cab38a9f63d9aca8397d37d6fa5d /src/tun.h | |
| parent | perf(mpu): Remove zero-copy items (diff) | |
feat: Implement TUN modulemaster
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); |
