History | View | Annotate | Download (35.2 kB)
default devices: network
Add a default_net variable which specified whenever a default networkshould be created. It is cleared in case any -net option is specifiedand it is also added to the new -nodefaults switch.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>...
net: add qemu_foreach_nic()
Signed-off-by: Mark McLoughlin <markmc@redhat.com>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
net: print correct error for '-netdev ""'
Reported-by: Markus Armbruster <armbru@redhat.com>Signed-off-by: Mark McLoughlin <markmc@redhat.com>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
net: move parse_macaddr() to net/util.[ch]
net: remove qemu_new_vlan_client()
... and VLANClientState::opaque and qemu_find_vlan_client().
All of these are now unused
net: remove VLANClientState members now in NetClientInfo
Add a NetClientInfo pointer to VLANClientState and use thatfor the typecode and function pointers.
net: introduce NICState and qemu_new_nic()
Common state for all NICs.
The opaque member will replace the opaque member in VLANClientStatesince only NICs need it.
The conf member will allow us to iterate over NICs, access the MACaddr for the NIC and send a packet from each NIC in qemu_announce_self()....
net: introduce qemu_new_net_client()
A replacement for qemu_new_vlan_client(), using NetClientInfo toreplace most arguments.
net: move vde code from net.c to net/vde.c
net: move socket backend code from net.c to net/socket.c
net: move dump backend code from net.c to net/dump.c
net: clean up includes in net.c
This is probably a little drastic, but the includes in this file arenow totally out of control when compared with what includes areactually needed.
This may break the build on e.g. *BSD, but it will be easily fixed byre-instating an include....
net: move slirp code from net.c to net/slirp.c
Add support for GNU/kFreeBSD
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
net: disable receiving if client returns zero
If a receiver returns zero, that means its queue is full and it willnotify us when room is available using qemu_flush_queued_packets().
Take note of that and disable that receiver until it flushes its queue....
net: move AIX code into net/tap-aix.c
Okay, this makes the tap options available on AIX even though there'sno support, but if we want to do it right we should have not compilethe tap code at all on AIX using e.g. CONFIG_TAP.
Signed-off-by: Mark McLoughlin <markmc@redhat.com>...
net: move more stuff into net/tap-win32.c, add net/tap.h
net: move tap-linux.h under net/
net: split all the tap code out into net/tap.c
Enable UFO on virtio-net and tap devices
Enable UFO on the host tap device if supported and allow setting UFOon virtio-net in the guest.
Signed-off-by: Sridhar Samudrala <sri@us.ibm.com>Signed-off-by: Mark McLoughlin <markmc@redhat.com>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
net: add tap_set_offload()
This API allows virtio-net to enable various offload features on atap interface - e.g. to tell the host kernel it can pass up partialchecksums to userspace.
net: add flags parameter to packet queue interface
This allows for the addition of a raw flag, and leaves the way openfor other flags too.
net: add an API for 'raw' packets
In the case where a NIC and backend agree on a packet header format,this API allows injecting packets which lack the agreed upon header.
We need this for sending our gratuitous ARP.
net: add receive_raw parameter to qemu_new_vlan_client()
Trivial patch to allow supplying a receive_raw function.
A future cleanup should combine this function pointer parameters into atable.
net: implement tap support for receive_raw()
tap_receive_raw() always prepends a vnet header if IFF_VNET_HDR isenabled.
tap_receive() only prepends when the a header is required but the NICdoesn't supply one.
net: import linux tap ioctl definitions
Making features dependent on the availability of newer versions if_tun.his going to get seriously clumsy, so let's just import the definitionswe need. It's only a small handful.
If and when we're comfortable depending on 2.6.30 headers, we can remove...
net: make tap_receive() re-use tap_receive_iov() code
In future we will want to prepend a virtio_net header if the NIC didn'tsupply one but IFF_VNET_HDR is enabled on the interface. This is mosteasily achived by using writev() in all cases.
net: enable IFF_VNET_HDR on tap fds if available
For now, we just add an empty header before writing and strip the headerafter reading.
We really only want IFF_VNET_HDR when virtio_net is using it, but itwould significantly complicate matters to try and do that. There should...
net: refactor tap initialization
Re-factor things so that there is only one call site fornet_tap_fd_init().
Two concerns about the QemuOpts usage here - firstly, we set the scriptarguments to their default value and, secondly, we set the ifname valueto the name allocated by the kernel if none is supplied. Are we okay...
net: add a vnet_hdr=on|off parameter
This allows people to disable the IFF_VNET_HDR flag, e.g. for debuggingpurposes or if they know they may migrate the guest to a machine withoutIFF_VNET_HDR support.
It also allows making the lack of IFF_VNET_HDR support an error...
net: add a client type code
This is so as to allow APIs which operate on specific client typeswithout having to add a function table entry which is only implementedby a single client type.
net: add tap_has_vnet_hdr() and tap_using_vnet_hdr() APIs
These lamely named functions allow virtio-net to query whetherIFF_VNET_HDR is enabled on a tap interface and inform the tap codethat virtio-net will supply packets with a vnet header.
qdev: add netdev property
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
net: add macaddr type.
Add new type for mac addresses.
Add function which sets the qemu default mac address if it finds the macaddress uninitialized (i.e. all zeros).
net: refactor packet queueing code
The packet queue code is fairly standalone, has some complex details andeasily reusable. It makes sense to split it out on its own. This patchdoesn't contain any functional changes.
Patchworks-ID: 35511Signed-off-by: Mark McLoughlin <markmc@redhat.com>...
net: add queue for peer-to-peer packet forwarding
Now that we have re-factored the packet queue code, we can re-useit for peer-to-peer also.
Patchworks-ID: 35520Signed-off-by: Mark McLoughlin <markmc@redhat.com>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
net: fix multiple NICs causing net opts process to stop
For NICs, net_init_client() returns the index into the NICInfo table.
qemu_opts_foreach() interprets non-zero as an error return an stopsiterating over the options.
So, if you have more than one '-net nic' on the command line, subsequent...
net: maintain a list of vlan-less clients
Allows them to be cleaned up at shutdown.
This is pretty lame, but will eventually go away as we make vlansthe special case.
Patchworks-ID: 35518Signed-off-by: Mark McLoughlin <markmc@redhat.com>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
net: add -net nic,netdev= option
Patchworks-ID: 35515Signed-off-by: Mark McLoughlin <markmc@redhat.com>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
net: allow NICs to be connected to netdevs
Introduce a 'peer' member to VLANClientState as an alternativeto a vlan. The idea being that packets are transfered directlyfrom peer clients rather than going through a vlan.
Patchworks-ID: 35516Signed-off-by: Mark McLoughlin <markmc@redhat.com>...
net: allow clients not associated with a vlan
Allow net clients to be created which are not connected to any vlan.
This is needed by Gerd in order to allow adding -device nic, wherethe absence of a vlan parameter will not imply vlan=0. Also neededto allow adding a -netdevice option which doesn't connect the backend...
net: add QemuOptsList arg to net_client_parse()
Patchworks-ID: 35505Signed-off-by: Mark McLoughlin <markmc@redhat.com>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
net: handle -netdevice options
Same as for -net except for:
- only tap, user, vde and socket types are supported- the vlan parameter is not allowed- the name parameter is not allowed but the id parameter isrequired
Patchworks-ID: 35517Signed-off-by: Mark McLoughlin <markmc@redhat.com>...
net: pass monitor handle to client init functions
Needed for e.g. looking up a file descriptor name usingmonitor_get_fd() in net_init_tap()
Patchworks-ID: 35509Signed-off-by: Mark McLoughlin <markmc@redhat.com>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
net: handle id= parameter for -net
Use id= in the same was as the current name= parameter; if both arespecified, id= is used.
Patchworks-ID: 35514Signed-off-by: Mark McLoughlin <markmc@redhat.com>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
net: remove id field from NICInfo
Just use the name field instead since we now use the id paramater asthe name, if supplied. Only implication with this change is that ifid is not supplied, the value of the name paramater is used as anid.
Patchworks-ID: 35512...
net: use qtailq for vlan and client lists
Patchworks-ID: 35507Signed-off-by: Mark McLoughlin <markmc@redhat.com>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
slirp: fix !CONFIG_SLIRP compilation
This moves the code that depens on slirp under CONFIG_SLIRP again.
Patchworks-ID: 35372Signed-off-by: Juan Quintela <quintela@redhat.com>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Port host_net_add monitor command to QemuOpts
Here is where we rely on qemu_opts_parse() to handle an empty string.We could alternatively explicitly handle this here by usingqemu_opts_create() when we're not supplied any parameters, but itscleaner this way....
Port usb net to QemuOpts
We need net_client_init_from_opts() exported for this
Final net cleanup after conversion to QemuOpts
Now that net_client_init() has no users, kill it off and renamenet_client_init_from_opts().
There is no further need for the old code in net_client_parse() either.We use qemu_opts_parse() 'firstname' facitity for that. Instead, move...
Port -net none and -net nic to QemuOpts
We use a table of network types to look up the initialization functionand parameter descriptions in net_client_init().
For now, we use QemuOpts for the 'none' and 'nic' types. Subsequentpatches port the other types too and the special casing is removed....
Port -net user to QemuOpts
The handling of guestfwd and hostfwd requires the previous changesto allow multiple values for each parameter. The only way to accessthose multiple values is to use qemu_opt_foreach().
Port -net tap to QemuOpts
Some parameters are not valid with fd=. Rather than having a separateparameter description table for validating fd=, it's easir to justcheck for those invalid parameters later.
Note, the need to possible lookup a file descriptor name from the...
Port -net socket to QemuOpts
Port -net vde to QemuOpts
The net_vde_init() change is needed because we now pass NULL pointersinstead of empty strings for group/sock if they're not set.
Port -net dump to QemuOpts
Note, not incrementing nb_host_devs in net_init_dump() is intentional.
Clean up legacy code in net_client_init()
Now that we've ported everything over to QemuOpts, we can kill offall the cruft in net_client_init().
Note, the 'channel' type requires special handling as it uses aformat that QemuOpts can't parse
Drop config_error(), use qemu_error() instead
Diagnostic output goes to stderr, except when we're in a monitorcommand, when it goes to the monitor instead.
config_error() implements this with a monitor argument: if it'snon-null, report there, else to stderr. This obliges us to pass the...
Use qemu_strdup() for NICInfo string fields
Make NICInfo string fields non-const
We now only assign strdup()ed strings to these fields, never staticstrings.
aliguori: fix build for ppc_prep and mips_jazz
Move memset() from net_client_uninit() to net_client_init()
zeroing a structure before using it is more common than zeroing afterusing it. Also makes the setting of nd->used more obvious.
Use qemu_strdup() for VLANClientState string fields
Make net_client_init() consume slirp_configs even on error
net_slirp_init() walks slirp_configs, and stops when it encounters onethat doesn't work. Instead of consuming slirp_configs members there,consume them in the sole caller. This makes sure all are consumed....
Don't exit() in config_error()
Propagating errors up the call chain is tedious. In startup code, wecan take a shortcut: terminate the program. This is wrong elsewhere,the monitor in particular.
config_error() tries to cater for both customers: it terminates the...
Make it obvious that pci_nic_init() can't fail
Before this patch, pci_nic_init() returns NULL when it can't find themodel in pci_nic_models[]. Except this can't happen, becauseqemu_check_nic_model_list() just searched for model inpci_nic_models[], and terminated the program on failure....
Fix pci_add nic not to exit on bad model
Monitor command "pci_add ADDR nic model=MODEL" uses pci_nic_init() tocreate the NIC. When MODEL is unknown or "?", this prints to stderrand terminates the program.
Change pci_nic_init() not to treat "?" specially, and to return NULL...
Correctly free nd structure
When we "free" a NICInfo structure, we can leak pointers, since we don't domuch more than setting used = 0.
We free() the model parameter, but we don't set it to NULL. This means thata new user of this structure will see garbage in there. It was not noticed...
net: fix coding style nit
Put space between = and - assigning a negative numberto avoid confusion with old-style "-=" (which we also have, and need to be fixed).
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
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.
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.
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.