1 | The following changes since commit c74e62ee3e2dc2955e07d004c71badecb68a84eb: | 1 | The following changes since commit 23895cbd82be95428e90168b12e925d0d3ca2f06: |
---|---|---|---|
2 | 2 | ||
3 | Merge remote-tracking branch 'remotes/rth/tags/cota-target-pull-request' into staging (2018-05-11 15:41:29 +0100) | 3 | Merge remote-tracking branch 'remotes/awilliam/tags/vfio-update-20201123.0' into staging (2020-11-23 18:51:13 +0000) |
4 | 4 | ||
5 | are available in the git repository at: | 5 | are available in the git repository at: |
6 | 6 | ||
7 | https://github.com/jasowang/qemu.git tags/net-pull-request | 7 | https://github.com/jasowang/qemu.git tags/net-pull-request |
8 | 8 | ||
9 | for you to fetch changes up to 0e0266c2e475b82b39a757c875fa03e64272fbe7: | 9 | for you to fetch changes up to 9925990d01a92564af55f6f69d0f5f59b47609b1: |
10 | 10 | ||
11 | net: Get rid of 'vlan' terminology and use 'hub' instead in the doc files (2018-05-14 15:47:14 +0800) | 11 | net: Use correct default-path macro for downscript (2020-11-24 10:40:17 +0800) |
12 | 12 | ||
13 | ---------------------------------------------------------------- | 13 | ---------------------------------------------------------------- |
14 | 14 | ||
15 | ---------------------------------------------------------------- | 15 | ---------------------------------------------------------------- |
16 | Thomas Huth (4): | 16 | Keqian Zhu (1): |
17 | net: Fix memory leak in net_param_nic() | 17 | net: Use correct default-path macro for downscript |
18 | net: Remove the deprecated "vlan" parameter | ||
19 | net: Get rid of 'vlan' terminology and use 'hub' instead in the source files | ||
20 | net: Get rid of 'vlan' terminology and use 'hub' instead in the doc files | ||
21 | 18 | ||
22 | docs/qdev-device-use.txt | 3 -- | 19 | Paolo Bonzini (1): |
23 | hw/core/qdev-properties-system.c | 80 ---------------------------------------- | 20 | net: do not exit on "netdev_add help" monitor command |
24 | include/hw/qdev-properties.h | 3 -- | 21 | |
25 | include/net/net.h | 1 - | 22 | Prasad J Pandit (1): |
26 | net/hub.c | 7 ++-- | 23 | hw/net/e1000e: advance desc_offset in case of null descriptor |
27 | net/net.c | 18 ++++----- | 24 | |
28 | net/slirp.c | 8 ++-- | 25 | Yuri Benditovich (1): |
29 | net/tap.c | 4 +- | 26 | net: purge queued rx packets on queue deletion |
30 | qapi/net.json | 15 ++++---- | 27 | |
31 | qemu-doc.texi | 51 ++++++++++++------------- | 28 | yuanjungong (1): |
32 | qemu-options.hx | 29 ++++++--------- | 29 | tap: fix a memory leak |
33 | 11 files changed, 58 insertions(+), 161 deletions(-) | 30 | |
31 | hw/net/e1000e_core.c | 8 +++--- | ||
32 | include/net/net.h | 1 + | ||
33 | monitor/hmp-cmds.c | 6 ++++ | ||
34 | net/net.c | 80 +++++++++++++++++++++++++++------------------------- | ||
35 | net/tap.c | 5 +++- | ||
36 | 5 files changed, 57 insertions(+), 43 deletions(-) | ||
34 | 37 | ||
35 | 38 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | From: Prasad J Pandit <pjp@fedoraproject.org> | ||
1 | 2 | ||
3 | While receiving packets via e1000e_write_packet_to_guest() routine, | ||
4 | 'desc_offset' is advanced only when RX descriptor is processed. And | ||
5 | RX descriptor is not processed if it has NULL buffer address. | ||
6 | This may lead to an infinite loop condition. Increament 'desc_offset' | ||
7 | to process next descriptor in the ring to avoid infinite loop. | ||
8 | |||
9 | Reported-by: Cheol-woo Myung <330cjfdn@gmail.com> | ||
10 | Signed-off-by: Prasad J Pandit <pjp@fedoraproject.org> | ||
11 | Signed-off-by: Jason Wang <jasowang@redhat.com> | ||
12 | --- | ||
13 | hw/net/e1000e_core.c | 8 ++++---- | ||
14 | 1 file changed, 4 insertions(+), 4 deletions(-) | ||
15 | |||
16 | diff --git a/hw/net/e1000e_core.c b/hw/net/e1000e_core.c | ||
17 | index XXXXXXX..XXXXXXX 100644 | ||
18 | --- a/hw/net/e1000e_core.c | ||
19 | +++ b/hw/net/e1000e_core.c | ||
20 | @@ -XXX,XX +XXX,XX @@ e1000e_write_packet_to_guest(E1000ECore *core, struct NetRxPkt *pkt, | ||
21 | (const char *) &fcs_pad, e1000x_fcs_len(core->mac)); | ||
22 | } | ||
23 | } | ||
24 | - desc_offset += desc_size; | ||
25 | - if (desc_offset >= total_size) { | ||
26 | - is_last = true; | ||
27 | - } | ||
28 | } else { /* as per intel docs; skip descriptors with null buf addr */ | ||
29 | trace_e1000e_rx_null_descriptor(); | ||
30 | } | ||
31 | + desc_offset += desc_size; | ||
32 | + if (desc_offset >= total_size) { | ||
33 | + is_last = true; | ||
34 | + } | ||
35 | |||
36 | e1000e_write_rx_descr(core, desc, is_last ? core->rx_pkt : NULL, | ||
37 | rss_info, do_ps ? ps_hdr_len : 0, &bastate.written); | ||
38 | -- | ||
39 | 2.7.4 | ||
40 | |||
41 | diff view generated by jsdifflib |
1 | From: Thomas Huth <thuth@redhat.com> | 1 | From: Paolo Bonzini <pbonzini@redhat.com> |
---|---|---|---|
2 | 2 | ||
3 | It's been marked as deprecated since QEMU v2.9.0, so that should have | 3 | "netdev_add help" is causing QEMU to exit because the code that |
4 | been enough time for everybody to either just drop unnecessary "vlan=0" | 4 | invokes show_netdevs is shared between CLI and HMP processing. |
5 | parameters, to switch to the modern -device + -netdev syntax for connecting | 5 | Move the check to the callers so that exit(0) remains only |
6 | guest NICs with host network backends, or to switch to the "hubport" netdev | 6 | in the CLI flow. |
7 | in case hubs are really wanted instead. | ||
8 | 7 | ||
9 | Buglink: https://bugs.launchpad.net/qemu/+bug/658904 | 8 | "netdev_add help" is not fixed by this patch; that is left for |
10 | Signed-off-by: Thomas Huth <thuth@redhat.com> | 9 | later work. |
11 | Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> | 10 | |
11 | Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> | ||
12 | Signed-off-by: Jason Wang <jasowang@redhat.com> | 12 | Signed-off-by: Jason Wang <jasowang@redhat.com> |
13 | --- | 13 | --- |
14 | docs/qdev-device-use.txt | 3 -- | 14 | include/net/net.h | 1 + |
15 | hw/core/qdev-properties-system.c | 80 ---------------------------------------- | 15 | monitor/hmp-cmds.c | 6 +++++ |
16 | include/hw/qdev-properties.h | 3 -- | 16 | net/net.c | 68 +++++++++++++++++++++++++++--------------------------- |
17 | include/net/net.h | 1 - | 17 | 3 files changed, 41 insertions(+), 34 deletions(-) |
18 | net/net.c | 12 ++---- | ||
19 | qapi/net.json | 15 ++++---- | ||
20 | qemu-doc.texi | 9 ----- | ||
21 | qemu-options.hx | 29 ++++++--------- | ||
22 | 8 files changed, 22 insertions(+), 130 deletions(-) | ||
23 | 18 | ||
24 | diff --git a/docs/qdev-device-use.txt b/docs/qdev-device-use.txt | ||
25 | index XXXXXXX..XXXXXXX 100644 | ||
26 | --- a/docs/qdev-device-use.txt | ||
27 | +++ b/docs/qdev-device-use.txt | ||
28 | @@ -XXX,XX +XXX,XX @@ devices and ne2k_isa are. | ||
29 | |||
30 | Some PCI devices aren't available with -net nic, e.g. i82558a. | ||
31 | |||
32 | -To connect to a VLAN instead of an ordinary host part, replace | ||
33 | -netdev=NET-ID by vlan=VLAN. | ||
34 | - | ||
35 | === Graphics Devices === | ||
36 | |||
37 | Host and guest part of graphics devices have always been separate. | ||
38 | diff --git a/hw/core/qdev-properties-system.c b/hw/core/qdev-properties-system.c | ||
39 | index XXXXXXX..XXXXXXX 100644 | ||
40 | --- a/hw/core/qdev-properties-system.c | ||
41 | +++ b/hw/core/qdev-properties-system.c | ||
42 | @@ -XXX,XX +XXX,XX @@ const PropertyInfo qdev_prop_netdev = { | ||
43 | .set = set_netdev, | ||
44 | }; | ||
45 | |||
46 | -/* --- vlan --- */ | ||
47 | - | ||
48 | -static int print_vlan(DeviceState *dev, Property *prop, char *dest, size_t len) | ||
49 | -{ | ||
50 | - NetClientState **ptr = qdev_get_prop_ptr(dev, prop); | ||
51 | - | ||
52 | - if (*ptr) { | ||
53 | - int id; | ||
54 | - if (!net_hub_id_for_client(*ptr, &id)) { | ||
55 | - return snprintf(dest, len, "%d", id); | ||
56 | - } | ||
57 | - } | ||
58 | - | ||
59 | - return snprintf(dest, len, "<null>"); | ||
60 | -} | ||
61 | - | ||
62 | -static void get_vlan(Object *obj, Visitor *v, const char *name, void *opaque, | ||
63 | - Error **errp) | ||
64 | -{ | ||
65 | - DeviceState *dev = DEVICE(obj); | ||
66 | - Property *prop = opaque; | ||
67 | - NetClientState **ptr = qdev_get_prop_ptr(dev, prop); | ||
68 | - int32_t id = -1; | ||
69 | - | ||
70 | - if (*ptr) { | ||
71 | - int hub_id; | ||
72 | - if (!net_hub_id_for_client(*ptr, &hub_id)) { | ||
73 | - id = hub_id; | ||
74 | - } | ||
75 | - } | ||
76 | - | ||
77 | - visit_type_int32(v, name, &id, errp); | ||
78 | -} | ||
79 | - | ||
80 | -static void set_vlan(Object *obj, Visitor *v, const char *name, void *opaque, | ||
81 | - Error **errp) | ||
82 | -{ | ||
83 | - DeviceState *dev = DEVICE(obj); | ||
84 | - Property *prop = opaque; | ||
85 | - NICPeers *peers_ptr = qdev_get_prop_ptr(dev, prop); | ||
86 | - NetClientState **ptr = &peers_ptr->ncs[0]; | ||
87 | - Error *local_err = NULL; | ||
88 | - int32_t id; | ||
89 | - NetClientState *hubport; | ||
90 | - | ||
91 | - if (dev->realized) { | ||
92 | - qdev_prop_set_after_realize(dev, name, errp); | ||
93 | - return; | ||
94 | - } | ||
95 | - | ||
96 | - visit_type_int32(v, name, &id, &local_err); | ||
97 | - if (local_err) { | ||
98 | - error_propagate(errp, local_err); | ||
99 | - return; | ||
100 | - } | ||
101 | - if (id == -1) { | ||
102 | - *ptr = NULL; | ||
103 | - return; | ||
104 | - } | ||
105 | - if (*ptr) { | ||
106 | - error_set_from_qdev_prop_error(errp, -EINVAL, dev, prop, name); | ||
107 | - return; | ||
108 | - } | ||
109 | - | ||
110 | - hubport = net_hub_port_find(id); | ||
111 | - if (!hubport) { | ||
112 | - error_setg(errp, QERR_INVALID_PARAMETER_VALUE, | ||
113 | - name, prop->info->name); | ||
114 | - return; | ||
115 | - } | ||
116 | - *ptr = hubport; | ||
117 | -} | ||
118 | - | ||
119 | -const PropertyInfo qdev_prop_vlan = { | ||
120 | - .name = "int32", | ||
121 | - .description = "Integer VLAN id to connect to", | ||
122 | - .print = print_vlan, | ||
123 | - .get = get_vlan, | ||
124 | - .set = set_vlan, | ||
125 | -}; | ||
126 | |||
127 | void qdev_prop_set_drive(DeviceState *dev, const char *name, | ||
128 | BlockBackend *value, Error **errp) | ||
129 | diff --git a/include/hw/qdev-properties.h b/include/hw/qdev-properties.h | ||
130 | index XXXXXXX..XXXXXXX 100644 | ||
131 | --- a/include/hw/qdev-properties.h | ||
132 | +++ b/include/hw/qdev-properties.h | ||
133 | @@ -XXX,XX +XXX,XX @@ extern const PropertyInfo qdev_prop_bios_chs_trans; | ||
134 | extern const PropertyInfo qdev_prop_fdc_drive_type; | ||
135 | extern const PropertyInfo qdev_prop_drive; | ||
136 | extern const PropertyInfo qdev_prop_netdev; | ||
137 | -extern const PropertyInfo qdev_prop_vlan; | ||
138 | extern const PropertyInfo qdev_prop_pci_devfn; | ||
139 | extern const PropertyInfo qdev_prop_blocksize; | ||
140 | extern const PropertyInfo qdev_prop_pci_host_devaddr; | ||
141 | @@ -XXX,XX +XXX,XX @@ extern const PropertyInfo qdev_prop_off_auto_pcibar; | ||
142 | DEFINE_PROP(_n, _s, _f, qdev_prop_string, char*) | ||
143 | #define DEFINE_PROP_NETDEV(_n, _s, _f) \ | ||
144 | DEFINE_PROP(_n, _s, _f, qdev_prop_netdev, NICPeers) | ||
145 | -#define DEFINE_PROP_VLAN(_n, _s, _f) \ | ||
146 | - DEFINE_PROP(_n, _s, _f, qdev_prop_vlan, NICPeers) | ||
147 | #define DEFINE_PROP_DRIVE(_n, _s, _f) \ | ||
148 | DEFINE_PROP(_n, _s, _f, qdev_prop_drive, BlockBackend *) | ||
149 | #define DEFINE_PROP_MACADDR(_n, _s, _f) \ | ||
150 | diff --git a/include/net/net.h b/include/net/net.h | 19 | diff --git a/include/net/net.h b/include/net/net.h |
151 | index XXXXXXX..XXXXXXX 100644 | 20 | index XXXXXXX..XXXXXXX 100644 |
152 | --- a/include/net/net.h | 21 | --- a/include/net/net.h |
153 | +++ b/include/net/net.h | 22 | +++ b/include/net/net.h |
154 | @@ -XXX,XX +XXX,XX @@ typedef struct NICConf { | 23 | @@ -XXX,XX +XXX,XX @@ extern const char *host_net_devices[]; |
155 | 24 | ||
156 | #define DEFINE_NIC_PROPERTIES(_state, _conf) \ | 25 | /* from net.c */ |
157 | DEFINE_PROP_MACADDR("mac", _state, _conf.macaddr), \ | 26 | int net_client_parse(QemuOptsList *opts_list, const char *str); |
158 | - DEFINE_PROP_VLAN("vlan", _state, _conf.peers), \ | 27 | +void show_netdevs(void); |
159 | DEFINE_PROP_NETDEV("netdev", _state, _conf.peers) | 28 | int net_init_clients(Error **errp); |
160 | 29 | void net_check_clients(void); | |
161 | 30 | void net_cleanup(void); | |
31 | diff --git a/monitor/hmp-cmds.c b/monitor/hmp-cmds.c | ||
32 | index XXXXXXX..XXXXXXX 100644 | ||
33 | --- a/monitor/hmp-cmds.c | ||
34 | +++ b/monitor/hmp-cmds.c | ||
35 | @@ -XXX,XX +XXX,XX @@ | ||
36 | #include "qemu/option.h" | ||
37 | #include "qemu/timer.h" | ||
38 | #include "qemu/sockets.h" | ||
39 | +#include "qemu/help_option.h" | ||
40 | #include "monitor/monitor-internal.h" | ||
41 | #include "qapi/error.h" | ||
42 | #include "qapi/clone-visitor.h" | ||
43 | @@ -XXX,XX +XXX,XX @@ void hmp_netdev_add(Monitor *mon, const QDict *qdict) | ||
44 | { | ||
45 | Error *err = NULL; | ||
46 | QemuOpts *opts; | ||
47 | + const char *type = qdict_get_try_str(qdict, "type"); | ||
48 | |||
49 | + if (type && is_help_option(type)) { | ||
50 | + show_netdevs(); | ||
51 | + return; | ||
52 | + } | ||
53 | opts = qemu_opts_from_qdict(qemu_find_opts("netdev"), qdict, &err); | ||
54 | if (err) { | ||
55 | goto out; | ||
162 | diff --git a/net/net.c b/net/net.c | 56 | diff --git a/net/net.c b/net/net.c |
163 | index XXXXXXX..XXXXXXX 100644 | 57 | index XXXXXXX..XXXXXXX 100644 |
164 | --- a/net/net.c | 58 | --- a/net/net.c |
165 | +++ b/net/net.c | 59 | +++ b/net/net.c |
166 | @@ -XXX,XX +XXX,XX @@ static int net_client_init1(const void *object, bool is_netdev, Error **errp) | 60 | @@ -XXX,XX +XXX,XX @@ |
167 | const Netdev *netdev; | 61 | #include "qemu/config-file.h" |
168 | const char *name; | 62 | #include "qemu/ctype.h" |
169 | NetClientState *peer = NULL; | 63 | #include "qemu/iov.h" |
170 | - static bool vlan_warned; | 64 | +#include "qemu/qemu-print.h" |
171 | 65 | #include "qemu/main-loop.h" | |
172 | if (is_netdev) { | 66 | #include "qemu/option.h" |
173 | netdev = object; | 67 | #include "qapi/error.h" |
174 | @@ -XXX,XX +XXX,XX @@ static int net_client_init1(const void *object, bool is_netdev, Error **errp) | 68 | @@ -XXX,XX +XXX,XX @@ static int net_client_init1(const Netdev *netdev, bool is_netdev, Error **errp) |
175 | return -1; | 69 | return 0; |
70 | } | ||
71 | |||
72 | -static void show_netdevs(void) | ||
73 | +void show_netdevs(void) | ||
74 | { | ||
75 | int idx; | ||
76 | const char *available_netdevs[] = { | ||
77 | @@ -XXX,XX +XXX,XX @@ static void show_netdevs(void) | ||
78 | #endif | ||
79 | }; | ||
80 | |||
81 | - printf("Available netdev backend types:\n"); | ||
82 | + qemu_printf("Available netdev backend types:\n"); | ||
83 | for (idx = 0; idx < ARRAY_SIZE(available_netdevs); idx++) { | ||
84 | - puts(available_netdevs[idx]); | ||
85 | + qemu_printf("%s\n", available_netdevs[idx]); | ||
86 | } | ||
87 | } | ||
88 | |||
89 | @@ -XXX,XX +XXX,XX @@ static int net_client_init(QemuOpts *opts, bool is_netdev, Error **errp) | ||
90 | int ret = -1; | ||
91 | Visitor *v = opts_visitor_new(opts); | ||
92 | |||
93 | - const char *type = qemu_opt_get(opts, "type"); | ||
94 | - | ||
95 | - if (is_netdev && type && is_help_option(type)) { | ||
96 | - show_netdevs(); | ||
97 | - exit(0); | ||
98 | - } else { | ||
99 | - /* Parse convenience option format ip6-net=fec0::0[/64] */ | ||
100 | - const char *ip6_net = qemu_opt_get(opts, "ipv6-net"); | ||
101 | + /* Parse convenience option format ip6-net=fec0::0[/64] */ | ||
102 | + const char *ip6_net = qemu_opt_get(opts, "ipv6-net"); | ||
103 | |||
104 | - if (ip6_net) { | ||
105 | - char *prefix_addr; | ||
106 | - unsigned long prefix_len = 64; /* Default 64bit prefix length. */ | ||
107 | + if (ip6_net) { | ||
108 | + char *prefix_addr; | ||
109 | + unsigned long prefix_len = 64; /* Default 64bit prefix length. */ | ||
110 | |||
111 | - substrings = g_strsplit(ip6_net, "/", 2); | ||
112 | - if (!substrings || !substrings[0]) { | ||
113 | - error_setg(errp, QERR_INVALID_PARAMETER_VALUE, "ipv6-net", | ||
114 | - "a valid IPv6 prefix"); | ||
115 | - goto out; | ||
116 | - } | ||
117 | + substrings = g_strsplit(ip6_net, "/", 2); | ||
118 | + if (!substrings || !substrings[0]) { | ||
119 | + error_setg(errp, QERR_INVALID_PARAMETER_VALUE, "ipv6-net", | ||
120 | + "a valid IPv6 prefix"); | ||
121 | + goto out; | ||
122 | + } | ||
123 | |||
124 | - prefix_addr = substrings[0]; | ||
125 | + prefix_addr = substrings[0]; | ||
126 | |||
127 | - /* Handle user-specified prefix length. */ | ||
128 | - if (substrings[1] && | ||
129 | - qemu_strtoul(substrings[1], NULL, 10, &prefix_len)) | ||
130 | - { | ||
131 | - error_setg(errp, QERR_INVALID_PARAMETER_VALUE, | ||
132 | - "ipv6-prefixlen", "a number"); | ||
133 | - goto out; | ||
134 | - } | ||
135 | - | ||
136 | - qemu_opt_set(opts, "ipv6-prefix", prefix_addr, &error_abort); | ||
137 | - qemu_opt_set_number(opts, "ipv6-prefixlen", prefix_len, | ||
138 | - &error_abort); | ||
139 | - qemu_opt_unset(opts, "ipv6-net"); | ||
140 | + /* Handle user-specified prefix length. */ | ||
141 | + if (substrings[1] && | ||
142 | + qemu_strtoul(substrings[1], NULL, 10, &prefix_len)) | ||
143 | + { | ||
144 | + error_setg(errp, QERR_INVALID_PARAMETER_VALUE, | ||
145 | + "ipv6-prefixlen", "a number"); | ||
146 | + goto out; | ||
176 | } | 147 | } |
177 | 148 | + | |
178 | - /* Do not add to a vlan if it's a nic with a netdev= parameter. */ | 149 | + qemu_opt_set(opts, "ipv6-prefix", prefix_addr, &error_abort); |
179 | + /* Do not add to a hub if it's a nic with a netdev= parameter. */ | 150 | + qemu_opt_set_number(opts, "ipv6-prefixlen", prefix_len, |
180 | if (netdev->type != NET_CLIENT_DRIVER_NIC || | 151 | + &error_abort); |
181 | !opts->u.nic.has_netdev) { | 152 | + qemu_opt_unset(opts, "ipv6-net"); |
182 | - peer = net_hub_add_port(net->has_vlan ? net->vlan : 0, NULL, NULL); | ||
183 | - } | ||
184 | - | ||
185 | - if (net->has_vlan && !vlan_warned) { | ||
186 | - error_report("'vlan' is deprecated. Please use 'netdev' instead."); | ||
187 | - vlan_warned = true; | ||
188 | + peer = net_hub_add_port(0, NULL, NULL); | ||
189 | } | ||
190 | } | 153 | } |
191 | 154 | ||
192 | @@ -XXX,XX +XXX,XX @@ void qmp_set_link(const char *name, bool up, Error **errp) | 155 | /* Create an ID for -net if the user did not specify one */ |
193 | * If the peer is a HUBPORT or a backend, we do not change the | 156 | @@ -XXX,XX +XXX,XX @@ static int net_init_client(void *dummy, QemuOpts *opts, Error **errp) |
194 | * link status. | 157 | |
195 | * | 158 | static int net_init_netdev(void *dummy, QemuOpts *opts, Error **errp) |
196 | - * This behavior is compatible with qemu vlans where there could be | 159 | { |
197 | + * This behavior is compatible with qemu hubs where there could be | 160 | + const char *type = qemu_opt_get(opts, "type"); |
198 | * multiple clients that can still communicate with each other in | 161 | + |
199 | * disconnected mode. For now maintain this compatibility. | 162 | + if (type && is_help_option(type)) { |
200 | */ | 163 | + show_netdevs(); |
201 | diff --git a/qapi/net.json b/qapi/net.json | 164 | + exit(0); |
202 | index XXXXXXX..XXXXXXX 100644 | 165 | + } |
203 | --- a/qapi/net.json | 166 | return net_client_init(opts, true, errp); |
204 | +++ b/qapi/net.json | 167 | } |
205 | @@ -XXX,XX +XXX,XX @@ | 168 | |
206 | ## | ||
207 | # @NetdevTapOptions: | ||
208 | # | ||
209 | -# Connect the host TAP network interface name to the VLAN. | ||
210 | +# Used to configure a host TAP network interface backend. | ||
211 | # | ||
212 | # @ifname: interface name | ||
213 | # | ||
214 | @@ -XXX,XX +XXX,XX @@ | ||
215 | ## | ||
216 | # @NetdevSocketOptions: | ||
217 | # | ||
218 | -# Connect the VLAN to a remote VLAN in another QEMU virtual machine using a TCP | ||
219 | -# socket connection. | ||
220 | +# Socket netdevs are used to establish a network connection to another | ||
221 | +# QEMU virtual machine via a TCP socket. | ||
222 | # | ||
223 | # @fd: file descriptor of an already opened socket | ||
224 | # | ||
225 | @@ -XXX,XX +XXX,XX @@ | ||
226 | ## | ||
227 | # @NetdevL2TPv3Options: | ||
228 | # | ||
229 | -# Connect the VLAN to Ethernet over L2TPv3 Static tunnel | ||
230 | +# Configure an Ethernet over L2TPv3 tunnel. | ||
231 | # | ||
232 | # @src: source address | ||
233 | # | ||
234 | @@ -XXX,XX +XXX,XX @@ | ||
235 | ## | ||
236 | # @NetdevVdeOptions: | ||
237 | # | ||
238 | -# Connect the VLAN to a vde switch running on the host. | ||
239 | +# Connect to a vde switch running on the host. | ||
240 | # | ||
241 | # @sock: socket path | ||
242 | # | ||
243 | @@ -XXX,XX +XXX,XX @@ | ||
244 | # | ||
245 | # Captures the configuration of a network device; legacy. | ||
246 | # | ||
247 | -# @vlan: vlan number | ||
248 | -# | ||
249 | # @id: identifier for monitor commands | ||
250 | # | ||
251 | # @name: identifier for monitor commands, ignored if @id is present | ||
252 | @@ -XXX,XX +XXX,XX @@ | ||
253 | # @opts: device type specific properties (legacy) | ||
254 | # | ||
255 | # Since: 1.2 | ||
256 | +# | ||
257 | +# 'vlan' - removed with 2.12 | ||
258 | ## | ||
259 | { 'struct': 'NetLegacy', | ||
260 | 'data': { | ||
261 | - '*vlan': 'int32', | ||
262 | '*id': 'str', | ||
263 | '*name': 'str', | ||
264 | 'opts': 'NetLegacyOptions' } } | ||
265 | diff --git a/qemu-doc.texi b/qemu-doc.texi | ||
266 | index XXXXXXX..XXXXXXX 100644 | ||
267 | --- a/qemu-doc.texi | ||
268 | +++ b/qemu-doc.texi | ||
269 | @@ -XXX,XX +XXX,XX @@ with ``-device ...,netdev=x''), or ``-nic user,smb=/some/dir'' | ||
270 | (for embedded NICs). The new syntax allows different settings to be | ||
271 | provided per NIC. | ||
272 | |||
273 | -@subsection -net vlan (since 2.9.0) | ||
274 | - | ||
275 | -The ``-net vlan=NN'' argument was mostly used to attach separate | ||
276 | -network backends to different virtual NICs. This is the default | ||
277 | -behavior for ``-netdev'' and ``-nic''. You can connect multiple | ||
278 | -``-netdev'' and ``-nic'' devices to the same network using the | ||
279 | -"hubport" network backend, created with ``-netdev hubport,hubid=NN,...'' | ||
280 | -and ``-nic hubport,hubid=NN''. | ||
281 | - | ||
282 | @subsection -drive cyls=...,heads=...,secs=...,trans=... (since 2.10.0) | ||
283 | |||
284 | The drive geometry arguments are replaced by the the geometry arguments | ||
285 | diff --git a/qemu-options.hx b/qemu-options.hx | ||
286 | index XXXXXXX..XXXXXXX 100644 | ||
287 | --- a/qemu-options.hx | ||
288 | +++ b/qemu-options.hx | ||
289 | @@ -XXX,XX +XXX,XX @@ DEF("netdev", HAS_ARG, QEMU_OPTION_netdev, | ||
290 | " configure a vhost-user network, backed by a chardev 'dev'\n" | ||
291 | #endif | ||
292 | "-netdev hubport,id=str,hubid=n[,netdev=nd]\n" | ||
293 | - " configure a hub port on QEMU VLAN 'n'\n", QEMU_ARCH_ALL) | ||
294 | + " configure a hub port on the hub with ID 'n'\n", QEMU_ARCH_ALL) | ||
295 | DEF("nic", HAS_ARG, QEMU_OPTION_nic, | ||
296 | "--nic [tap|bridge|" | ||
297 | #ifdef CONFIG_SLIRP | ||
298 | @@ -XXX,XX +XXX,XX @@ DEF("nic", HAS_ARG, QEMU_OPTION_nic, | ||
299 | " provided a 'user' network connection)\n", | ||
300 | QEMU_ARCH_ALL) | ||
301 | DEF("net", HAS_ARG, QEMU_OPTION_net, | ||
302 | - "-net nic[,vlan=n][,netdev=nd][,macaddr=mac][,model=type][,name=str][,addr=str][,vectors=v]\n" | ||
303 | + "-net nic[,macaddr=mac][,model=type][,name=str][,addr=str][,vectors=v]\n" | ||
304 | " configure or create an on-board (or machine default) NIC and\n" | ||
305 | - " connect it either to VLAN 'n' or the netdev 'nd' (for pluggable\n" | ||
306 | - " NICs please use '-device devtype,netdev=nd' instead)\n" | ||
307 | + " connect it to hub 0 (please use -nic unless you need a hub)\n" | ||
308 | "-net [" | ||
309 | #ifdef CONFIG_SLIRP | ||
310 | "user|" | ||
311 | @@ -XXX,XX +XXX,XX @@ DEF("net", HAS_ARG, QEMU_OPTION_net, | ||
312 | #ifdef CONFIG_NETMAP | ||
313 | "netmap|" | ||
314 | #endif | ||
315 | - "socket][,vlan=n][,option][,option][,...]\n" | ||
316 | + "socket][,option][,option][,...]\n" | ||
317 | " old way to initialize a host network interface\n" | ||
318 | " (use the -netdev option if possible instead)\n", QEMU_ARCH_ALL) | ||
319 | STEXI | ||
320 | @@ -XXX,XX +XXX,XX @@ qemu -m 512 -object memory-backend-file,id=mem,size=512M,mem-path=/hugetlbfs,sha | ||
321 | Create a hub port on the emulated hub with ID @var{hubid}. | ||
322 | |||
323 | The hubport netdev lets you connect a NIC to a QEMU emulated hub instead of a | ||
324 | -single netdev. @code{-net} and @code{-device} with the parameter @option{vlan} | ||
325 | -(deprecated), or @code{-nic hubport} can also be used to connect a | ||
326 | -network device or a NIC to a hub. Alternatively, you can also connect the | ||
327 | -hubport to another netdev with ID @var{nd} by using the @option{netdev=@var{nd}} | ||
328 | -option. | ||
329 | +single netdev. Alternatively, you can also connect the hubport to another | ||
330 | +netdev with ID @var{nd} by using the @option{netdev=@var{nd}} option. | ||
331 | |||
332 | -@item -net nic[,vlan=@var{n}][,netdev=@var{nd}][,macaddr=@var{mac}][,model=@var{type}] [,name=@var{name}][,addr=@var{addr}][,vectors=@var{v}] | ||
333 | +@item -net nic[,netdev=@var{nd}][,macaddr=@var{mac}][,model=@var{type}] [,name=@var{name}][,addr=@var{addr}][,vectors=@var{v}] | ||
334 | @findex -net | ||
335 | Legacy option to configure or create an on-board (or machine default) Network | ||
336 | -Interface Card(NIC) and connect it either to the emulated hub port ("vlan") | ||
337 | -with number @var{n} (@var{n} = 0 is the default), or to the netdev @var{nd}. | ||
338 | +Interface Card(NIC) and connect it either to the emulated hub with ID 0 (i.e. | ||
339 | +the default hub), or to the netdev @var{nd}. | ||
340 | The NIC is an e1000 by default on the PC target. Optionally, the MAC address | ||
341 | can be changed to @var{mac}, the device address set to @var{addr} (PCI cards | ||
342 | only), and a @var{name} can be assigned for use in monitor commands. | ||
343 | @@ -XXX,XX +XXX,XX @@ that the card should have; this option currently only affects virtio cards; set | ||
344 | NIC is created. QEMU can emulate several different models of network card. | ||
345 | Use @code{-net nic,model=help} for a list of available devices for your target. | ||
346 | |||
347 | -@item -net user|tap|bridge|socket|l2tpv3|vde[,...][,vlan=@var{n}][,name=@var{name}] | ||
348 | +@item -net user|tap|bridge|socket|l2tpv3|vde[,...][,name=@var{name}] | ||
349 | Configure a host network backend (with the options corresponding to the same | ||
350 | -@option{-netdev} option) and connect it to the emulated hub ("vlan") with the | ||
351 | -number @var{n} (default is number 0). Use @var{name} to specify the name of the | ||
352 | -hub port. | ||
353 | +@option{-netdev} option) and connect it to the emulated hub 0 (the default | ||
354 | +hub). Use @var{name} to specify the name of the hub port. | ||
355 | ETEXI | ||
356 | |||
357 | STEXI | ||
358 | -- | 169 | -- |
359 | 2.7.4 | 170 | 2.7.4 |
360 | 171 | ||
361 | 172 | diff view generated by jsdifflib |
1 | From: Thomas Huth <thuth@redhat.com> | 1 | From: Yuri Benditovich <yuri.benditovich@daynix.com> |
---|---|---|---|
2 | 2 | ||
3 | The early exits in case of errors leak the memory allocated for nd_id. | 3 | https://bugzilla.redhat.com/show_bug.cgi?id=1829272 |
4 | Fix it by using a "goto out" to the cleanup at the end of the function | 4 | When deleting queue pair, purge pending RX packets if any. |
5 | instead. | 5 | Example of problematic flow: |
6 | 1. Bring up q35 VM with tap (vhost off) and virtio-net or e1000e | ||
7 | 2. Run ping flood to the VM NIC ( 1 ms interval) | ||
8 | 3. Hot unplug the NIC device (device_del) | ||
9 | During unplug process one or more packets come, the NIC | ||
10 | can't receive, tap disables read_poll | ||
11 | 4. Hot plug the device (device_add) with the same netdev | ||
12 | The tap stays with read_poll disabled and does not receive | ||
13 | any packets anymore (tap_send never triggered) | ||
6 | 14 | ||
7 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | 15 | Signed-off-by: Yuri Benditovich <yuri.benditovich@daynix.com> |
8 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
9 | Signed-off-by: Thomas Huth <thuth@redhat.com> | ||
10 | Signed-off-by: Jason Wang <jasowang@redhat.com> | 16 | Signed-off-by: Jason Wang <jasowang@redhat.com> |
11 | --- | 17 | --- |
12 | net/net.c | 6 ++++-- | 18 | net/net.c | 12 ++++++++---- |
13 | 1 file changed, 4 insertions(+), 2 deletions(-) | 19 | 1 file changed, 8 insertions(+), 4 deletions(-) |
14 | 20 | ||
15 | diff --git a/net/net.c b/net/net.c | 21 | diff --git a/net/net.c b/net/net.c |
16 | index XXXXXXX..XXXXXXX 100644 | 22 | index XXXXXXX..XXXXXXX 100644 |
17 | --- a/net/net.c | 23 | --- a/net/net.c |
18 | +++ b/net/net.c | 24 | +++ b/net/net.c |
19 | @@ -XXX,XX +XXX,XX @@ static int net_param_nic(void *dummy, QemuOpts *opts, Error **errp) | 25 | @@ -XXX,XX +XXX,XX @@ void qemu_del_nic(NICState *nic) |
20 | g_free(mac); | 26 | |
21 | if (ret) { | 27 | qemu_macaddr_set_free(&nic->conf->macaddr); |
22 | error_setg(errp, "invalid syntax for ethernet address"); | 28 | |
23 | - return -1; | 29 | - /* If this is a peer NIC and peer has already been deleted, free it now. */ |
24 | + goto out; | 30 | - if (nic->peer_deleted) { |
25 | } | 31 | - for (i = 0; i < queues; i++) { |
26 | if (is_multicast_ether_addr(ni->macaddr.a)) { | 32 | - qemu_free_net_client(qemu_get_subqueue(nic, i)->peer); |
27 | error_setg(errp, "NIC cannot have multicast MAC address"); | 33 | + for (i = 0; i < queues; i++) { |
28 | - return -1; | 34 | + NetClientState *nc = qemu_get_subqueue(nic, i); |
29 | + ret = -1; | 35 | + /* If this is a peer NIC and peer has already been deleted, free it now. */ |
30 | + goto out; | 36 | + if (nic->peer_deleted) { |
37 | + qemu_free_net_client(nc->peer); | ||
38 | + } else if (nc->peer) { | ||
39 | + /* if there are RX packets pending, complete them */ | ||
40 | + qemu_purge_queued_packets(nc->peer); | ||
31 | } | 41 | } |
32 | } | 42 | } |
33 | qemu_macaddr_default_if_unset(&ni->macaddr); | 43 | |
34 | @@ -XXX,XX +XXX,XX @@ static int net_param_nic(void *dummy, QemuOpts *opts, Error **errp) | ||
35 | nb_nics++; | ||
36 | } | ||
37 | |||
38 | +out: | ||
39 | g_free(nd_id); | ||
40 | return ret; | ||
41 | } | ||
42 | -- | 44 | -- |
43 | 2.7.4 | 45 | 2.7.4 |
44 | 46 | ||
45 | 47 | diff view generated by jsdifflib |
1 | From: Thomas Huth <thuth@redhat.com> | 1 | From: yuanjungong <ruc_gongyuanjun@163.com> |
---|---|---|---|
2 | 2 | ||
3 | 'vlan' is very confusing since it does not mean something like IEEE | 3 | Close fd before returning. |
4 | 802.1Q, but rather emulated hubs, so let's switch to that terminology | ||
5 | instead. | ||
6 | 4 | ||
7 | Buglink: https://bugs.launchpad.net/qemu/+bug/658904 | 5 | Buglink: https://bugs.launchpad.net/qemu/+bug/1904486 |
8 | Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> | 6 | |
9 | Signed-off-by: Thomas Huth <thuth@redhat.com> | 7 | Signed-off-by: yuanjungong <ruc_gongyuanjun@163.com> |
8 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
10 | Signed-off-by: Jason Wang <jasowang@redhat.com> | 9 | Signed-off-by: Jason Wang <jasowang@redhat.com> |
11 | --- | 10 | --- |
12 | net/hub.c | 7 +++---- | 11 | net/tap.c | 2 ++ |
13 | net/slirp.c | 8 ++++---- | 12 | 1 file changed, 2 insertions(+) |
14 | net/tap.c | 4 ++-- | ||
15 | 3 files changed, 9 insertions(+), 10 deletions(-) | ||
16 | 13 | ||
17 | diff --git a/net/hub.c b/net/hub.c | ||
18 | index XXXXXXX..XXXXXXX 100644 | ||
19 | --- a/net/hub.c | ||
20 | +++ b/net/hub.c | ||
21 | @@ -XXX,XX +XXX,XX @@ | ||
22 | |||
23 | /* | ||
24 | * A hub broadcasts incoming packets to all its ports except the source port. | ||
25 | - * Hubs can be used to provide independent network segments, also confusingly | ||
26 | - * named the QEMU 'vlan' feature. | ||
27 | + * Hubs can be used to provide independent emulated network segments. | ||
28 | */ | ||
29 | |||
30 | typedef struct NetHub NetHub; | ||
31 | @@ -XXX,XX +XXX,XX @@ void net_hub_check_clients(void) | ||
32 | } | ||
33 | } | ||
34 | if (has_host_dev && !has_nic) { | ||
35 | - warn_report("vlan %d with no nics", hub->id); | ||
36 | + warn_report("hub %d with no nics", hub->id); | ||
37 | } | ||
38 | if (has_nic && !has_host_dev) { | ||
39 | - warn_report("vlan %d is not connected to host network", hub->id); | ||
40 | + warn_report("hub %d is not connected to host network", hub->id); | ||
41 | } | ||
42 | } | ||
43 | } | ||
44 | diff --git a/net/slirp.c b/net/slirp.c | ||
45 | index XXXXXXX..XXXXXXX 100644 | ||
46 | --- a/net/slirp.c | ||
47 | +++ b/net/slirp.c | ||
48 | @@ -XXX,XX +XXX,XX @@ static SlirpState *slirp_lookup(Monitor *mon, const char *hub_id, | ||
49 | if (hub_id) { | ||
50 | nc = net_hub_find_client_by_name(strtol(hub_id, NULL, 0), name); | ||
51 | if (!nc) { | ||
52 | - monitor_printf(mon, "unrecognized (vlan-id, stackname) pair\n"); | ||
53 | + monitor_printf(mon, "unrecognized (hub-id, stackname) pair\n"); | ||
54 | return NULL; | ||
55 | } | ||
56 | } else { | ||
57 | @@ -XXX,XX +XXX,XX @@ void hmp_info_usernet(Monitor *mon, const QDict *qdict) | ||
58 | |||
59 | QTAILQ_FOREACH(s, &slirp_stacks, entry) { | ||
60 | int id; | ||
61 | - bool got_vlan_id = net_hub_id_for_client(&s->nc, &id) == 0; | ||
62 | - monitor_printf(mon, "VLAN %d (%s):\n", | ||
63 | - got_vlan_id ? id : -1, | ||
64 | + bool got_hub_id = net_hub_id_for_client(&s->nc, &id) == 0; | ||
65 | + monitor_printf(mon, "Hub %d (%s):\n", | ||
66 | + got_hub_id ? id : -1, | ||
67 | s->nc.name); | ||
68 | slirp_connection_info(s->slirp, mon); | ||
69 | } | ||
70 | diff --git a/net/tap.c b/net/tap.c | 14 | diff --git a/net/tap.c b/net/tap.c |
71 | index XXXXXXX..XXXXXXX 100644 | 15 | index XXXXXXX..XXXXXXX 100644 |
72 | --- a/net/tap.c | 16 | --- a/net/tap.c |
73 | +++ b/net/tap.c | 17 | +++ b/net/tap.c |
74 | @@ -XXX,XX +XXX,XX @@ int net_init_tap(const Netdev *netdev, const char *name, | 18 | @@ -XXX,XX +XXX,XX @@ int net_init_tap(const Netdev *netdev, const char *name, |
75 | queues = tap->has_queues ? tap->queues : 1; | 19 | if (ret < 0) { |
76 | vhostfdname = tap->has_vhostfd ? tap->vhostfd : NULL; | 20 | error_setg_errno(errp, -ret, "%s: Can't use file descriptor %d", |
77 | 21 | name, fd); | |
78 | - /* QEMU vlans does not support multiqueue tap, in this case peer is set. | 22 | + close(fd); |
79 | + /* QEMU hubs do not support multiqueue tap, in this case peer is set. | 23 | return -1; |
80 | * For -netdev, peer is always NULL. */ | 24 | } |
81 | if (peer && (tap->has_queues || tap->has_fds || tap->has_vhostfds)) { | 25 | |
82 | - error_setg(errp, "Multiqueue tap cannot be used with QEMU vlans"); | 26 | @@ -XXX,XX +XXX,XX @@ int net_init_tap(const Netdev *netdev, const char *name, |
83 | + error_setg(errp, "Multiqueue tap cannot be used with hubs"); | 27 | vhostfdname, vnet_hdr, fd, &err); |
84 | return -1; | 28 | if (err) { |
85 | } | 29 | error_propagate(errp, err); |
86 | 30 | + close(fd); | |
31 | return -1; | ||
32 | } | ||
33 | } else if (tap->has_fds) { | ||
87 | -- | 34 | -- |
88 | 2.7.4 | 35 | 2.7.4 |
89 | 36 | ||
90 | 37 | diff view generated by jsdifflib |
1 | From: Thomas Huth <thuth@redhat.com> | 1 | From: Keqian Zhu <zhukeqian1@huawei.com> |
---|---|---|---|
2 | 2 | ||
3 | 'vlan' is very confusing since it does not mean something like IEEE | 3 | Fixes: 63c4db4c2e6d (net: relocate paths to helpers and scripts) |
4 | 802.1Q, but rather emulated hubs, so let's switch to that terminology | 4 | Signed-off-by: Keqian Zhu <zhukeqian1@huawei.com> |
5 | instead. While we're at it, move the subsection about hub a little bit | ||
6 | downward in the documentation (it's not as important anymore as it was | ||
7 | before the invention of the -netdev parameter), and extend it a little | ||
8 | bit. | ||
9 | |||
10 | Buglink: https://bugs.launchpad.net/qemu/+bug/658904 | ||
11 | Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> | ||
12 | Signed-off-by: Thomas Huth <thuth@redhat.com> | ||
13 | Signed-off-by: Jason Wang <jasowang@redhat.com> | 5 | Signed-off-by: Jason Wang <jasowang@redhat.com> |
14 | --- | 6 | --- |
15 | qemu-doc.texi | 42 +++++++++++++++++++++++------------------- | 7 | net/tap.c | 3 ++- |
16 | 1 file changed, 23 insertions(+), 19 deletions(-) | 8 | 1 file changed, 2 insertions(+), 1 deletion(-) |
17 | 9 | ||
18 | diff --git a/qemu-doc.texi b/qemu-doc.texi | 10 | diff --git a/net/tap.c b/net/tap.c |
19 | index XXXXXXX..XXXXXXX 100644 | 11 | index XXXXXXX..XXXXXXX 100644 |
20 | --- a/qemu-doc.texi | 12 | --- a/net/tap.c |
21 | +++ b/qemu-doc.texi | 13 | +++ b/net/tap.c |
22 | @@ -XXX,XX +XXX,XX @@ state is not saved or restored properly (in particular USB). | 14 | @@ -XXX,XX +XXX,XX @@ free_fail: |
23 | @node pcsys_network | 15 | script = default_script = get_relocated_path(DEFAULT_NETWORK_SCRIPT); |
24 | @section Network emulation | 16 | } |
25 | 17 | if (!downscript) { | |
26 | -QEMU can simulate several network cards (PCI or ISA cards on the PC | 18 | - downscript = default_downscript = get_relocated_path(DEFAULT_NETWORK_SCRIPT); |
27 | -target) and can connect them to an arbitrary number of Virtual Local | 19 | + downscript = default_downscript = |
28 | -Area Networks (VLANs). Host TAP devices can be connected to any QEMU | 20 | + get_relocated_path(DEFAULT_NETWORK_DOWN_SCRIPT); |
29 | -VLAN. VLAN can be connected between separate instances of QEMU to | 21 | } |
30 | -simulate large networks. For simpler usage, a non privileged user mode | 22 | |
31 | -network stack can replace the TAP device to have a basic network | 23 | if (tap->has_ifname) { |
32 | -connection. | ||
33 | - | ||
34 | -@subsection VLANs | ||
35 | - | ||
36 | -QEMU simulates several VLANs. A VLAN can be symbolised as a virtual | ||
37 | -connection between several network devices. These devices can be for | ||
38 | -example QEMU virtual Ethernet cards or virtual Host ethernet devices | ||
39 | -(TAP devices). | ||
40 | +QEMU can simulate several network cards (e.g. PCI or ISA cards on the PC | ||
41 | +target) and can connect them to a network backend on the host or an emulated | ||
42 | +hub. The various host network backends can either be used to connect the NIC of | ||
43 | +the guest to a real network (e.g. by using a TAP devices or the non-privileged | ||
44 | +user mode network stack), or to other guest instances running in another QEMU | ||
45 | +process (e.g. by using the socket host network backend). | ||
46 | |||
47 | @subsection Using TAP network interfaces | ||
48 | |||
49 | @@ -XXX,XX +XXX,XX @@ network). The virtual network configuration is the following: | ||
50 | |||
51 | @example | ||
52 | |||
53 | - QEMU VLAN <------> Firewall/DHCP server <-----> Internet | ||
54 | + guest (10.0.2.15) <------> Firewall/DHCP server <-----> Internet | ||
55 | | (10.0.2.2) | ||
56 | | | ||
57 | ----> DNS server (10.0.2.3) | ||
58 | @@ -XXX,XX +XXX,XX @@ When using the @option{'-netdev user,hostfwd=...'} option, TCP or UDP | ||
59 | connections can be redirected from the host to the guest. It allows for | ||
60 | example to redirect X11, telnet or SSH connections. | ||
61 | |||
62 | -@subsection Connecting VLANs between QEMU instances | ||
63 | +@subsection Hubs | ||
64 | + | ||
65 | +QEMU can simulate several hubs. A hub can be thought of as a virtual connection | ||
66 | +between several network devices. These devices can be for example QEMU virtual | ||
67 | +ethernet cards or virtual Host ethernet devices (TAP devices). You can connect | ||
68 | +guest NICs or host network backends to such a hub using the @option{-netdev | ||
69 | +hubport} or @option{-nic hubport} options. The legacy @option{-net} option | ||
70 | +also connects the given device to the emulated hub with ID 0 (i.e. the default | ||
71 | +hub) unless you specify a netdev with @option{-net nic,netdev=xxx} here. | ||
72 | + | ||
73 | +@subsection Connecting emulated networks between QEMU instances | ||
74 | |||
75 | -Using the @option{-net socket} option, it is possible to make VLANs | ||
76 | -that span several QEMU instances. See @ref{sec_invocation} to have a | ||
77 | -basic example. | ||
78 | +Using the @option{-netdev socket} (or @option{-nic socket} or | ||
79 | +@option{-net socket}) option, it is possible to create emulated | ||
80 | +networks that span several QEMU instances. | ||
81 | +See the description of the @option{-netdev socket} option in the | ||
82 | +@ref{sec_invocation,,Invocation chapter} to have a basic example. | ||
83 | |||
84 | @node pcsys_other_devs | ||
85 | @section Other Devices | ||
86 | -- | 24 | -- |
87 | 2.7.4 | 25 | 2.7.4 |
88 | 26 | ||
89 | 27 | diff view generated by jsdifflib |