• Signed-off-by: Andre Przywara <andre.przywara@amd.com>
    Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
    Andre Przywara authored
     
    Browse Code »
  • Although the guest's CPUID bits can be controlled in a fine grained way
    in QEMU, a simple way to inject the host CPU is missing. This is handy
    for KVM desktop virtualization, where one wants the guest to support the
    full host feature set.
    Introduce another CPU type called 'host', which will propagate the host's
    CPUID bits to the guest. Unwanted bits can still be turned off by using
    the existing syntax (-cpu host,-skinit)
    
    Signed-off-by: Andre Przywara <andre.przywara@amd.com>
    Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
    Andre Przywara authored
     
    Browse Code »
  • KVM defaults to the hypervisor CPUID bit to be set, whereas pure
    QEMU clears it. On some occasions one wants to set or clear it the
    other way round (for instance to get HyperV running inside a guest).
    
    Move the bit-set to be done before the command line parsing and
    enable it by default. One can disable it by using: -cpu qemu64,-hypervisor
    Fix some whitespace damage on the way.
    
    Signed-off-by: Andre Przywara <andre.przywara@amd.com>
    Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
    Andre Przywara authored
     
    Browse Code »
  • Problem: It is impossible to feed filenames with the character colon because
    qemu interprets such names as a protocol. For example filename scsi:0, is
    interpreted as a protocol by name "scsi".
    
    This patch allows user to espace colon characters. For example the above
    filename can now be expressed either as 'scsi\:0' or as file:scsi:0
    
    anything following the "file:" tag is interpreted verbatin. However if "file:"
    tag is omitted then any colon characters in the string must be escaped using
    backslash.
    
    Here are couple of examples:
    
    scsi\:0\:abc is a local file scsi:0:abc
    http\://myweb is a local file by name http://myweb
    file:scsi:0:abc is a local file scsi:0:abc
    file:http://myweb is a local file by name http://myweb
    
    Signed-off-by: Ram Pai <linuxram@us.ibm.com>
    Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
    Ram Pai authored
     
    Browse Code »
  • Not every distro provides libcurses anymore, at least OpenSUSE, and at
    least under a standard library search path. So try to link against
    standard ncurses first and then fall back to legacy curses.
    
    Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
    Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
    Jan Kiszka authored
     
    Browse Code »
  • Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
    Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
    Jan Kiszka authored
     
    Browse Code »
  • Extend the syntax of hostfwd_add/remove to optionally take a tuple of
    VLAN ID and slirp stack name. If those are omitted, the commands will
    continue to work on the first registered slirp stack.
    
    Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
    Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
    Jan Kiszka authored
     
    Browse Code »
  • Introduce qemu_find_vlan_client_by_name for VLANClientState lookup based
    on VLAN ID and client name. This is useful for monitor commands.
    
    Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
    Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
    Jan Kiszka authored
     
    Browse Code »
  • Push the smb state, smb_dir, into SlirpState and construct it in a way
    that allows multiple smb instances (one per slirp stack). Remove the smb
    directory on slirp cleanup instead of qemu termination. As VLAN clients
    are also cleaned up on process termination, no feature is lost.
    
    Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
    Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
    Jan Kiszka authored
     
    Browse Code »
  • Make sure for invocations from the monitor that slirp_smb properly
    reports errors and doesn't terminate qemu.
    
    Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
    Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
    Jan Kiszka authored
     
    Browse Code »
  • Instead of open-coding this, we can use the power of the shell to remove
    the smb_dir on exit.
    
    Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
    Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
    Jan Kiszka authored
     
    Browse Code »
  • Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
    Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
    Jan Kiszka authored
     
    Browse Code »
  • Once again this was a long journey to reach the destination: Allow to
    instantiate slirp multiple times. But as in the past, the journey was
    worthwhile, cleaning up, fixing and enhancing various parts of the user
    space network stack along the way.
    
    What is this particular change good for? Multiple slirps instances
    allow separated user space networks for guests with multiple NICs. This
    is already possible, but without any slirp support for the second
    network, ie. without a chance to talk to that network from the host via
    IP. We have a legacy guest system here that benefits from this slirp
    enhancement, allowing us to run both of its NICs purely over
    unprivileged user space IP stacks.
    
    Another benefit of this patch is that it simply removes an artificial
    restriction of the configuration space qemu is providing, avoiding
    another source of surprises that users may face when playing with
    possible setups.
    
    Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
    Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
    Jan Kiszka authored
     
    Browse Code »
  • Allocate the internal slirp state dynamically and provide and call
    slirp_cleanup to properly release it after use. This patch finally
    unbreaks slirp release and re-instantiation via host_net_* monitor
    commands.
    
    Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
    Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
    Jan Kiszka authored
     
    Browse Code »
  • This now also exports the internal state to the slirp users in qemu,
    returning it from slirp_init and expecting it along with service
    invocations. Additionally provide an opaque value interface for the
    callbacks from slirp into the qemu core.
    
    Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
    Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
    Jan Kiszka authored
     
    Browse Code »
  • The essence of this patch is to stuff (almost) all global variables of
    the slirp stack into the structure Slirp. In this step, we still keep
    the structure as global variable, directly accessible by the whole
    stack. Changes to the external interface of slirp will be applied in
    the following patches.
    
    Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
    Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
    Jan Kiszka authored
     
    Browse Code »
  • link_up is true once slirp is initialized, so these check are really not
    required.
    
    Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
    Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
    Jan Kiszka authored
     
    Browse Code »
  • Again lot of dead code. Remove it.
    
    Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
    Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
    Jan Kiszka authored
     
    Browse Code »
  • Slirp doesn't invoke slirp[_can]_output before it is initialized. The
    motivation for these checks (3b7f5d47) no longer applies. So drop
    them.
    
    Note: slirp_vc will become invalid if the slirp stack is removed during
    runtime. But this is no new bug and will be fixed later.
    
    Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
    Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
    Jan Kiszka authored
     
    Browse Code »
  • Avoid the need for slirp_is_inited by refactoring the protected
    slirp_select_* functions. This also avoids the clearing of all fd sets
    on select errors.
    
    Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
    Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
    Jan Kiszka authored
     
    Browse Code »
  • Drop redundant typecasts in both variants and remove the pointless
    round-up in the UNIX version.
    
    Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
    Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
    Jan Kiszka authored
     
    Browse Code »
  • Currently, ip_id is always initialized to 0 on slirp startup (despite
    the broken attempt to derive it from the clock). This is good for
    reproducibility. But it is not preserved across save/restore. This patch
    therefore drops the dead initialization code from ip_init and introduces
    ip_id to the persistent slirp state.
    
    Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
    Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
    Jan Kiszka authored
     
    Browse Code »
  • In order to prepare re-initialization and multi-instance slirp, factor
    out init code that is of global scope and (at least for now) only need
    to be run once.
    
    This also fixes the potentially uninitialized use of our_addr in
    get_dns_addr.
    
    Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
    Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
    Jan Kiszka authored
     
    Browse Code »
  • This changes the filename handling from a static buffer in tftp_session
    for the client-provided name + prefix to a dynamically allocated buffer
    that keeps the combined path in one place.
    
    Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
    Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
    Jan Kiszka authored
     
    Browse Code »
  • Specifically make the filename extraction more readable, and always
    report errors back to the client.
    
    Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
    Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
    Jan Kiszka authored
     
    Browse Code »
  • The return code of tftp_send_error is not used, drop it. And also make
    sure to always terminate the session.
    
    Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
    Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
    Jan Kiszka authored
     
    Browse Code »
  • Perform check for set prefix early (if it's not given, tftp is disabled)
    and drop redundant second check.
    
    Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
    Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
    Jan Kiszka authored
     
    Browse Code »
  • Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
    Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
    Jan Kiszka authored
     
    Browse Code »
  • Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
    Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
    Jan Kiszka authored
     
    Browse Code »
  • As agreed on the mailing list, there is no interest in keeping the
    usually disabled slirp statistics in the tree. So this patch removes
    them.
    
    Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
    Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
    Jan Kiszka authored
     
    Browse Code »
  • After all its years inside the qemu tree, there is no point in keeping
    the dead code paths of slirp. This patch is a first round of removing
    usually commented out code parts. More cleanups need to follow (and
    maybe finally a proper reindention).
    
    Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
    Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
    Jan Kiszka authored
     
    Browse Code »
  • Break out sockstats from the slirp statistics and present them under the
    new info category "usernet". This patch also improves the current output
    /wrt proper reporting connection source and destination.
    
    Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
    Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
    Jan Kiszka authored
     
    Browse Code »
  • Required for pretty-printing.
    
    Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
    Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
    Jan Kiszka authored
     
    Browse Code »
  • Prevent that the users accidentally shoots down dynamic sockets. This
    allows to remove looping for removals as there can now only be one
    match.
    
    Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
    Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
    Jan Kiszka authored
     
    Browse Code »
  • Mark sockets that describe host forwardings. This is required for their
    (and only their) proper deletion and for pretty-printing.
    
    Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
    Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
    Jan Kiszka authored
     
    Browse Code »
  • This prepares for adding flags to socket.so_state that must not be
    removed during the lifetime of a socket.
    
    Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
    Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
    Jan Kiszka authored
     
    Browse Code »
  • Extend the hostfwd rule format so that the user can specify on which
    host interface qemu should listen for incoming connections. If omitted,
    binding will takes place against all interfaces.
    
    Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
    Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
    Jan Kiszka authored
     
    Browse Code »
  • Improve the monitor interface for adding and removing host forwarding
    rules by splitting it up in two commands and rename them to hostfwd_add
    and hostfwd_remove. Also split up the paths taken for legacy -redir
    support and the monitor add command as the latter will be extended later
    on.
    
    Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
    Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
    Jan Kiszka authored
     
    Browse Code »
  • For UDP host forwardings, fport is not stable, every outgoing packet of
    the redirection can modify it. Use getsockname instead to look up the
    port that is actually used on the host side.
    
    Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
    Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
    Jan Kiszka authored
     
    Browse Code »
  • With the internal IP configuration made more flexible, we can now
    enhance the user interface. This patch adds a number of new options to
    "-net user": net (address and mask), host, dhcpstart, dns and smbserver.
    It also renames "redir" to "hostfwd" and "channel" to "guestfwd" in
    order to (hopefully) clarify their meanings. The format of guestfwd is
    extended so that the user can define not only the port but also the
    virtual server's IP address the forwarding starts from.
    
    Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
    Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
    Jan Kiszka authored
     
    Browse Code »