]> git.lizzy.rs Git - plan9front.git/blob - sys/man/3/ether
add shr(3) manpage
[plan9front.git] / sys / man / 3 / ether
1 .TH ETHER 3 
2 .SH NAME
3 ether \- Ethernet device
4 .SH SYNOPSIS
5 .nf
6 .B bind -a #l\fIn\fP /net
7
8 .BI /net/ether n /clone
9 .BI /net/ether n /addr
10 .BI /net/ether n /ifstats
11 .BI /net/ether n /stats
12 .BI /net/ether n /[0-7]
13 .BI /net/ether n /[0-7]/data
14 .BI /net/ether n /[0-7]/ctl
15 .BI /net/ether n /[0-7]/ifstats
16 .BI /net/ether n /[0-7]/stats
17 .BI /net/ether n /[0-7]/type
18 .fi
19 .SH DESCRIPTION
20 The Ethernet interface,
21 .BI /net/ether n\f1,
22 is a directory
23 containing subdirectories, one for each distinct Ethernet packet type,
24 and
25 .BR clone ,
26 .BR addr ,
27 .BR ifstats ,
28 and
29 .B stats
30 files.
31 .B stats
32 and
33 .B ifstats
34 are the same as in the subdirectories (see below).
35 Reading
36 .B addr
37 returns the MAC address of this interface in hex with no punctuation
38 and no trailing newline.
39 The number
40 .I n
41 (optional in the bind)
42 is the device number of the card, permitting multiple cards to be used on a single machine.
43 .PP
44 Each directory contains files to control the associated connection,
45 receive and send data,
46 and supply statistics.
47 Incoming Ethernet packets are demultiplexed by packet type and passed up
48 the corresponding open connection.
49 Reading from the
50 .B data
51 file reads packets of that type arriving from the network.
52 A read will terminate at packet boundaries.
53 Each write to the
54 .B data
55 file causes a packet to be sent.
56 The Ethernet address of the interface is inserted into
57 the packet header as the source address.
58 .PP
59 A connection is assigned to a packet type by opening its
60 .B ctl
61 file and
62 writing 
63 .B connect
64 .I n
65 where
66 .I n
67 is a decimal integer constant identifying the Ethernet packet type.
68 A type of \-1 enables the connection to receive copies of packets of
69 all types.  A type of \-2 enables the connection to receive copies of
70 the first 64 bytes of packets of all types.
71 If multiple connections are assigned to a given packet type
72 a copy of each packet is passed up each connection.
73 .PP
74 Some interfaces also accept unique options when written to the
75 .I ctl
76 (or
77 .IR clone )
78 file; see the description of
79 .I wavelan
80 in
81 .IR plan9.ini (8).
82 .PP
83 Reading the
84 .B ctl
85 file returns the decimal index of the associated connection, 0 through 7.
86 Reading the
87 .B type
88 file returns the decimal value of the assigned Ethernet packet type.
89 Reading the
90 .B stats
91 file returns status information such as the Ethernet address of the
92 card and general statistics, independent of the interface;
93 .B ifstats
94 contains device-specific data and statistics about the card.
95 .PP
96 An interface normally receives only those packets whose 
97 destination address is that of the interface or is the
98 broadcast address,
99 .BR ff:ff:ff:ff:ff:ff .
100 The interface can be made to receive all packets on the
101 network by writing the string 
102 .B promiscuous
103 to the
104 .B ctl
105 file. 
106 The interface remains promiscuous until the control file is
107 closed.
108 The extra packets are passed up connections only of types \-1
109 and \-2.
110 .SH SOURCE
111 .B /sys/src/9/*/devether.c