1
0

ether 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  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. .BI /net/ether n /clone
  8. .BI /net/ether n /addr
  9. .BI /net/ether n /ifstats
  10. .BI /net/ether n /stats
  11. .BI /net/ether n /[0-7]
  12. .BI /net/ether n /[0-7]/data
  13. .BI /net/ether n /[0-7]/ctl
  14. .BI /net/ether n /[0-7]/ifstats
  15. .BI /net/ether n /[0-7]/stats
  16. .BI /net/ether n /[0-7]/type
  17. .fi
  18. .SH DESCRIPTION
  19. The Ethernet interface,
  20. .BI /net/ether n\f1,
  21. is a directory
  22. containing subdirectories, one for each distinct Ethernet packet type,
  23. and
  24. .BR clone ,
  25. .BR addr ,
  26. .BR ifstats ,
  27. and
  28. .B stats
  29. files.
  30. .B stats
  31. and
  32. .B ifstats
  33. are the same as in the subdirectories (see below).
  34. Reading
  35. .B addr
  36. returns the MAC address of this interface in hex with no punctuation
  37. and no trailing newline.
  38. The number
  39. .I n
  40. (optional in the bind)
  41. is the device number of the card, permitting multiple cards to be used on a single machine.
  42. .PP
  43. Each directory contains files to control the associated connection,
  44. receive and send data,
  45. and supply statistics.
  46. Incoming Ethernet packets are demultiplexed by packet type and passed up
  47. the corresponding open connection.
  48. Reading from the
  49. .B data
  50. file reads packets of that type arriving from the network.
  51. A read will terminate at packet boundaries.
  52. Each write to the
  53. .B data
  54. file causes a packet to be sent.
  55. The Ethernet address of the interface is inserted into
  56. the packet header as the source address.
  57. .PP
  58. A connection is assigned to a packet type by opening its
  59. .B ctl
  60. file and
  61. writing
  62. .B connect
  63. .I n
  64. where
  65. .I n
  66. is a decimal integer constant identifying the Ethernet packet type.
  67. A type of \-1 enables the connection to receive copies of packets of
  68. all types. A type of \-2 enables the connection to receive copies of
  69. the first 64 bytes of packets of all types.
  70. If multiple connections are assigned to a given packet type
  71. a copy of each packet is passed up each connection.
  72. .PP
  73. Some interfaces also accept unique options when written to the
  74. .I ctl
  75. (or
  76. .IR clone )
  77. file; see the description of
  78. .I wavelan
  79. in
  80. .IR plan9.ini (8).
  81. The control messages described in
  82. .IR ip (3)
  83. under
  84. .B "Configuring interfaces"
  85. from
  86. .L bridge
  87. to
  88. .L headersonly
  89. are understood.
  90. The additional control message
  91. .L nonblocking
  92. makes
  93. .I write
  94. systems calls to this interface non-blocking iff
  95. followed by nothing or a non-zero integer;
  96. a following
  97. .L 0
  98. makes
  99. .I writes
  100. block on a full output queue.
  101. .PP
  102. Reading the
  103. .B ctl
  104. file returns the decimal index of the associated connection, 0 through 7.
  105. Reading the
  106. .B type
  107. file returns the decimal value of the assigned Ethernet packet type.
  108. Reading the
  109. .B stats
  110. file returns status information such as the Ethernet address of the
  111. card and general statistics, independent of the interface;
  112. .B ifstats
  113. contains device-specific data and statistics about the card.
  114. .PP
  115. An interface normally receives only those packets whose
  116. destination address is that of the interface or is the
  117. broadcast address,
  118. .BR ff:ff:ff:ff:ff:ff .
  119. The interface can be made to receive all packets on the
  120. network by writing the string
  121. .B promiscuous
  122. to the
  123. .B ctl
  124. file.
  125. The interface remains promiscuous until the control file is
  126. closed.
  127. The extra packets are passed up connections only of types \-1
  128. and \-2.
  129. .SH SOURCE
  130. .B /sys/src/9/*/devether.c