Index: vlan.4 =================================================================== RCS file: /cvs/src/share/man/man4/vlan.4,v retrieving revision 1.41 diff -u -p -r1.41 vlan.4 --- vlan.4 15 Jan 2015 20:37:36 -0000 1.41 +++ vlan.4 21 Apr 2016 12:43:10 -0000 @@ -38,16 +38,20 @@ .Cd "pseudo-device vlan" .Sh DESCRIPTION The -.Nm -Ethernet interface allows construction of virtual LANs when used in -conjunction with IEEE 802.1Q-compliant Ethernet devices. -The -.Nm svlan -Ethernet interface allows construction of IEEE 802.1AD-compliant -provider bridges. -It is normally used for QinQ to stack -.Nm -interfaces on top of it. +.Nm vlan +driver provides network interfaces supporting Virtual Local Area +Networks (VLANs) on Ethernet networks. +.Nm vlan +interfaces implement virtual networks using the IEEE 802.1q protocol. +.Nm svlan +interfaces implement virtual networks using the IEEE 802.1ad protocol. +.Pp +.Nm svlan +interfaces allow construction of IEEE 802.1ad-compliant provider bridges. +.Nm vlan +and +.Nm svlan +interfaces can be configured to provide QinQ or stacked VLANs. .Pp The interfaces can be created at runtime using the .Ic ifconfig vlan Ns Ar N Ic create @@ -59,104 +63,88 @@ The interface itself can be configured w .Xr ifconfig 8 ; see its manual page for more information. .Pp -For -.Nm -devices, -the 802.1Q header specifies the virtual LAN number, and thus allows an -Ethernet switch (or other 802.1Q compliant network devices) to be aware of -which LAN the frame is part of, and in the case of a switch, which -port(s) the frame can go to. -Frames transmitted through the vlan interface will be diverted to the specified -physical interface with a 802.1Q vlan tag added. -802.1Q frames received by the parent interface with the -correct vlan tag will be diverted to the associated -.Nm -pseudo-interface. -.Pp -Frame headers which normally contain the destination host, source host, and -protocol, are altered with additional information, comprising as follows: -16 bits for the ether type (0x8100); -3 bits for the priority field; -1 bit for the canonical field (always 0); -and 12 bits for the vlan identifier. -The priority field may be altered via +.Nm vlan +and +.Nm svlan +interfaces must be configured with a parent Ethernet interface to +operate, and a virtual network identifier. +Packets transmitted through a +.Nm vlan +or +.Nm svlan +interface will be encapsulated in their respective protocols and +transmitted on the specified physical interface. +802.1q and 802.1ad packets received on the parent interface will be +matched to the +.Nm vlan +and +.Nm svlan +intefaces by their respective protocols and virtual network +identifiers, and decapsulated for reception on the associated virtual +intefaces. +.Pp +The 802.1q and 802.1ad protocols include a priority field which may +be altered via .Xr pf.conf 5 ; see the .Cm prio option for more information. -Following the vlan header is the actual ether type for the frame and length -information. -.Pp -For -.Nm svlan -devices, -the configuration is identical to the -.Nm -interface, the only differences being that it uses a different Ethernet -type (0x88a8) and an independent VLAN ID space on the parent -interface. .Pp -.Nm +.Nm vlan and .Nm svlan -interfaces support the following unique +interfaces support the following .Xr ioctl 2 Ns s : -.Bl -tag -width "SIOCSETVLAN" -offset 3n -.It SIOCGETVLAN -Get the vlan tag and parent for a given vlan interface. -.It SIOCSETVLAN -Set the vlan tag and parent for a given vlan interface. +.Pp +.Bl -tag -width indent -offset 3n +.It Dv SIOCSIFPARENT Fa "struct if_parent *" +Set the parent interface. +The parent may only be configured while the virtual interface is +administratively down. +.It Dv SIOCGIFPARENT Fa "struct if_parent *" +Get the currently configured parent interface. +.It Dv SIOCDIFPARENT Fa "struct ifreq *" +Delete the parent interface configuration. +The parent may only be removed while the virtual interface is +administratively down. +.It Dv SIOCSVNETID Fa "struct ifreq *" +Set the virtual network identifier. +Valid identifiers are in the range 1 to 4095. +.It Dv SIOCGVNETID Fa "struct if_parent *" +Get the currently configured virtual network identifier. +.It Dv SIOCDVNETID Fa "struct ifreq *" +Clear the current virtual network identifier. +Virtual interfaces without a configured virtual network identifier +will use 0 in their protocols tag field. +.It Dv SIOCSIFLLADDR Fa "struct ifreq *" +Configure a custom MAC address on the virtual interface. +When the virtual interface is using a custom MAC address the parent +interface will be configured to promiscuously receive packets. +When operating without a custom MAC address the virtual interface +will inherit the parent interfaces MAC address. +Configuring 00:00:00:00:00:00 as the MAC address will clear the +custom MAC address configuration and resume operation with the +parents MAC address. .El .Pp -.Nm +.Nm vlan and .Nm svlan -interfaces use the following interface capabilities: +interfaces use the following capability on parent interfaces: .Bl -tag -width "IFCAP_VLAN_HWTAGGING" -offset 3n .It IFCAP_VLAN_MTU The parent interface can handle full sized frames, plus the size of the vlan tag. -.It IFCAP_VLAN_HWTAGGING -The parent interface will participate in the tagging of frames. -(This is not supported by -.Nm svlan -interfaces.) .El -.Sh DIAGNOSTICS -.Bl -diag -.It "vlan0: initialized with non-standard mtu N (parent ...)" -The IFCAP_VLAN_MTU capability was not set on the parent interface. -We assume in this event that the parent interface is not capable of handling -frames larger than its MTU. -This will generally result in a non-compliant 802.1Q implementation. .Pp -Some Ethernet chips will either discard or truncate -Ethernet frames that are larger than 1514 bytes. -This causes a problem as 802.1Q tagged frames can be up to 1518 bytes. -Most controller chips can be told not to discard large frames -and/or to increase the allowed frame size. -Refer to the hardware manual for your chip to do this. +.Nm vlan +interfaces use the following capability on parent interfaces: +.Bl -tag -width "IFCAP_VLAN_HWTAGGING" -offset 3n +.It IFCAP_VLAN_HWTAGGING +The parent interface will offload the encapsulation and decapsulation +of 802.1q frames. .El -.Pp -If the IFCAP_VLAN_MTU capability is set on a vlan parent, -.Nm -assumes that the Ethernet chip on the parent can handle -oversized frames. -Either the chip allows 1518 byte frames by default (such as -.Xr rl 4 ) , -the driver has instructed the chip to do so (such as -.Xr fxp 4 -and -.Xr dc 4 ) , -or the driver also takes advantage of a hardware tagging capability, -and thus oversized frames are never actually sent by -.Ox -(such as -.Xr txp 4 -and -.Xr ti 4 ) . .Sh SEE ALSO -.Xr bridge 4 , .Xr inet 4 , .Xr ip 4 , .Xr netintro 4 , @@ -165,13 +153,19 @@ and .Xr ifconfig 8 , .Xr netstart 8 .Rs -.%T IEEE 802.1Q standard +.%T IEEE 802.1q standard .%U http://standards.ieee.org/getieee802/802.1.html .Re .Rs .%Q Provider Bridges, QinQ -.%T IEEE 802.1AD standard +.%T IEEE 802.1ad standard .Re .Sh AUTHORS Originally .An Garrett Wollman Aq Mt wollman@freebsd.org . +.Sh CAVEATS +Some Ethernet chips will either discard or truncate +Ethernet frames that are larger than 1514 bytes. +This causes a problem as 802.1Q tagged frames can be up to 1518 bytes. +Most controller chips can be told not to discard large frames +and/or to increase the allowed frame size.