undefined4 * ifinit(char *param_1)
{
undefined4 *puVar1;
int iVar2;
undefined4 *__s;
char *pcVar3;
undefined4 uVar4;
undefined4 uVar5;
void *__ptr;
short *psVar6;
undefined4 uVar7;
int *piVar8;
int *local_28 [2];
iVar2 = FUN_00411330();
if (iVar2 != 0) {
dprintf(5,"ifinit","duplicated interface: %s",param_1);
return (undefined4 *)0x0;
}
__s = (undefined4 *)malloc(100) //possible issue identified - semgrep
if (__s == (undefined4 *)0x0) {
dprintf(3,"ifinit","malloc failed");
}
else {
memset(__s,0,100) //possible issue identified - semgrep
__s[3] = __s + 2;
__s[2] = 0;
pcVar3 = strdup(param_1);
__s[4] = pcVar3;
if (pcVar3 == (char *)0x0) {
dprintf(3,"ifinit","failed to copy ifname");
__ptr = (void *)__s[4];
goto joined_r0x0041151c;
}
iVar2 = FUN_004113b0(__s);
if (iVar2 == 0) {
__s[0x18] = 0xffffffff;
__s[0x16] = 0xffffffff;
__s[0x17] = 0xffffffff;
__s[0x13] = __s + 0x12;
__s[0x15] = __s + 0x14;
__s[0x12] = 0;
__s[0x14] = 0;
iVar2 = getifaddrs(local_28);
piVar8 = local_28[0];
if (-1 < iVar2) {
for (; piVar8 != (int *)0x0; piVar8 = (int *)*piVar8) {
while ((((iVar2 = strcmp((char *)piVar8[1],param_1), iVar2 == 0 &&
(psVar6 = (short *)piVar8[3], psVar6 != (short *)0x0)) && (*psVar6 == 10)) &&
((*(uint *)(psVar6 + 4) & 0xc0ff) != 0x80fe))) {
uVar4 = *(undefined4 *)(psVar6 + 10);
uVar5 = *(undefined4 *)(psVar6 + 6);
uVar7 = *(undefined4 *)(psVar6 + 8);
__s[7] = *(uint *)(psVar6 + 4);
__s[8] = uVar5;
__s[9] = uVar7;
__s[10] = uVar4;
piVar8 = (int *)*piVar8;
if (piVar8 == (int *)0x0) goto LAB_00411664;
}
}
LAB_00411664:
freeifaddrs(local_28[0]);
puVar1 = __s;
*__s = dhcp6_if;
dhcp6_if = puVar1;
return __s;
}
piVar8 = __errno_location();
pcVar3 = strerror(*piVar8);
dprintf(3,"ifinit","getifaddrs failed: %s",pcVar3);
}
}
__ptr = (void *)__s[4];
joined_r0x0041151c:
if (__ptr != (void *)0x0) {
free(__ptr);
}
free(__s);
return (undefined4 *)0x0;
}