summaryrefslogtreecommitdiff
path: root/device.h
diff options
context:
space:
mode:
authorFelix Fietkau <nbd@nbd.name>2020-07-15 17:18:20 +0200
committerFelix Fietkau <nbd@nbd.name>2020-07-19 10:46:02 +0200
commit0e8cea0f2acdae3812f9603ee046055acd89d717 (patch)
treeeffec0c99fc1bc6e72ce70b39b92d31026a55f54 /device.h
parent82bcb641602579f339e9addafe5f1869134a0cd1 (diff)
downloadnetifd-0e8cea0f2acdae3812f9603ee046055acd89d717.tar.gz
bridge: add support for VLAN filtering
VLANs can be defined using bridge-vlan sections, like the following example: config bridge-vlan option device 'switch0' option vlan '1' option ports "lan1 lan2 lan3 lan4:t*" Each member port can be confgured with optional attributes after ':' - t: member port is tagged - *: This is the primary VLAN for the port (PVID) VLAN member interfaces are automatically added as bridge members Signed-off-by: Felix Fietkau <nbd@nbd.name>
Diffstat (limited to 'device.h')
-rw-r--r--device.h20
1 files changed, 20 insertions, 0 deletions
diff --git a/device.h b/device.h
index 4fb15a3..b25d267 100644
--- a/device.h
+++ b/device.h
@@ -22,6 +22,7 @@ struct device;
struct device_type;
struct device_user;
struct device_hotplug_ops;
+struct bridge_vlan;
struct interface;
typedef int (*device_state_cb)(struct device *, bool up);
@@ -184,6 +185,8 @@ struct device {
struct safe_list users;
struct safe_list aliases;
+ struct vlist_tree vlans;
+
char ifname[IFNAMSIZ + 1];
int ifindex;
@@ -234,6 +237,21 @@ enum bridge_vlan_flags {
BRVLAN_F_UNTAGGED = (1 << 2),
};
+struct bridge_vlan_port {
+ const char *ifname;
+ uint16_t flags;
+};
+
+struct bridge_vlan {
+ struct vlist_node node;
+
+ struct bridge_vlan_port *ports;
+ int n_ports;
+
+ uint16_t vid;
+ bool local;
+};
+
extern const struct uci_blob_param_list device_attr_list;
extern struct device_type simple_device_type;
extern struct device_type tunnel_device_type;
@@ -241,6 +259,8 @@ extern struct device_type tunnel_device_type;
void device_lock(void);
void device_unlock(void);
+void device_vlan_update(bool done);
+
int device_type_add(struct device_type *devtype);
struct device_type *device_type_get(const char *tname);
struct device *device_create(const char *name, struct device_type *type,