1117395Skan/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
2169689Skan#ifndef _UAPI__LINUX_BRIDGE_EBT_802_3_H
390075Sobrien#define _UAPI__LINUX_BRIDGE_EBT_802_3_H
490075Sobrien
590075Sobrien#include <linux/types.h>
690075Sobrien#include <linux/if_ether.h>
790075Sobrien
890075Sobrien#define EBT_802_3_SAP 0x01
990075Sobrien#define EBT_802_3_TYPE 0x02
1090075Sobrien
1190075Sobrien#define EBT_802_3_MATCH "802_3"
1290075Sobrien
13117395Skan/*
14117395Skan * If frame has DSAP/SSAP value 0xaa you must check the SNAP type
1590075Sobrien * to discover what kind of packet we're carrying.
1690075Sobrien */
1790075Sobrien#define CHECK_TYPE 0xaa
1890075Sobrien
1990075Sobrien/*
2090075Sobrien * Control field may be one or two bytes.  If the first byte has
2190075Sobrien * the value 0x03 then the entire length is one byte, otherwise it is two.
2290075Sobrien * One byte controls are used in Unnumbered Information frames.
2390075Sobrien * Two byte controls are used in Numbered Information frames.
24107590Sobrien */
25107590Sobrien#define IS_UI 0x03
2696263Sobrien
2796263Sobrien#define EBT_802_3_MASK (EBT_802_3_SAP | EBT_802_3_TYPE | EBT_802_3)
2890075Sobrien
2990075Sobrien/* ui has one byte ctrl, ni has two */
3090075Sobrienstruct hdr_ui {
3190075Sobrien	__u8 dsap;
32132718Skan	__u8 ssap;
33132718Skan	__u8 ctrl;
34132718Skan	__u8 orig[3];
35132718Skan	__be16 type;
36117395Skan};
3790075Sobrien
3890075Sobrienstruct hdr_ni {
39122180Skan	__u8 dsap;
40122180Skan	__u8 ssap;
41122180Skan	__be16 ctrl;
42132718Skan	__u8  orig[3];
43132718Skan	__be16 type;
44132718Skan};
45132718Skan
4690075Sobrienstruct ebt_802_3_hdr {
4790075Sobrien	__u8  daddr[ETH_ALEN];
4890075Sobrien	__u8  saddr[ETH_ALEN];
49107590Sobrien	__be16 len;
50107590Sobrien	union {
51107590Sobrien		struct hdr_ui ui;
52107590Sobrien		struct hdr_ni ni;
53107590Sobrien	} llc;
54107590Sobrien};
55117395Skan
56107590Sobrien
57107590Sobrienstruct ebt_802_3_info {
58132718Skan	__u8  sap;
59117395Skan	__be16 type;
60117395Skan	__u8  bitmask;
61117395Skan	__u8  invflags;
62132718Skan};
63117395Skan
64117395Skan#endif /* _UAPI__LINUX_BRIDGE_EBT_802_3_H */
65107590Sobrien