VXLAN(4P) 4P VXLAN(4P)

NAME


VXLAN, vxlan - Virtual eXtensible Local Area Network

SYNOPSIS


#include <sys/vxlan.h>

DESCRIPTION


VXLAN (RFC 7348) is a network encapsulation protocol that is used by
overlay(7) devices. A payload, commonly an Ethernet frame, is placed
inside of a UDP packet and prepended with an 8-byte VXLAN header.

The VXLAN header contains two 32-bit words. The first word is an 8-bit
flags field followed by 24 reserved bits. The second word is a 24-bit
virtual network identifier followed by 8 reserved bits. The virtual
network identifier identifies a unique VXLAN and is similar in concept to
an IEEE 802.1Q VLAN identifier.

The system provides access to VXLAN through dladm overlays. See dladm(8)
and overlay(7) for more information.

The <sys/vxlan.h> header provides information for working with the VXLAN
protocol. The contents of this header are uncommitted. The header defines
a structure that may be used to encode and decode a VXLAN header. It
defines a packed structure type vxlan_hdr_t which represents the VXLAN
frame header and has the following members:

uint32_t vxlan_flags; /* flags in upper 8 bits */
uint32_t vxlan_id; /* VXLAN ID in upper 24 bits */

EXAMPLES


Example 1 Decoding a VXLAN header

The following example shows how to validate a header. For more information
on this process, see RFC 7348.

#include <sys/types.h>
#include <netinet/in.h>
#include <inttypes.h>
#include <sys/vxlan.h>

...

/*
* Validate the following bytes as a VXLAN header. If valid, return
* 0 and store the VXLAN identifier in *vidp. Otherwise, return an
* error.
*/
int
validate_vxlan(void *buf, int len, uint32_t *vidp)
{
vxlan_hdr_t *hdr;

if (len < sizeof (vxlan_hdr_t))
return (EINAVL);

hdr = buf;
if ((ntohl(hdr->vxlan_flags) & VXLAN_MAGIC) == 0)
return (EINAVL);

*vidp = ntohl(vxlan->vxlan_id) >> VXLAN_ID_SHIFT;

return (0);
}

STABILITY


The contents of <sys/vxlan.h> are Uncommitted.

SEE ALSO


overlay(7), dladm(8)

Mahalingam, M., Dutt, D., Duda, K., Agarwal, P., Kreeger L., Sridhar, T.,
Bursell, M., and C. Wright, RFC 7348, Virtual eXtensible Local Area Network
(VXLAN): A Framework, for Overlaying Virtualized Layer 2 Networks over
Layer 3 Networks, August 2014.

OmniOS April 10, 2015 OmniOS