ng_vlan (4)
Leading comments
Copyright (c) 2003 Ruslan Ermilov All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or oth...
NAME
ng_vlan - IEEE 802.1Q VLAN tagging netgraph node typeSYNOPSIS
In sys/types.h In netgraph.h In netgraph/ng_vlan.hDESCRIPTION
The vlan node type multiplexes frames tagged according to the IEEE 802.1Q standard between different hooks.Each node has two special hooks, downstream and nomatch and an arbitrary number of ``vlan'' hooks, each associated with a particular VLAN tag.
An ETHERTYPE_VLAN frame received on the downstream hook with a tag that the node has been configured to filter is sent out the corresponding ``vlan'' hook. If it does not match any of the configured tags, or is not of a type ETHERTYPE_VLAN it is sent out the nomatch hook. If the nomatch hook is not connected, the packet is dropped.
An Ethernet frame received on the nomatch hook is passed unmodified to the downstream hook.
An Ethernet frame received on any of the ``vlan'' hooks is tagged accordingly and sent out the downstream hook.
HOOKS
This node type supports the following hooks:- downstream
- Typically this hook would be connected to a ng_ether4 node, using the lower hook.
- nomatch
- Typically this hook would also be connected to an ng_ether4 type node using the upper hook.
- Aq any valid name
- Any other hook name will be accepted and should later be associated with a particular tag. Typically this hook would be attached to an ng_eiface4 type node using the ether hook.
CONTROL MESSAGES
This node type supports the generic control messages, plus the following:- NGM_VLAN_ADD_FILTER (addfilter )
- Associates a hook with the tag.
- NGM_VLAN_DEL_FILTER (delfilter )
- Disassociates a hook from the tag.
- NGM_VLAN_GET_TABLE (gettable )
- Returns a table of all hook/tag associations.
EXAMPLES
#!/bin/sh ETHER_IF=rl0 ngctl -f- <<EOF shutdown ${ETHER_IF}: mkpeer ${ETHER_IF}: vlan lower downstream name ${ETHER_IF}:lower vlan connect ${ETHER_IF}: vlan: upper nomatch EOF ngctl mkpeer vlan: eiface vlan123 ether ngctl msg vlan: addfilter '{ vlan=123 hook="vlan123" }'