1
0

ether 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  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. .PP
  82. Reading the
  83. .B ctl
  84. file returns the decimal index of the associated connection, 0 through 7.
  85. Reading the
  86. .B type
  87. file returns the decimal value of the assigned Ethernet packet type.
  88. Reading the
  89. .B stats
  90. file returns status information such as the Ethernet address of the
  91. card and general statistics, independent of the interface;
  92. .B ifstats
  93. contains device-specific data and statistics about the card.
  94. .PP
  95. An interface normally receives only those packets whose
  96. destination address is that of the interface or is the
  97. broadcast address,
  98. .BR ff:ff:ff:ff:ff:ff .
  99. The interface can be made to receive all packets on the
  100. network by writing the string
  101. .B promiscuous
  102. to the
  103. .B ctl
  104. file.
  105. The interface remains promiscuous until the control file is
  106. closed.
  107. The extra packets are passed up connections only of types \-1
  108. and \-2.
  109. .SH SOURCE
  110. .B /sys/src/9/*/devether.c