2000-01-25 20:26:52 +00:00
|
|
|
.\" Copyright (c) 2000 Whistle Communications, Inc.
|
|
|
|
.\" All rights reserved.
|
2001-07-14 19:41:16 +00:00
|
|
|
.\"
|
2000-01-25 20:26:52 +00:00
|
|
|
.\" Subject to the following obligations and disclaimer of warranty, use and
|
|
|
|
.\" redistribution of this software, in source or object code forms, with or
|
|
|
|
.\" without modifications are expressly permitted by Whistle Communications;
|
|
|
|
.\" provided, however, that:
|
|
|
|
.\" 1. Any and all reproductions of the source or object code must include the
|
|
|
|
.\" copyright notice above and the following disclaimer of warranties; and
|
|
|
|
.\" 2. No rights are granted, in any manner or form, to use Whistle
|
|
|
|
.\" Communications, Inc. trademarks, including the mark "WHISTLE
|
|
|
|
.\" COMMUNICATIONS" on advertising, endorsements, or otherwise except as
|
|
|
|
.\" such appears in the above copyright notice or in the software.
|
2001-07-14 19:41:16 +00:00
|
|
|
.\"
|
2000-01-25 20:26:52 +00:00
|
|
|
.\" THIS SOFTWARE IS BEING PROVIDED BY WHISTLE COMMUNICATIONS "AS IS", AND
|
|
|
|
.\" TO THE MAXIMUM EXTENT PERMITTED BY LAW, WHISTLE COMMUNICATIONS MAKES NO
|
|
|
|
.\" REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, REGARDING THIS SOFTWARE,
|
|
|
|
.\" INCLUDING WITHOUT LIMITATION, ANY AND ALL IMPLIED WARRANTIES OF
|
|
|
|
.\" MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT.
|
|
|
|
.\" WHISTLE COMMUNICATIONS DOES NOT WARRANT, GUARANTEE, OR MAKE ANY
|
|
|
|
.\" REPRESENTATIONS REGARDING THE USE OF, OR THE RESULTS OF THE USE OF THIS
|
|
|
|
.\" SOFTWARE IN TERMS OF ITS CORRECTNESS, ACCURACY, RELIABILITY OR OTHERWISE.
|
|
|
|
.\" IN NO EVENT SHALL WHISTLE COMMUNICATIONS BE LIABLE FOR ANY DAMAGES
|
|
|
|
.\" RESULTING FROM OR ARISING OUT OF ANY USE OF THIS SOFTWARE, INCLUDING
|
|
|
|
.\" WITHOUT LIMITATION, ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
|
|
|
|
.\" PUNITIVE, OR CONSEQUENTIAL DAMAGES, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
|
|
.\" SERVICES, LOSS OF USE, DATA OR PROFITS, HOWEVER CAUSED AND UNDER ANY
|
|
|
|
.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
|
|
.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
|
|
|
.\" THIS SOFTWARE, EVEN IF WHISTLE COMMUNICATIONS IS ADVISED OF THE POSSIBILITY
|
|
|
|
.\" OF SUCH DAMAGE.
|
2001-07-14 19:41:16 +00:00
|
|
|
.\"
|
2000-10-26 15:30:44 +00:00
|
|
|
.\" Author: Archie Cobbs <archie@FreeBSD.org>
|
2000-01-25 20:26:52 +00:00
|
|
|
.\"
|
|
|
|
.\" $FreeBSD$
|
|
|
|
.\"
|
2011-06-23 10:43:36 +00:00
|
|
|
.Dd June 23, 2011
|
2000-05-04 17:40:13 +00:00
|
|
|
.Dt NG_ETHER 4
|
2001-07-10 15:31:11 +00:00
|
|
|
.Os
|
2000-01-25 20:26:52 +00:00
|
|
|
.Sh NAME
|
|
|
|
.Nm ng_ether
|
|
|
|
.Nd Ethernet netgraph node type
|
|
|
|
.Sh SYNOPSIS
|
2001-10-01 16:09:29 +00:00
|
|
|
.In netgraph/ng_ether.h
|
2000-01-25 20:26:52 +00:00
|
|
|
.Sh DESCRIPTION
|
|
|
|
The
|
2004-04-21 19:47:33 +00:00
|
|
|
.Nm ether
|
2000-01-25 20:26:52 +00:00
|
|
|
netgraph node type allows Ethernet interfaces to interact with
|
|
|
|
the
|
2001-07-14 19:41:16 +00:00
|
|
|
.Xr netgraph 4
|
2000-06-27 00:09:49 +00:00
|
|
|
networking subsystem.
|
|
|
|
Once the
|
|
|
|
.Nm
|
2004-04-21 19:47:33 +00:00
|
|
|
module is loaded into the kernel, a node is automatically created
|
2000-06-27 00:09:49 +00:00
|
|
|
for each Ethernet interface in the system.
|
|
|
|
Each node will attempt to name itself with the same name
|
|
|
|
as the associated interface.
|
2000-01-25 20:26:52 +00:00
|
|
|
.Pp
|
2000-06-27 00:09:49 +00:00
|
|
|
Three hooks are supported:
|
2004-04-21 19:47:33 +00:00
|
|
|
.Va lower , upper ,
|
2000-06-27 00:09:49 +00:00
|
|
|
and
|
2004-04-21 19:47:33 +00:00
|
|
|
.Va orphans .
|
2000-06-27 00:09:49 +00:00
|
|
|
The hook name
|
2004-04-21 19:47:33 +00:00
|
|
|
.Va divert
|
2000-06-27 00:09:49 +00:00
|
|
|
may be used as an alias for
|
2004-04-21 19:47:33 +00:00
|
|
|
.Va lower ,
|
2000-06-27 00:09:49 +00:00
|
|
|
and is provided for backward compatibility.
|
2004-04-21 19:47:33 +00:00
|
|
|
In reality, the two names represent the same hook.
|
2000-01-25 20:26:52 +00:00
|
|
|
.Pp
|
|
|
|
The
|
2004-04-21 19:47:33 +00:00
|
|
|
.Va lower
|
2000-06-27 00:09:49 +00:00
|
|
|
hook is a connection to the raw Ethernet device.
|
2004-04-21 19:47:33 +00:00
|
|
|
When connected, all incoming packets are forwarded to this hook,
|
|
|
|
instead of being passed to the kernel for upper layer processing.
|
2000-06-27 00:09:49 +00:00
|
|
|
Writing to this hook results in a raw Ethernet frame being transmitted
|
|
|
|
by the device.
|
|
|
|
Normal outgoing packets are not affected by
|
2004-04-21 19:47:33 +00:00
|
|
|
.Va lower
|
2000-06-27 00:09:49 +00:00
|
|
|
being connected.
|
|
|
|
.Pp
|
2000-01-25 20:26:52 +00:00
|
|
|
The
|
2004-04-21 19:47:33 +00:00
|
|
|
.Va upper
|
2000-06-27 00:09:49 +00:00
|
|
|
hook is a connection to the upper protocol layers.
|
2004-04-21 19:47:33 +00:00
|
|
|
When connected, all outgoing packets are forwarded to this hook,
|
|
|
|
instead of being transmitted by the device.
|
2000-06-27 00:09:49 +00:00
|
|
|
Writing to this hook results in a raw Ethernet frame being received by
|
|
|
|
the kernel just as if it had come in over the wire.
|
|
|
|
Normal incoming packets are not affected by
|
2004-04-21 19:47:33 +00:00
|
|
|
.Va upper
|
2000-06-27 00:09:49 +00:00
|
|
|
being connected.
|
2000-01-25 20:26:52 +00:00
|
|
|
.Pp
|
2000-06-27 00:09:49 +00:00
|
|
|
The
|
2004-04-21 19:47:33 +00:00
|
|
|
.Va orphans
|
2000-06-27 00:09:49 +00:00
|
|
|
hook is equivalent to
|
2004-04-21 19:47:33 +00:00
|
|
|
.Va lower ,
|
2000-06-27 00:09:49 +00:00
|
|
|
except that only unrecognized packets (that would otherwise be discarded)
|
2004-05-16 19:31:35 +00:00
|
|
|
are written to the hook, while other normal incoming traffic is unaffected.
|
|
|
|
Unrecognized packets written to
|
|
|
|
.Va upper
|
|
|
|
will be forwarded back out to
|
2004-04-21 19:47:33 +00:00
|
|
|
.Va orphans
|
2004-05-16 19:31:35 +00:00
|
|
|
if connected.
|
2000-06-27 00:09:49 +00:00
|
|
|
.Pp
|
|
|
|
In all cases, frames are raw Ethernet frames with the standard
|
2000-01-25 20:26:52 +00:00
|
|
|
14 byte Ethernet header (but no checksum).
|
2000-06-27 00:09:49 +00:00
|
|
|
.Pp
|
|
|
|
When no hooks are connected,
|
2004-04-21 19:47:33 +00:00
|
|
|
.Va upper
|
2000-06-27 00:09:49 +00:00
|
|
|
and
|
2004-04-21 19:47:33 +00:00
|
|
|
.Va lower
|
2000-06-27 00:09:49 +00:00
|
|
|
are in effect connected together,
|
|
|
|
so that packets flow normally upwards and downwards.
|
2000-01-25 20:26:52 +00:00
|
|
|
.Sh HOOKS
|
|
|
|
This node type supports the following hooks:
|
2004-04-21 19:47:33 +00:00
|
|
|
.Bl -tag -width ".Va orphans"
|
|
|
|
.It Va lower
|
2000-06-27 00:09:49 +00:00
|
|
|
Connection to the lower device link layer.
|
2004-04-21 19:47:33 +00:00
|
|
|
.It Va upper
|
2000-06-27 00:09:49 +00:00
|
|
|
Connection to the upper protocol layers.
|
2004-04-21 19:47:33 +00:00
|
|
|
.It Va orphans
|
2000-06-27 00:09:49 +00:00
|
|
|
Like
|
2004-04-21 19:47:33 +00:00
|
|
|
.Va lower ,
|
2000-06-27 00:09:49 +00:00
|
|
|
but only receives unrecognized packets.
|
2000-01-25 20:26:52 +00:00
|
|
|
.El
|
|
|
|
.Sh CONTROL MESSAGES
|
2000-06-27 00:09:49 +00:00
|
|
|
This node type supports the generic control messages, plus the following:
|
2012-11-13 20:41:36 +00:00
|
|
|
.Bl -tag -width foo
|
|
|
|
.It Dv NGM_ETHER_GET_IFNAME Pq Ic getifname
|
2004-04-21 19:47:33 +00:00
|
|
|
Returns the name of the associated interface as a
|
|
|
|
.Dv NUL Ns -terminated
|
|
|
|
.Tn ASCII
|
|
|
|
string.
|
2000-06-27 00:09:49 +00:00
|
|
|
Normally this is the same as the name of the node.
|
2012-11-13 20:41:36 +00:00
|
|
|
.It Dv NGM_ETHER_GET_IFINDEX Pq Ic getifindex
|
2000-06-27 00:09:49 +00:00
|
|
|
Returns the global index of the associated interface as a 32 bit integer.
|
2012-11-13 20:41:36 +00:00
|
|
|
.It Dv NGM_ETHER_GET_ENADDR Pq Ic getenaddr
|
2000-08-07 18:53:42 +00:00
|
|
|
Returns the device's unique six byte Ethernet address.
|
2012-11-13 20:41:36 +00:00
|
|
|
.It Dv NGM_ETHER_SET_ENADDR Pq Ic setenaddr
|
2000-08-15 01:17:44 +00:00
|
|
|
Sets the device's unique six byte Ethernet address.
|
|
|
|
This control message is equivalent to using the
|
|
|
|
.Dv SIOCSIFLLADDR
|
|
|
|
.Xr ioctl 2
|
|
|
|
system call.
|
2012-11-13 20:41:36 +00:00
|
|
|
.It Dv NGM_ETHER_SET_PROMISC Pq Ic setpromisc
|
2000-08-07 18:53:42 +00:00
|
|
|
Enable or disable promiscuous mode.
|
|
|
|
This message includes a single 32 bit integer flag that enables or
|
|
|
|
disables promiscuous mode on the interface.
|
2004-04-21 19:47:33 +00:00
|
|
|
Any non-zero value enables promiscuous mode.
|
2012-11-13 20:41:36 +00:00
|
|
|
.It Dv NGM_ETHER_GET_PROMISC Pq Ic getpromisc
|
2000-08-15 01:17:44 +00:00
|
|
|
Get the current value of the node's promiscuous flag.
|
|
|
|
The returned value is always either one or zero.
|
|
|
|
Note that this flag reflects the node's own promiscuous setting
|
|
|
|
and does not necessarily reflect the promiscuous state of the actual
|
|
|
|
interface, which can be affected by other means (e.g.,
|
2000-08-15 07:36:08 +00:00
|
|
|
.Xr bpf 4 ) .
|
2012-11-13 20:41:36 +00:00
|
|
|
.It Dv NGM_ETHER_SET_AUTOSRC Pq Ic setautosrc
|
2000-08-07 18:53:42 +00:00
|
|
|
Sets the automatic source address override flag.
|
2000-08-08 16:26:03 +00:00
|
|
|
This message includes a single 32 bit integer flag that causes
|
2000-08-07 18:53:42 +00:00
|
|
|
all outgoing packets to have their source Ethernet
|
|
|
|
address field overwritten with the device's unique Ethernet address.
|
|
|
|
If this flag is set to zero, the source address in outgoing packets
|
|
|
|
is not modified.
|
2006-08-04 18:28:57 +00:00
|
|
|
The default setting for this flag is disabled.
|
2012-11-13 20:41:36 +00:00
|
|
|
.It Dv NGM_ETHER_GET_AUTOSRC Pq Ic getautosrc
|
2000-08-15 01:17:44 +00:00
|
|
|
Get the current value of the node's source address override flag.
|
|
|
|
The returned value is always either one or zero.
|
2012-11-13 20:41:36 +00:00
|
|
|
.It Dv NGM_ETHER_ADD_MULTI Pq Ic addmulti
|
2005-02-12 11:52:14 +00:00
|
|
|
Join Ethernet multicast group.
|
|
|
|
This control message is equivalent to using the
|
|
|
|
.Dv SIOCADDMULTI
|
|
|
|
.Xr ioctl 2
|
|
|
|
system call.
|
2012-11-13 20:41:36 +00:00
|
|
|
.It Dv NGM_ETHER_DEL_MULTI Pq Ic delmulti
|
2005-02-12 11:52:14 +00:00
|
|
|
Leave Ethernet multicast group.
|
|
|
|
This control message is equivalent to using the
|
|
|
|
.Dv SIOCDELMULTI
|
|
|
|
.Xr ioctl 2
|
|
|
|
system call.
|
2012-11-13 20:41:36 +00:00
|
|
|
.It Dv NGM_ETHER_DETACH Pq Ic detach
|
2005-02-14 18:49:19 +00:00
|
|
|
Detach from underlying Ethernet interface and shut down node.
|
2000-06-27 00:09:49 +00:00
|
|
|
.El
|
2000-01-25 20:26:52 +00:00
|
|
|
.Sh SHUTDOWN
|
2004-04-21 19:47:33 +00:00
|
|
|
Upon receipt of the
|
2000-01-25 20:26:52 +00:00
|
|
|
.Dv NGM_SHUTDOWN
|
2000-08-07 18:53:42 +00:00
|
|
|
control message, all hooks are disconnected, promiscuous mode is disabled,
|
|
|
|
but the node is not removed.
|
2005-02-14 17:43:42 +00:00
|
|
|
Node can be shut down only using
|
|
|
|
.Dv NGM_ETHER_DETACH
|
|
|
|
control message.
|
2004-04-21 19:47:33 +00:00
|
|
|
If the interface itself is detached (e.g., because of PC Card removal), the
|
2000-06-27 00:09:49 +00:00
|
|
|
node disappears as well.
|
2000-11-17 11:44:16 +00:00
|
|
|
.Sh EXAMPLES
|
2000-06-27 00:09:49 +00:00
|
|
|
This command dumps all unrecognized packets received by the
|
2004-04-21 19:47:33 +00:00
|
|
|
.Dq Li fxp0
|
|
|
|
interface to standard output decoded in hex and
|
|
|
|
.Tn ASCII :
|
|
|
|
.Pp
|
|
|
|
.Dl "nghook -a fxp0: orphans"
|
2000-06-27 00:09:49 +00:00
|
|
|
.Pp
|
|
|
|
This command sends the contents of
|
2004-04-21 19:47:33 +00:00
|
|
|
.Pa sample.pkt
|
2000-06-27 00:09:49 +00:00
|
|
|
out the interface
|
2004-04-21 19:47:33 +00:00
|
|
|
.Dq Li fxp0 :
|
|
|
|
.Pp
|
|
|
|
.Dl "cat sample.pkt | nghook fxp0: orphans"
|
2000-06-27 00:09:49 +00:00
|
|
|
.Pp
|
|
|
|
These commands insert an
|
|
|
|
.Xr ng_tee 4
|
2004-04-21 19:47:33 +00:00
|
|
|
node between the
|
|
|
|
.Va lower
|
|
|
|
and
|
|
|
|
.Va upper
|
|
|
|
protocol layers, which can be used for
|
2000-06-27 00:09:49 +00:00
|
|
|
tracing packet flow, statistics, etc.:
|
2000-05-03 16:46:10 +00:00
|
|
|
.Bd -literal -offset indent
|
2000-06-27 00:09:49 +00:00
|
|
|
ngctl mkpeer fxp0: tee lower right
|
|
|
|
ngctl connect fxp0: lower upper left
|
2000-05-03 16:46:10 +00:00
|
|
|
.Ed
|
2005-01-21 08:36:40 +00:00
|
|
|
.Sh SEE ALSO
|
|
|
|
.Xr arp 4 ,
|
|
|
|
.Xr netgraph 4 ,
|
|
|
|
.Xr netintro 4 ,
|
|
|
|
.Xr ifconfig 8 ,
|
|
|
|
.Xr ngctl 8 ,
|
|
|
|
.Xr nghook 8
|
|
|
|
.Sh AUTHORS
|
2014-06-26 21:46:14 +00:00
|
|
|
.An Julian Elischer Aq Mt julian@FreeBSD.org
|
|
|
|
.An Archie Cobbs Aq Mt archie@FreeBSD.org
|
2001-05-16 17:30:15 +00:00
|
|
|
.Sh BUGS
|
|
|
|
The automatic KLD module loading mechanism that works for most
|
2004-04-21 19:47:33 +00:00
|
|
|
other Netgraph node types does not work for the
|
|
|
|
.Nm ether
|
2001-05-16 17:30:15 +00:00
|
|
|
node type,
|
|
|
|
because
|
2004-04-21 19:47:33 +00:00
|
|
|
.Nm ether
|
2001-05-16 17:30:15 +00:00
|
|
|
nodes are not created on demand; instead, they are created when
|
|
|
|
Ethernet interfaces are attached or when the KLD is first loaded.
|
|
|
|
Therefore, if the KLD is not statically compiled into the kernel,
|
|
|
|
it is necessary to load the KLD manually in order to bring the
|
2004-04-21 19:47:33 +00:00
|
|
|
.Nm ether
|
2001-05-16 17:30:15 +00:00
|
|
|
nodes into existence.
|