docs: def get_alias_address(iface_name, ip_mask, gw_str, metric):
      """
      Get the correct source IP address of an interface alias
      """
  
      # Detect the architecture
      if scapy.consts.IS_64BITS:
          offset, name_len = 16, 40
      else:
          offset, name_len = 32, 32
  
      # Retrieve interfaces structures
      sck = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
      names = array.array('B', b'\0' * 4096)
      ifreq = ioctl(sck.fileno(), SIOCGIFCONF,
                    struct.pack("iL", len(names), names.buffer_info()[0]))
  
      # Extract interfaces names
      out = struct.unpack("iL", ifreq)[0]
      names = names.tobytes() if six.PY3 else names.tostring()
      names = [names[i:i + offset].split(b'\0', 1)[0] for i in range(0, out, name_len)]  # noqa: E501
  
      # Look for the IP address
      for ifname in names:
          # Only look for a matching interface name
          if not ifname.decode("utf8").startswith(iface_name):
              continue
  
          # Retrieve and convert addresses
          ifreq = ioctl(sck, SIOCGIFADDR, struct.pack("16s16x", ifname))
          ifaddr = struct.unpack(">I", ifreq[20:24])[0]
          ifreq = ioctl(sck, SIOCGIFNETMASK, struct.pack("16s16x", ifname))
          msk = struct.unpack(">I", ifreq[20:24])[0]
  
          # Get the full interface name
          ifname = plain_str(ifname)
          if ':' in ifname:
              ifname = ifname[:ifname.index(':')]
          else:
              continue
  
          # Check if the source address is included in the network
          if (ifaddr & msk) == ip_mask:
              sck.close()
              return (ifaddr & msk, msk, gw_str, ifname,
                      scapy.utils.ltoa(ifaddr), metric)
  
      sck.close()
      return