ether 2.5 KB

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