📄 dot11smeaplib.c
字号:
break; } *(UINT32 *)data = pBss->bcastRate; status = OK; break; /************************************************************** * WIOCSBCASTRATE: Sets the rate used for multicast pakcets. **************************************************************/ case WIOCSBCASTRATE: if ( (char*)data == NULL) { DOT11_LOG(DOT11_DEBUG_ERROR, DOT11_AREA_SME, ("dot11SmeApIoctl: NULL <data> pointer in IOCTL" " 0x%04x\n", cmd, 0, 0, 0, 0, 0)); status = ERROR; break; } pBss->desiredBcastRate = (int)data; status = pDot11->sme->txMultiRateSet(pDot11, (int)data, &pDot11->sme->bss[pDot11->sme->curConfigBss]); break; /************************************************************** * WIOCGPWRMAN - Not supported in AP mode **************************************************************/ case WIOCGPWRMAN: status = ERROR; break; /************************************************************** * WIOCSPWRMAN -Not supported - AP always supports PM **************************************************************/ case WIOCSPWRMAN: status = ERROR; break; /************************************************************** * WIOCGCHANNEL - Get channel used **************************************************************/ case WIOCGCHANNEL: /* We need a pointer in <data>. Make sure it's not NULL */ if ( (char*)data == NULL) { DOT11_LOG(DOT11_DEBUG_ERROR, DOT11_AREA_SME, ("dot11SmeApIoctl: NULL <data> pointer in IOCTL" " 0x%04x\n", cmd, 0, 0, 0, 0, 0)); status = ERROR; break; } *(UINT32 *)data = pDot11->hdd->curChannel; status = OK; break; /******************************************************************** * WIOCSRADIOMODE - Sets the current radio mode ********************************************************************/ case WIOCSRADIOMODE: if ((UINT32)data > DOT11_RADIO_MAX) { DOT11_LOG(DOT11_DEBUG_ERROR, DOT11_AREA_SME, ("dot11SmeIoctl: WIOCSRADIOMODE: Invalid radio " "type \n", 0,0,0,0,0,0)); status = ERROR; break; } pDot11->radioMode = (UINT32)data; /* pDot11->hdd->curMode = (UINT32)data; */ /* Build the scan list - we will only scan channels the match the current mode */ if (pDot11->sme->scanListBuild(pDot11) != OK) { status = ERROR; DOT11_LOG(DOT11_DEBUG_ERROR, DOT11_AREA_SME, ("dot11SmeIoctl: WIOCSRADIOMODE: Invalid radio " "type \n",0,0,0,0,0,0)); break; } /* Check and see if the channel is in the scanList, which is a list of all channels in the current radio mode */ status = ERROR; for (i=0; i<pDot11->sme->scanList.numChannels; i++) { if (pDot11->sme->scanList.channels[i].channel == pDot11->defaultChannel) { status = OK; break; } } /* If we didn't find the channel, take the lowest channel in the scanList as a default. */ if (status != OK) { pDot11->defaultChannel = pDot11->sme->scanList.channels[0].channel; DOT11_LOG(DOT11_DEBUG_INFO, DOT11_AREA_SME, ("dot11SmeIoctl: WIOCSRADIOMODE: Channel has been " "changed to %d due to radio mode change. \n" ,pDot11->defaultChannel,0,0,0,0,0)); if (dot11SmeApBeaconStop(pDot11) != OK) { DOT11_LOG(DOT11_DEBUG_ERROR, DOT11_AREA_SME, ("dot11SmeApIoctl: WIOCSRADIOMODE: cannot stop bcns\n", 0, 0, 0, 0, 0, 0)); status = ERROR; break; } if (pDot11->hdd->channelSet(pDot11, pDot11->defaultChannel, pDot11->radioMode) != OK) { DOT11_LOG(DOT11_DEBUG_FATAL, DOT11_AREA_INIT, ("dot11SmeIoctl: WIOCSRADIOMODE: Cannot set " "channel %d mode %s\n", pDot11->defaultChannel, (int)dot11ModeStr[pDot11->radioMode], 0,0,0,0)); status = ERROR; break; } /* Need to restart beacons, since the channelSet above killed them. */ if ((dot11SmeApBeaconUpdate(pDot11, NULL) != OK) || (dot11SmeApBeaconStart(pDot11, 0) != OK)) { DOT11_LOG(DOT11_DEBUG_ERROR, DOT11_AREA_SME, ("dot11SmeApIoctl: WIOCSRADIOMODE: cannot restart " "bcns\n", 0, 0, 0, 0, 0, 0)); status = ERROR; } } /* We also need to update the supported rates */ if (pDot11->hdd->suppRatesGet(pDot11, &pDot11->sme->suppRates) != OK) { DOT11_LOG(DOT11_DEBUG_FATAL, DOT11_AREA_INIT, ("dot11SmeIoctl: WIOCSRADIOMODE: Cannot init supp " "rates\n", 0,0,0,0,0,0)); status = ERROR; break; } /* Flush the KSL so that we're not using old stations */ (VOID)pDot11->sme->ksl.flush(pDot11); /* Reset the device, if currently in a SME mode */ if ((pDot11->dot11Mode != DOT11_MODE_NONE) && (pDot11->sme->reset != NULL)) { status = pDot11->sme->reset(pDot11); } else { status = OK; } break; /************************************************************** * WIOCSCHANNEL - Set channel used for the AP. **************************************************************/ case WIOCSCHANNEL: if (dot11SmeApBeaconStop(pDot11) != OK) { DOT11_LOG(DOT11_DEBUG_ERROR, DOT11_AREA_SME, ("dot11SmeApIoctl: WIOCSCHANNEL: cannot stop bcns\n", 0, 0, 0, 0, 0, 0)); status = ERROR; break; } status = pDot11->hdd->channelSet(pDot11, (int)data, pDot11->radioMode ); if (status == OK) { pDot11->defaultChannel = (UINT32)data; } /* We also need to update the supported rates */ if (pDot11->hdd->suppRatesGet(pDot11, &pDot11->sme->suppRates) != OK) { DOT11_LOG(DOT11_DEBUG_FATAL, DOT11_AREA_INIT, ("dot11SmeApInit: Cannot get supp rates\n", 0,0,0,0,0,0)); break; } for(i=0; i<DOT11_BSS_MAX; i++) { /* Choose a starting broadcast rate */ pDot11->sme->bss[i].bcastRate = DOT11_RATE_MASK(pDot11->sme->suppRates.rates[0]); } status |= dot11SmeApReset(pDot11); /* Need to restart beacons, since the channelSet above killed them. */ if ((dot11SmeApBeaconUpdate(pDot11, NULL) != OK) || (dot11SmeApBeaconStart(pDot11, 0) != OK)) { DOT11_LOG(DOT11_DEBUG_ERROR, DOT11_AREA_SME, ("dot11SmeApIoctl: WIOCSCHANNEL: cannot restart " "bcns\n", 0, 0, 0, 0, 0, 0)); status = ERROR; } break; /************************************************************** * WIOCGAUTHTYPE - Get authentication protocol **************************************************************/ case WIOCGAUTHTYPE: /* We need a pointer in <data>. Make sure it's not NULL */ if ( (char*)data == NULL) { DOT11_LOG(DOT11_DEBUG_ERROR, DOT11_AREA_SME, ("dot11SmeApIoctl: NULL <data> pointer in IOCTL" " 0x%04x\n", cmd, 0, 0, 0, 0, 0)); status = ERROR; break; } *(UINT32 *)data = pBss->authType; status = OK; break; /************************************************************** * WIOCSAUTHTYPE - Set authentication protocol **************************************************************/ case WIOCSAUTHTYPE: /* Convert from the format the IOCTL uses to IEEE format.*/ if (((UINT32)data == DOT11_AUTH_OPEN + 1) || ((UINT32)data == DOT11_AUTH_SHARED_KEY + 1)) { if (((UINT32)data == DOT11_AUTH_SHARED_KEY + 1) && (pBss->secPol != DOT11_SECPOL_NONE)) { DOT11_LOG(DOT11_DEBUG_ERROR, DOT11_AREA_SME, ("dot11SmeIoctl: WIOCSAUTHTYPE: SKA not allowed" " when WPA/RSN is enabled\n",0, 0, 0, 0, 0, 0)); return ERROR; } pBss->authType = (UINT32)data - 1; status = OK; } else if ((UINT32)data == DOT11_AUTH_ALL) /* This is the "both" case */ { if (pBss->secPol != DOT11_SECPOL_NONE) { /* SKA not allowed when secpol != NONE */ pBss->authType = DOT11_AUTH_OPEN; } else { pBss->authType = DOT11_AUTH_ALL; } } else { status = ERROR; } break; /************************************************************** * WIOCSBEACONRATE: Sets the beacon rate and re-forms the beacon **************************************************************/ case WIOCSBEACONRATE: if ((UINT32)data > 10) { pDot11->sme->beaconInterval = (UINT32)data; /* Reset the AP so that the new beacon interval is written to the beacon and communicated to all stations. */ status = dot11SmeApReset(pDot11); } else { DOT11_LOG(DOT11_DEBUG_ERROR, DOT11_AREA_SME, ("dot11SmeApIoctl: WIOCSBEACONRATE: invalid BI " "\n", 0, 0, 0, 0, 0, 0)); status = ERROR; } break; /************************************************************** * WIOCSADVSECURITY - Set advanced security options **************************************************************/ case WIOCSADVSECURITY: /* Check for the "Hide SSID in beacon" bit */ if (((UINT32)data & DOT11_ADVSEC_HIDE_SSID) != 0) { pBss->showSsidInBeacon = FALSE; } else { pBss->showSsidInBeacon = TRUE; } /* Check for the "Block response to broadcast probe/assoc" bit */ if (((UINT32)data & DOT11_ADVSEC_BLOCK_BCAST_SSID) != 0) { pBss->respondBcastSsid = FALSE; } else { pBss->respondBcastSsid = TRUE; } /* Reset the AP so that these changes take place */ status = dot11SmeApReset(pDot11); break; /************************************************************** * WIOCGADVSECURITY - Get advanced security options **************************************************************/ case WIOCGADVSECURITY: /* We need a pointer in <data>. Make sure it's not NULL */ if ((UINT32*)data == NULL) { DOT11_LOG(DOT11_DEBUG_ERROR, DOT11_AREA_SME, ("dot11SmeApIoctl: NULL <data> pointer in IOCTL" " 0x%04x\n", cmd, 0, 0, 0, 0, 0)); status = ERROR; break;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -