EXAMPLES
Using ngctl(8) it is possible to set a filter in place from the command line as follows:
#!/bin/sh
ETHER_IF=lnc0
MATCH1=0x834
MATCH2=0x835
cat <<DONE >/tmp/xwert
# Make a new ethertype filter and attach to the Ethernet lower hook.
# first remove left over bits from last time.
shutdown ${ETHER_IF}:lower
mkpeer ${ETHER_IF}: etf lower downstream
# Give it a name to easily refer to it.
name ${ETHER_IF}:lower etf
# Connect the nomatch hook to the upper part of the same interface.
# All unmatched packets will act as if the filter is not present.
connect ${ETHER_IF}: etf: upper nomatch
DONE
ngctl -f /tmp/xwert
# something to set a hook to catch packets and show them.
echo "Unrecognised packets:"
nghook -a etf: newproto &
# Filter two random ethertypes to that hook.
ngctl msg etf: setfilter { matchhook="newproto" ethertype=${MATCH1} }
ngctl msg etf: setfilter { matchhook="newproto" ethertype=${MATCH2} }
DONE
SHUTDOWN
This node shuts down upon receipt of a NGM_SHUTDOWN control message, or when all hooks have been disconnected.
SEE ALSO
netgraph(4), ng_ether(4), ngctl(8), nghook(8)
HISTORY
AUTHORS