111 lines · 2.8 KB · Text
RawDownload
.TH ETHER 3 .SH NAMEether \- Ethernet device.SH SYNOPSIS.nf.B bind -a #l\fIn\fP /net .BI /net/ether n /clone.BI /net/ether n /addr.BI /net/ether n /ifstats.BI /net/ether n /stats.BI /net/ether n /[0-7].BI /net/ether n /[0-7]/data.BI /net/ether n /[0-7]/ctl.BI /net/ether n /[0-7]/ifstats.BI /net/ether n /[0-7]/stats.BI /net/ether n /[0-7]/type.fi.SH DESCRIPTIONThe Ethernet interface,.BI /net/ether n\f1,is a directorycontaining subdirectories, one for each distinct Ethernet packet type,and.BR clone ,.BR addr ,.BR ifstats ,and.B statsfiles..B statsand.B ifstatsare the same as in the subdirectories (see below).Reading.B addrreturns the MAC address of this interface in hex with no punctuationand no trailing newline.The number.I n(optional in the bind)is the device number of the card, permitting multiple cards to be used on a single machine..PPEach directory contains files to control the associated connection,receive and send data,and supply statistics.Incoming Ethernet packets are demultiplexed by packet type and passed upthe corresponding open connection.Reading from the.B datafile reads packets of that type arriving from the network.A read will terminate at packet boundaries.Each write to the.B datafile causes a packet to be sent.The Ethernet address of the interface is inserted intothe packet header as the source address..PPA connection is assigned to a packet type by opening its.B ctlfile andwriting .B connect.I nwhere.I nis a decimal integer constant identifying the Ethernet packet type.A type of \-1 enables the connection to receive copies of packets ofall types.  A type of \-2 enables the connection to receive copies ofthe first 64 bytes of packets of all types.If multiple connections are assigned to a given packet typea copy of each packet is passed up each connection..PPSome interfaces also accept unique options when written to the.I ctl(or.IR clone )file; see the description of.I wavelanin.IR plan9.ini (8)..PPReading the.B ctlfile returns the decimal index of the associated connection, 0 through 7.Reading the.B typefile returns the decimal value of the assigned Ethernet packet type.Reading the.B statsfile returns status information such as the Ethernet address of thecard and general statistics, independent of the interface;.B ifstatscontains device-specific data and statistics about the card..PPAn interface normally receives only those packets whose destination address is that of the interface or is thebroadcast address,.BR ff:ff:ff:ff:ff:ff .The interface can be made to receive all packets on thenetwork by writing the string .B promiscuousto the.B ctlfile. The interface remains promiscuous until the control file isclosed.The extra packets are passed up connections only of types \-1and \-2..SH SOURCE.B /sys/src/9/*/devether.c