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