]> Pileus Git - ~andy/linux/blob - include/uapi/linux/if_bridge.h
c6c30e28f396fab3126382eb135c94039777e708
[~andy/linux] / include / uapi / linux / if_bridge.h
1 /*
2  *      Linux ethernet bridge
3  *
4  *      Authors:
5  *      Lennert Buytenhek               <buytenh@gnu.org>
6  *
7  *      This program is free software; you can redistribute it and/or
8  *      modify it under the terms of the GNU General Public License
9  *      as published by the Free Software Foundation; either version
10  *      2 of the License, or (at your option) any later version.
11  */
12
13 #ifndef _UAPI_LINUX_IF_BRIDGE_H
14 #define _UAPI_LINUX_IF_BRIDGE_H
15
16 #include <linux/types.h>
17
18 #define SYSFS_BRIDGE_ATTR       "bridge"
19 #define SYSFS_BRIDGE_FDB        "brforward"
20 #define SYSFS_BRIDGE_PORT_SUBDIR "brif"
21 #define SYSFS_BRIDGE_PORT_ATTR  "brport"
22 #define SYSFS_BRIDGE_PORT_LINK  "bridge"
23
24 #define BRCTL_VERSION 1
25
26 #define BRCTL_GET_VERSION 0
27 #define BRCTL_GET_BRIDGES 1
28 #define BRCTL_ADD_BRIDGE 2
29 #define BRCTL_DEL_BRIDGE 3
30 #define BRCTL_ADD_IF 4
31 #define BRCTL_DEL_IF 5
32 #define BRCTL_GET_BRIDGE_INFO 6
33 #define BRCTL_GET_PORT_LIST 7
34 #define BRCTL_SET_BRIDGE_FORWARD_DELAY 8
35 #define BRCTL_SET_BRIDGE_HELLO_TIME 9
36 #define BRCTL_SET_BRIDGE_MAX_AGE 10
37 #define BRCTL_SET_AGEING_TIME 11
38 #define BRCTL_SET_GC_INTERVAL 12
39 #define BRCTL_GET_PORT_INFO 13
40 #define BRCTL_SET_BRIDGE_STP_STATE 14
41 #define BRCTL_SET_BRIDGE_PRIORITY 15
42 #define BRCTL_SET_PORT_PRIORITY 16
43 #define BRCTL_SET_PATH_COST 17
44 #define BRCTL_GET_FDB_ENTRIES 18
45
46 #define BR_STATE_DISABLED 0
47 #define BR_STATE_LISTENING 1
48 #define BR_STATE_LEARNING 2
49 #define BR_STATE_FORWARDING 3
50 #define BR_STATE_BLOCKING 4
51
52 struct __bridge_info {
53         __u64 designated_root;
54         __u64 bridge_id;
55         __u32 root_path_cost;
56         __u32 max_age;
57         __u32 hello_time;
58         __u32 forward_delay;
59         __u32 bridge_max_age;
60         __u32 bridge_hello_time;
61         __u32 bridge_forward_delay;
62         __u8 topology_change;
63         __u8 topology_change_detected;
64         __u8 root_port;
65         __u8 stp_enabled;
66         __u32 ageing_time;
67         __u32 gc_interval;
68         __u32 hello_timer_value;
69         __u32 tcn_timer_value;
70         __u32 topology_change_timer_value;
71         __u32 gc_timer_value;
72 };
73
74 struct __port_info {
75         __u64 designated_root;
76         __u64 designated_bridge;
77         __u16 port_id;
78         __u16 designated_port;
79         __u32 path_cost;
80         __u32 designated_cost;
81         __u8 state;
82         __u8 top_change_ack;
83         __u8 config_pending;
84         __u8 unused0;
85         __u32 message_age_timer_value;
86         __u32 forward_delay_timer_value;
87         __u32 hold_timer_value;
88 };
89
90 struct __fdb_entry {
91         __u8 mac_addr[6];
92         __u8 port_no;
93         __u8 is_local;
94         __u32 ageing_timer_value;
95         __u8 port_hi;
96         __u8 pad0;
97         __u16 unused;
98 };
99
100 /* Bridge Flags */
101 #define BRIDGE_FLAGS_MASTER     1       /* Bridge command to/from master */
102 #define BRIDGE_FLAGS_SELF       2       /* Bridge command to/from lowerdev */
103
104 #define BRIDGE_MODE_VEB         0       /* Default loopback mode */
105 #define BRIDGE_MODE_VEPA        1       /* 802.1Qbg defined VEPA mode */
106
107 /* Bridge management nested attributes
108  * [IFLA_AF_SPEC] = {
109  *     [IFLA_BRIDGE_FLAGS]
110  *     [IFLA_BRIDGE_MODE]
111  *     [IFLA_BRIDGE_VLAN_INFO]
112  * }
113  */
114 enum {
115         IFLA_BRIDGE_FLAGS,
116         IFLA_BRIDGE_MODE,
117         IFLA_BRIDGE_VLAN_INFO,
118         __IFLA_BRIDGE_MAX,
119 };
120 #define IFLA_BRIDGE_MAX (__IFLA_BRIDGE_MAX - 1)
121
122 #define BRIDGE_VLAN_INFO_MASTER (1<<0)  /* Operate on Bridge device as well */
123 #define BRIDGE_VLAN_INFO_PVID   (1<<1)  /* VLAN is PVID, ingress untagged */
124
125 struct bridge_vlan_info {
126         u16 flags;
127         u16 vid;
128 };
129
130 /* Bridge multicast database attributes
131  * [MDBA_MDB] = {
132  *     [MDBA_MDB_ENTRY] = {
133  *         [MDBA_MDB_ENTRY_INFO]
134  *     }
135  * }
136  * [MDBA_ROUTER] = {
137  *    [MDBA_ROUTER_PORT]
138  * }
139  */
140 enum {
141         MDBA_UNSPEC,
142         MDBA_MDB,
143         MDBA_ROUTER,
144         __MDBA_MAX,
145 };
146 #define MDBA_MAX (__MDBA_MAX - 1)
147
148 enum {
149         MDBA_MDB_UNSPEC,
150         MDBA_MDB_ENTRY,
151         __MDBA_MDB_MAX,
152 };
153 #define MDBA_MDB_MAX (__MDBA_MDB_MAX - 1)
154
155 enum {
156         MDBA_MDB_ENTRY_UNSPEC,
157         MDBA_MDB_ENTRY_INFO,
158         __MDBA_MDB_ENTRY_MAX,
159 };
160 #define MDBA_MDB_ENTRY_MAX (__MDBA_MDB_ENTRY_MAX - 1)
161
162 enum {
163         MDBA_ROUTER_UNSPEC,
164         MDBA_ROUTER_PORT,
165         __MDBA_ROUTER_MAX,
166 };
167 #define MDBA_ROUTER_MAX (__MDBA_ROUTER_MAX - 1)
168
169 struct br_port_msg {
170         __u8  family;
171         __u32 ifindex;
172 };
173
174 struct br_mdb_entry {
175         __u32 ifindex;
176 #define MDB_TEMPORARY 0
177 #define MDB_PERMANENT 1
178         __u8 state;
179         struct {
180                 union {
181                         __be32  ip4;
182                         struct in6_addr ip6;
183                 } u;
184                 __be16          proto;
185         } addr;
186 };
187
188 enum {
189         MDBA_SET_ENTRY_UNSPEC,
190         MDBA_SET_ENTRY,
191         __MDBA_SET_ENTRY_MAX,
192 };
193 #define MDBA_SET_ENTRY_MAX (__MDBA_SET_ENTRY_MAX - 1)
194
195 #endif /* _UAPI_LINUX_IF_BRIDGE_H */