]> git.proxmox.com Git - qemu-server.git/commitdiff
fix #2114: set correct link status on hotplug
authorDominik Csapak <d.csapak@proxmox.com>
Thu, 28 Feb 2019 08:15:59 +0000 (09:15 +0100)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Thu, 28 Feb 2019 09:02:23 +0000 (10:02 +0100)
we also need to set the link status if the whole device changed,
otherwise a change of macaddress allows a network connection even
if link_down is set to 1

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
PVE/QemuServer.pm

index 6e56eda49aaeec48c1614a1fdfdf374be499d89f..5422296602e8da2616194e69460e84f0fafab201 100644 (file)
@@ -4140,7 +4140,10 @@ sub vm_deviceplug {
 
         my $netdevicefull = print_netdevice_full($vmid, $conf, $device, $deviceid, undef, $use_old_bios_files, $arch, $machine_type);
         qemu_deviceadd($vmid, $netdevicefull);
-        eval { qemu_deviceaddverify($vmid, $deviceid); };
+       eval {
+           qemu_deviceaddverify($vmid, $deviceid);
+           qemu_set_link_status($vmid, $deviceid, !$device->{link_down});
+       };
        if (my $err = $@) {
            eval { qemu_netdevdel($vmid, $deviceid); };
            warn $@ if $@;