Zephyr API Documentation 4.4.0-rc1
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
Wireguard VPN service

Wireguard VPN service. More...

Data Structures

struct  wireguard_allowed_ip
 Wireguard allowed IP address struct. More...
struct  wireguard_peer_config
 Wireguard peer configuration information. More...
struct  net_stats_vpn
 Wireguard VPN statistics. More...
struct  net_event_vpn_peer
 Network Management event information structure Used to pass information on network event NET_EVENT_VPN_PEER_ADD when CONFIG_NET_MGMT_EVENT_INFO enabled and event generator pass the information. More...

Macros

#define WIREGUARD_TIMESTAMP_LEN   (sizeof(uint64_t) + sizeof(uint32_t))
 Timestamp length (64-bit seconds and 32-bit nanoseconds).

Functions

int wireguard_peer_add (struct wireguard_peer_config *peer_config, struct net_if **peer_iface)
 Add a Wireguard peer to the system.
int wireguard_peer_remove (int peer_id)
 Remove a Wireguard peer from the system.
int wireguard_peer_keepalive (int peer_id)
 Send a Wireguard keepalive message to peer.
int wireguard_get_current_time (uint64_t *seconds, uint32_t *nanoseconds)
 Get current time in seconds and nanoseconds from Unix epoch.

Detailed Description

Wireguard VPN service.

Since
4.4
Version
0.1.0

Macro Definition Documentation

◆ WIREGUARD_TIMESTAMP_LEN

#define WIREGUARD_TIMESTAMP_LEN   (sizeof(uint64_t) + sizeof(uint32_t))

#include <zephyr/net/wireguard.h>

Timestamp length (64-bit seconds and 32-bit nanoseconds).

Function Documentation

◆ wireguard_get_current_time()

int wireguard_get_current_time ( uint64_t * seconds,
uint32_t * nanoseconds )

#include <zephyr/net/wireguard.h>

Get current time in seconds and nanoseconds from Unix epoch.

This function is used to get the current time in seconds and nanoseconds. The time is used to calculate the timestamp in the Wireguard handshake. User can override this function to provide the current time. The default implementation uses k_uptime_get() to get the current time.

Parameters
secondsPointer to store the current time in seconds.
nanosecondsPointer to store the current time in nanoseconds.
Returns
0 on success, a negative errno otherwise.

◆ wireguard_peer_add()

int wireguard_peer_add ( struct wireguard_peer_config * peer_config,
struct net_if ** peer_iface )

#include <zephyr/net/wireguard.h>

Add a Wireguard peer to the system.

If successful, a virtual network interface is returned which can be used to communicate with the peer.

Parameters
peer_configPeer configuration data.
peer_ifaceA pointer to network interface is returned to the caller if adding the peer was successful.
Returns
>0 peer id on success, a negative errno otherwise.

◆ wireguard_peer_keepalive()

int wireguard_peer_keepalive ( int peer_id)

#include <zephyr/net/wireguard.h>

Send a Wireguard keepalive message to peer.

Parameters
peer_idPeer id returned by wireguard_peer_add()
Returns
0 on success, a negative errno otherwise.

◆ wireguard_peer_remove()

int wireguard_peer_remove ( int peer_id)

#include <zephyr/net/wireguard.h>

Remove a Wireguard peer from the system.

If successful, the virtual network interface is also removed and user is no longer be able to communicate with the peer.

Parameters
peer_idPeer id returned by wireguard_peer_add()
Returns
0 on success, a negative errno otherwise.