Changeset 104

Show
Ignore:
Timestamp:
03/04/07 01:25:08 (23 months ago)
Author:
jwright
Message:

Removed reference to IW_MODE literals in tx80211_setmode and related code; minor changes to man page for tx80211_setmode/tx80211_setfuncmode; added 802.11e header packet crafting support

Location:
trunk
Files:
6 modified

Legend:

Unmodified
Added
Removed
  • trunk/iwcontrol.c

    r97 r104  
    613613} 
    614614 
    615 int iwconfig_set_mode(const char *in_dev, char *in_err, int in_mode) 
     615int iwconfig_set_mode(const char *in_dev, char *in_err, int tx80211_mode) 
    616616{ 
    617617        struct iwreq wrq; 
     
    627627        memset(&wrq, 0, sizeof(struct iwreq)); 
    628628        strncpy(wrq.ifr_name, in_dev, IFNAMSIZ); 
    629         wrq.u.mode = in_mode; 
     629 
     630        /* LORCON modes align with Linux wireless tools modes */ 
     631        wrq.u.mode = tx80211_mode; 
    630632 
    631633        if (ioctl(skfd, SIOCSIWMODE, &wrq) < 0) { 
  • trunk/lorcon.3

    r102 r104  
    4343.LP 
    4444.ft B 
    45 int tx80211_setmode(struct tx80211 *in_tx, int in_mode) /* deprecated */ 
     45int tx80211_setmode(struct tx80211 *in_tx, int in_mode) /* superceded */ 
    4646int tx80211_getmode(struct tx80211 *in_tx)  
    4747int tx80211_setfunctionalmode(struct tx80211 *in_tx, int in_fmode) 
     
    340340.PP 
    341341.BR tx80211_setmode() 
    342 is used to set the operating mode of the wireless card. 
    343 .I in_tx 
    344 is the structure populated by the 
    345 .B tx80211_init 
    346 function. 
    347  
    348 .I This function is deprecated.  It has been superseded by the 
    349 .B tx80211_setfunctionalmode 
    350 .I function. 
     342is used to explicitly set the operating mode of the wireless card. 
     343.I in_tx 
     344is the structure populated by the 
     345.B tx80211_init 
     346function. 
     347 
     348.I This function has been superceded with the 
     349.B tx80211_setfunctionalmode() 
     350.I function.  Only use this function for explicitly setting the card mode, 
     351.I not to prepare the card for packet injection. 
    351352 
    352353.I in_mode 
    353 is the desired operating mode for the wireless card, as defined in the 
    354 .B <linux/wireless.h> 
    355 header file: 
     354is the desired operating mode for the wireless card, as defined below: 
    356355 
    357356.RS 
    358357.TP 
    359358.B 
    360 IW_MODE_AUTO 
     359TX80211_MODE_AUTO 
    361360Allows the driver to decide the best operating mode. 
    362361.TP 
    363362.B 
    364 IW_MODE_ADHOC 
     363TX80211_MODE_ADHOC 
    365364Configures the card to operate as an IBSS or ad-hoc network. 
    366365.TP 
    367366.B 
    368 IW_MODE_INFRA 
     367TX80211_MODE_INFRA 
    369368Configures the card as a wireless client in an BSS or ESS network. 
    370369.TP 
    371370.B 
    372 IW_MODE_MASTER 
     371TX80211_MODE_MASTER 
    373372Configures the card as an access point or master device. 
    374373.TP 
    375374.B 
    376 IW_MODE_REPEAT 
     375TX80211_MODE_REPEAT 
    377376Configures the card as a wireless repeater or forwarder. 
    378377.TP 
    379378.B 
    380 IW_MODE_SECOND 
     379TX80211_MODE_SECOND 
    381380Configures the card as a backup or secondary access point or master device. 
    382381.TP 
    383382.B 
    384 IW_MODE_MONITOR 
     383TX80211_MODE_MONITOR 
    385384Configures the card to forward all frames to userspace regardless of destination 
    386385or BSSID address. 
     386 
     387.RE 
     388Note that these values match the Linux wireless IW_MODE_ values for backward-compatibility. 
    387389 
    388390.RE 
     
    390392returns 0 on success, -1 on error. 
    391393 
    392 .B NOTE: 
    393 For most packet injection uses, the  
    394 .B IW_MODE_MONITOR 
    395 operating mode is the preferred operating mechanism. 
    396  
    397394.PP 
    398395.BR tx80211_setfunctionalmode() 
    399 is used to set the operating mode of the wireless card. 
     396is used to set the functional operating mode of the wireless card. 
    400397.I in_tx 
    401398is the structure populated by the 
     
    433430.B NOTE 2: It's possible that on some cards one mode can perform multiple tasks (IE 
    434431injection still works while in monitor mode) however this is not recommended as it 
    435 will not operate on all cards.  The caller should always set the desired functional 
    436 mode. 
     432will not operate on all cards.  The caller should always set the desired functional mode. 
    437433 
    438434.PP 
  • trunk/lorcon_forge.c

    r101 r104  
    7575    addr[4] = rand() % 255; 
    7676    addr[5] = rand() % 255; 
     77} 
     78 
     79void lcpf_qosheaders(metapack_component *pack, unsigned int priority, 
     80                unsigned int eosp, unsigned int ackpol) { 
     81        uint8_t chunk[2]; 
     82 
     83        /* Bits 0 and 4 are reserved. */ 
     84        chunk[0] = 0; 
     85        chunk[0] = ((priority << 5) | (eosp << 3) | (ackpol << 1)); 
     86        /* All 8 bits reserved */ 
     87        chunk[1] = 0; 
     88        pack = pack_append_copy(pack, "80211QOSHDR", 2, chunk); 
    7789} 
    7890 
  • trunk/lorcon_forge.h

    r101 r104  
    6868                                           unsigned int sequence); 
    6969 
     70/* Generate a QoS header (2 bytes) which follows immediately after Addr4 or 
     71 * the sequence number field in the standard 802.11 header */ 
     72void lcpf_qosheaders(metapack_component *pack, unsigned int priority, 
     73                unsigned int eosp, unsigned int ackpol); 
     74 
    7075/* Generate a beacon frame header with no IE tags (see lcpf_appendie) 
    7176 * 
  • trunk/tx80211.h

    r103 r104  
    161161#define TX80211_FUNCMODE_INJMON         2 
    162162 
     163/* Modes for setting various operation types.  This aligns with the standard 
     164 * Linux wireless operation modes, but doesn't tie us to the IW literals. */ 
     165#define TX80211_MODE_AUTO       0   /* Let the driver decides */ 
     166#define TX80211_MODE_ADHOC      1   /* Single cell network */ 
     167#define TX80211_MODE_INFRA      2   /* Multi cell network, roaming, ... */ 
     168#define TX80211_MODE_MASTER     3   /* Synchronisation master or Access Point */ 
     169#define TX80211_MODE_REPEAT     4   /* Wireless Repeater (forwarder) */ 
     170#define TX80211_MODE_SECOND     5   /* Secondary master/repeater (backup) */ 
     171#define TX80211_MODE_MONITOR    6   /* Passive monitor (listen only) */ 
     172 
    163173/* tx80211 device capabilities */ 
    164174#define TX80211_CAP_NONE        0       /* no capabilities */ 
  • trunk/wginject.c

    r90 r104  
    175175 
    176176        switch (mode) { 
    177         case IW_MODE_MONITOR: 
     177        case TX80211_MODE_MONITOR: 
    178178                currentchan = wginj_getchannel(wginj); 
    179179                snprintf(cmdline, sizeof(cmdline), 
     
    182182                return (system(cmdline)); 
    183183 
    184         case IW_MODE_INFRA: 
     184        case TX80211_MODE_INFRA: 
    185185                currentchan = wginj_getchannel(wginj); 
    186186                snprintf(cmdline, sizeof(cmdline), 
     
    189189                return (system(cmdline)); 
    190190 
    191         case IW_MODE_AUTO: 
    192         case IW_MODE_ADHOC: 
    193         case IW_MODE_MASTER: 
    194         case IW_MODE_REPEAT: 
    195         case IW_MODE_SECOND: 
     191        case TX80211_MODE_AUTO: 
     192        case TX80211_MODE_ADHOC: 
     193        case TX80211_MODE_MASTER: 
     194        case TX80211_MODE_REPEAT: 
     195        case TX80211_MODE_SECOND: 
    196196        default: 
    197197                return -1;      /* not supported */