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