History | View | Annotate | Download (79.9 kB)
Fix sys-queue.h conflict for good
Problem: Our file sys-queue.h is a copy of the BSD file, but there aresome additions and it's not entirely compatible. Because of that, there havebeen conflicts with system headers on BSD systems. Some hacks have beenintroduced in the commits 15cc9235840a22c289edbe064a9b3c19c5f49896,...
Unexport ticks_per_sec variable. Create get_ticks_per_sec() function
Signed-off-by: Juan Quintela <quintela@redhat.com>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Include sys-queue.h early to override system queue definitions on BSD
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
monitor: Port handler_2 to use QDict
This commit ports command handlers that receive two arguments to usethe new monitor's dictionary.
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
monitor: Port handler_3 to use QDict
This commit ports command handlers that receive three arguments to usethe new monitor's dictionary.
net: Fix send queue ordering
Ensure that packets enqueued for delayed delivery are dequeued in FIFOorder. At least one simplistic guest TCP/IP stack became unhappy due tosporadically reordered packet streams.
At this chance, switch the send queue implementation to TAILQ....
Add missing linefeed in error message
The error message for an unknown network device given tomonitor command set_link looks better with a terminatinglinefeed.
Signed-off-by: Stefan Weil <weil@mail.berlios.de>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
net: Fix do_set_link() return type
do_set_link() returns int, but Monitor handler functions shouldalways return void.
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>Message-Id:
rename HOST_BSD to CONFIG_BSD
Remove useless Win32 include files and unused function in net.c.
Signed-off-by: Filip Navara <filip.navara@gmail.com>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
slirp: Fix guestfwd for incoming data
Unless a virtual server address was explicitly defined (which isimpossible with the legacy net channel format), guestfwd did notproperly forwarded host>guest packets. This patch fixes it.
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>...
Add support for fd=name to tap and socket networking
This allows a program to initialize a host networking device using afile descriptor passed over a unix monitor socket.
The program must first pass the file descriptor using SCM_RIGHTSancillary data with the getfd monitor command. It then may do...
qdev: add id= support for pci nics.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
slirp: Fix default netmask to 255.255.255.0
This got broken between a13a4126c8 and c92ef6a22d: old slirp code used255.255.255.0.
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Don't abort if TUNSETSNDBUF fails where no sndbuf= arg is supplied
If no tap,sndbuf= arg is supplied, we use a default value. IfTUNSETSNDBUF fails in this case, we should not abort.
Signed-off-by: Mark McLoughlin <markmc@redhat.com>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
net: set a default value for sndbuf=
On reflection, perhaps it does make sense to set a default value forthe sndbuf= tap parameter.
For best effect, sndbuf= should be set to just below the capacity ofthe physical NIC.
Setting it higher will cause packets to be dropped before the limit...
Use pstrcpy and pstrcat to avoid OpenBSD linker warning
slirp: Basic VLAN client info_str
slirp: Enable multiple instances
Once again this was a long journey to reach the destination: Allow toinstantiate slirp multiple times. But as in the past, the journey wasworthwhile, cleaning up, fixing and enhancing various parts of the userspace network stack along the way....
slirp: Use shell to erase smb directory
Instead of open-coding this, we can use the power of the shell to removethe smb_dir on exit.
slirp: Improve error handling in slirp_smb
Make sure for invocations from the monitor that slirp_smb properlyreports errors and doesn't terminate qemu.
slirp: Enable multi-instance support for the smb service
Push the smb state, smb_dir, into SlirpState and construct it in a waythat allows multiple smb instances (one per slirp stack). Remove the smbdirectory on slirp cleanup instead of qemu termination. As VLAN clients...
net: Provide VLAN client lookup helper
Introduce qemu_find_vlan_client_by_name for VLANClientState lookup basedon VLAN ID and client name. This is useful for monitor commands.
slirp: Make hostfwd_add/remove multi-instance-aware
Extend the syntax of hostfwd_add/remove to optionally take a tuple ofVLAN ID and slirp stack name. If those are omitted, the commands willcontinue to work on the first registered slirp stack.
slirp: Kill slirp_is_inited
Avoid the need for slirp_is_inited by refactoring the protectedslirp_select_* functions. This also avoids the clearing of all fd setson select errors.
slirp: Drop redundant checks from slirp_output
Slirp doesn't invoke slirp[_can]_output before it is initialized. Themotivation for these checks (3b7f5d479c) no longer applies. So dropthem.
Note: slirp_vc will become invalid if the slirp stack is removed during...
slirp: Use internal state in interface
This now also exports the internal state to the slirp users in qemu,returning it from slirp_init and expecting it along with serviceinvocations. Additionally provide an opaque value interface for thecallbacks from slirp into the qemu core....
slirp: Allocate/free stack instance dynamically
Allocate the internal slirp state dynamically and provide and callslirp_cleanup to properly release it after use. This patch finallyunbreaks slirp release and re-instantiation via host_net_* monitorcommands....
slirp: Do not allow to remove non-hostfwd sockets
Prevent that the users accidentally shoots down dynamic sockets. Thisallows to remove looping for removals as there can now only be onematch.
slirp: Add info usernet for dumping connection states
Break out sockstats from the slirp statistics and present them under thenew info category "usernet". This patch also improves the current output/wrt proper reporting connection source and destination....
slirp: Drop statistic code
As agreed on the mailing list, there is no interest in keeping theusually disabled slirp statistics in the tree. So this patch removesthem.
slirp: Rework external configuration interface
With the internal IP configuration made more flexible, we can nowenhance the user interface. This patch adds a number of new options to"-net user": net (address and mask), host, dhcpstart, dns and smbserver....
slirp: Rework monitor commands for host forwarding
Improve the monitor interface for adding and removing host forwardingrules by splitting it up in two commands and rename them to hostfwd_addand hostfwd_remove. Also split up the paths taken for legacy -redir...
slirp: Bind support for host forwarding rules
Extend the hostfwd rule format so that the user can specify on whichhost interface qemu should listen for incoming connections. If omitted,binding will takes place against all interfaces.
Revert "User networking: Show active connections"
This reverts commit 1c6ed9f3379faac83da0ed3e95cbd49003ac0dd1.
It's redundant to slirp statistics, which are going to be split up /reworked later on.
Conflicts:
monitor.c net.c
slirp: Move smb, redir, tftp and bootp parameters and -net channel
So far a couple of slirp-related parameters were expressed viastand-alone command line options. This it inconsistent and unintuitive.Moreover, it prevents both dynamically reconfigured (host_net_add/...
qemu/net: flag to control the number of vectors a nic has
Add an option to specify the number of MSI-X vectors for PCI NIC cards. Thiscan also be used to disable MSI-X, for compatibility with old qemu. Thisoption currently only affects virtio cards.
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>...
net: add qemu_purge_queued_packets()
If net client sends packets asynchronously, it needs to purge its queuedpackets in cleanup() so as to prevent sent callbacks being invoked witha freed client.
net: purge queued packets in tap_cleanup()
If tap has any packets queued at host_net_remove time, it needs to purgethem in order to prevent a sent callback being invoked for it.
net: add tap_read_poll() helper
Add a helper to enable/disable the read polling on tapfd.
We need this, because we want to start write polling on the tapfd tooand enable/disable both types of polling independently.
Signed-off-by: Mark McLoughlin <markmc@redhat.com>...
net: handle EAGAIN from tapfd write()
If a write() on tapfd returns EAGAIN, return zero so that the packetgets queued (in the case of async send) and enable polling tapfd forwriting.
When tapfd becomes writable, disable write polling and flush any queued...
net: return TAPState from net_tap_init()
net_tap_fd_init() already returns TAPState, so this is a sensiblecleanup in its own right.
net: add '-net tap,sndbuf=nbytes'
2.6.30 adds a new TUNSETSNDBUF ioctl() which allows a send buffer limitfor the tap device to be specified. When this limit is reached, a tapwrite() will return EAGAIN and poll() will indicate the fd isn'twritable.
This allows people to tune their setups so as to avoid e.g. UDP packet...
net: add packet length to NetPacketSent callback
virtio-net needs this - for the same purpose that it currently uses thereturn value from qemu_sendv_packet().
Support addr=... in option argument of -net nic
Make net_client_init() accept addr=, put the value into structNICinfo. Use it in pci_nic_init(), and remove arguments bus anddevfn.
Don't support addr= in third argument of monitor command pci_add,because that clashes with its first argument. Admittedly unelegant....
Make nic option rom loading less painful.
The code how it is today, is totally painful to read and keep.To begin with, the code is duplicated with the option rom loadingcode that linux_boot and vga are already using.
This patch introduces a "bootable" state in NICInfo structure,...
Add O_BINARY to open call in net_dump_init.
Fix the pcap dumps on Win32 and other systems where O_BINARY is required.
Win32: Don't remove const attribute in type casts.
Type casts removing the const attribute are bad becausethey hide the fact that the argument remains const.
They also result in a compiler warning (at least with MS-C).
Signed-off-by: Stefan Weil <weil@mail.berlios.de>
Fix mingw32 build warnings
Work around buffer and ioctlsocket argument type signedness problemsSuppress a prototype which is unused on mingw32Expand a macro to avoid warnings from some GCC versions
Fix build breakage when using VDE introduced by 4f1c942
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
net: return status from qemu_deliver_packet()
Will allow qemu_send_packet() handle queue full condition.
Signed-off-by: Mark McLoughlin <markmc@redhat.com>
net: split out packet queueing and flushing into separate functions
We'll be doing more packet queueing in later commits.
net: add qemu_send_packet_async()
Add a qemu_send_packet() variant which will queue up the packetif it cannot be sent when all client queues are full. It laterinvokes the supplied callback when the packet has been sent.
If qemu_send_packet_async() returns zero, the caller is expected...
net: make use of async packet sending API in tap client
If a packet is queued by qemu_send_packet(), remove I/Ohandler for the tap fd until we get notification that thepacket has been sent.
A not insignificant side effect of this is we can nowdrain the tap send queue in one go without fear of packets...
slirp: Avoid zombie processes after fork_exec
Slirp uses fork_exec for spawning service processes, and QEMU uses thisfor running smbd. As SIGCHLD is not handled, these processes becomezombies on termination. Fix this by installing a proper signal handler,...
Revert "Fix output of uninitialized strings"
This reverts commit 8cf07dcbe7691dbe4f47563058659dba6ef66b05.
This is a sorry saga.
This commit:
8e4416af45 net: Add parameter checks for VLAN clients
broken '-net socket' and this commit:
ffad4116b9 net: Fix -net socket parameter checks...
net: Real fix for check_params users
OK, last try: 8e4416af45 broke -net socket, ffad4116b9 tried to fix itbut broke error reporting of invalid parameters. So this patch widelyreverts ffad4116b9 again and intead fixes those callers of check_paramsthat originally suffered from overwritten buffers by using separate...
net: fix error reporting for some net parameter checks
A small bit of confusion between buffers is causing errors like:
qemu: invalid parameter '10' in 'script=/etc/qemu-ifup,fd=10'
instead of:
qemu: invalid parameter 'script' in 'script=/etc/qemu-ifup,fd=10'...
net: Improve parameter error reporting
As host network devices can also be instantiated via the monitor, errorsshould then be reported to the related monitor instead of stderr. Thisrequires larger refactoring, so this patch starts small with introducing...
slirp: Reorder initialization
This patch reorders the initialization of slirp itself as well as itsassociated features smb and redirection. So far the first reference toslirp triggered the initialization, independent of the actual -net useroption which may carry additional parameters. Now we save any request to...
net: factor tap_read_packet() out of tap_send()
Move portability clutter out into its own function.
net: move the tap buffer into TAPState
KVM uses a 64k buffer for reading from tapfd (for GSO support)and allocates the buffer with TAPState rather than on the stack.
Not allocating it on the stack probably makes sense for qemuanyway, so merge it in advance of GSO support....
net: vlan clients with no fd_can_read() can always receive
If a vlan client has no fd_can_read(), that means it canalways receive packets. The current code assumes it can neverreceive packets.
net: only read from tapfd when we can send
Reduce the number of packets dropped under heavy networktraffic by only reading a packet from the tapfd when aclient can actually handle it.
net: add fd_readv() handler to qemu_new_vlan_client() args
This, apparently, is the style we prefer - all VLANClientStateshould be an argument to qemu_new_vlan_client().
net: re-name vc->fd_read() to vc->receive()
VLANClientState's fd_read() handler doesn't read from filedescriptors, it adds a buffer to the client's receive queue.
Re-name the handlers to make things a little less confusing.
net: pass VLANClientState* as first arg to receive handlers
Give static type checking a chance to catch errors.
net: add return value to packet receive handler
This allows us to handle queue full conditions rather than droppingthe packet on the floor.
net: Don't deliver to disabled interfaces in qemu_sendv_packet
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>Signed-off-by: Mark McLoughlin <markmc@redhat.com>
net: Fix and improved ordered packet delivery
Fix a race in qemu_send_packet when delivering deferred packets andadd proper deferring also to qemu_sendv_packet.
User networking: Show active connections
In case you're wondering what connections exactly you have openor maybe redir'ed in the past, you can't really find out from qemuright now.
This patch enables you to see all current connections the hostonly networking holds open, so you can kill them using the previous...
User Networking: Enable removal of redirections
Using the new host_net_redir command you can easily create redirectionson the fly while your VM is running.
While that's great, it's missing the removal of redirections, in case youwant to have a port closed again at a later point in time....
Fix output of uninitialized strings
Commit ffad4116b96e29e0fbe892806f97c0a6c903d30d removed the "scratch buffer" from check_params, but didn't care for the error messages which actuallyincluded this string to tell the user which option was wrong. Now this string...
net: Fix dump time stamps
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Suppress type mismatch warnings in VDE code.
Signed-off-by: Paul Brook <paul@codesourcery.com>
net: Fix -net socket parameter checks
My commit ea053add700d8abe203cd79a9ffb082aee4eabc0 broke -net socket byoverwriting an intermediate buffer in the added check_param. Fix thisby switching check_param to automatic buffer allocation and release, ie.callers no longer have to worry about providing a scratch buffer....
net: Avoid gcc'ism in net_host_device_add
+ if (net_client_init(device, opts ? : "") < 0) { Is this a gcc extension? Do we want to introduce this construct to thecode base.
+ if (net_client_init(device, opts ? : "") < 0) {
Is this a gcc extension? Do we want to introduce this construct to thecode base.
Valid remark, fix below.
Thanks,Jan
-------->
fix net.c compile warning
Fix net.c compile warning:
CC net.onet.c: In function net_slirp_redir:net.c:623: warning: format not a string literal and no format arguments
Signed-off-by: Robert Reif <reif@earthlink.net>
net: Prevent multiple slirp instances (Jan Kiszka)
The slirp stack is full of global variables which prevents instantiatingit more than once. Catch this during net_slirp_init to prevent more harmlater on.
slirp: Enhance host-guest redirection setup (Jan Kiszka)
Allow to establish a TCP/UDP connection redirection also via a monitorcommand 'host_net_redir'. Moreover, assume TCP as connection type ifthat parameter is omitted.
net: Untangle nested qemu_send_packet (Jan Kiszka)
Queue packets that are send during an ongoing packet delivery. Thisensures that packets will always arrive in their logical order at eachclient of a VLAN. Currently, slirp generates such immediate relies, and...
monitor: Improve host_net_add (Jan Kiszka)
Fix the documentation of the host_net_add monitor command and allow theuser to pass no options at all. Moreover, inform the user on themonitor terminal if a request failed.
net: Add support for capturing VLANs (Jan Kiszka)
This patch is derived from Tristan Gingold's patch. It adds a new VLANclient type that writes all traffic on the VLAN it is attached to into apcap file. Such a file can then be analyzed offline with Wireshark or...
net: Add parameter checks for VLAN clients (Jan Kiszka)
This aims at helping the user to find typos or other mistakes inparameter lists passed for VLAN client initialization. The existingparsing infrastructure does not allow a leaner approach, but this is...
net: Fix -net socket,listen (Jan Kiszka)
In case no symbolic name is provided when requesting VLAN connection vialistening TCP socket ('-net socket,listen=...'), qemu crashes. Thisfixes the cause.
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>...
net: Check device passed to host_net_remove (Jan Kiszka)
Make sure that we do not delete guest NICs via host_net_remove.
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@7195 c046a42c-6fe2-441c-8c8c-71466251a162
Free VLANClientState using qemu_free() (Mark McLoughlin)
It's allocated using qemu_mallocz(), so ...
The name and model strings are strdup() allocated, so free()is still appropriate for them.
Reported-by: Jan Kiszka <jan.kiszka@siemens.com>Signed-off-by: Mark McLoughlin <markmc@redhat.com>...
Introduce VLANClientState::cleanup() (Mark McLoughlin)
We're currently leaking memory and file descriptors on devicehot-unplug.
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@7150 c046a42c-6fe2-441c-8c8c-71466251a162
Remove some useless malloc() checking (Mark McLoughlin)
Now that we abort() on malloc, neither qemu_find_vlan() nornet_tap_fd_init() can fail.
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@7146 c046a42c-6fe2-441c-8c8c-71466251a162
Fix error handling in net_client_init() (Mark McLoughlin)
We weren't freeing the name string everywhere.
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@7144 c046a42c-6fe2-441c-8c8c-71466251a162
struct iovec is now universally available (Mark McLoughlin)
struct iovec is now defined in qemu-common.h if needed, so we don't needthe tap code to handle !defined(HAVE_IOVEC).
Signed-off-by: Mark McLoughlin <markmc@redhat.com>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>...
Fix OpenSolaris gcc4 warnings: iovec type mismatches, missing 'static'
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@7103 c046a42c-6fe2-441c-8c8c-71466251a162
Fix some win32 compile warnings
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6984 c046a42c-6fe2-441c-8c8c-71466251a162
host_device_remove: remove incorrect check for device name (Eduardo Habkost)
There is no need to check for valid prefixes on the the device namewhen removing it. If the device name is found on the vlan client list,it can be removed, regardless of the prefix used on its name....
Fix windows build and clean up use of <windows.h>
We want to globally define WIN_LEAN_AND_MEAN and WINVER to particular values solet's do it in OS_CFLAGS.
Then, we can pepper in windows.h includes where using #includes that require it.
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>...
Rename _BSD to HOST_BSD so that it's more obvious that it's defined by configure
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6775 c046a42c-6fe2-441c-8c8c-71466251a162
Support for DragonFly BSD (Hasso Tepper)
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6746 c046a42c-6fe2-441c-8c8c-71466251a162
Fix BSD breakage from r6736
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6742 c046a42c-6fe2-441c-8c8c-71466251a162
Sparse fixes: NULL use, header order, ANSI prototypes, static
Fix Sparse warnings: * use NULL instead of plain 0 * rearrange header include order to avoid redefining types accidentally * ANSIfy SLIRP * avoid "restrict" keyword * add static
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6736 c046a42c-6fe2-441c-8c8c-71466251a162
monitor: Rework API (Jan Kiszka)
Refactor the monitor API and prepare it for decoupled terminals:term_print functions are renamed to monitor_* and all monitor servicesgain a new parameter (mon) that will once refer to the monitor instancethe output is supposed to appear on. However, the argument remains...