NG_VLAN(4)

✨ ng_vlan β€” the IEEE 802.1Q VLAN tagging netgraph node type ✨

okay bestie, pull up a chair, we're talking about ng_vlan from the Kernel Interfaces Manual (section 4, networking, iykyk) πŸ’…


🌸 SYNOPSIS 🌸

#include <sys/types.h>
#include <netgraph.h>
#include <netgraph/ng_vlan.h>

πŸ¦‹ DESCRIPTION πŸ¦‹

So the vlan node type is literally a little frame multiplexer β€” it takes frames that are tagged per the IEEE 802.1Q standard and shuffles them between different hooks. That's the whole job. She's focused. She's booked and busy. ✨

Every node has two special hooks β€” downstream and nomatch β€” plus as many "vlan" hooks as you want, and each one of those is tied to a specific VLAN tag. No cap.

Here's the tea on how frames move around 🍡:

  • An ETHERTYPE_VLAN frame that shows up on the downstream hook, with a tag the node has been configured to filter, gets sent out the matching "vlan" hook. Slay.
  • If it doesn't match any of the configured tags, or it isn't even an ETHERTYPE_VLAN type, it goes out the nomatch hook instead. And if nomatch isn't connected? The packet is dropped. πŸ’€
  • An Ethernet frame arriving on the nomatch hook gets passed to the downstream hook unmodified β€” no touching, no edits, she's just a courier.
  • An Ethernet frame arriving on any of the "vlan" hooks gets tagged accordingly and sent out the downstream hook.

πŸŽ€ HOOKS πŸŽ€

This node type supports these hooks, bestie:

  • downstream β€” typically you'd connect this one to an ng_ether(4) node, using the lower hook.
  • nomatch β€” typically this one also goes to an ng_ether(4) type node, but using the upper hook.
  • ⟨any valid name⟩ β€” literally any other hook name is accepted, and you should later associate it with a particular tag. Typically you'd attach this kind of hook to an ng_eiface(4) type node using the ether hook.

πŸ’– CONTROL MESSAGES πŸ’–

This node type supports all the generic control messages, plus these little icons:

  • NGM_VLAN_ADD_FILTER (addfilter) β€” associates a hook with the tag. it's giving matchmaker 🫢
  • NGM_VLAN_DEL_FILTER (delfilter) β€” disassociates a hook from the tag. we're breaking up, it's not you it's the table 😭
  • NGM_VLAN_GET_TABLE (gettable) β€” returns a table of all hook/tag associations. the receipts, fr fr πŸ‘‘

🌈 EXAMPLES 🌈

no because this example eats every single time:

#!/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" }'

like, setup, naming, connecting, filter added. main character energy from start to finish ⭐


🧚 SHUTDOWN 🧚

This node shuts down when it gets a NGM_SHUTDOWN control message, or when all hooks have been disconnected. she simply leaves when the party's over πŸ™ˆ


πŸ‘‘ SEE ALSO πŸ‘‘

netgraph(4), ng_eiface(4), ng_ether(4), ngctl(8), nghook(8)


πŸ’œ HISTORY πŸ’œ

The ng_vlan node type appeared in FreeBSD 4.10. a true veteran, honestly.


🌟 AUTHORS 🌟

Ruslan Ermilov <ru@FreeBSD.org>


πŸ’Œ okay that's the whole page, bestie. every flag, every hook, every message, all of it. go forth and tag your frames. periodt. πŸ’…

Debian β€” March 1, 2004 β€” NG_VLAN(4) πŸŽ€ that's the version, that's the date, that's the vibe check passed βœ¨πŸ¦‹πŸŒΈ

πŸ“¦ where this page comes from