ETHER(3) ETHER(3)
NAME
ether - Ethernet device
SYNOPSIS
bind -a #ln /net
/net/ethern/clone
/net/ethern/addr
/net/ethern/ifstats
/net/ethern/stats
/net/ethern/[0-7]
/net/ethern/[0-7]/data
/net/ethern/[0-7]/ctl
/net/ethern/[0-7]/ifstats
/net/ethern/[0-7]/stats
/net/ethern/[0-7]/type
DESCRIPTION
The Ethernet interface, /net/ethern, is a directory contain-
ing subdirectories, one for each distinct Ethernet packet
type, and clone, addr, ifstats, and stats files. stats and
ifstats are the same as in the subdirectories (see below).
Reading addr returns the MAC address of this interface in
hex with no punctuation and no trailing newline. The number
n (optional in the bind) is the device number of the card,
permitting multiple cards to be used on a single machine.
Each directory contains files to control the associated con-
nection, receive and send data, and supply statistics.
Incoming Ethernet packets are demultiplexed by packet type
and passed up the corresponding open connection. Reading
from the data file reads packets of that type arriving from
the network. A read will terminate at packet boundaries.
Each write to the data file causes a packet to be sent. The
Ethernet address of the interface is inserted into the
packet header as the source address.
The following control messages are supported:
bridge
Enable bridging (see bridge(3)).
promiscuous
Set the interface into promiscuous mode, which makes it
accept all incoming packets, whether addressed to it or
not.
connect type
marks the Ethernet packet type as being in use, if not
already in use on this interface. A type of -1 means
Page 1 Plan 9 (printed 10/30/25)
ETHER(3) ETHER(3)
`all' but appears to be a no-op.
addmulti Media-addr
Treat the multicast Media-addr on this interface as a
local address.
delmulti Media-addr
Delete the multicast address Media-addr from this
interface.
scanbs
Make the wireless interface scan for base stations.
headersonly
Set the interface to pass only packet headers, not data
too.
A connection is assigned to a packet type by opening its ctl
file and writing connect n where n is a decimal integer con-
stant identifying the Ethernet packet type. A type of -1
enables the connection to receive copies of packets of all
types. A type of -2 enables the connection to receive
copies of the first 64 bytes of packets of all types. If
multiple connections are assigned to a given packet type a
copy of each packet is passed up each connection.
Some interfaces also accept unique options when written to
the ctl (or clone) file; see the description of wavelan in
plan9.ini(8).
Reading the ctl file returns the decimal index of the asso-
ciated connection, 0 through 7. Reading the type file
returns the decimal value of the assigned Ethernet packet
type. Reading the stats file returns status information
such as the Ethernet address of the card and general statis-
tics, independent of the interface; ifstats contains
device-specific data and statistics about the card.
An interface normally receives only those packets whose des-
tination address is that of the interface or is the broad-
cast address, ff:ff:ff:ff:ff:ff. The interface can be made
to receive all packets on the network by writing the string
promiscuous to the ctl file. The interface remains promiscu-
ous until the control file is closed. The extra packets are
passed up connections only of types -1 and -2.
Writing packets to the data file automatically fills the
source address before sending. To allow implementations of
layer 2 bridges like bridge(3), connections can be set to
bridge mode by writing bridge to the ctl file.
For bridge(3) and ethermultilink(8), the physical interface
Page 2 Plan 9 (printed 10/30/25)
ETHER(3) ETHER(3)
can be bypassed by writing bypass to the ctl file. This
means that packets transmitted on the interface are not
physically sent out but looped back to the bypass data file
and packets received on the physical interface are ignored.
Writing a packet to the bypass data file loops it back as if
it was received on the physical interface.
SEE ALSO
ip(3), bridge(3), plan9.ini(8), ethermultilink(8)
SOURCE
/sys/src/9/port/devether.c
/sys/src/9/port/netif.c
Page 3 Plan 9 (printed 10/30/25)