Commit 7a9f6e4a8db958caf10332f160ed04f175932d55
1 parent
96d5e201
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'. Signed-off-by: Mark McLoughlin <markmc@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6220 c046a42c-6fe2-441c-8c8c-71466251a162
Showing
19 changed files
with
100 additions
and
64 deletions
hw/e1000.c
@@ -1071,7 +1071,7 @@ pci_e1000_init(PCIBus *bus, NICInfo *nd, int devfn) | @@ -1071,7 +1071,7 @@ pci_e1000_init(PCIBus *bus, NICInfo *nd, int devfn) | ||
1071 | d->rxbuf_min_shift = 1; | 1071 | d->rxbuf_min_shift = 1; |
1072 | memset(&d->tx, 0, sizeof d->tx); | 1072 | memset(&d->tx, 0, sizeof d->tx); |
1073 | 1073 | ||
1074 | - d->vc = qemu_new_vlan_client(nd->vlan, nd->model, | 1074 | + d->vc = qemu_new_vlan_client(nd->vlan, nd->model, nd->name, |
1075 | e1000_receive, e1000_can_receive, d); | 1075 | e1000_receive, e1000_can_receive, d); |
1076 | 1076 | ||
1077 | qemu_format_nic_info_str(d->vc, d->nd->macaddr); | 1077 | qemu_format_nic_info_str(d->vc, d->nd->macaddr); |
hw/eepro100.c
@@ -1776,7 +1776,7 @@ static void nic_init(PCIBus * bus, NICInfo * nd, | @@ -1776,7 +1776,7 @@ static void nic_init(PCIBus * bus, NICInfo * nd, | ||
1776 | 1776 | ||
1777 | nic_reset(s); | 1777 | nic_reset(s); |
1778 | 1778 | ||
1779 | - s->vc = qemu_new_vlan_client(nd->vlan, nd->model, | 1779 | + s->vc = qemu_new_vlan_client(nd->vlan, nd->model, nd->name, |
1780 | nic_receive, nic_can_receive, s); | 1780 | nic_receive, nic_can_receive, s); |
1781 | 1781 | ||
1782 | qemu_format_nic_info_str(s->vc, s->macaddr); | 1782 | qemu_format_nic_info_str(s->vc, s->macaddr); |
hw/etraxfs_eth.c
@@ -572,7 +572,7 @@ void *etraxfs_eth_init(NICInfo *nd, CPUState *env, | @@ -572,7 +572,7 @@ void *etraxfs_eth_init(NICInfo *nd, CPUState *env, | ||
572 | eth->ethregs = cpu_register_io_memory(0, eth_read, eth_write, eth); | 572 | eth->ethregs = cpu_register_io_memory(0, eth_read, eth_write, eth); |
573 | cpu_register_physical_memory (base, 0x5c, eth->ethregs); | 573 | cpu_register_physical_memory (base, 0x5c, eth->ethregs); |
574 | 574 | ||
575 | - eth->vc = qemu_new_vlan_client(nd->vlan, nd->model, | 575 | + eth->vc = qemu_new_vlan_client(nd->vlan, nd->model, nd->name, |
576 | eth_receive, eth_can_receive, eth); | 576 | eth_receive, eth_can_receive, eth); |
577 | 577 | ||
578 | return dma; | 578 | return dma; |
hw/mcf_fec.c
@@ -452,7 +452,7 @@ void mcf_fec_init(NICInfo *nd, target_phys_addr_t base, qemu_irq *irq) | @@ -452,7 +452,7 @@ void mcf_fec_init(NICInfo *nd, target_phys_addr_t base, qemu_irq *irq) | ||
452 | mcf_fec_writefn, s); | 452 | mcf_fec_writefn, s); |
453 | cpu_register_physical_memory(base, 0x400, iomemtype); | 453 | cpu_register_physical_memory(base, 0x400, iomemtype); |
454 | 454 | ||
455 | - s->vc = qemu_new_vlan_client(nd->vlan, nd->model, | 455 | + s->vc = qemu_new_vlan_client(nd->vlan, nd->model, nd->name, |
456 | mcf_fec_receive, mcf_fec_can_receive, s); | 456 | mcf_fec_receive, mcf_fec_can_receive, s); |
457 | memcpy(s->macaddr, nd->macaddr, 6); | 457 | memcpy(s->macaddr, nd->macaddr, 6); |
458 | qemu_format_nic_info_str(n->vc, s->macaddr); | 458 | qemu_format_nic_info_str(n->vc, s->macaddr); |
hw/mipsnet.c
@@ -250,7 +250,7 @@ void mipsnet_init (int base, qemu_irq irq, NICInfo *nd) | @@ -250,7 +250,7 @@ void mipsnet_init (int base, qemu_irq irq, NICInfo *nd) | ||
250 | s->irq = irq; | 250 | s->irq = irq; |
251 | s->nd = nd; | 251 | s->nd = nd; |
252 | if (nd && nd->vlan) { | 252 | if (nd && nd->vlan) { |
253 | - s->vc = qemu_new_vlan_client(nd->vlan, nd->model, | 253 | + s->vc = qemu_new_vlan_client(nd->vlan, nd->model, nd->name, |
254 | mipsnet_receive, mipsnet_can_receive, s); | 254 | mipsnet_receive, mipsnet_can_receive, s); |
255 | } else { | 255 | } else { |
256 | s->vc = NULL; | 256 | s->vc = NULL; |
hw/musicpal.c
@@ -718,7 +718,7 @@ static void mv88w8618_eth_init(NICInfo *nd, uint32_t base, qemu_irq irq) | @@ -718,7 +718,7 @@ static void mv88w8618_eth_init(NICInfo *nd, uint32_t base, qemu_irq irq) | ||
718 | if (!s) | 718 | if (!s) |
719 | return; | 719 | return; |
720 | s->irq = irq; | 720 | s->irq = irq; |
721 | - s->vc = qemu_new_vlan_client(nd->vlan, nd->model, | 721 | + s->vc = qemu_new_vlan_client(nd->vlan, nd->model, nd->name, |
722 | eth_receive, eth_can_receive, s); | 722 | eth_receive, eth_can_receive, s); |
723 | iomemtype = cpu_register_io_memory(0, mv88w8618_eth_readfn, | 723 | iomemtype = cpu_register_io_memory(0, mv88w8618_eth_readfn, |
724 | mv88w8618_eth_writefn, s); | 724 | mv88w8618_eth_writefn, s); |
hw/ne2000.c
@@ -741,7 +741,7 @@ void isa_ne2000_init(int base, qemu_irq irq, NICInfo *nd) | @@ -741,7 +741,7 @@ void isa_ne2000_init(int base, qemu_irq irq, NICInfo *nd) | ||
741 | 741 | ||
742 | ne2000_reset(s); | 742 | ne2000_reset(s); |
743 | 743 | ||
744 | - s->vc = qemu_new_vlan_client(nd->vlan, nd->model, | 744 | + s->vc = qemu_new_vlan_client(nd->vlan, nd->model, nd->name, |
745 | ne2000_receive, ne2000_can_receive, s); | 745 | ne2000_receive, ne2000_can_receive, s); |
746 | 746 | ||
747 | qemu_format_nic_info_str(s->vc, s->macaddr); | 747 | qemu_format_nic_info_str(s->vc, s->macaddr); |
@@ -804,7 +804,7 @@ void pci_ne2000_init(PCIBus *bus, NICInfo *nd, int devfn) | @@ -804,7 +804,7 @@ void pci_ne2000_init(PCIBus *bus, NICInfo *nd, int devfn) | ||
804 | s->pci_dev = (PCIDevice *)d; | 804 | s->pci_dev = (PCIDevice *)d; |
805 | memcpy(s->macaddr, nd->macaddr, 6); | 805 | memcpy(s->macaddr, nd->macaddr, 6); |
806 | ne2000_reset(s); | 806 | ne2000_reset(s); |
807 | - s->vc = qemu_new_vlan_client(nd->vlan, nd->model, | 807 | + s->vc = qemu_new_vlan_client(nd->vlan, nd->model, nd->name, |
808 | ne2000_receive, ne2000_can_receive, s); | 808 | ne2000_receive, ne2000_can_receive, s); |
809 | 809 | ||
810 | qemu_format_nic_info_str(s->vc, s->macaddr); | 810 | qemu_format_nic_info_str(s->vc, s->macaddr); |
hw/pcnet.c
@@ -1936,7 +1936,7 @@ static void pcnet_common_init(PCNetState *d, NICInfo *nd, const char *info_str) | @@ -1936,7 +1936,7 @@ static void pcnet_common_init(PCNetState *d, NICInfo *nd, const char *info_str) | ||
1936 | d->nd = nd; | 1936 | d->nd = nd; |
1937 | 1937 | ||
1938 | if (nd && nd->vlan) { | 1938 | if (nd && nd->vlan) { |
1939 | - d->vc = qemu_new_vlan_client(nd->vlan, nd->model, | 1939 | + d->vc = qemu_new_vlan_client(nd->vlan, nd->model, nd->name, |
1940 | pcnet_receive, pcnet_can_receive, d); | 1940 | pcnet_receive, pcnet_can_receive, d); |
1941 | 1941 | ||
1942 | qemu_format_nic_info_str(d->vc, d->nd->macaddr); | 1942 | qemu_format_nic_info_str(d->vc, d->nd->macaddr); |
hw/rtl8139.c
@@ -3438,7 +3438,7 @@ void pci_rtl8139_init(PCIBus *bus, NICInfo *nd, int devfn) | @@ -3438,7 +3438,7 @@ void pci_rtl8139_init(PCIBus *bus, NICInfo *nd, int devfn) | ||
3438 | s->pci_dev = (PCIDevice *)d; | 3438 | s->pci_dev = (PCIDevice *)d; |
3439 | memcpy(s->macaddr, nd->macaddr, 6); | 3439 | memcpy(s->macaddr, nd->macaddr, 6); |
3440 | rtl8139_reset(s); | 3440 | rtl8139_reset(s); |
3441 | - s->vc = qemu_new_vlan_client(nd->vlan, nd->model, | 3441 | + s->vc = qemu_new_vlan_client(nd->vlan, nd->model, nd->name, |
3442 | rtl8139_receive, rtl8139_can_receive, s); | 3442 | rtl8139_receive, rtl8139_can_receive, s); |
3443 | 3443 | ||
3444 | qemu_format_nic_info_str(s->vc, s->macaddr); | 3444 | qemu_format_nic_info_str(s->vc, s->macaddr); |
hw/smc91c111.c
@@ -704,7 +704,7 @@ void smc91c111_init(NICInfo *nd, uint32_t base, qemu_irq irq) | @@ -704,7 +704,7 @@ void smc91c111_init(NICInfo *nd, uint32_t base, qemu_irq irq) | ||
704 | 704 | ||
705 | smc91c111_reset(s); | 705 | smc91c111_reset(s); |
706 | 706 | ||
707 | - s->vc = qemu_new_vlan_client(nd->vlan, nd->model, | 707 | + s->vc = qemu_new_vlan_client(nd->vlan, nd->model, nd->name, |
708 | smc91c111_receive, smc91c111_can_receive, s); | 708 | smc91c111_receive, smc91c111_can_receive, s); |
709 | qemu_format_nic_info_str(s->vc, s->macaddr); | 709 | qemu_format_nic_info_str(s->vc, s->macaddr); |
710 | /* ??? Save/restore. */ | 710 | /* ??? Save/restore. */ |
hw/stellaris_enet.c
@@ -397,7 +397,7 @@ void stellaris_enet_init(NICInfo *nd, uint32_t base, qemu_irq irq) | @@ -397,7 +397,7 @@ void stellaris_enet_init(NICInfo *nd, uint32_t base, qemu_irq irq) | ||
397 | memcpy(s->macaddr, nd->macaddr, 6); | 397 | memcpy(s->macaddr, nd->macaddr, 6); |
398 | 398 | ||
399 | if (nd->vlan) { | 399 | if (nd->vlan) { |
400 | - s->vc = qemu_new_vlan_client(nd->vlan, nd->model, | 400 | + s->vc = qemu_new_vlan_client(nd->vlan, nd->model, nd->name, |
401 | stellaris_enet_receive, stellaris_enet_can_receive, s); | 401 | stellaris_enet_receive, stellaris_enet_can_receive, s); |
402 | qemu_format_nic_info_str(s->vc, s->macaddr); | 402 | qemu_format_nic_info_str(s->vc, s->macaddr); |
403 | } | 403 | } |
hw/usb-net.c
@@ -1453,7 +1453,7 @@ USBDevice *usb_net_init(NICInfo *nd) | @@ -1453,7 +1453,7 @@ USBDevice *usb_net_init(NICInfo *nd) | ||
1453 | 1453 | ||
1454 | pstrcpy(s->dev.devname, sizeof(s->dev.devname), | 1454 | pstrcpy(s->dev.devname, sizeof(s->dev.devname), |
1455 | "QEMU USB Network Interface"); | 1455 | "QEMU USB Network Interface"); |
1456 | - s->vc = qemu_new_vlan_client(nd->vlan, nd->model, | 1456 | + s->vc = qemu_new_vlan_client(nd->vlan, nd->model, nd->name, |
1457 | usbnet_receive, usbnet_can_receive, s); | 1457 | usbnet_receive, usbnet_can_receive, s); |
1458 | 1458 | ||
1459 | qemu_format_nic_info_str(s->vc, s->mac); | 1459 | qemu_format_nic_info_str(s->vc, s->mac); |
hw/virtio-net.c
@@ -315,7 +315,7 @@ PCIDevice *virtio_net_init(PCIBus *bus, NICInfo *nd, int devfn) | @@ -315,7 +315,7 @@ PCIDevice *virtio_net_init(PCIBus *bus, NICInfo *nd, int devfn) | ||
315 | n->rx_vq = virtio_add_queue(&n->vdev, 256, virtio_net_handle_rx); | 315 | n->rx_vq = virtio_add_queue(&n->vdev, 256, virtio_net_handle_rx); |
316 | n->tx_vq = virtio_add_queue(&n->vdev, 256, virtio_net_handle_tx); | 316 | n->tx_vq = virtio_add_queue(&n->vdev, 256, virtio_net_handle_tx); |
317 | memcpy(n->mac, nd->macaddr, 6); | 317 | memcpy(n->mac, nd->macaddr, 6); |
318 | - n->vc = qemu_new_vlan_client(nd->vlan, nd->model, | 318 | + n->vc = qemu_new_vlan_client(nd->vlan, nd->model, nd->name, |
319 | virtio_net_receive, virtio_net_can_receive, n); | 319 | virtio_net_receive, virtio_net_can_receive, n); |
320 | 320 | ||
321 | qemu_format_nic_info_str(n->vc, n->mac); | 321 | qemu_format_nic_info_str(n->vc, n->mac); |
net.c
@@ -325,6 +325,7 @@ static char *assign_name(VLANClientState *vc1, const char *model) | @@ -325,6 +325,7 @@ static char *assign_name(VLANClientState *vc1, const char *model) | ||
325 | 325 | ||
326 | VLANClientState *qemu_new_vlan_client(VLANState *vlan, | 326 | VLANClientState *qemu_new_vlan_client(VLANState *vlan, |
327 | const char *model, | 327 | const char *model, |
328 | + const char *name, | ||
328 | IOReadHandler *fd_read, | 329 | IOReadHandler *fd_read, |
329 | IOCanRWHandler *fd_can_read, | 330 | IOCanRWHandler *fd_can_read, |
330 | void *opaque) | 331 | void *opaque) |
@@ -334,7 +335,10 @@ VLANClientState *qemu_new_vlan_client(VLANState *vlan, | @@ -334,7 +335,10 @@ VLANClientState *qemu_new_vlan_client(VLANState *vlan, | ||
334 | if (!vc) | 335 | if (!vc) |
335 | return NULL; | 336 | return NULL; |
336 | vc->model = strdup(model); | 337 | vc->model = strdup(model); |
337 | - vc->name = assign_name(vc, model); | 338 | + if (name) |
339 | + vc->name = strdup(name); | ||
340 | + else | ||
341 | + vc->name = assign_name(vc, model); | ||
338 | vc->fd_read = fd_read; | 342 | vc->fd_read = fd_read; |
339 | vc->fd_can_read = fd_can_read; | 343 | vc->fd_can_read = fd_can_read; |
340 | vc->opaque = opaque; | 344 | vc->opaque = opaque; |
@@ -474,13 +478,13 @@ static void slirp_receive(void *opaque, const uint8_t *buf, int size) | @@ -474,13 +478,13 @@ static void slirp_receive(void *opaque, const uint8_t *buf, int size) | ||
474 | slirp_input(buf, size); | 478 | slirp_input(buf, size); |
475 | } | 479 | } |
476 | 480 | ||
477 | -static int net_slirp_init(VLANState *vlan, const char *model) | 481 | +static int net_slirp_init(VLANState *vlan, const char *model, const char *name) |
478 | { | 482 | { |
479 | if (!slirp_inited) { | 483 | if (!slirp_inited) { |
480 | slirp_inited = 1; | 484 | slirp_inited = 1; |
481 | slirp_init(); | 485 | slirp_init(); |
482 | } | 486 | } |
483 | - slirp_vc = qemu_new_vlan_client(vlan, model, | 487 | + slirp_vc = qemu_new_vlan_client(vlan, model, name, |
484 | slirp_receive, NULL, NULL); | 488 | slirp_receive, NULL, NULL); |
485 | slirp_vc->info_str[0] = '\0'; | 489 | slirp_vc->info_str[0] = '\0'; |
486 | return 0; | 490 | return 0; |
@@ -694,7 +698,10 @@ static void tap_send(void *opaque) | @@ -694,7 +698,10 @@ static void tap_send(void *opaque) | ||
694 | 698 | ||
695 | /* fd support */ | 699 | /* fd support */ |
696 | 700 | ||
697 | -static TAPState *net_tap_fd_init(VLANState *vlan, const char *model, int fd) | 701 | +static TAPState *net_tap_fd_init(VLANState *vlan, |
702 | + const char *model, | ||
703 | + const char *name, | ||
704 | + int fd) | ||
698 | { | 705 | { |
699 | TAPState *s; | 706 | TAPState *s; |
700 | 707 | ||
@@ -702,7 +709,7 @@ static TAPState *net_tap_fd_init(VLANState *vlan, const char *model, int fd) | @@ -702,7 +709,7 @@ static TAPState *net_tap_fd_init(VLANState *vlan, const char *model, int fd) | ||
702 | if (!s) | 709 | if (!s) |
703 | return NULL; | 710 | return NULL; |
704 | s->fd = fd; | 711 | s->fd = fd; |
705 | - s->vc = qemu_new_vlan_client(vlan, model, tap_receive, NULL, s); | 712 | + s->vc = qemu_new_vlan_client(vlan, model, name, tap_receive, NULL, s); |
706 | #ifdef HAVE_IOVEC | 713 | #ifdef HAVE_IOVEC |
707 | s->vc->fd_readv = tap_receive_iov; | 714 | s->vc->fd_readv = tap_receive_iov; |
708 | #endif | 715 | #endif |
@@ -937,7 +944,8 @@ static int launch_script(const char *setup_script, const char *ifname, int fd) | @@ -937,7 +944,8 @@ static int launch_script(const char *setup_script, const char *ifname, int fd) | ||
937 | return 0; | 944 | return 0; |
938 | } | 945 | } |
939 | 946 | ||
940 | -static int net_tap_init(VLANState *vlan, const char *model, const char *ifname1, | 947 | +static int net_tap_init(VLANState *vlan, const char *model, |
948 | + const char *name, const char *ifname1, | ||
941 | const char *setup_script, const char *down_script) | 949 | const char *setup_script, const char *down_script) |
942 | { | 950 | { |
943 | TAPState *s; | 951 | TAPState *s; |
@@ -958,7 +966,7 @@ static int net_tap_init(VLANState *vlan, const char *model, const char *ifname1, | @@ -958,7 +966,7 @@ static int net_tap_init(VLANState *vlan, const char *model, const char *ifname1, | ||
958 | if (launch_script(setup_script, ifname, fd)) | 966 | if (launch_script(setup_script, ifname, fd)) |
959 | return -1; | 967 | return -1; |
960 | } | 968 | } |
961 | - s = net_tap_fd_init(vlan, model, fd); | 969 | + s = net_tap_fd_init(vlan, model, name, fd); |
962 | if (!s) | 970 | if (!s) |
963 | return -1; | 971 | return -1; |
964 | snprintf(s->vc->info_str, sizeof(s->vc->info_str), | 972 | snprintf(s->vc->info_str, sizeof(s->vc->info_str), |
@@ -1002,7 +1010,8 @@ static void vde_from_qemu(void *opaque, const uint8_t *buf, int size) | @@ -1002,7 +1010,8 @@ static void vde_from_qemu(void *opaque, const uint8_t *buf, int size) | ||
1002 | } | 1010 | } |
1003 | } | 1011 | } |
1004 | 1012 | ||
1005 | -static int net_vde_init(VLANState *vlan, const char *model, const char *sock, | 1013 | +static int net_vde_init(VLANState *vlan, const char *model, |
1014 | + const char *name, const char *sock, | ||
1006 | int port, const char *group, int mode) | 1015 | int port, const char *group, int mode) |
1007 | { | 1016 | { |
1008 | VDEState *s; | 1017 | VDEState *s; |
@@ -1023,7 +1032,7 @@ static int net_vde_init(VLANState *vlan, const char *model, const char *sock, | @@ -1023,7 +1032,7 @@ static int net_vde_init(VLANState *vlan, const char *model, const char *sock, | ||
1023 | free(s); | 1032 | free(s); |
1024 | return -1; | 1033 | return -1; |
1025 | } | 1034 | } |
1026 | - s->vc = qemu_new_vlan_client(vlan, model, vde_from_qemu, NULL, s); | 1035 | + s->vc = qemu_new_vlan_client(vlan, model, name, vde_from_qemu, NULL, s); |
1027 | qemu_set_fd_handler(vde_datafd(s->vde), vde_to_qemu, NULL, s); | 1036 | qemu_set_fd_handler(vde_datafd(s->vde), vde_to_qemu, NULL, s); |
1028 | snprintf(s->vc->info_str, sizeof(s->vc->info_str), "sock=%s,fd=%d", | 1037 | snprintf(s->vc->info_str, sizeof(s->vc->info_str), "sock=%s,fd=%d", |
1029 | sock, vde_datafd(s->vde)); | 1038 | sock, vde_datafd(s->vde)); |
@@ -1045,6 +1054,7 @@ typedef struct NetSocketState { | @@ -1045,6 +1054,7 @@ typedef struct NetSocketState { | ||
1045 | typedef struct NetSocketListenState { | 1054 | typedef struct NetSocketListenState { |
1046 | VLANState *vlan; | 1055 | VLANState *vlan; |
1047 | char *model; | 1056 | char *model; |
1057 | + char *name; | ||
1048 | int fd; | 1058 | int fd; |
1049 | } NetSocketListenState; | 1059 | } NetSocketListenState; |
1050 | 1060 | ||
@@ -1198,7 +1208,9 @@ fail: | @@ -1198,7 +1208,9 @@ fail: | ||
1198 | return -1; | 1208 | return -1; |
1199 | } | 1209 | } |
1200 | 1210 | ||
1201 | -static NetSocketState *net_socket_fd_init_dgram(VLANState *vlan, const char *model, | 1211 | +static NetSocketState *net_socket_fd_init_dgram(VLANState *vlan, |
1212 | + const char *model, | ||
1213 | + const char *name, | ||
1202 | int fd, int is_connected) | 1214 | int fd, int is_connected) |
1203 | { | 1215 | { |
1204 | struct sockaddr_in saddr; | 1216 | struct sockaddr_in saddr; |
@@ -1242,7 +1254,7 @@ static NetSocketState *net_socket_fd_init_dgram(VLANState *vlan, const char *mod | @@ -1242,7 +1254,7 @@ static NetSocketState *net_socket_fd_init_dgram(VLANState *vlan, const char *mod | ||
1242 | return NULL; | 1254 | return NULL; |
1243 | s->fd = fd; | 1255 | s->fd = fd; |
1244 | 1256 | ||
1245 | - s->vc = qemu_new_vlan_client(vlan, model, net_socket_receive_dgram, NULL, s); | 1257 | + s->vc = qemu_new_vlan_client(vlan, model, name, net_socket_receive_dgram, NULL, s); |
1246 | qemu_set_fd_handler(s->fd, net_socket_send_dgram, NULL, s); | 1258 | qemu_set_fd_handler(s->fd, net_socket_send_dgram, NULL, s); |
1247 | 1259 | ||
1248 | /* mcast: save bound address as dst */ | 1260 | /* mcast: save bound address as dst */ |
@@ -1261,7 +1273,9 @@ static void net_socket_connect(void *opaque) | @@ -1261,7 +1273,9 @@ static void net_socket_connect(void *opaque) | ||
1261 | qemu_set_fd_handler(s->fd, net_socket_send, NULL, s); | 1273 | qemu_set_fd_handler(s->fd, net_socket_send, NULL, s); |
1262 | } | 1274 | } |
1263 | 1275 | ||
1264 | -static NetSocketState *net_socket_fd_init_stream(VLANState *vlan, const char *model, | 1276 | +static NetSocketState *net_socket_fd_init_stream(VLANState *vlan, |
1277 | + const char *model, | ||
1278 | + const char *name, | ||
1265 | int fd, int is_connected) | 1279 | int fd, int is_connected) |
1266 | { | 1280 | { |
1267 | NetSocketState *s; | 1281 | NetSocketState *s; |
@@ -1269,7 +1283,7 @@ static NetSocketState *net_socket_fd_init_stream(VLANState *vlan, const char *mo | @@ -1269,7 +1283,7 @@ static NetSocketState *net_socket_fd_init_stream(VLANState *vlan, const char *mo | ||
1269 | if (!s) | 1283 | if (!s) |
1270 | return NULL; | 1284 | return NULL; |
1271 | s->fd = fd; | 1285 | s->fd = fd; |
1272 | - s->vc = qemu_new_vlan_client(vlan, model, | 1286 | + s->vc = qemu_new_vlan_client(vlan, model, name, |
1273 | net_socket_receive, NULL, s); | 1287 | net_socket_receive, NULL, s); |
1274 | snprintf(s->vc->info_str, sizeof(s->vc->info_str), | 1288 | snprintf(s->vc->info_str, sizeof(s->vc->info_str), |
1275 | "socket: fd=%d", fd); | 1289 | "socket: fd=%d", fd); |
@@ -1281,7 +1295,8 @@ static NetSocketState *net_socket_fd_init_stream(VLANState *vlan, const char *mo | @@ -1281,7 +1295,8 @@ static NetSocketState *net_socket_fd_init_stream(VLANState *vlan, const char *mo | ||
1281 | return s; | 1295 | return s; |
1282 | } | 1296 | } |
1283 | 1297 | ||
1284 | -static NetSocketState *net_socket_fd_init(VLANState *vlan, const char *model, | 1298 | +static NetSocketState *net_socket_fd_init(VLANState *vlan, |
1299 | + const char *model, const char *name, | ||
1285 | int fd, int is_connected) | 1300 | int fd, int is_connected) |
1286 | { | 1301 | { |
1287 | int so_type=-1, optlen=sizeof(so_type); | 1302 | int so_type=-1, optlen=sizeof(so_type); |
@@ -1293,13 +1308,13 @@ static NetSocketState *net_socket_fd_init(VLANState *vlan, const char *model, | @@ -1293,13 +1308,13 @@ static NetSocketState *net_socket_fd_init(VLANState *vlan, const char *model, | ||
1293 | } | 1308 | } |
1294 | switch(so_type) { | 1309 | switch(so_type) { |
1295 | case SOCK_DGRAM: | 1310 | case SOCK_DGRAM: |
1296 | - return net_socket_fd_init_dgram(vlan, model, fd, is_connected); | 1311 | + return net_socket_fd_init_dgram(vlan, model, name, fd, is_connected); |
1297 | case SOCK_STREAM: | 1312 | case SOCK_STREAM: |
1298 | - return net_socket_fd_init_stream(vlan, model, fd, is_connected); | 1313 | + return net_socket_fd_init_stream(vlan, model, name, fd, is_connected); |
1299 | default: | 1314 | default: |
1300 | /* who knows ... this could be a eg. a pty, do warn and continue as stream */ | 1315 | /* who knows ... this could be a eg. a pty, do warn and continue as stream */ |
1301 | fprintf(stderr, "qemu: warning: socket type=%d for fd=%d is not SOCK_DGRAM or SOCK_STREAM\n", so_type, fd); | 1316 | fprintf(stderr, "qemu: warning: socket type=%d for fd=%d is not SOCK_DGRAM or SOCK_STREAM\n", so_type, fd); |
1302 | - return net_socket_fd_init_stream(vlan, model, fd, is_connected); | 1317 | + return net_socket_fd_init_stream(vlan, model, name, fd, is_connected); |
1303 | } | 1318 | } |
1304 | return NULL; | 1319 | return NULL; |
1305 | } | 1320 | } |
@@ -1321,7 +1336,7 @@ static void net_socket_accept(void *opaque) | @@ -1321,7 +1336,7 @@ static void net_socket_accept(void *opaque) | ||
1321 | break; | 1336 | break; |
1322 | } | 1337 | } |
1323 | } | 1338 | } |
1324 | - s1 = net_socket_fd_init(s->vlan, s->model, fd, 1); | 1339 | + s1 = net_socket_fd_init(s->vlan, s->model, s->name, fd, 1); |
1325 | if (!s1) { | 1340 | if (!s1) { |
1326 | closesocket(fd); | 1341 | closesocket(fd); |
1327 | } else { | 1342 | } else { |
@@ -1331,7 +1346,9 @@ static void net_socket_accept(void *opaque) | @@ -1331,7 +1346,9 @@ static void net_socket_accept(void *opaque) | ||
1331 | } | 1346 | } |
1332 | } | 1347 | } |
1333 | 1348 | ||
1334 | -static int net_socket_listen_init(VLANState *vlan, const char *model, | 1349 | +static int net_socket_listen_init(VLANState *vlan, |
1350 | + const char *model, | ||
1351 | + const char *name, | ||
1335 | const char *host_str) | 1352 | const char *host_str) |
1336 | { | 1353 | { |
1337 | NetSocketListenState *s; | 1354 | NetSocketListenState *s; |
@@ -1368,12 +1385,15 @@ static int net_socket_listen_init(VLANState *vlan, const char *model, | @@ -1368,12 +1385,15 @@ static int net_socket_listen_init(VLANState *vlan, const char *model, | ||
1368 | } | 1385 | } |
1369 | s->vlan = vlan; | 1386 | s->vlan = vlan; |
1370 | s->model = strdup(model); | 1387 | s->model = strdup(model); |
1388 | + s->name = strdup(name); | ||
1371 | s->fd = fd; | 1389 | s->fd = fd; |
1372 | qemu_set_fd_handler(fd, net_socket_accept, NULL, s); | 1390 | qemu_set_fd_handler(fd, net_socket_accept, NULL, s); |
1373 | return 0; | 1391 | return 0; |
1374 | } | 1392 | } |
1375 | 1393 | ||
1376 | -static int net_socket_connect_init(VLANState *vlan, const char *model, | 1394 | +static int net_socket_connect_init(VLANState *vlan, |
1395 | + const char *model, | ||
1396 | + const char *name, | ||
1377 | const char *host_str) | 1397 | const char *host_str) |
1378 | { | 1398 | { |
1379 | NetSocketState *s; | 1399 | NetSocketState *s; |
@@ -1412,7 +1432,7 @@ static int net_socket_connect_init(VLANState *vlan, const char *model, | @@ -1412,7 +1432,7 @@ static int net_socket_connect_init(VLANState *vlan, const char *model, | ||
1412 | break; | 1432 | break; |
1413 | } | 1433 | } |
1414 | } | 1434 | } |
1415 | - s = net_socket_fd_init(vlan, model, fd, connected); | 1435 | + s = net_socket_fd_init(vlan, model, name, fd, connected); |
1416 | if (!s) | 1436 | if (!s) |
1417 | return -1; | 1437 | return -1; |
1418 | snprintf(s->vc->info_str, sizeof(s->vc->info_str), | 1438 | snprintf(s->vc->info_str, sizeof(s->vc->info_str), |
@@ -1421,7 +1441,9 @@ static int net_socket_connect_init(VLANState *vlan, const char *model, | @@ -1421,7 +1441,9 @@ static int net_socket_connect_init(VLANState *vlan, const char *model, | ||
1421 | return 0; | 1441 | return 0; |
1422 | } | 1442 | } |
1423 | 1443 | ||
1424 | -static int net_socket_mcast_init(VLANState *vlan, const char *model, | 1444 | +static int net_socket_mcast_init(VLANState *vlan, |
1445 | + const char *model, | ||
1446 | + const char *name, | ||
1425 | const char *host_str) | 1447 | const char *host_str) |
1426 | { | 1448 | { |
1427 | NetSocketState *s; | 1449 | NetSocketState *s; |
@@ -1436,7 +1458,7 @@ static int net_socket_mcast_init(VLANState *vlan, const char *model, | @@ -1436,7 +1458,7 @@ static int net_socket_mcast_init(VLANState *vlan, const char *model, | ||
1436 | if (fd < 0) | 1458 | if (fd < 0) |
1437 | return -1; | 1459 | return -1; |
1438 | 1460 | ||
1439 | - s = net_socket_fd_init(vlan, model, fd, 0); | 1461 | + s = net_socket_fd_init(vlan, model, name, fd, 0); |
1440 | if (!s) | 1462 | if (!s) |
1441 | return -1; | 1463 | return -1; |
1442 | 1464 | ||
@@ -1474,6 +1496,7 @@ int net_client_init(const char *device, const char *p) | @@ -1474,6 +1496,7 @@ int net_client_init(const char *device, const char *p) | ||
1474 | char buf[1024]; | 1496 | char buf[1024]; |
1475 | int vlan_id, ret; | 1497 | int vlan_id, ret; |
1476 | VLANState *vlan; | 1498 | VLANState *vlan; |
1499 | + char *name = NULL; | ||
1477 | 1500 | ||
1478 | vlan_id = 0; | 1501 | vlan_id = 0; |
1479 | if (get_param_value(buf, sizeof(buf), "vlan", p)) { | 1502 | if (get_param_value(buf, sizeof(buf), "vlan", p)) { |
@@ -1484,6 +1507,9 @@ int net_client_init(const char *device, const char *p) | @@ -1484,6 +1507,9 @@ int net_client_init(const char *device, const char *p) | ||
1484 | fprintf(stderr, "Could not create vlan %d\n", vlan_id); | 1507 | fprintf(stderr, "Could not create vlan %d\n", vlan_id); |
1485 | return -1; | 1508 | return -1; |
1486 | } | 1509 | } |
1510 | + if (get_param_value(buf, sizeof(buf), "name", p)) { | ||
1511 | + name = strdup(buf); | ||
1512 | + } | ||
1487 | if (!strcmp(device, "nic")) { | 1513 | if (!strcmp(device, "nic")) { |
1488 | NICInfo *nd; | 1514 | NICInfo *nd; |
1489 | uint8_t *macaddr; | 1515 | uint8_t *macaddr; |
@@ -1511,6 +1537,8 @@ int net_client_init(const char *device, const char *p) | @@ -1511,6 +1537,8 @@ int net_client_init(const char *device, const char *p) | ||
1511 | nd->model = strdup(buf); | 1537 | nd->model = strdup(buf); |
1512 | } | 1538 | } |
1513 | nd->vlan = vlan; | 1539 | nd->vlan = vlan; |
1540 | + nd->name = name; | ||
1541 | + name = NULL; | ||
1514 | nb_nics++; | 1542 | nb_nics++; |
1515 | vlan->nb_guest_devs++; | 1543 | vlan->nb_guest_devs++; |
1516 | ret = 0; | 1544 | ret = 0; |
@@ -1526,7 +1554,7 @@ int net_client_init(const char *device, const char *p) | @@ -1526,7 +1554,7 @@ int net_client_init(const char *device, const char *p) | ||
1526 | pstrcpy(slirp_hostname, sizeof(slirp_hostname), buf); | 1554 | pstrcpy(slirp_hostname, sizeof(slirp_hostname), buf); |
1527 | } | 1555 | } |
1528 | vlan->nb_host_devs++; | 1556 | vlan->nb_host_devs++; |
1529 | - ret = net_slirp_init(vlan, device); | 1557 | + ret = net_slirp_init(vlan, device, name); |
1530 | } else | 1558 | } else |
1531 | #endif | 1559 | #endif |
1532 | #ifdef _WIN32 | 1560 | #ifdef _WIN32 |
@@ -1537,7 +1565,7 @@ int net_client_init(const char *device, const char *p) | @@ -1537,7 +1565,7 @@ int net_client_init(const char *device, const char *p) | ||
1537 | return -1; | 1565 | return -1; |
1538 | } | 1566 | } |
1539 | vlan->nb_host_devs++; | 1567 | vlan->nb_host_devs++; |
1540 | - ret = tap_win32_init(vlan, device, ifname); | 1568 | + ret = tap_win32_init(vlan, device, name, ifname); |
1541 | } else | 1569 | } else |
1542 | #elif defined (_AIX) | 1570 | #elif defined (_AIX) |
1543 | #else | 1571 | #else |
@@ -1550,7 +1578,7 @@ int net_client_init(const char *device, const char *p) | @@ -1550,7 +1578,7 @@ int net_client_init(const char *device, const char *p) | ||
1550 | fd = strtol(buf, NULL, 0); | 1578 | fd = strtol(buf, NULL, 0); |
1551 | fcntl(fd, F_SETFL, O_NONBLOCK); | 1579 | fcntl(fd, F_SETFL, O_NONBLOCK); |
1552 | ret = -1; | 1580 | ret = -1; |
1553 | - if (net_tap_fd_init(vlan, device, fd)) | 1581 | + if (net_tap_fd_init(vlan, device, name, fd)) |
1554 | ret = 0; | 1582 | ret = 0; |
1555 | } else { | 1583 | } else { |
1556 | if (get_param_value(ifname, sizeof(ifname), "ifname", p) <= 0) { | 1584 | if (get_param_value(ifname, sizeof(ifname), "ifname", p) <= 0) { |
@@ -1562,7 +1590,7 @@ int net_client_init(const char *device, const char *p) | @@ -1562,7 +1590,7 @@ int net_client_init(const char *device, const char *p) | ||
1562 | if (get_param_value(down_script, sizeof(down_script), "downscript", p) == 0) { | 1590 | if (get_param_value(down_script, sizeof(down_script), "downscript", p) == 0) { |
1563 | pstrcpy(down_script, sizeof(down_script), DEFAULT_NETWORK_DOWN_SCRIPT); | 1591 | pstrcpy(down_script, sizeof(down_script), DEFAULT_NETWORK_DOWN_SCRIPT); |
1564 | } | 1592 | } |
1565 | - ret = net_tap_init(vlan, device, ifname, setup_script, down_script); | 1593 | + ret = net_tap_init(vlan, device, name, ifname, setup_script, down_script); |
1566 | } | 1594 | } |
1567 | } else | 1595 | } else |
1568 | #endif | 1596 | #endif |
@@ -1571,14 +1599,14 @@ int net_client_init(const char *device, const char *p) | @@ -1571,14 +1599,14 @@ int net_client_init(const char *device, const char *p) | ||
1571 | int fd; | 1599 | int fd; |
1572 | fd = strtol(buf, NULL, 0); | 1600 | fd = strtol(buf, NULL, 0); |
1573 | ret = -1; | 1601 | ret = -1; |
1574 | - if (net_socket_fd_init(vlan, device, fd, 1)) | 1602 | + if (net_socket_fd_init(vlan, device, name, fd, 1)) |
1575 | ret = 0; | 1603 | ret = 0; |
1576 | } else if (get_param_value(buf, sizeof(buf), "listen", p) > 0) { | 1604 | } else if (get_param_value(buf, sizeof(buf), "listen", p) > 0) { |
1577 | - ret = net_socket_listen_init(vlan, device, buf); | 1605 | + ret = net_socket_listen_init(vlan, device, name, buf); |
1578 | } else if (get_param_value(buf, sizeof(buf), "connect", p) > 0) { | 1606 | } else if (get_param_value(buf, sizeof(buf), "connect", p) > 0) { |
1579 | - ret = net_socket_connect_init(vlan, device, buf); | 1607 | + ret = net_socket_connect_init(vlan, device, name, buf); |
1580 | } else if (get_param_value(buf, sizeof(buf), "mcast", p) > 0) { | 1608 | } else if (get_param_value(buf, sizeof(buf), "mcast", p) > 0) { |
1581 | - ret = net_socket_mcast_init(vlan, device, buf); | 1609 | + ret = net_socket_mcast_init(vlan, device, name, buf); |
1582 | } else { | 1610 | } else { |
1583 | fprintf(stderr, "Unknown socket options: %s\n", p); | 1611 | fprintf(stderr, "Unknown socket options: %s\n", p); |
1584 | return -1; | 1612 | return -1; |
@@ -1606,17 +1634,20 @@ int net_client_init(const char *device, const char *p) | @@ -1606,17 +1634,20 @@ int net_client_init(const char *device, const char *p) | ||
1606 | } else { | 1634 | } else { |
1607 | vde_mode = 0700; | 1635 | vde_mode = 0700; |
1608 | } | 1636 | } |
1609 | - ret = net_vde_init(vlan, device, vde_sock, vde_port, vde_group, vde_mode); | 1637 | + ret = net_vde_init(vlan, device, name, vde_sock, vde_port, vde_group, vde_mode); |
1610 | } else | 1638 | } else |
1611 | #endif | 1639 | #endif |
1612 | { | 1640 | { |
1613 | fprintf(stderr, "Unknown network device: %s\n", device); | 1641 | fprintf(stderr, "Unknown network device: %s\n", device); |
1642 | + if (name) | ||
1643 | + free(name); | ||
1614 | return -1; | 1644 | return -1; |
1615 | } | 1645 | } |
1616 | if (ret < 0) { | 1646 | if (ret < 0) { |
1617 | fprintf(stderr, "Could not initialize device '%s'\n", device); | 1647 | fprintf(stderr, "Could not initialize device '%s'\n", device); |
1618 | } | 1648 | } |
1619 | - | 1649 | + if (name) |
1650 | + free(name); | ||
1620 | return ret; | 1651 | return ret; |
1621 | } | 1652 | } |
1622 | 1653 |
net.h
@@ -33,6 +33,7 @@ struct VLANState { | @@ -33,6 +33,7 @@ struct VLANState { | ||
33 | VLANState *qemu_find_vlan(int id); | 33 | VLANState *qemu_find_vlan(int id); |
34 | VLANClientState *qemu_new_vlan_client(VLANState *vlan, | 34 | VLANClientState *qemu_new_vlan_client(VLANState *vlan, |
35 | const char *model, | 35 | const char *model, |
36 | + const char *name, | ||
36 | IOReadHandler *fd_read, | 37 | IOReadHandler *fd_read, |
37 | IOCanRWHandler *fd_can_read, | 38 | IOCanRWHandler *fd_can_read, |
38 | void *opaque); | 39 | void *opaque); |
@@ -53,6 +54,7 @@ void do_info_network(void); | @@ -53,6 +54,7 @@ void do_info_network(void); | ||
53 | struct NICInfo { | 54 | struct NICInfo { |
54 | uint8_t macaddr[6]; | 55 | uint8_t macaddr[6]; |
55 | const char *model; | 56 | const char *model; |
57 | + const char *name; | ||
56 | VLANState *vlan; | 58 | VLANState *vlan; |
57 | }; | 59 | }; |
58 | 60 |
qemu-doc.texi
@@ -608,10 +608,11 @@ Network options: | @@ -608,10 +608,11 @@ Network options: | ||
608 | 608 | ||
609 | @table @option | 609 | @table @option |
610 | 610 | ||
611 | -@item -net nic[,vlan=@var{n}][,macaddr=@var{addr}][,model=@var{type}] | 611 | +@item -net nic[,vlan=@var{n}][,macaddr=@var{addr}][,model=@var{type}][,name=@var{name}] |
612 | Create a new Network Interface Card and connect it to VLAN @var{n} (@var{n} | 612 | Create a new Network Interface Card and connect it to VLAN @var{n} (@var{n} |
613 | = 0 is the default). The NIC is an ne2k_pci by default on the PC | 613 | = 0 is the default). The NIC is an ne2k_pci by default on the PC |
614 | -target. Optionally, the MAC address can be changed. If no | 614 | +target. Optionally, the MAC address can be changed to @var{addr} |
615 | +and a @var{name} can be assigned for use in monitor commands. If no | ||
615 | @option{-net} option is specified, a single NIC is created. | 616 | @option{-net} option is specified, a single NIC is created. |
616 | Qemu can emulate several different models of network card. | 617 | Qemu can emulate several different models of network card. |
617 | Valid values for @var{type} are | 618 | Valid values for @var{type} are |
@@ -621,12 +622,12 @@ Valid values for @var{type} are | @@ -621,12 +622,12 @@ Valid values for @var{type} are | ||
621 | Not all devices are supported on all targets. Use -net nic,model=? | 622 | Not all devices are supported on all targets. Use -net nic,model=? |
622 | for a list of available devices for your target. | 623 | for a list of available devices for your target. |
623 | 624 | ||
624 | -@item -net user[,vlan=@var{n}][,hostname=@var{name}] | 625 | +@item -net user[,vlan=@var{n}][,hostname=@var{name}][,name=@var{name}] |
625 | Use the user mode network stack which requires no administrator | 626 | Use the user mode network stack which requires no administrator |
626 | privilege to run. @option{hostname=name} can be used to specify the client | 627 | privilege to run. @option{hostname=name} can be used to specify the client |
627 | hostname reported by the builtin DHCP server. | 628 | hostname reported by the builtin DHCP server. |
628 | 629 | ||
629 | -@item -net tap[,vlan=@var{n}][,fd=@var{h}][,ifname=@var{name}][,script=@var{file}][,downscript=@var{dfile}] | 630 | +@item -net tap[,vlan=@var{n}][,name=@var{name}][,fd=@var{h}][,ifname=@var{name}][,script=@var{file}][,downscript=@var{dfile}] |
630 | Connect the host TAP network interface @var{name} to VLAN @var{n}, use | 631 | Connect the host TAP network interface @var{name} to VLAN @var{n}, use |
631 | the network script @var{file} to configure it and the network script | 632 | the network script @var{file} to configure it and the network script |
632 | @var{dfile} to deconfigure it. If @var{name} is not provided, the OS | 633 | @var{dfile} to deconfigure it. If @var{name} is not provided, the OS |
@@ -647,7 +648,7 @@ qemu linux.img -net nic,vlan=0 -net tap,vlan=0,ifname=tap0 \ | @@ -647,7 +648,7 @@ qemu linux.img -net nic,vlan=0 -net tap,vlan=0,ifname=tap0 \ | ||
647 | @end example | 648 | @end example |
648 | 649 | ||
649 | 650 | ||
650 | -@item -net socket[,vlan=@var{n}][,fd=@var{h}][,listen=[@var{host}]:@var{port}][,connect=@var{host}:@var{port}] | 651 | +@item -net socket[,vlan=@var{n}][,name=@var{name}][,fd=@var{h}][,listen=[@var{host}]:@var{port}][,connect=@var{host}:@var{port}] |
651 | 652 | ||
652 | Connect the VLAN @var{n} to a remote VLAN in another QEMU virtual | 653 | Connect the VLAN @var{n} to a remote VLAN in another QEMU virtual |
653 | machine using a TCP socket connection. If @option{listen} is | 654 | machine using a TCP socket connection. If @option{listen} is |
@@ -667,7 +668,7 @@ qemu linux.img -net nic,macaddr=52:54:00:12:34:57 \ | @@ -667,7 +668,7 @@ qemu linux.img -net nic,macaddr=52:54:00:12:34:57 \ | ||
667 | -net socket,connect=127.0.0.1:1234 | 668 | -net socket,connect=127.0.0.1:1234 |
668 | @end example | 669 | @end example |
669 | 670 | ||
670 | -@item -net socket[,vlan=@var{n}][,fd=@var{h}][,mcast=@var{maddr}:@var{port}] | 671 | +@item -net socket[,vlan=@var{n}][,name=@var{name}][,fd=@var{h}][,mcast=@var{maddr}:@var{port}] |
671 | 672 | ||
672 | Create a VLAN @var{n} shared with another QEMU virtual | 673 | Create a VLAN @var{n} shared with another QEMU virtual |
673 | machines using a UDP multicast socket, effectively making a bus for | 674 | machines using a UDP multicast socket, effectively making a bus for |
@@ -707,7 +708,7 @@ qemu linux.img -net nic,macaddr=52:54:00:12:34:56 \ | @@ -707,7 +708,7 @@ qemu linux.img -net nic,macaddr=52:54:00:12:34:56 \ | ||
707 | /path/to/linux ubd0=/path/to/root_fs eth0=mcast | 708 | /path/to/linux ubd0=/path/to/root_fs eth0=mcast |
708 | @end example | 709 | @end example |
709 | 710 | ||
710 | -@item -net vde[,vlan=@var{n}][,sock=@var{socketpath}][,port=@var{n}][,group=@var{groupname}][,mode=@var{octalmode}] | 711 | +@item -net vde[,vlan=@var{n}][,name=@var{name}][,sock=@var{socketpath}][,port=@var{n}][,group=@var{groupname}][,mode=@var{octalmode}] |
711 | Connect VLAN @var{n} to PORT @var{n} of a vde switch running on host and | 712 | Connect VLAN @var{n} to PORT @var{n} of a vde switch running on host and |
712 | listening for incoming connections on @var{socketpath}. Use GROUP @var{groupname} | 713 | listening for incoming connections on @var{socketpath}. Use GROUP @var{groupname} |
713 | and MODE @var{octalmode} to change default ownership and permissions for | 714 | and MODE @var{octalmode} to change default ownership and permissions for |
sysemu.h
@@ -75,7 +75,8 @@ void qemu_del_wait_object(HANDLE handle, WaitObjectFunc *func, void *opaque); | @@ -75,7 +75,8 @@ void qemu_del_wait_object(HANDLE handle, WaitObjectFunc *func, void *opaque); | ||
75 | #endif | 75 | #endif |
76 | 76 | ||
77 | /* TAP win32 */ | 77 | /* TAP win32 */ |
78 | -int tap_win32_init(VLANState *vlan, const char *model, const char *ifname); | 78 | +int tap_win32_init(VLANState *vlan, const char *model, |
79 | + const char *name, const char *ifname); | ||
79 | 80 | ||
80 | /* SLIRP */ | 81 | /* SLIRP */ |
81 | void do_info_slirp(void); | 82 | void do_info_slirp(void); |
tap-win32.c
@@ -660,7 +660,8 @@ static void tap_win32_send(void *opaque) | @@ -660,7 +660,8 @@ static void tap_win32_send(void *opaque) | ||
660 | } | 660 | } |
661 | } | 661 | } |
662 | 662 | ||
663 | -int tap_win32_init(VLANState *vlan, const char *model, const char *ifname) | 663 | +int tap_win32_init(VLANState *vlan, const char *model, |
664 | + const char *name, const char *ifname) | ||
664 | { | 665 | { |
665 | TAPState *s; | 666 | TAPState *s; |
666 | 667 | ||
@@ -672,7 +673,7 @@ int tap_win32_init(VLANState *vlan, const char *model, const char *ifname) | @@ -672,7 +673,7 @@ int tap_win32_init(VLANState *vlan, const char *model, const char *ifname) | ||
672 | return -1; | 673 | return -1; |
673 | } | 674 | } |
674 | 675 | ||
675 | - s->vc = qemu_new_vlan_client(vlan, model, tap_receive, NULL, s); | 676 | + s->vc = qemu_new_vlan_client(vlan, model, name, tap_receive, NULL, s); |
676 | 677 | ||
677 | snprintf(s->vc->info_str, sizeof(s->vc->info_str), | 678 | snprintf(s->vc->info_str, sizeof(s->vc->info_str), |
678 | "tap: ifname=%s", ifname); | 679 | "tap: ifname=%s", ifname); |
vl.c
@@ -3887,30 +3887,30 @@ static void help(int exitcode) | @@ -3887,30 +3887,30 @@ static void help(int exitcode) | ||
3887 | "-uuid %%08x-%%04x-%%04x-%%04x-%%012x specify machine UUID\n" | 3887 | "-uuid %%08x-%%04x-%%04x-%%04x-%%012x specify machine UUID\n" |
3888 | "\n" | 3888 | "\n" |
3889 | "Network options:\n" | 3889 | "Network options:\n" |
3890 | - "-net nic[,vlan=n][,macaddr=addr][,model=type]\n" | 3890 | + "-net nic[,vlan=n][,macaddr=addr][,model=type][,name=str]\n" |
3891 | " create a new Network Interface Card and connect it to VLAN 'n'\n" | 3891 | " create a new Network Interface Card and connect it to VLAN 'n'\n" |
3892 | #ifdef CONFIG_SLIRP | 3892 | #ifdef CONFIG_SLIRP |
3893 | - "-net user[,vlan=n][,hostname=host]\n" | 3893 | + "-net user[,vlan=n][,name=str][,hostname=host]\n" |
3894 | " connect the user mode network stack to VLAN 'n' and send\n" | 3894 | " connect the user mode network stack to VLAN 'n' and send\n" |
3895 | " hostname 'host' to DHCP clients\n" | 3895 | " hostname 'host' to DHCP clients\n" |
3896 | #endif | 3896 | #endif |
3897 | #ifdef _WIN32 | 3897 | #ifdef _WIN32 |
3898 | - "-net tap[,vlan=n],ifname=name\n" | 3898 | + "-net tap[,vlan=n][,name=str],ifname=name\n" |
3899 | " connect the host TAP network interface to VLAN 'n'\n" | 3899 | " connect the host TAP network interface to VLAN 'n'\n" |
3900 | #else | 3900 | #else |
3901 | - "-net tap[,vlan=n][,fd=h][,ifname=name][,script=file][,downscript=dfile]\n" | 3901 | + "-net tap[,vlan=n][,name=str][,fd=h][,ifname=name][,script=file][,downscript=dfile]\n" |
3902 | " connect the host TAP network interface to VLAN 'n' and use the\n" | 3902 | " connect the host TAP network interface to VLAN 'n' and use the\n" |
3903 | " network scripts 'file' (default=%s)\n" | 3903 | " network scripts 'file' (default=%s)\n" |
3904 | " and 'dfile' (default=%s);\n" | 3904 | " and 'dfile' (default=%s);\n" |
3905 | " use '[down]script=no' to disable script execution;\n" | 3905 | " use '[down]script=no' to disable script execution;\n" |
3906 | " use 'fd=h' to connect to an already opened TAP interface\n" | 3906 | " use 'fd=h' to connect to an already opened TAP interface\n" |
3907 | #endif | 3907 | #endif |
3908 | - "-net socket[,vlan=n][,fd=h][,listen=[host]:port][,connect=host:port]\n" | 3908 | + "-net socket[,vlan=n][,name=str][,fd=h][,listen=[host]:port][,connect=host:port]\n" |
3909 | " connect the vlan 'n' to another VLAN using a socket connection\n" | 3909 | " connect the vlan 'n' to another VLAN using a socket connection\n" |
3910 | - "-net socket[,vlan=n][,fd=h][,mcast=maddr:port]\n" | 3910 | + "-net socket[,vlan=n][,name=str][,fd=h][,mcast=maddr:port]\n" |
3911 | " connect the vlan 'n' to multicast maddr and port\n" | 3911 | " connect the vlan 'n' to multicast maddr and port\n" |
3912 | #ifdef CONFIG_VDE | 3912 | #ifdef CONFIG_VDE |
3913 | - "-net vde[,vlan=n][,sock=socketpath][,port=n][,group=groupname][,mode=octalmode]\n" | 3913 | + "-net vde[,vlan=n][,name=str][,sock=socketpath][,port=n][,group=groupname][,mode=octalmode]\n" |
3914 | " connect the vlan 'n' to port 'n' of a vde switch running\n" | 3914 | " connect the vlan 'n' to port 'n' of a vde switch running\n" |
3915 | " on host and listening for incoming connections on 'socketpath'.\n" | 3915 | " on host and listening for incoming connections on 'socketpath'.\n" |
3916 | " Use group 'groupname' and mode 'octalmode' to change default\n" | 3916 | " Use group 'groupname' and mode 'octalmode' to change default\n" |