1*bbf21555SRichard Lowe.\" 2*bbf21555SRichard Lowe.\" This file and its contents are supplied under the terms of the 3*bbf21555SRichard Lowe.\" Common Development and Distribution License ("CDDL"), version 1.0. 4*bbf21555SRichard Lowe.\" You may only use this file in accordance with the terms of version 5*bbf21555SRichard Lowe.\" 1.0 of the CDDL. 6*bbf21555SRichard Lowe.\" 7*bbf21555SRichard Lowe.\" A full copy of the text of the CDDL should have accompanied this 8*bbf21555SRichard Lowe.\" source. A copy of the CDDL is also available via the Internet at 9*bbf21555SRichard Lowe.\" http://www.illumos.org/license/CDDL. 10*bbf21555SRichard Lowe.\" 11*bbf21555SRichard Lowe.\" 12*bbf21555SRichard Lowe.\" Copyright 2015 Joyent, Inc. 13*bbf21555SRichard Lowe.\" 14*bbf21555SRichard Lowe.Dd Apr 10, 2015 15*bbf21555SRichard Lowe.Dt VXLAN 4P 16*bbf21555SRichard Lowe.Os 17*bbf21555SRichard Lowe.Sh NAME 18*bbf21555SRichard Lowe.Nm VXLAN , 19*bbf21555SRichard Lowe.Nm vxlan 20*bbf21555SRichard Lowe.Nd Virtual eXtensible Local Area Network 21*bbf21555SRichard Lowe.Sh SYNOPSIS 22*bbf21555SRichard Lowe.In sys/vxlan.h 23*bbf21555SRichard Lowe.Sh DESCRIPTION 24*bbf21555SRichard Lowe.Nm 25*bbf21555SRichard Lowe(RFC 7348) is a network encapsulation protocol that is used by 26*bbf21555SRichard Lowe.Xr overlay 7 27*bbf21555SRichard Lowedevices. 28*bbf21555SRichard LoweA payload, commonly an Ethernet frame, is placed inside of a 29*bbf21555SRichard LoweUDP packet and prepended with an 8-byte 30*bbf21555SRichard Lowe.Nm 31*bbf21555SRichard Loweheader. 32*bbf21555SRichard Lowe.Pp 33*bbf21555SRichard LoweThe 34*bbf21555SRichard Lowe.Nm 35*bbf21555SRichard Loweheader contains two 32-bit words. 36*bbf21555SRichard LoweThe first word is an 8-bit flags field followed by 24 reserved bits. 37*bbf21555SRichard LoweThe second word is a 24-bit virtual network identifier followed by 8 38*bbf21555SRichard Lowereserved bits. 39*bbf21555SRichard LoweThe virtual network identifier identifies a unique 40*bbf21555SRichard Lowe.Nm 41*bbf21555SRichard Loweand 42*bbf21555SRichard Loweis similar in concept to an IEEE 802.1Q VLAN identifier. 43*bbf21555SRichard Lowe.Pp 44*bbf21555SRichard LoweThe system provides access to 45*bbf21555SRichard Lowe.Nm 46*bbf21555SRichard Lowethrough dladm overlays. 47*bbf21555SRichard LoweSee 48*bbf21555SRichard Lowe.Xr dladm 8 49*bbf21555SRichard Loweand 50*bbf21555SRichard Lowe.Xr overlay 7 51*bbf21555SRichard Lowefor more information. 52*bbf21555SRichard Lowe.Pp 53*bbf21555SRichard LoweThe 54*bbf21555SRichard Lowe.In sys/vxlan.h 55*bbf21555SRichard Loweheader provides information for working with the 56*bbf21555SRichard Lowe.Nm 57*bbf21555SRichard Loweprotocol. 58*bbf21555SRichard LoweThe contents of this header are 59*bbf21555SRichard Lowe.Sy uncommitted . 60*bbf21555SRichard LoweThe header defines a structure that may be used to encode and decode a VXLAN 61*bbf21555SRichard Loweheader. 62*bbf21555SRichard LoweIt defines a packed structure type 63*bbf21555SRichard Lowe.Sy vxlan_hdr_t 64*bbf21555SRichard Lowewhich represents the 65*bbf21555SRichard Lowe.Nm 66*bbf21555SRichard Loweframe header and has the following members: 67*bbf21555SRichard Lowe.Bd -literal 68*bbf21555SRichard Lowe uint32_t vxlan_flags; /* flags in upper 8 bits */ 69*bbf21555SRichard Lowe uint32_t vxlan_id; /* VXLAN ID in upper 24 bits */ 70*bbf21555SRichard Lowe.Ed 71*bbf21555SRichard Lowe.Sh EXAMPLES 72*bbf21555SRichard Lowe.Sy Example 1 73*bbf21555SRichard LoweDecoding a 74*bbf21555SRichard Lowe.Nm 75*bbf21555SRichard Loweheader 76*bbf21555SRichard Lowe.Pp 77*bbf21555SRichard LoweThe following example shows how to validate a 78*bbf21555SRichard Lowe.Nm header. 79*bbf21555SRichard LoweFor more information on this process, see RFC 7348. 80*bbf21555SRichard Lowe.Bd -literal -offset indent 81*bbf21555SRichard Lowe#include <sys/types.h> 82*bbf21555SRichard Lowe#include <netinet/in.h> 83*bbf21555SRichard Lowe#include <inttypes.h> 84*bbf21555SRichard Lowe#include <sys/vxlan.h> 85*bbf21555SRichard Lowe 86*bbf21555SRichard Lowe\&... 87*bbf21555SRichard Lowe 88*bbf21555SRichard Lowe/* 89*bbf21555SRichard Lowe * Validate the following bytes as a VXLAN header. If valid, return 90*bbf21555SRichard Lowe * 0 and store the VXLAN identifier in *vidp. Otherwise, return an 91*bbf21555SRichard Lowe * error. 92*bbf21555SRichard Lowe */ 93*bbf21555SRichard Loweint 94*bbf21555SRichard Lowevalidate_vxlan(void *buf, int len, uint32_t *vidp) 95*bbf21555SRichard Lowe{ 96*bbf21555SRichard Lowe vxlan_hdr_t *hdr; 97*bbf21555SRichard Lowe 98*bbf21555SRichard Lowe if (len < sizeof (vxlan_hdr_t)) 99*bbf21555SRichard Lowe return (EINAVL); 100*bbf21555SRichard Lowe 101*bbf21555SRichard Lowe hdr = buf; 102*bbf21555SRichard Lowe if ((ntohl(hdr->vxlan_flags) & VXLAN_MAGIC) == 0) 103*bbf21555SRichard Lowe return (EINAVL); 104*bbf21555SRichard Lowe 105*bbf21555SRichard Lowe *vidp = ntohl(vxlan->vxlan_id) >> VXLAN_ID_SHIFT; 106*bbf21555SRichard Lowe 107*bbf21555SRichard Lowe return (0); 108*bbf21555SRichard Lowe} 109*bbf21555SRichard Lowe.Ed 110*bbf21555SRichard Lowe.Sh STABILITY 111*bbf21555SRichard LoweThe contents of 112*bbf21555SRichard Lowe.In sys/vxlan.h 113*bbf21555SRichard Loweare 114*bbf21555SRichard Lowe.Sy Uncommitted . 115*bbf21555SRichard Lowe.Sh SEE ALSO 116*bbf21555SRichard Lowe.Xr overlay 7 , 117*bbf21555SRichard Lowe.Xr dladm 8 118*bbf21555SRichard Lowe.Rs 119*bbf21555SRichard Lowe.%A Mahalingam, M. 120*bbf21555SRichard Lowe.%A Dutt, D. 121*bbf21555SRichard Lowe.%A Duda, K. 122*bbf21555SRichard Lowe.%A Agarwal, P. 123*bbf21555SRichard Lowe.%A Kreeger L. 124*bbf21555SRichard Lowe.%A Sridhar, T. 125*bbf21555SRichard Lowe.%A Bursell, M. 126*bbf21555SRichard Lowe.%A C. Wright 127*bbf21555SRichard Lowe.%T RFC 7348, Virtual eXtensible Local Area Network (VXLAN): A Framework 128*bbf21555SRichard Lowe.%T for Overlaying Virtualized Layer 2 Networks over Layer 3 Networks 129*bbf21555SRichard Lowe.%D August 2014 130*bbf21555SRichard Lowe.Re 131