1.\" Copyright (c) 2003 Ruslan Ermilov 2.\" All rights reserved. 3.\" 4.\" Redistribution and use in source and binary forms, with or without 5.\" modification, are permitted provided that the following conditions 6.\" are met: 7.\" 1. Redistributions of source code must retain the above copyright 8.\" notice, this list of conditions and the following disclaimer. 9.\" 2. Redistributions in binary form must reproduce the above copyright 10.\" notice, this list of conditions and the following disclaimer in the 11.\" documentation and/or other materials provided with the distribution. 12.\" 13.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 14.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 15.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 16.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 17.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 18.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 19.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 20.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 21.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 22.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 23.\" SUCH DAMAGE. 24.\" 25.\" $FreeBSD$ 26.\" 27.Dd March 1, 2004 28.Dt NG_VLAN 4 29.Os 30.Sh NAME 31.Nm ng_vlan 32.Nd IEEE 802.1Q VLAN tagging netgraph node type 33.Sh SYNOPSIS 34.In sys/types.h 35.In netgraph.h 36.In netgraph/ng_vlan.h 37.Sh DESCRIPTION 38The 39.Nm vlan 40node type multiplexes frames tagged according to 41the IEEE 802.1Q standard between different hooks. 42.Pp 43Each node has two special hooks, 44.Va downstream 45and 46.Va nomatch , 47and an arbitrary number of 48.Dq vlan 49hooks, each associated with a particular VLAN tag. 50.Pp 51An 52.Dv ETHERTYPE_VLAN 53frame received on the 54.Va downstream 55hook with a tag that the node has been configured to filter 56is sent out the corresponding 57.Dq vlan 58hook. 59If it does not match any of the configured tags, or is not of a type 60.Dv ETHERTYPE_VLAN , 61it is sent out the 62.Va nomatch 63hook. 64If the 65.Va nomatch 66hook is not connected, the packet is dropped. 67.Pp 68An Ethernet frame received on the 69.Va nomatch 70hook is passed unmodified to the 71.Va downstream 72hook. 73.Pp 74An Ethernet frame received on any of the 75.Dq vlan 76hooks is tagged accordingly and sent out the 77.Va downstream 78hook. 79.Sh HOOKS 80This node type supports the following hooks: 81.Bl -tag -width "Aq Em any valid name" 82.It Va downstream 83Typically this hook would be connected to a 84.Xr ng_ether 4 85node, using the 86.Va lower 87hook. 88.It Va nomatch 89Typically this hook would also be connected to an 90.Xr ng_ether 4 91type node using the 92.Va upper 93hook. 94.It Aq Em "any valid name" 95Any other hook name will be accepted and should later be associated with 96a particular tag. 97Typically this hook would be attached to an 98.Xr ng_eiface 4 99type node using the 100.Va ether 101hook. 102.El 103.Sh CONTROL MESSAGES 104This node type supports the generic control messages, plus the following: 105.Bl -tag -width foo 106.It Dv NGM_VLAN_ADD_FILTER Pq Ic addfilter 107Associates a hook with the tag. 108.It Dv NGM_VLAN_DEL_FILTER Pq Ic delfilter 109Disassociates a hook from the tag. 110.It Dv NGM_VLAN_GET_TABLE Pq Ic gettable 111Returns a table of all hook/tag associations. 112.El 113.Sh EXAMPLES 114.Bd -literal 115#!/bin/sh 116 117ETHER_IF=rl0 118 119ngctl -f- <<EOF 120shutdown ${ETHER_IF}: 121mkpeer ${ETHER_IF}: vlan lower downstream 122name ${ETHER_IF}:lower vlan 123connect ${ETHER_IF}: vlan: upper nomatch 124EOF 125 126ngctl mkpeer vlan: eiface vlan123 ether 127ngctl msg vlan: addfilter '{ vlan=123 hook="vlan123" }' 128.Ed 129.Sh SHUTDOWN 130This node shuts down upon receipt of a 131.Dv NGM_SHUTDOWN 132control message, or when all hooks have been disconnected. 133.Sh SEE ALSO 134.Xr netgraph 4 , 135.Xr ng_eiface 4 , 136.Xr ng_ether 4 , 137.Xr ngctl 8 , 138.Xr nghook 8 139.Sh HISTORY 140The 141.Nm 142node type appeared in 143.Fx 4.10 . 144.Sh AUTHORS 145.An Ruslan Ermilov Aq ru@FreeBSD.org 146