1/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
2#ifndef _UAPI__LINUX_BRIDGE_EBT_802_3_H
3#define _UAPI__LINUX_BRIDGE_EBT_802_3_H
4
5#include <linux/types.h>
6#include <linux/if_ether.h>
7
8#define EBT_802_3_SAP 0x01
9#define EBT_802_3_TYPE 0x02
10
11#define EBT_802_3_MATCH "802_3"
12
13/*
14 * If frame has DSAP/SSAP value 0xaa you must check the SNAP type
15 * to discover what kind of packet we're carrying.
16 */
17#define CHECK_TYPE 0xaa
18
19/*
20 * Control field may be one or two bytes.  If the first byte has
21 * the value 0x03 then the entire length is one byte, otherwise it is two.
22 * One byte controls are used in Unnumbered Information frames.
23 * Two byte controls are used in Numbered Information frames.
24 */
25#define IS_UI 0x03
26
27#define EBT_802_3_MASK (EBT_802_3_SAP | EBT_802_3_TYPE | EBT_802_3)
28
29/* ui has one byte ctrl, ni has two */
30struct hdr_ui {
31	__u8 dsap;
32	__u8 ssap;
33	__u8 ctrl;
34	__u8 orig[3];
35	__be16 type;
36};
37
38struct hdr_ni {
39	__u8 dsap;
40	__u8 ssap;
41	__be16 ctrl;
42	__u8  orig[3];
43	__be16 type;
44};
45
46struct ebt_802_3_hdr {
47	__u8  daddr[ETH_ALEN];
48	__u8  saddr[ETH_ALEN];
49	__be16 len;
50	union {
51		struct hdr_ui ui;
52		struct hdr_ni ni;
53	} llc;
54};
55
56
57struct ebt_802_3_info {
58	__u8  sap;
59	__be16 type;
60	__u8  bitmask;
61	__u8  invflags;
62};
63
64#endif /* _UAPI__LINUX_BRIDGE_EBT_802_3_H */
65