1/*
2 * Copyright (c) 1993, 1994, 1996
3 *	The Regents of the University of California.  All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that: (1) source code distributions
7 * retain the above copyright notice and this paragraph in its entirety, (2)
8 * distributions including binary code include the above copyright notice and
9 * this paragraph in its entirety in the documentation or other materials
10 * provided with the distribution, and (3) all advertising materials mentioning
11 * features or use of this software display the following acknowledgement:
12 * ``This product includes software developed by the University of California,
13 * Lawrence Berkeley Laboratory and its contributors.'' Neither the name of
14 * the University nor the names of its contributors may be used to endorse
15 * or promote products derived from this software without specific prior
16 * written permission.
17 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
18 * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
19 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
20 */
21
22/*
23 * Maximum length of the length field in an Ethernet header; any value
24 * greater than this is not a length value, so it's either an Ethernet
25 * type or an invalid value.
26 */
27#define	MAX_ETHERNET_LENGTH_VAL	1500
28
29/*
30 * Ethernet types.
31 *
32 * We wrap the declarations with #ifdef, so that if a file includes
33 * <netinet/if_ether.h>, which may declare some of these, we don't
34 * get a bunch of complaints from the C compiler about redefinitions
35 * of these values.
36 *
37 * We declare all of them here so that no file has to include
38 * <netinet/if_ether.h> if all it needs are ETHERTYPE_ values.
39 */
40
41#ifndef ETHERTYPE_LEN
42#define ETHERTYPE_LEN           2
43#endif
44
45#ifndef ETHERTYPE_GRE_ISO
46#define ETHERTYPE_GRE_ISO       0x00FE  /* not really an ethertype only used in GRE */
47#endif
48#ifndef ETHERTYPE_PUP
49#define	ETHERTYPE_PUP		0x0200	/* PUP protocol */
50#endif
51#ifndef ETHERTYPE_IP
52#define	ETHERTYPE_IP		0x0800	/* IP protocol */
53#endif
54#ifndef ETHERTYPE_ARP
55#define ETHERTYPE_ARP		0x0806	/* Addr. resolution protocol */
56#endif
57#ifndef ETHERTYPE_REVARP
58#define ETHERTYPE_REVARP	0x8035	/* reverse Addr. resolution protocol */
59#endif
60#ifndef ETHERTYPE_NS
61#define ETHERTYPE_NS		0x0600
62#endif
63#ifndef	ETHERTYPE_SPRITE
64#define	ETHERTYPE_SPRITE	0x0500
65#endif
66#ifndef ETHERTYPE_TRAIL
67#define ETHERTYPE_TRAIL		0x1000
68#endif
69#ifndef	ETHERTYPE_MOPDL
70#define	ETHERTYPE_MOPDL		0x6001
71#endif
72#ifndef	ETHERTYPE_MOPRC
73#define	ETHERTYPE_MOPRC		0x6002
74#endif
75#ifndef	ETHERTYPE_DN
76#define	ETHERTYPE_DN		0x6003
77#endif
78#ifndef	ETHERTYPE_LAT
79#define	ETHERTYPE_LAT		0x6004
80#endif
81#ifndef ETHERTYPE_SCA
82#define ETHERTYPE_SCA		0x6007
83#endif
84#ifndef ETHERTYPE_TEB
85#define ETHERTYPE_TEB		0x6558
86#endif
87#ifndef	ETHERTYPE_LANBRIDGE
88#define	ETHERTYPE_LANBRIDGE	0x8038
89#endif
90#ifndef	ETHERTYPE_DECDNS
91#define	ETHERTYPE_DECDNS	0x803c
92#endif
93#ifndef	ETHERTYPE_DECDTS
94#define	ETHERTYPE_DECDTS	0x803e
95#endif
96#ifndef	ETHERTYPE_VEXP
97#define	ETHERTYPE_VEXP		0x805b
98#endif
99#ifndef	ETHERTYPE_VPROD
100#define	ETHERTYPE_VPROD		0x805c
101#endif
102#ifndef ETHERTYPE_ATALK
103#define ETHERTYPE_ATALK		0x809b
104#endif
105#ifndef ETHERTYPE_AARP
106#define ETHERTYPE_AARP		0x80f3
107#endif
108#ifndef	ETHERTYPE_TIPC
109#define	ETHERTYPE_TIPC		0x88ca
110#endif
111#ifndef	ETHERTYPE_8021Q
112#define	ETHERTYPE_8021Q		0x8100
113#endif
114
115/* see:
116        https://en.wikipedia.org/wiki/IEEE_802.1Q
117    and https://en.wikipedia.org/wiki/QinQ
118*/
119#ifndef	ETHERTYPE_8021Q9100
120#define	ETHERTYPE_8021Q9100	0x9100
121#endif
122#ifndef	ETHERTYPE_8021Q9200
123#define	ETHERTYPE_8021Q9200	0x9200
124#endif
125#ifndef	ETHERTYPE_8021QinQ
126#define	ETHERTYPE_8021QinQ      0x88a8
127#endif
128#ifndef ETHERTYPE_MACSEC
129#define ETHERTYPE_MACSEC	0x88e5
130#endif
131#ifndef ETHERTYPE_IPX
132#define ETHERTYPE_IPX		0x8137
133#endif
134#ifndef ETHERTYPE_IPV6
135#define ETHERTYPE_IPV6		0x86dd
136#endif
137#ifndef ETHERTYPE_PPP
138#define	ETHERTYPE_PPP		0x880b
139#endif
140#ifndef ETHERTYPE_MPCP
141#define	ETHERTYPE_MPCP		0x8808
142#endif
143#ifndef ETHERTYPE_SLOW
144#define	ETHERTYPE_SLOW		0x8809
145#endif
146#ifndef	ETHERTYPE_MPLS
147#define	ETHERTYPE_MPLS		0x8847
148#endif
149#ifndef	ETHERTYPE_MPLS_MULTI
150#define	ETHERTYPE_MPLS_MULTI	0x8848
151#endif
152#ifndef ETHERTYPE_PPPOED
153#define ETHERTYPE_PPPOED	0x8863
154#endif
155#ifndef ETHERTYPE_PPPOES
156#define ETHERTYPE_PPPOES	0x8864
157#endif
158#ifndef ETHERTYPE_NSH
159#define ETHERTYPE_NSH		0x894F
160#endif
161#ifndef ETHERTYPE_PPPOED2
162#define ETHERTYPE_PPPOED2	0x3c12
163#endif
164#ifndef ETHERTYPE_PPPOES2
165#define ETHERTYPE_PPPOES2	0x3c13
166#endif
167#ifndef ETHERTYPE_MS_NLB_HB
168#define ETHERTYPE_MS_NLB_HB	0x886f /* MS Network Load Balancing Heartbeat */
169#endif
170#ifndef ETHERTYPE_JUMBO
171#define ETHERTYPE_JUMBO         0x8870
172#endif
173#ifndef ETHERTYPE_LLDP
174#define ETHERTYPE_LLDP          0x88cc
175#endif
176#ifndef ETHERTYPE_EAPOL
177#define ETHERTYPE_EAPOL		0x888e
178#endif
179#ifndef ETHERTYPE_REALTEK
180#define ETHERTYPE_REALTEK	0x8899	/* Realtek layer 2 protocols and switch tags */
181#endif
182#ifndef ETHERTYPE_AOE
183#define ETHERTYPE_AOE		0x88a2
184#endif
185#ifndef ETHERTYPE_PTP
186#define ETHERTYPE_PTP		0x88f7
187#endif
188#ifndef	ETHERTYPE_LOOPBACK
189#define	ETHERTYPE_LOOPBACK	0x9000
190#endif
191#ifndef	ETHERTYPE_VMAN
192#define	ETHERTYPE_VMAN	        0x9100 /* Extreme VMAN Protocol */
193#endif
194#ifndef	ETHERTYPE_CFM_OLD
195#define	ETHERTYPE_CFM_OLD       0xabcd /* 802.1ag depreciated */
196#endif
197#ifndef	ETHERTYPE_CFM
198#define	ETHERTYPE_CFM           0x8902 /* 802.1ag */
199#endif
200#ifndef	ETHERTYPE_IEEE1905_1
201#define	ETHERTYPE_IEEE1905_1    0x893a /* IEEE 1905.1 */
202#endif
203#ifndef	ETHERTYPE_ISO
204#define	ETHERTYPE_ISO           0xfefe  /* nonstandard - used in Cisco HDLC encapsulation */
205#endif
206#ifndef	ETHERTYPE_CALM_FAST
207#define	ETHERTYPE_CALM_FAST     0x1111  /* ISO CALM FAST */
208#endif
209#ifndef	ETHERTYPE_GEONET_OLD
210#define	ETHERTYPE_GEONET_OLD    0x0707  /* ETSI GeoNetworking (before Jan 2013) */
211#endif
212#ifndef	ETHERTYPE_GEONET
213#define	ETHERTYPE_GEONET        0x8947  /* ETSI GeoNetworking (Official IEEE registration from Jan 2013) */
214#endif
215#ifndef	ETHERTYPE_ARISTA
216#define	ETHERTYPE_ARISTA        0xd28b /*  Arista Networks vendor specific EtherType */
217#endif
218
219extern const struct tok ethertype_values[];
220