diff options
| author | Jacob McDonnell <jacob@jacobmcdonnell.com> | 2026-04-25 19:55:43 -0400 |
|---|---|---|
| committer | Jacob McDonnell <jacob@jacobmcdonnell.com> | 2026-04-25 19:55:43 -0400 |
| commit | ac5e55f5f2af5b92794c2aded46c6bae85b5f5ed (patch) | |
| tree | 9367490586c84cba28652e443e3166d66c33b0d9 /static/freebsd/man4/ng_etf.4 3.html | |
| parent | 253e67c8b3a72b3a4757fdbc5845297628db0a4a (diff) | |
docs: Added All FreeBSD Manuals
Diffstat (limited to 'static/freebsd/man4/ng_etf.4 3.html')
| -rw-r--r-- | static/freebsd/man4/ng_etf.4 3.html | 146 |
1 files changed, 146 insertions, 0 deletions
diff --git a/static/freebsd/man4/ng_etf.4 3.html b/static/freebsd/man4/ng_etf.4 3.html new file mode 100644 index 00000000..901ddd73 --- /dev/null +++ b/static/freebsd/man4/ng_etf.4 3.html @@ -0,0 +1,146 @@ +<table class="head"> + <tr> + <td class="head-ltitle">NG_ETF(4)</td> + <td class="head-vol">Device Drivers Manual</td> + <td class="head-rtitle">NG_ETF(4)</td> + </tr> +</table> +<div class="manual-text"> +<section class="Sh"> +<h1 class="Sh" id="NAME"><a class="permalink" href="#NAME">NAME</a></h1> +<p class="Pp"><code class="Nm">ng_etf</code> — <span class="Nd">Ethertype + filtering netgraph node type</span></p> +</section> +<section class="Sh"> +<h1 class="Sh" id="SYNOPSIS"><a class="permalink" href="#SYNOPSIS">SYNOPSIS</a></h1> +<p class="Pp"><code class="In">#include + <<a class="In">netgraph.h</a>></code> + <br/> + <code class="In">#include + <<a class="In">netgraph/ng_etf.h</a>></code></p> +</section> +<section class="Sh"> +<h1 class="Sh" id="DESCRIPTION"><a class="permalink" href="#DESCRIPTION">DESCRIPTION</a></h1> +<p class="Pp">The <code class="Nm">etf</code> node type multiplexes and filters + data between hooks on the basis of the ethertype found in an Ethernet + header, presumed to be in the first 14 bytes of the data. Incoming Ethernet + frames are accepted on the <i class="Em">downstream</i> hook and if the + ethertype matches a value which the node has been configured to filter, the + packet is forwarded out the hook which was identified at the time that value + was configured. If it does not match a configured value, it is passed to the + <i class="Em">nomatch</i> hook. If the <i class="Em">nomatch</i> hook is not + connected, the packet is dropped.</p> +<p class="Pp">Packets travelling in the other direction (towards the + <i class="Em">downstream</i> hook) are also examined and filtered. If a + packet has an ethertype that matches one of the values configured into the + node, it must have arrived in on the hook for which that value was + configured, otherwise it will be discarded. Ethertypes of values other than + those configured by the control messages must have arrived via the + <i class="Em">nomatch</i> hook.</p> +</section> +<section class="Sh"> +<h1 class="Sh" id="HOOKS"><a class="permalink" href="#HOOKS">HOOKS</a></h1> +<p class="Pp">This node type supports the following hooks:</p> +<dl class="Bl-tag"> + <dt id="downstream"><a class="permalink" href="#downstream"><i class="Em">downstream</i></a></dt> + <dd>Typically this hook would be connected to a <a class="Xr">ng_ether(4)</a> + node, using the + <a class="permalink" href="#lower"><i class="Em" id="lower">lower</i></a> + hook.</dd> + <dt id="nomatch"><a class="permalink" href="#nomatch"><i class="Em">nomatch</i></a></dt> + <dd>Typically this hook would also be connected to an + <a class="Xr">ng_ether(4)</a> type node using the + <a class="permalink" href="#upper"><i class="Em" id="upper">upper</i></a> + hook.</dd> + <dt id="any">⟨<a class="permalink" href="#any"><i class="Em">any legal + name</i></a>⟩</dt> + <dd>Any other hook name will be accepted and can be used as the match target + of an ethertype. Typically this hook would be attached to a protocol + handling node that requires and generates packets with a particular set of + ethertypes.</dd> +</dl> +</section> +<section class="Sh"> +<h1 class="Sh" id="CONTROL_MESSAGES"><a class="permalink" href="#CONTROL_MESSAGES">CONTROL + MESSAGES</a></h1> +<p class="Pp">This node type supports the generic control messages, plus the + following:</p> +<dl class="Bl-tag"> + <dt id="NGM_ETF_GET_STATUS"><a class="permalink" href="#NGM_ETF_GET_STATUS"><code class="Dv">NGM_ETF_GET_STATUS</code></a> + (<code class="Ic">getstatus</code>)</dt> + <dd>This command returns a <var class="Vt">struct ng_etfstat</var> containing + node statistics for packet counts.</dd> + <dt id="NGM_ETF_SET_FILTER"><a class="permalink" href="#NGM_ETF_SET_FILTER"><code class="Dv">NGM_ETF_SET_FILTER</code></a> + (<code class="Ic">setfilter</code>)</dt> + <dd>Sets the a new ethertype filter into the node and specifies the hook to + and from which packets of that type should use. The hook and ethertype are + specified in a structure of type <var class="Vt">struct + ng_etffilter</var>: + <div class="Bd Pp Bd-indent Li"> + <pre>struct ng_etffilter { + char matchhook[NG_HOOKSIZ]; /* hook name */ + uint16_t ethertype; /* this ethertype to this hook */ +};</pre> + </div> + </dd> +</dl> +</section> +<section class="Sh"> +<h1 class="Sh" id="EXAMPLES"><a class="permalink" href="#EXAMPLES">EXAMPLES</a></h1> +<p class="Pp">Using <a class="Xr">ngctl(8)</a> it is possible to set a filter in + place from the command line as follows:</p> +<div class="Bd Pp Bd-indent Li"> +<pre>#!/bin/sh +ETHER_IF=fxp0 +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} }</pre> +</div> +</section> +<section class="Sh"> +<h1 class="Sh" id="SHUTDOWN"><a class="permalink" href="#SHUTDOWN">SHUTDOWN</a></h1> +<p class="Pp">This node shuts down upon receipt of a + <code class="Dv">NGM_SHUTDOWN</code> control message, or when all hooks have + been disconnected.</p> +</section> +<section class="Sh"> +<h1 class="Sh" id="SEE_ALSO"><a class="permalink" href="#SEE_ALSO">SEE + ALSO</a></h1> +<p class="Pp"><a class="Xr">netgraph(4)</a>, <a class="Xr">ng_ether(4)</a>, + <a class="Xr">ngctl(8)</a>, <a class="Xr">nghook(8)</a></p> +</section> +<section class="Sh"> +<h1 class="Sh" id="HISTORY"><a class="permalink" href="#HISTORY">HISTORY</a></h1> +<p class="Pp">The <code class="Nm">ng_etf</code> node type was implemented in + <span class="Ux">FreeBSD 5.0</span>.</p> +</section> +<section class="Sh"> +<h1 class="Sh" id="AUTHORS"><a class="permalink" href="#AUTHORS">AUTHORS</a></h1> +<p class="Pp"><span class="An">Julian Elischer</span> + <<a class="Mt" href="mailto:julian@FreeBSD.org">julian@FreeBSD.org</a>></p> +</section> +</div> +<table class="foot"> + <tr> + <td class="foot-date">November 13, 2012</td> + <td class="foot-os">FreeBSD 15.0</td> + </tr> +</table> |
