/* WARNING: Globals starting with '_' overlap smaller symbols at the same address */
undefined4 main(int param_1,char **param_2)
{
char *pcVar1;
int iVar2;
size_t sVar3;
FILE *__stream;
undefined4 uVar4;
__ssize_t _Var5;
undefined4 uVar6;
undefined4 *puVar7;
char *pcVar8;
ulong uVar9;
char *local_48;
size_t local_44;
char acStack_40 [24];
pcVar8 = *param_2;
pcVar1 = strrchr(pcVar8,0x2f);
g_Progname = pcVar8;
if (pcVar1 != (char *)0x0) {
g_Progname = pcVar1 + 1;
}
pcVar1 = strstr(g_Progname,"conftest");
isConfTest = (uint)(pcVar1 != (char *)0x0);
uVar9 = 0;
pcVar1 = (char *)0x0;
LAB_00404474:
do {
pcVar8 = pcVar1;
iVar2 = getopt(param_1,param_2,"dt:c:") //possible issue identified - semgrep
if (iVar2 == -1) break;
pcVar1 = pcVar8;
if (iVar2 != 100) {
if (iVar2 == 0x74) {
uVar9 = strtoul(_optarg,(char **)0x0,0);
if (uVar9 != 0) goto LAB_00404474;
fprintf(_stderr,"%s: -t TRACELEVEL: parse error in \"%s\"\n",g_Progname,_optarg);
}
else {
pcVar1 = _optarg;
if (iVar2 == 99) goto LAB_00404474;
if (isConfTest != 0) {
uVar9 = 0x12;
pcVar1 = pcVar8;
goto LAB_00404474;
}
}
FUN_004040d0();
pcVar1 = pcVar8;
}
} while( true );
if (isConfTest == 0) {
if (param_1 <= _optind) {
fprintf(_stderr,"%s: error: missing INTERFACE name argument\n",g_Progname);
FUN_004040d0();
pcVar1 = g_wl_interface;
goto LAB_00404610;
}
}
else if (param_1 <= _optind) {
pcVar1 = strstr(g_Progname,"x86");
if (pcVar1 == (char *)0x0) {
g_interface = "br0";
}
else {
g_interface = "eth0";
}
pcVar1 = strstr(g_Progname,"x86");
if (pcVar1 == (char *)0x0) {
g_wl_interface = "eth1";
}
else {
g_wl_interface = "eth0";
}
printf("%s: no interface-name argument; \'%s\' assumed.\n",g_Progname,g_interface);
pcVar1 = g_wl_interface;
goto LAB_00404610;
}
g_interface = strdup(param_2[_optind]) //possible issue identified - semgrep
pcVar1 = g_interface;
if (_optind + 1 < param_1) {
pcVar1 = strdup(param_2[_optind + 1]) //possible issue identified - semgrep
}
LAB_00404610:
g_wl_interface = pcVar1;
g_smE_state = 0;
_DAT_0041f02c = 0;
_g_hwaddr = 0;
g_smT_state = 0;
g_trace_flags = uVar9;
memset(&g_sessions,0,0x1b8) //possible issue identified - semgrep
DAT_0041f168 = 0;
g_band = 0;
DAT_0041f164 = 0;
g_osl = osl_init();
memset(&g_rxbuf,0,0x800) //possible issue identified - semgrep
memset(g_emitbuf,0,0x800) //possible issue identified - semgrep
memset(g_txbuf,0,0x800) //possible issue identified - semgrep
memset(g_re_txbuf,0,0x800) //possible issue identified - semgrep
g_sees = seeslist_new(0x400);
g_opcode = 0xd;
g_rcvd_pkt_len = 0;
g_rtxseqnum = 0;
g_re_tx_len = 0;
local_48 = (char *)0x0;
g_generation = 0;
local_44 = 0;
g_sequencenum = 0;
g_ctc_packets = 0;
g_ctc_bytes = 0;
g_hello_timer = 0;
g_emit_timer = 0;
g_charge_timer = 0;
g_block_timer = 0;
memcpy(acStack_40,"/www/pic/lld2d.ico",0x13) //possible issue identified - semgrep
g_ssid = 0;
g_uuid = 0;
_DAT_0042ce64 = 0;
g_machine_name = 0;
_g_comptbl = 0;
g_jumbo_icon_path = 0;
DAT_0042ce5c = 0;
g_helper = 0;
DAT_0042ce60 = 0;
g_net_flags = 0;
g_max_op_rate = 0;
g_link_speed = 0;
g_qos_flags = 0;
g_wl_physical_medium = 0;
sVar3 = strlen(acStack_40);
g_icon_path = (char *)xmalloc(sVar3 + 1) //possible issue identified - semgrep
strcpy(g_icon_path,acStack_40) //possible issue identified - semgrep
if (pcVar8 == (char *)0x0) {
pcVar8 = "/var/lld2d.conf";
}
__stream = fopen(pcVar8,"r") //possible issue identified - semgrep
if (__stream != (FILE *)0x0) {
LAB_00404bd8:
_Var5 = getline(&local_48,&local_44,__stream);
if (_Var5 != -1) {
pcVar1 = (char *)lxmldbc_eatwhite();
pcVar8 = strchr(pcVar1,0x3d);
if (pcVar8 != (char *)0x0) {
*pcVar8 = '\0';
uVar4 = lxmldbc_reatwhite(pcVar8 + 1);
uVar4 = lxmldbc_eatwhite(uVar4);
pcVar1 = (char *)lxmldbc_reatwhite(pcVar1);
iVar2 = strcmp(pcVar1,"icon");
if (iVar2 == 0) {
if (g_icon_path != (char *)0x0) {
xfree();
}
g_icon_path = (char *)FUN_0040425c(uVar4);
}
else {
iVar2 = strcmp(pcVar1,"jumbo-icon");
if (iVar2 != 0) {
iVar2 = strcmp(pcVar1,"helper");
if (iVar2 == 0) {
puVar7 = &g_helper;
uVar6 = 0;
}
else {
iVar2 = strcmp(pcVar1,"machine-name");
if (iVar2 == 0) {
puVar7 = &g_machine_name;
uVar6 = 0;
}
else {
iVar2 = strcmp(pcVar1,"uuid");
if (iVar2 == 0) {
puVar7 = &g_uuid;
uVar6 = 0;
}
else {
iVar2 = strcmp(pcVar1,"ssid");
if (iVar2 == 0) {
puVar7 = &g_ssid;
uVar6 = 0;
}
else {
iVar2 = strcmp(pcVar1,"net_flags");
if (iVar2 == 0) {
puVar7 = &g_net_flags;
uVar6 = 3;
}
else {
iVar2 = strcmp(pcVar1,"max_op_rate");
if (iVar2 == 0) {
puVar7 = (undefined4 *)&g_max_op_rate;
uVar6 = 2;
}
else {
iVar2 = strcmp(pcVar1,"link_speed");
if (iVar2 == 0) {
puVar7 = &g_link_speed;
uVar6 = 3;
}
else {
iVar2 = strcmp(pcVar1,"qos_flags");
if (iVar2 == 0) {
puVar7 = &g_qos_flags;
uVar6 = 3;
}
else {
iVar2 = strcmp(pcVar1,"wl_physical_medium");
if (iVar2 != 0) {
iVar2 = strcmp(pcVar1,"bridge_behavior");
if (iVar2 == 0) {
uVar6 = 1;
puVar7 = (undefined4 *)&DAT_0042ce59;
}
else {
iVar2 = strcmp(pcVar1,"switch_speed");
if (iVar2 != 0) goto LAB_00404bd8;
uVar6 = 3;
puVar7 = &DAT_0042ce5c;
}
FUN_0040411c(uVar4,uVar6,puVar7);
_g_comptbl = CONCAT31(_DAT_0042ce59,1);
goto LAB_00404bd8;
}
puVar7 = (undefined4 *)&g_wl_physical_medium;
uVar6 = 1;
}
}
}
}
}
}
}
}
FUN_0040411c(uVar4,uVar6,puVar7);
goto LAB_00404bd8;
}
if (g_jumbo_icon_path != 0) {
xfree();
}
g_jumbo_icon_path = FUN_0040425c(uVar4);
}
}
goto LAB_00404bd8;
}
if (local_48 != (char *)0x0) {
free(local_48);
}
fclose(__stream);
}
event_init();
qos_init();
osl_interface_open(g_osl,g_interface,0) //possible issue identified - semgrep
osl_get_hwaddr(g_osl,&g_hwaddr);
osl_write_pidfile(g_osl);
osl_drop_privs(g_osl);
event_mainloop();
return 0;
}