summaryrefslogtreecommitdiff
path: root/system.h
diff options
context:
space:
mode:
authorGioacchino Mazzurco <gio@eigenlab.org>2014-06-10 19:29:13 +0200
committerFelix Fietkau <nbd@openwrt.org>2014-06-11 12:22:23 +0200
commit59217785704fca27d2c7a19e279d27c384a452cd (patch)
tree5de87f928553d8b56c1681151026c4b14f0f17c4 /system.h
parentf8981d9933683e1a8314fa86ac610f8e9a22661c (diff)
downloadnetifd-59217785704fca27d2c7a19e279d27c384a452cd.tar.gz
Add vlan 802.1q/802.1ad support as netifd devices
At moment netifd supports just 802.1q vlan, you can configure them using a concise but "hacky" syntax using an interface config section, with this patch netifd acquire the capability of configuring 802.1ad and 802.1q vlan using config device sections, so you can define a vlan device plus interface with something like this: config device 'test' option type '8021ad' option name 'test' option ifname 'eth0' option vid '1000' config interface 'testif' option ifname 'test' option proto 'none' option auto '1' old syntax for 802.1q keeps working so no retrocompatibility problems, to keep retrocompatibility means also that user must not use name/ifname like eth0.2 for devices declared with the new style because this would trigger the "old style" when interface config section is parsed Signed-off-by: Gioacchino Mazzurco <gmazzurco89@gmail.com>
Diffstat (limited to 'system.h')
-rw-r--r--system.h13
1 files changed, 13 insertions, 0 deletions
diff --git a/system.h b/system.h
index a8f12ac..76eee23 100644
--- a/system.h
+++ b/system.h
@@ -68,6 +68,16 @@ struct macvlan_config {
unsigned char macaddr[6];
};
+enum vlan_proto {
+ VLAN_PROTO_8021Q = 0x8100,
+ VLAN_PROTO_8021AD = 0x88A8
+};
+
+struct vlandev_config {
+ enum vlan_proto proto;
+ uint16_t vid;
+};
+
static inline int system_get_addr_family(unsigned int flags)
{
if ((flags & DEVADDR_FAMILY) == DEVADDR_INET6)
@@ -97,6 +107,9 @@ int system_macvlan_del(struct device *macvlan);
int system_vlan_add(struct device *dev, int id);
int system_vlan_del(struct device *dev);
+int system_vlandev_add(struct device *vlandev, struct device *dev, struct vlandev_config *cfg);
+int system_vlandev_del(struct device *vlandev);
+
void system_if_clear_state(struct device *dev);
int system_if_up(struct device *dev);
int system_if_down(struct device *dev);