void PeerSpectrumAction(int param_1,int param_2)
{
byte bVar1;
bool bVar2;
undefined4 uVar3;
undefined4 uVar4;
undefined4 uVar5;
undefined4 *__s;
undefined4 *puVar6;
uint uVar7;
int iVar8;
undefined4 *puVar9;
size_t __n;
undefined4 *puVar10;
int iVar11;
char *pcVar12;
char *pcVar13;
char local_50 [4];
undefined1 local_4c;
undefined1 local_4b [3];
undefined1 local_48;
char local_47;
char local_46 [2];
char *local_44;
uint local_40;
uint local_3c;
undefined1 uStack_38;
uint local_37;
undefined4 local_33;
uint3 uStack_2f;
if (*(char *)(param_1 + 0x16a80) != '\x01') {
return;
}
switch(*(undefined1 *)(param_2 + 0x19)) {
case 0:
iVar8 = *(int *)(param_2 + 0x648);
memmove(local_50,(void *)(param_2 + 0x1a),1) //possible issue identified - semgrep
bVar2 = false;
for (pcVar13 = (char *)(param_2 + 0x1b);
pcVar13 + (byte)pcVar13[1] + 1 < (char *)(param_2 + iVar8); pcVar13 = pcVar13 + bVar1 + 2) {
if (*pcVar13 == '&') {
memmove(&local_48,pcVar13 + 2,1) //possible issue identified - semgrep
memmove(&local_47,pcVar13 + 3,1) //possible issue identified - semgrep
memmove(local_46,pcVar13 + 4,1) //possible issue identified - semgrep
memmove(&uStack_38,pcVar13 + 5,1) //possible issue identified - semgrep
memmove(&local_40,pcVar13 + 6,8) //possible issue identified - semgrep
local_37 = local_3c >> 0x18 | local_3c << 0x18 | (local_3c & 0xff00) << 8 |
(local_3c & 0xff0000) >> 8;
local_33 = local_40 << 0x18 | (local_40 & 0xff00) << 8 | (local_40 & 0xff0000) >> 8 |
local_40 >> 0x18;
memmove(&local_44,pcVar13 + 0xe,2) //possible issue identified - semgrep
uVar7 = CONCAT31(uStack_2f,local_33._3_1_) & 0xff0000ff;
uStack_2f = (uint3)(uVar7 >> 8) |
(uint3)(((uint)local_44 & 0xff) << 8) | (uint3)((uint)local_44 >> 8) & 0xff;
local_33._3_1_ = (undefined1)uVar7;
bVar2 = true;
bVar1 = pcVar13[1];
}
else {
bVar1 = pcVar13[1];
}
}
if (bVar2) {
EnqueueMeasurementRep(param_1,param_2 + 10,local_50[0],local_48,2,local_46[0],0,0);
}
break;
case 1:
os_alloc_mem(param_1,&local_44,0x13);
if (local_44 == (char *)0x0) {
if (RTDebugLevel == 0) {
return;
}
printk("%s unable to alloc memory for measure report buffer (size=%d).\n",
"PeerMeasureReportAction",0x13);
return;
}
memset(&local_48,0,3) //possible issue identified - semgrep
memset(local_44,0,0x13) //possible issue identified - semgrep
pcVar13 = local_44;
iVar8 = *(int *)(param_2 + 0x648);
memmove(local_50,(void *)(param_2 + 0x1a),1) //possible issue identified - semgrep
bVar2 = false;
for (pcVar12 = (char *)(param_2 + 0x1b);
pcVar12 + (byte)pcVar12[1] + 1 < (char *)(param_2 + iVar8); pcVar12 = pcVar12 + bVar1 + 2) {
if (*pcVar12 == '\'') {
memmove(&local_48,pcVar12 + 2,1) //possible issue identified - semgrep
memmove(&local_47,pcVar12 + 3,1) //possible issue identified - semgrep
memmove(local_46,pcVar12 + 4,1) //possible issue identified - semgrep
if ((local_46[0] == '\0') || (local_46[0] == '\x01')) {
memmove(pcVar13,pcVar12 + 5,1) //possible issue identified - semgrep
memmove(pcVar13 + 1,pcVar12 + 6,8) //possible issue identified - semgrep
memmove(pcVar13 + 9,pcVar12 + 0xe,2) //possible issue identified - semgrep
__n = 1 //possible issue identified - semgrep
LAB_0004689c:
memmove(pcVar13 + 0xb,pcVar12 + 0x10,__n) //possible issue identified - semgrep
}
else if (local_46[0] == '\x02') {
memmove(pcVar13,pcVar12 + 5,1) //possible issue identified - semgrep
memmove(pcVar13 + 1,pcVar12 + 6,8) //possible issue identified - semgrep
memmove(pcVar13 + 9,pcVar12 + 0xe,2) //possible issue identified - semgrep
__n = 8 //possible issue identified - semgrep
goto LAB_0004689c;
}
bVar2 = true;
bVar1 = pcVar12[1];
}
else {
bVar1 = pcVar12[1];
}
}
if (bVar2) {
if (local_50[0] != '\0') {
iVar8 = MeasureReqLookUp(param_1);
if (iVar8 == 0) goto LAB_000469d8;
MeasureReqDelete(param_1,*(undefined1 *)(iVar8 + 9));
}
if (((local_46[0] == '\0') && ((local_44[0xb] & 8U) != 0)) &&
(*(char *)(param_1 + 0x16acc) == '\0')) {
pcVar13 = (char *)(param_1 + 0x4e3e);
for (iVar8 = 0; iVar8 < (int)(uint)*(byte *)(param_1 + 0x5058); iVar8 = iVar8 + 1) {
if ((*pcVar13 == *local_44) && (*(short *)(pcVar13 + -2) == 0)) {
*(undefined2 *)(iVar8 * 10 + param_1 + 0x4e3c) = 0x708;
*(char *)(param_1 + 0x169ec) = *local_44;
N_ChannelCheck(param_1);
*(undefined1 *)(param_1 + 0x16acc) = 1;
*(undefined1 *)(param_1 + 0x16ac8) = 0;
break;
}
pcVar13 = pcVar13 + 10;
}
}
}
else if (2 < RTDebugLevel) {
printk("Invalid Measurement Report Frame.\n",local_44);
}
LAB_000469d8:
os_free_mem(0,local_44);
break;
case 2:
uVar3 = ConvertToRssi(param_1,(int)*(char *)(param_2 + 0x658),0);
uVar4 = ConvertToRssi(param_1,(int)*(char *)(param_2 + 0x659),1);
uVar5 = ConvertToRssi(param_1,(int)*(char *)(param_2 + 0x65a),2);
iVar8 = RTMPMaxRssi(param_1,uVar3,uVar4,uVar5);
memmove(local_50,(void *)(param_2 + 0x1a),1) //possible issue identified - semgrep
iVar11 = *(int *)(param_2 + 0x648);
memmove(local_50,(void *)(param_2 + 0x1a),1) //possible issue identified - semgrep
bVar2 = false;
for (pcVar13 = (char *)(param_2 + 0x1b);
pcVar13 + (byte)pcVar13[1] + 1 < (char *)(param_2 + iVar11);
pcVar13 = pcVar13 + (byte)pcVar13[1] + 2) {
if (*pcVar13 == '\"') {
bVar2 = true;
}
}
if (bVar2) {
EnqueueTPCRep(param_1,param_2 + 10,local_50[0],0x10,iVar8 / 100 & 0xff);
}
break;
case 3:
memset(&local_4c,0,2) //possible issue identified - semgrep
iVar8 = *(int *)(param_2 + 0x648);
memmove(local_50,(void *)(param_2 + 0x1a),1) //possible issue identified - semgrep
bVar2 = false;
for (pcVar13 = (char *)(param_2 + 0x1b);
pcVar13 + (byte)pcVar13[1] + 1 < (char *)(param_2 + iVar8); pcVar13 = pcVar13 + bVar1 + 2) {
if (*pcVar13 == '#') {
memmove(&local_4c,pcVar13 + 2,1) //possible issue identified - semgrep
memmove(local_4b,pcVar13 + 3,1) //possible issue identified - semgrep
bVar2 = true;
bVar1 = pcVar13[1];
}
else {
bVar1 = pcVar13[1];
}
}
if ((bVar2) && (iVar8 = TpcReqLookUp(param_1,local_50[0]), iVar8 != 0)) {
pcVar13 = *(char **)(param_1 + 0x16e1c);
if (pcVar13 == (char *)0x0) {
if (RTDebugLevel != 0) {
printk("%s: pTpcReqTab doesn\'t exist.\n","TpcReqDelete");
}
}
else if (*pcVar13 == '\0') {
if (RTDebugLevel != 0) {
printk("pTpcReqTab empty.\n");
}
}
else {
__s = (undefined4 *)TpcReqLookUp(param_1,*(undefined1 *)(iVar8 + 9));
if (__s != (undefined4 *)0x0) {
uVar7 = *(byte *)((int)__s + 9) & 0x1f;
puVar10 = *(undefined4 **)(pcVar13 + uVar7 * 4 + 4);
local_bh_disable();
puVar6 = (undefined4 *)0x0;
do {
if (puVar10 == __s) {
if (puVar6 == (undefined4 *)0x0) {
*(undefined4 *)(pcVar13 + uVar7 * 4 + 4) = *__s;
}
else {
*puVar6 = *__s;
}
break;
}
puVar9 = (undefined4 *)*puVar10;
puVar6 = puVar10;
puVar10 = puVar9;
} while (puVar9 != (undefined4 *)0x0);
memset(__s,0,0xc) //possible issue identified - semgrep
*pcVar13 = *pcVar13 + -1;
local_bh_enable();
}
}
if (2 < RTDebugLevel) {
printk("%s: DialogToken=%x, TxPwr=%d, LinkMargin=%d\n","PeerTpcRepAction",local_50[0],
local_4c,local_4b[0]);
}
}
break;
case 4:
RTMPMoveMemory(&uStack_38,param_2 + 0x1c,3);
if (*(int *)(param_2 + 0x648) == 0x1e) {
RTMPMoveMemory(&local_4c,param_2 + 0x21,1);
uVar7 = *(uint *)(param_2 + 0x18);
}
else {
local_4c = 0;
uVar7 = *(uint *)(param_2 + 0x18);
}
if ((uVar7 & 0xffff0000) == 0x3250000) {
ChannelSwitchAction(param_1,*(undefined1 *)(param_2 + 0x65d),local_37 & 0xff,local_4c);
}
memset(&local_48,0,3) //possible issue identified - semgrep
iVar8 = *(int *)(param_2 + 0x648);
bVar2 = false;
for (pcVar13 = (char *)(param_2 + 0x1a);
pcVar13 + (byte)pcVar13[1] + 1 < (char *)(param_2 + iVar8); pcVar13 = pcVar13 + bVar1 + 2) {
if (*pcVar13 == '%') {
memmove(&local_48,pcVar13 + 2,1) //possible issue identified - semgrep
memmove(&local_47,pcVar13 + 3,1) //possible issue identified - semgrep
memmove(local_46,pcVar13 + 4,1) //possible issue identified - semgrep
bVar2 = true;
bVar1 = pcVar13[1];
}
else {
bVar1 = pcVar13[1];
}
}
if (bVar2) {
if ((*(char *)(param_1 + 0x16964) == '\x01') && (*(char *)(param_1 + 0x16acc) == '\0')) {
pcVar13 = (char *)(param_1 + 0x4e3e);
for (iVar8 = 0; iVar8 < (int)(uint)*(byte *)(param_1 + 0x5058); iVar8 = iVar8 + 1) {
if ((*pcVar13 == local_47) && (*(short *)(pcVar13 + -2) == 0)) {
*(undefined2 *)(iVar8 * 10 + param_1 + 0x4e3c) = 0x708;
*(char *)(param_1 + 0x169ec) = local_47;
N_ChannelCheck(param_1);
*(undefined1 *)(param_1 + 0x16acc) = 1;
*(undefined1 *)(param_1 + 0x16ac8) = 0;
return;
}
pcVar13 = pcVar13 + 10;
}
}
}
else if (2 < RTDebugLevel) {
printk("Invalid Channel Switch Action Frame.\n");
}
}
return;
}