Changeset 85 for trunk

Show
Ignore:
Timestamp:
08/17/06 14:37:10 (2 years ago)
Author:
jwright
Message:

Enhanced support for rt2570, enumerated capabilities and added appropriate _send and _init functions; updated man page to remove _CAP_PHY

Location:
trunk
Files:
5 modified

Legend:

Unmodified
Added
Removed
  • trunk/lorcon.3

    r73 r85  
    224224.TP 
    225225.B 
    226 TX80211_CAP_PHY 
    227 NOT SURE, ASK MIKE 
    228 .TP 
    229 .B 
    230226TX80211_CAP_FRAG 
    231227Indicates the capability to transmit a fragmented 802.11 frame by setting the 
  • trunk/rt2570inject.c

    r70 r85  
    2626 
    2727        in_tx->capabilities = tx80211_rt2570_capabilities(); 
    28         in_tx->open_callthrough = &wtinj_open; 
     28        in_tx->open_callthrough = &rt2570_open; 
    2929        in_tx->close_callthrough = &wtinj_close; 
    3030        in_tx->setmode_callthrough = &wtinj_setmode; 
     
    3232        in_tx->getchan_callthrough = &wtinj_getchannel; 
    3333        in_tx->setchan_callthrough = &wtinj_setchannel; 
    34         in_tx->txpacket_callthrough = &wtinj_send; 
     34        in_tx->txpacket_callthrough = &rt2570_send; 
    3535 
    3636        return 0; 
    3737} 
    3838 
     39 
    3940int tx80211_rt2570_capabilities() 
    4041{ 
    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); 
    4847} 
     48 
     49int 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 
     64int 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  
    5454 
    5555int tx80211_rt2500_init(struct tx80211 *in_tx); 
    56  
    5756int tx80211_rt2500_capabilities(); 
    5857 
     58int rt2570_open(struct tx80211 *in_tx); 
     59int rt2570_send(struct tx80211 *in_tx, struct tx80211_packet *in_pkt); 
     60 
    5961#endif 
  • trunk/tx.c

    r74 r85  
    4242               "  -n <number>          number of packets to send\n" 
    4343               "  -c <channel>         channel to transmit packets on.\n" 
     44               "  -s <sleep>           sleep time in usec between packets.\n" 
    4445               "  -d <drivername>      string indicating driver used on interface\n"); 
    4546 
     
    5960 
    6061        // WEP encrypted packet  
    61         /* 
    62         char packet[108] = { 
     62        unsigned char packet[108] = { 
    6363                0x08, 0x41, 0x0a, 0x00, 0x00, 0x03, 0x1b, 0xc2, 
    6464                0x45, 0x33, 0x00, 0x1b, 0x4b, 0x29, 0x61, 0xb1, 
     
    7676                0x5a, 0x90, 0xb4, 0x68 
    7777        }; 
    78         */ 
    7978 
    8079//ACK frame 
    81 /* 
    82     char packet[10] = { 
     80    /* 
     81    unsigned char packet[10] = { 
    8382        0xd4, 0x00, 0x00, 0x00, 0x00, 0x0f, 0x66, 0xe3, 
    8483        0x76, 0x3b}; 
    85 */ 
     84    */ 
    8685 
    8786    // Beacon frame 
    88         /* 
    89     char packet[115] = { 
    90         0x80, 0x04, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, // retry bit, dur ffff 
     87    /* 
     88    unsigned char packet[115] = { 
     89        0x80, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, // dur ffff 
    9190        0xff, 0xff, 0x00, 0x0f, 0x66, 0xe3, 0xe4, 0x03,  
    9291        0x00, 0x0f, 0x66, 0xe3, 0xe4, 0x03, 0x00, 0x00, // 0x0000 - seq no. 
     
    103102        0x00, 0x00, 0x50, 0xf2, 0x02, 0x01, 0x00, 0x00,  
    104103        0x50, 0xf2, 0x02}; 
    105         */ 
     104    */ 
    106105 
    107106    // small fragmented WEP packet 
    108     char packet[] = { 
     107    /* 
     108    unsigned char packet[] = { 
    109109        0x08, 0x45, 0xd5, 0x00, 0x00, 0x0f, 0x66, 0xe3,  
    110110        0x76, 0x3b, 0x00, 0x02, 0x6f, 0x35, 0x73, 0x0f,  
     
    112112        0xa8, 0x34, 0x00, 0x00, 0xc4, 0x42, 0x86, 0x90,  
    113113        0x4f, 0x76, 0xa5, 0x4d}; 
     114    */ 
    114115 
    115116/* 
     
    128129        memset(iface, 0, sizeof(iface)); 
    129130 
    130         while ((c = getopt(argc, argv, "n:i:d:c:")) != EOF) { 
     131        while ((c = getopt(argc, argv, "n:i:d:c:s:")) != EOF) { 
    131132                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; 
    132141                case 'n': 
    133142                        if (sscanf(optarg, "%d", &cnt) != 1) { 
    134143                                fprintf(stderr, "%s: Illegal count on cmd line", 
    135                                         argv[0]); 
     144                                        ".\n", argv[0]); 
    136145                                usage(); 
    137146                                return -1; 
  • trunk/tx80211.h

    r73 r85  
    9393#define TX80211_CAP_SEQ         4       /* capable of sequence spoofing */ 
    9494#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 */ 
    9697#define TX80211_CAP_FRAG        32      /* capable of sending fragments */ 
    9798#define TX80211_CAP_CTRL        64      /* capable of sending ctrl frames */