我正在尝试使用Wifi在两台笔记本电脑之间进行通信。我正在使用的radiotap头和ieee80211头的结构是:
struct ieee80211_radiotap_header {
unsigned char it_version;
uint16_t it_len;
uint32_t it_present;
};
/* Structure for 80211 header */
struct ieee80211_hdr_3addr {
uint16_t frame_ctl[2];
uint16_t duration_id;
unsigned char addr1[ETH_ALEN];
unsigned char addr2[ETH_ALEN];
unsigned char addr3[ETH_ALEN];
uint16_t seq_ctl;
};
struct packet {
struct ieee80211_radiotap_header rtap_header;
struct ieee80211_hdr_3addr iee802_header;
unsigned char payload[30];
};
/* In main program */
struct packet mypacket;
struct ieee80211_radiotap_header ratap_header;
struct ieee80211_hdr_3addr iee802_header;
unsigned char addr1[ETH_ALEN] = {0xFF,0xFF,0xFF,0xFF,0xFF,0xFF}; /* broadcast address */
unsigned char addr2[ETH_ALEN] = {0x28,0xcf,0xda,0xde,0xd3,0xcc}; /* mac address of
network card */
unsigned char addr3[ETH_ALEN] = {0xd8,0xc7,0xc8,0xd7,0x9f,0x21}; /* mac address of
access point i am trying to connect to */
/* Radio tap header data */
ratap_header.it_version = 0x00;
ratap_header.it_len = 0x07;
ratap_header.it_present = (1 << IEEE80211_RADIOTAP_RATE);
mypacket.rtap_header = ratap_header;
/* ieee80211 header data */
iee802_header.frame_ctl[0] = IEEE80211_FC0_VERSION_0 | IEEE80211_FC0_TYPE_MGT |
IEEE80211_FC0_SUBTYPE_BEACON;
iee802_header.frame_ctl[1] =IEEE80211_FC1_DIR_NODS;
strcpy(iee802_header.addr1,addr1);
strcpy(iee802_header.addr2,addr2);
strcpy(iee802_header.addr3,addr3);
iee802_header.seq_ctl = 0x1086;
mypacket.iee802_header=iee802_header;
/* Payload */
unsigned char payload[PACKET_LENGTH]="temp";
strcpy(mypacket.payload , payload);
当我在同一台笔记本电脑上测试传输和接收时,我能够收到数据包。但是,我无法接收在其他笔记本电脑上传输的数据包。 Wireshark也不显示数据包。
有人能说出我犯的错误吗?