summaryrefslogtreecommitdiff
path: root/src/tun.h
blob: 98a307d35a39120b750c1ce74c559b3a823dee45 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
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);