[6220] Add a -net name=foo parameter (Mark McLoughlin)
Revision: 6220
http://svn.sv.gnu.org/viewvc/?view=rev&root=qemu&revision=6220 Author: aliguori Date: 2009-01-07 17:48:51 +0000 (Wed, 07 Jan 2009)
Log Message:
-----------
Add a -net name=foo parameter (Mark McLoughlin)
Allow the user to supply a vlan client name on the command line.
This is probably only useful for management tools so that they can use their own names rather than parsing the output of 'info network'.
Modified Paths:
--------------
trunk/hw/e1000.c
trunk/hw/eepro100.c
trunk/hw/etraxfs_eth.c
trunk/hw/mcf_fec.c
trunk/hw/mipsnet.c
trunk/hw/musicpal.c
trunk/hw/ne2000.c
trunk/hw/pcnet.c
trunk/hw/rtl8139.c
trunk/hw/smc91c111.c
trunk/hw/stellaris_enet.c
trunk/hw/usb-net.c
trunk/hw/virtio-net.c
trunk/net.c
trunk/net.h
trunk/qemu-doc.texi
trunk/sysemu.h
trunk/tap-win32.c
trunk/vl.cModified: trunk/hw/e1000.c
===================================================================
hw/e1000.c +1 -1
@@ -1071,7 +1071,7 @@ d->rxbuf_min_shift =1 ;memset (&d->tx,0 ,sizeof d->tx); - d->vc =qemu_new_vlan_client (nd->vlan, nd->model, + d->vc =qemu_new_vlan_client (nd->vlan, nd->model, nd->name, e1000_receive, e1000_can_receive, d);qemu_format_nic_info_str (d->vc, d->nd->macaddr);
Modified: trunk/hw/eepro100.c
===================================================================
hw/eepro100.c +1 -1
@@ -1776,7 +1776,7 @@nic_reset (s); - s->vc =qemu_new_vlan_client (nd->vlan, nd->model, + s->vc =qemu_new_vlan_client (nd->vlan, nd->model, nd->name, nic_receive, nic_can_receive, s);qemu_format_nic_info_str (s->vc, s->macaddr);
Modified: trunk/hw/etraxfs_eth.c
===================================================================
hw/etraxfs_eth.c +1 -1
@@ -572,7 +572,7 @@ eth->ethregs =cpu_register_io_memory (0 , eth_read, eth_write, eth);cpu_register_physical_memory (base,0x5c , eth->ethregs); - eth->vc =qemu_new_vlan_client (nd->vlan, nd->model, + eth->vc =qemu_new_vlan_client (nd->vlan, nd->model, nd->name, eth_receive, eth_can_receive, eth);return dma;
Modified: trunk/hw/mcf_fec.c
===================================================================
hw/mcf_fec.c +1 -1
@@ -452,7 +452,7 @@ mcf_fec_writefn, s);cpu_register_physical_memory (base,0x400 , iomemtype); - s->vc =qemu_new_vlan_client (nd->vlan, nd->model, + s->vc =qemu_new_vlan_client (nd->vlan, nd->model, nd->name, mcf_fec_receive, mcf_fec_can_receive, s);memcpy (s->macaddr, nd->macaddr,6 );qemu_format_nic_info_str (n->vc, s->macaddr);
Modified: trunk/hw/mipsnet.c
===================================================================
hw/mipsnet.c +1 -1
@@ -250,7 +250,7 @@ s->irq = irq; s->nd = nd;if (nd && nd->vlan) { - s->vc =qemu_new_vlan_client (nd->vlan, nd->model, + s->vc =qemu_new_vlan_client (nd->vlan, nd->model, nd->name, mipsnet_receive, mipsnet_can_receive, s); }else { s->vc =NULL ;
Modified: trunk/hw/musicpal.c
===================================================================
hw/musicpal.c +1 -1
@@ -718,7 +718,7 @@if (!s)return ; s->irq = irq; - s->vc =qemu_new_vlan_client (nd->vlan, nd->model, + s->vc =qemu_new_vlan_client (nd->vlan, nd->model, nd->name, eth_receive, eth_can_receive, s); iomemtype =cpu_register_io_memory (0 , mv88w8618_eth_readfn, mv88w8618_eth_writefn, s);
Modified: trunk/hw/ne2000.c
===================================================================
hw/ne2000.c +2 -2
@@ -741,7 +741,7 @@ne2000_reset (s); - s->vc =qemu_new_vlan_client (nd->vlan, nd->model, + s->vc =qemu_new_vlan_client (nd->vlan, nd->model, nd->name, ne2000_receive, ne2000_can_receive, s);qemu_format_nic_info_str (s->vc, s->macaddr);
@@ -804,7 +804,7 @@ s->pci_dev = (PCIDevice *)d;memcpy (s->macaddr, nd->macaddr,6 );ne2000_reset (s); - s->vc =qemu_new_vlan_client (nd->vlan, nd->model, + s->vc =qemu_new_vlan_client (nd->vlan, nd->model, nd->name, ne2000_receive, ne2000_can_receive, s);qemu_format_nic_info_str (s->vc, s->macaddr);
Modified: trunk/hw/pcnet.c
===================================================================
hw/pcnet.c +1 -1
@@ -1936,7 +1936,7 @@ d->nd = nd;if (nd && nd->vlan) { - d->vc =qemu_new_vlan_client (nd->vlan, nd->model, + d->vc =qemu_new_vlan_client (nd->vlan, nd->model, nd->name, pcnet_receive, pcnet_can_receive, d);qemu_format_nic_info_str (d->vc, d->nd->macaddr);
Modified: trunk/hw/rtl8139.c
===================================================================
hw/rtl8139.c +1 -1
@@ -3438,7 +3438,7 @@ s->pci_dev = (PCIDevice *)d;memcpy (s->macaddr, nd->macaddr,6 );rtl8139_reset (s); - s->vc =qemu_new_vlan_client (nd->vlan, nd->model, + s->vc =qemu_new_vlan_client (nd->vlan, nd->model, nd->name, rtl8139_receive, rtl8139_can_receive, s);qemu_format_nic_info_str (s->vc, s->macaddr);
Modified: trunk/hw/smc91c111.c
===================================================================
hw/smc91c111.c +1 -1
@@ -704,7 +704,7 @@smc91c111_reset (s); - s->vc =qemu_new_vlan_client (nd->vlan, nd->model, + s->vc =qemu_new_vlan_client (nd->vlan, nd->model, nd->name, smc91c111_receive, smc91c111_can_receive, s);qemu_format_nic_info_str (s->vc, s->macaddr);/* ??? Save/restore. */
Modified: trunk/hw/stellaris_enet.c
===================================================================
hw/stellaris_enet.c +1 -1
@@ -397,7 +397,7 @@memcpy (s->macaddr, nd->macaddr,6 );if (nd->vlan) { - s->vc =qemu_new_vlan_client (nd->vlan, nd->model, + s->vc =qemu_new_vlan_client (nd->vlan, nd->model, nd->name, stellaris_enet_receive, stellaris_enet_can_receive, s);qemu_format_nic_info_str (s->vc, s->macaddr); }
Modified: trunk/hw/usb-net.c
===================================================================
hw/usb-net.c +1 -1
@@ -1453,7 +1453,7 @@pstrcpy (s->dev.devname,sizeof (s->dev.devname),"QEMU USB Network Interface" ); - s->vc =qemu_new_vlan_client (nd->vlan, nd->model, + s->vc =qemu_new_vlan_client (nd->vlan, nd->model, nd->name, usbnet_receive, usbnet_can_receive, s);qemu_format_nic_info_str (s->vc, s->mac);
Modified: trunk/hw/virtio-net.c
===================================================================
hw/virtio-net.c +1 -1
@@ -315,7 +315,7 @@ n->rx_vq =virtio_add_queue (&n->vdev,256 , virtio_net_handle_rx); n->tx_vq =virtio_add_queue (&n->vdev,256 , virtio_net_handle_tx);memcpy (n->mac, nd->macaddr,6 ); - n->vc =qemu_new_vlan_client (nd->vlan, nd->model, + n->vc =qemu_new_vlan_client (nd->vlan, nd->model, nd->name, virtio_net_receive, virtio_net_can_receive, n);qemu_format_nic_info_str (n->vc, n->mac);
Modified: trunk/net.c
===================================================================
net.c +64 -33
310 lines not on this page · raw message
Modified: trunk/net.h
===================================================================
net.h +2 -0
@@ -33,6 +33,7 @@VLANState *qemu_find_vlan (int id);VLANClientState *qemu_new_vlan_client (VLANState *vlan,const char *model, +const char *name,IOReadHandler *fd_read,IOCanRWHandler *fd_can_read,void *opaque);
@@ -53,6 +54,7 @@struct NICInfo {uint8_t macaddr[6 ];const char *model; +const char *name;VLANState *vlan; };
Modified: trunk/qemu-doc.texi
===================================================================
qemu-doc.texi +8 -7
@@ -608,10 +608,11 @@ @table @option -@item -net nic[,vlan=@var{n}][,macaddr=@var{addr}][,model=@var{type}] +@item -net nic[,vlan=@var{n}][,macaddr=@var{addr}][,model=@var{type}][,name=@var{name}] Create a new Network Interface Card and connect it to VLAN @var{n} (@var{n} = 0 is the default). The NIC is an ne2k_pci by default on the PC -target. Optionally, the MAC address can be changed. If no +target. Optionally, the MAC address can be changed to @var{addr} +and a @var{name} can be assigned for use in monitor commands. If no @option{-net} option is specified, a single NIC is created. Qemu can emulate several different models of network card. Valid values for @var{type} are
@@ -621,12 +622,12 @@ Not all devices are supported on all targets. Use -net nic,model=? for a list of available devices for your target. -@item -net user[,vlan=@var{n}][,hostname=@var{name}] +@item -net user[,vlan=@var{n}][,hostname=@var{name}][,name=@var{name}] Use the user mode network stack which requires no administrator privilege to run. @option{hostname=name} can be used to specify the client hostname reported by the builtin DHCP server. -@item -net tap[,vlan=@var{n}][,fd=@var{h}][,ifname=@var{name}][,script=@var{file}][,downscript=@var{dfile}] +@item -net tap[,vlan=@var{n}][,name=@var{name}][,fd=@var{h}][,ifname=@var{name}][,script=@var{file}][,downscript=@var{dfile}] Connect the host TAP network interface @var{name} to VLAN @var{n}, use the network script @var{file} to configure it and the network script @var{dfile} to deconfigure it. If @var{name} is not provided, the OS
@@ -647,7 +648,7 @@ @end example -@item -net socket[,vlan=@var{n}][,fd=@var{h}][,listen=[@var{host}]:@var{port}][,connect=@var{host}:@var{port}] +@item -net socket[,vlan=@var{n}][,name=@var{name}][,fd=@var{h}][,listen=[@var{host}]:@var{port}][,connect=@var{host}:@var{port}] Connect the VLAN @var{n} to a remote VLAN in another QEMU virtual machine using a TCP socket connection. If @option{listen} is
@@ -667,7 +668,7 @@ -net socket,connect=127.0.0.1:1234 @end example -@item -net socket[,vlan=@var{n}][,fd=@var{h}][,mcast=@var{maddr}:@var{port}] +@item -net socket[,vlan=@var{n}][,name=@var{name}][,fd=@var{h}][,mcast=@var{maddr}:@var{port}] Create a VLAN @var{n} shared with another QEMU virtual machines using a UDP multicast socket, effectively making a bus for
@@ -707,7 +708,7 @@ /path/to/linux ubd0=/path/to/root_fs eth0=mcast @end example -@item -net vde[,vlan=@var{n}][,sock=@var{socketpath}][,port=@var{n}][,group=@var{groupname}][,mode=@var{octalmode}] +@item -net vde[,vlan=@var{n}][,name=@var{name}][,sock=@var{socketpath}][,port=@var{n}][,group=@var{groupname}][,mode=@var{octalmode}] Connect VLAN @var{n} to PORT @var{n} of a vde switch running on host and listening for incoming connections on @var{socketpath}. Use GROUP @var{groupname} and MODE @var{octalmode} to change default ownership and permissions for
Modified: trunk/sysemu.h
===================================================================
sysemu.h +2 -1
@@ -75,7 +75,8 @@#endif /* TAP win32 */ -int tap_win32_init (VLANState *vlan,const char *model,const char *ifname); +int tap_win32_init (VLANState *vlan,const char *model, +const char *name,const char *ifname);/* SLIRP */ void do_info_slirp (void );
Modified: trunk/tap-win32.c
===================================================================
tap-win32.c +3 -2
@@ -660,7 +660,8 @@ } } -int tap_win32_init (VLANState *vlan,const char *model,const char *ifname) +int tap_win32_init (VLANState *vlan,const char *model, +const char *name,const char *ifname) {TAPState *s;
@@ -672,7 +673,7 @@return -1 ; } - s->vc =qemu_new_vlan_client (vlan, model, tap_receive,NULL , s); + s->vc =qemu_new_vlan_client (vlan, model, name, tap_receive,NULL , s);snprintf (s->vc->info_str,sizeof (s->vc->info_str),"tap: ifname=%s" , ifname);
Modified: trunk/vl.c
===================================================================
vl.c +7 -7
@@ -3887,30 +3887,30 @@ "-uuid %%08x-%%04x-%%04x-%%04x-%%012x specify machine UUID\n" "\n" "Network options:\n" - "-net nic[,vlan=n][,macaddr=addr][,model=type]\n" + "-net nic[,vlan=n][,macaddr=addr][,model=type][,name=str]\n" " create a new Network Interface Card and connect it to VLAN 'n'\n" #ifdef CONFIG_SLIRP - "-net user[,vlan=n][,hostname=host]\n" + "-net user[,vlan=n][,name=str][,hostname=host]\n" " connect the user mode network stack to VLAN 'n' and send\n" " hostname 'host' to DHCP clients\n" #endif#ifdef _WIN32 -"-net tap[,vlan=n],ifname=name\n" +"-net tap[,vlan=n][,name=str],ifname=name\n" " connect the host TAP network interface to VLAN 'n'\n"#else -"-net tap[,vlan=n][,fd=h][,ifname=name][,script=file][,downscript=dfile]\n" +"-net tap[,vlan=n][,name=str][,fd=h][,ifname=name][,script=file][,downscript=dfile]\n" " connect the host TAP network interface to VLAN 'n' and use the\n" " network scripts 'file' (default=%s)\n" " and 'dfile' (default=%s);\n" " use '[down]script=no' to disable script execution;\n" " use 'fd=h' to connect to an already opened TAP interface\n"#endif -"-net socket[,vlan=n][,fd=h][,listen=[host]:port][,connect=host:port]\n" +"-net socket[,vlan=n][,name=str][,fd=h][,listen=[host]:port][,connect=host:port]\n" " connect the vlan 'n' to another VLAN using a socket connection\n" -"-net socket[,vlan=n][,fd=h][,mcast=maddr:port]\n" +"-net socket[,vlan=n][,name=str][,fd=h][,mcast=maddr:port]\n" " connect the vlan 'n' to multicast maddr and port\n" #ifdef CONFIG_VDE -"-net vde[,vlan=n][,sock=socketpath][,port=n][,group=groupname][,mode=octalmode]\n" +"-net vde[,vlan=n][,name=str][,sock=socketpath][,port=n][,group=groupname][,mode=octalmode]\n" " connect the vlan 'n' to port 'n' of a vde switch running\n" " on host and listening for incoming connections on 'socketpath'.\n" " Use group 'groupname' and mode 'octalmode' to change default\n"