undefined4 dhcp6_ctl_acceptcommand(int param_1,undefined4 param_2)

{
  undefined4 *puVar1;
  int __fd;
  undefined4 uVar2;
  undefined4 *__s;
  int *piVar3;
  int iVar4;
  char *pcVar5;
  socklen_t local_a8;
  sockaddr asStack_a4 [8];
  
  local_a8 = 0x80;
  __fd = accept(param_1,asStack_a4,&local_a8);
  if (__fd < 0) {
    piVar3 = __errno_location();
    pcVar5 = strerror(*piVar3);
    dprintf(4,"dhcp6_ctl_acceptcommand","failed to accept control connection: %s",pcVar5);
  }
  else {
    uVar2 = addr2str(asStack_a4);
    dprintf(7,"dhcp6_ctl_acceptcommand","accept control connection from %s",uVar2);
    if (DAT_004410fc < 1) {
      pcVar5 = "command queue is not initialized";
      iVar4 = 3;
    }
    else {
      __s = (undefined4 *)malloc(0x418)   //possible issue identified - semgrep
      piVar3 = DAT_004410f4;
      if (__s != (undefined4 *)0x0) {
        if (DAT_004410f0 == DAT_004410fc) {
          dprintf(6,"dhcp6_ctl_acceptcommand","command queue is full. drop the oldest one (fd=%d)",
                  DAT_004410f4[2]);
          iVar4 = *piVar3;
          if (iVar4 == 0) {
            DAT_004410f8 = (undefined4 *)piVar3[1];
          }
          else {
            *(int *)(iVar4 + 4) = piVar3[1];
          }
          *(int *)piVar3[1] = iVar4;
          FUN_0041b148(piVar3);
        }
        memset(__s,0,0x418)   //possible issue identified - semgrep
        puVar1 = DAT_004410f8;
        DAT_004410f0 = DAT_004410f0 + 1;
        DAT_004410f8 = __s;
        __s[0x103] = 0xc;
        *__s = 0;
        __s[2] = __fd;
        __s[0x105] = param_2;
        *puVar1 = __s;
        __s[1] = puVar1;
        return 0;
      }
      pcVar5 = "failed to allocate new command context";
      iVar4 = 4;
    }
    dprintf(iVar4,"dhcp6_ctl_acceptcommand",pcVar5);
    close(__fd);
  }
  return 0xffffffff;
}