Xtang,感谢您的指点,我想问问您所说的查看ether_type是在哪个结构中存在的吗?可以有现有的函数进行查询得到吗?或是要自己进行以太网包的某个字段进行分析?如果分析的话是不是就是要对npkt_t结构进行。
今天我在ftp.qnx.com中的FAQ中得到了关于以太网包的结构,是这样子的:
±-----------+
| | Preamble -
| 62 bits | A series of alternating 1’s and 0’s used by the
| | ethernet receiver to acquire bit synchronization.
| | This is generated by the chip.
±-----------+
| | Start Of Frame Delimiter -
| 2 bits | Two consecutive 1 bits used to acquire byte
| | alignment. This is generated by the chip.
±-----------+
±-----------+
| | Destination Ethernet Address -
| 6 bytes | Address of the intended receiver.
| | The broadcast address is all 1’s.
±-----------+
| | Source Ethernet Address -
| 6 bytes | The unique ethernet address of the sending
| | station.
±-----------+
| | Length or Type field -
| 2 bytes | For IEEE 802.3 this is the number of bytes of
| | data. For Ethernet I&II this is the type of
| | packet. Types codes are > 1500 to allow both to
| | coexist. The type code for IP packets is 0x800.
±-----------+
| 46 bytes | Data -
| to | Short packets must be padded to 46 bytes.
| 1500 bytes |
±-----------+
±-----------+
| | Frame Check Sequence -
| 4 bytes | The FCS is a 32 bit CRC calculated using
| | the AUTODIN II polynomial.
| | This field is normally generated by the chip.
±-----------+
您所说的ether_type是不是就是标记为Length or Type field的那两个字节? 另外我想知道的是,白皮书上说到的以太网packet的头(head)是14个字节,但这个结构中却远远不只14个字节呀,为什么呢?那14个字节是上面的哪14个字节呢?望给个解释,谢谢!
请问一下,运行filter模块之后,可能看到各个协议的数据包,过了1-2分钟。就出问题了/dev/io-net 目录都没有了,点击网络配置窗口,提示 cannot open socket. 运行netmanager,提示 cannot open socket:Address family not supported by protocol family。 不知道是为什么,谢谢。