OpenVPN
Functions
tun_afunix.h File Reference
#include <sys/types.h>
#include "tun.h"
Include dependency graph for tun_afunix.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

void open_tun_afunix (struct options *o, int mtu, struct tuntap *tt, struct env_set *env)
 Opens an AF_UNIX based tun device.
 
void close_tun_afunix (struct tuntap *tt)
 Closes the socket used for the AF_UNIX based device.
 
ssize_t write_tun_afunix (struct tuntap *tt, uint8_t *buf, int len)
 Writes a packet to a AF_UNIX based tun device.
 
ssize_t read_tun_afunix (struct tuntap *tt, uint8_t *buf, int len)
 Reads a packet from a AF_UNIX based tun device.
 
static bool is_tun_afunix (const char *devnode)
 Checks whether a –dev-node parameter specifies a AF_UNIX device.
 

Function Documentation

◆ close_tun_afunix()

void close_tun_afunix ( struct tuntap tt)

Closes the socket used for the AF_UNIX based device.

Also sends a SIGINT to the child process that was spawned to handle the tun device

Definition at line 129 of file tun_afunix.c.

References tuntap::actual_name, tuntap::afunix, ASSERT, and afunix_context::childprocess.

Referenced by do_close_tun_simple().

◆ is_tun_afunix()

static bool is_tun_afunix ( const char *  devnode)
inlinestatic

Checks whether a –dev-node parameter specifies a AF_UNIX device.

Parameters
devnodethe string to check
Returns
true if the string starts with unix:

Definition at line 69 of file tun_afunix.h.

References strprefix().

Referenced by do_init_tun().

◆ open_tun_afunix()

void open_tun_afunix ( struct options o,
int  mtu,
struct tuntap tt,
struct env_set env 
)

Opens an AF_UNIX based tun device.

This also executes the command that the user provided taking care of implementing the actual tun device.

Definition at line 74 of file tun_afunix.c.

References tuntap::actual_name, options::dev, options::dev_node, options::dev_type, dev_type_string(), env_set_create(), env_set_inherit(), gc, gc_free(), gc_new(), options::lladdr, M_ERR, msg, options::route_default_gateway, set_cloexec(), setenv_int(), setenv_str(), socket_set_buffers(), string_alloc(), and tun_afunix_exec_child().

Referenced by open_tun_backend().

◆ read_tun_afunix()

ssize_t read_tun_afunix ( struct tuntap tt,
uint8_t *  buf,
int  len 
)

Reads a packet from a AF_UNIX based tun device.

Definition at line 157 of file tun_afunix.c.

References tuntap::afunix, afunix_context::childprocess, M_WARN, msg, openvpn_waitpid_check(), and read.

Referenced by read_incoming_tun().

◆ write_tun_afunix()

ssize_t write_tun_afunix ( struct tuntap tt,
uint8_t *  buf,
int  len 
)

Writes a packet to a AF_UNIX based tun device.

Definition at line 144 of file tun_afunix.c.

References tuntap::afunix, afunix_context::childprocess, M_WARN, msg, openvpn_waitpid_check(), and write.

Referenced by process_outgoing_tun().