xref: /freebsd/share/man/man4/ng_vlan.4 (revision a64729f5077d77e13b9497cb33ecb3c82e606ee8)
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.Dd March 1, 2004
26.Dt NG_VLAN 4
27.Os
28.Sh NAME
29.Nm ng_vlan
30.Nd IEEE 802.1Q VLAN tagging netgraph node type
31.Sh SYNOPSIS
32.In sys/types.h
33.In netgraph.h
34.In netgraph/ng_vlan.h
35.Sh DESCRIPTION
36The
37.Nm vlan
38node type multiplexes frames tagged according to
39the IEEE 802.1Q standard between different hooks.
40.Pp
41Each node has two special hooks,
42.Va downstream
43and
44.Va nomatch ,
45and an arbitrary number of
46.Dq vlan
47hooks, each associated with a particular VLAN tag.
48.Pp
49An
50.Dv ETHERTYPE_VLAN
51frame received on the
52.Va downstream
53hook with a tag that the node has been configured to filter
54is sent out the corresponding
55.Dq vlan
56hook.
57If it does not match any of the configured tags, or is not of a type
58.Dv ETHERTYPE_VLAN ,
59it is sent out the
60.Va nomatch
61hook.
62If the
63.Va nomatch
64hook is not connected, the packet is dropped.
65.Pp
66An Ethernet frame received on the
67.Va nomatch
68hook is passed unmodified to the
69.Va downstream
70hook.
71.Pp
72An Ethernet frame received on any of the
73.Dq vlan
74hooks is tagged accordingly and sent out the
75.Va downstream
76hook.
77.Sh HOOKS
78This node type supports the following hooks:
79.Bl -tag -width "Aq Em any valid name"
80.It Va downstream
81Typically this hook would be connected to a
82.Xr ng_ether 4
83node, using the
84.Va lower
85hook.
86.It Va nomatch
87Typically this hook would also be connected to an
88.Xr ng_ether 4
89type node using the
90.Va upper
91hook.
92.It Aq Em "any valid name"
93Any other hook name will be accepted and should later be associated with
94a particular tag.
95Typically this hook would be attached to an
96.Xr ng_eiface 4
97type node using the
98.Va ether
99hook.
100.El
101.Sh CONTROL MESSAGES
102This node type supports the generic control messages, plus the following:
103.Bl -tag -width foo
104.It Dv NGM_VLAN_ADD_FILTER Pq Ic addfilter
105Associates a hook with the tag.
106.It Dv NGM_VLAN_DEL_FILTER Pq Ic delfilter
107Disassociates a hook from the tag.
108.It Dv NGM_VLAN_GET_TABLE Pq Ic gettable
109Returns a table of all hook/tag associations.
110.El
111.Sh EXAMPLES
112.Bd -literal
113#!/bin/sh
114
115ETHER_IF=rl0
116
117ngctl -f- <<EOF
118shutdown ${ETHER_IF}:
119mkpeer ${ETHER_IF}: vlan lower downstream
120name ${ETHER_IF}:lower vlan
121connect ${ETHER_IF}: vlan: upper nomatch
122EOF
123
124ngctl mkpeer vlan: eiface vlan123 ether
125ngctl msg vlan: addfilter '{ vlan=123 hook="vlan123" }'
126.Ed
127.Sh SHUTDOWN
128This node shuts down upon receipt of a
129.Dv NGM_SHUTDOWN
130control message, or when all hooks have been disconnected.
131.Sh SEE ALSO
132.Xr netgraph 4 ,
133.Xr ng_eiface 4 ,
134.Xr ng_ether 4 ,
135.Xr ngctl 8 ,
136.Xr nghook 8
137.Sh HISTORY
138The
139.Nm
140node type appeared in
141.Fx 4.10 .
142.Sh AUTHORS
143.An Ruslan Ermilov Aq Mt ru@FreeBSD.org
144