vhost-user_net, vm-virtio, vmm: Permit host MAC address setting

Add a new "host_mac" parameter to "--net" and "--net-backend" and use
this to set the MAC address on the tap interface. If no address is given
one is randomly assigned and is stored in the config.

Support for vhost-user-net self spawning was also included.

Fixes: #1177

Signed-off-by: Rob Bradford <robert.bradford@intel.com>
This commit is contained in:
Rob Bradford
2020-05-15 10:00:38 +01:00
parent 11049401ce
commit 1b8b5ac179
6 changed files with 79 additions and 35 deletions
+9 -2
View File
@@ -1463,8 +1463,13 @@ impl DeviceManager {
.args(&[
"--net-backend",
&format!(
"ip={},mask={},socket={},num_queues={},queue_size={}",
net_cfg.ip, net_cfg.mask, &sock, net_cfg.num_queues, net_cfg.queue_size
"ip={},mask={},socket={},num_queues={},queue_size={},host_mac={}",
net_cfg.ip,
net_cfg.mask,
&sock,
net_cfg.num_queues,
net_cfg.queue_size,
net_cfg.host_mac
),
])
.spawn()
@@ -1529,6 +1534,7 @@ impl DeviceManager {
None,
None,
Some(net_cfg.mac),
Some(net_cfg.host_mac),
net_cfg.iommu,
net_cfg.num_queues,
net_cfg.queue_size,
@@ -1543,6 +1549,7 @@ impl DeviceManager {
Some(net_cfg.ip),
Some(net_cfg.mask),
Some(net_cfg.mac),
Some(net_cfg.host_mac),
net_cfg.iommu,
net_cfg.num_queues,
net_cfg.queue_size,