- Timestamp:
- 08/17/06 14:37:10 (2 years ago)
- Location:
- trunk
- Files:
-
- 5 modified
-
lorcon.3 (modified) (1 diff)
-
rt2570inject.c (modified) (2 diffs)
-
rt2570inject.h (modified) (1 diff)
-
tx.c (modified) (6 diffs)
-
tx80211.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/lorcon.3
r73 r85 224 224 .TP 225 225 .B 226 TX80211_CAP_PHY227 NOT SURE, ASK MIKE228 .TP229 .B230 226 TX80211_CAP_FRAG 231 227 Indicates the capability to transmit a fragmented 802.11 frame by setting the -
trunk/rt2570inject.c
r70 r85 26 26 27 27 in_tx->capabilities = tx80211_rt2570_capabilities(); 28 in_tx->open_callthrough = & wtinj_open;28 in_tx->open_callthrough = &rt2570_open; 29 29 in_tx->close_callthrough = &wtinj_close; 30 30 in_tx->setmode_callthrough = &wtinj_setmode; … … 32 32 in_tx->getchan_callthrough = &wtinj_getchannel; 33 33 in_tx->setchan_callthrough = &wtinj_setchannel; 34 in_tx->txpacket_callthrough = & wtinj_send;34 in_tx->txpacket_callthrough = &rt2570_send; 35 35 36 36 return 0; 37 37 } 38 38 39 39 40 int tx80211_rt2570_capabilities() 40 41 { 41 /* TODO: Test capabilities, should write a tool to do this 42 return (TX80211_CAP_SNIFF | TX80211_CAP_TRANSMIT | 43 TX80211_CAP_SEQ | TX80211_CAP_BSSTIME | 44 TX80211_CAP_FRAG | TX80211_CAP_CTRL | 45 TX80211_CAP_DURID); 46 */ 47 return (0); 42 /* No sequence number spoofing support, overridden in firmware :( */ 43 return (TX80211_CAP_SNIFF | TX80211_CAP_TRANSMIT | 44 TX80211_CAP_BSSTIME | 45 TX80211_CAP_FRAG | TX80211_CAP_CTRL | 46 TX80211_CAP_DURID | TX80211_CAP_SNIFFACK); 48 47 } 48 49 int rt2570_open(struct tx80211 *in_tx) 50 { 51 52 char errstr[TX80211_STATUS_MAX]; 53 54 /* Call private ioctl "rfmontx" to enable raw TX */ 55 if (iwconfig_set_intpriv(in_tx->ifname, "rfmontx", 1, 0, errstr) != 0) { 56 fprintf(stderr, "Error enabling rfmontx private ioctl: %s\n", 57 errstr); 58 return -1; 59 } 60 61 return(wtinj_open(in_tx)); 62 } 63 64 int rt2570_send(struct tx80211 *in_tx, struct tx80211_packet *in_pkt) 65 { 66 67 int ret; 68 69 if (!(in_tx->raw_fd > 0)) { 70 /* file descriptor is not open */ 71 return 0; 72 } 73 74 ret = write(in_tx->raw_fd, in_pkt->packet, in_pkt->plen); 75 76 /* With no delay, the rt2570 only sends < 1% of frames, by adding 77 this (nominal) delay, we get consisten 100% TX */ 78 usleep(2); 79 80 if (ret < 0) 81 return -1; 82 if (ret < (in_pkt->plen)) 83 return -2; 84 return (ret); 85 } 86 -
trunk/rt2570inject.h
r70 r85 54 54 55 55 int tx80211_rt2500_init(struct tx80211 *in_tx); 56 57 56 int tx80211_rt2500_capabilities(); 58 57 58 int rt2570_open(struct tx80211 *in_tx); 59 int rt2570_send(struct tx80211 *in_tx, struct tx80211_packet *in_pkt); 60 59 61 #endif -
trunk/tx.c
r74 r85 42 42 " -n <number> number of packets to send\n" 43 43 " -c <channel> channel to transmit packets on.\n" 44 " -s <sleep> sleep time in usec between packets.\n" 44 45 " -d <drivername> string indicating driver used on interface\n"); 45 46 … … 59 60 60 61 // WEP encrypted packet 61 /* 62 char packet[108] = { 62 unsigned char packet[108] = { 63 63 0x08, 0x41, 0x0a, 0x00, 0x00, 0x03, 0x1b, 0xc2, 64 64 0x45, 0x33, 0x00, 0x1b, 0x4b, 0x29, 0x61, 0xb1, … … 76 76 0x5a, 0x90, 0xb4, 0x68 77 77 }; 78 */79 78 80 79 //ACK frame 81 /*82 char packet[10] = {80 /* 81 unsigned char packet[10] = { 83 82 0xd4, 0x00, 0x00, 0x00, 0x00, 0x0f, 0x66, 0xe3, 84 83 0x76, 0x3b}; 85 */84 */ 86 85 87 86 // Beacon frame 88 /*89 char packet[115] = {90 0x80, 0x0 4, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, // retry bit,dur ffff87 /* 88 unsigned char packet[115] = { 89 0x80, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, // dur ffff 91 90 0xff, 0xff, 0x00, 0x0f, 0x66, 0xe3, 0xe4, 0x03, 92 91 0x00, 0x0f, 0x66, 0xe3, 0xe4, 0x03, 0x00, 0x00, // 0x0000 - seq no. … … 103 102 0x00, 0x00, 0x50, 0xf2, 0x02, 0x01, 0x00, 0x00, 104 103 0x50, 0xf2, 0x02}; 105 */104 */ 106 105 107 106 // small fragmented WEP packet 108 char packet[] = { 107 /* 108 unsigned char packet[] = { 109 109 0x08, 0x45, 0xd5, 0x00, 0x00, 0x0f, 0x66, 0xe3, 110 110 0x76, 0x3b, 0x00, 0x02, 0x6f, 0x35, 0x73, 0x0f, … … 112 112 0xa8, 0x34, 0x00, 0x00, 0xc4, 0x42, 0x86, 0x90, 113 113 0x4f, 0x76, 0xa5, 0x4d}; 114 */ 114 115 115 116 /* … … 128 129 memset(iface, 0, sizeof(iface)); 129 130 130 while ((c = getopt(argc, argv, "n:i:d:c: ")) != EOF) {131 while ((c = getopt(argc, argv, "n:i:d:c:s:")) != EOF) { 131 132 switch (c) { 133 case 's': 134 if (sscanf(optarg, "%d", &delay) != 1) { 135 fprintf(stderr, "%s: Illegal delay on cmd line" 136 ".\n", argv[0]); 137 usage(); 138 return -1; 139 } 140 break; 132 141 case 'n': 133 142 if (sscanf(optarg, "%d", &cnt) != 1) { 134 143 fprintf(stderr, "%s: Illegal count on cmd line", 135 argv[0]);144 ".\n", argv[0]); 136 145 usage(); 137 146 return -1; -
trunk/tx80211.h
r73 r85 93 93 #define TX80211_CAP_SEQ 4 /* capable of sequence spoofing */ 94 94 #define TX80211_CAP_BSSTIME 8 /* capable of bss timestamp spoofing */ 95 #define TX80211_CAP_PHY 16 /* capable of phy-frame spoofing */ 95 /* CAP_PHY deprecated */ 96 /* #define TX80211_CAP_PHY 16 */ 96 97 #define TX80211_CAP_FRAG 32 /* capable of sending fragments */ 97 98 #define TX80211_CAP_CTRL 64 /* capable of sending ctrl frames */
