]>
git.proxmox.com Git - qemu-server.git/blob - vm-network-scripts/pve-bridge
7 use PVE
::Tools
qw(run_command);
13 require PVE
::Network
::SDN
::Zones
;
14 require PVE
::Network
::SDN
::Vnets
;
21 if ($iface eq '--hotplug') {
26 die "no interface specified\n" if !$iface;
28 die "got strange interface name '$iface'\n"
29 if $iface !~ m/^tap(\d+)i(\d+)$/;
34 my $migratedfrom = $hotplug ?
undef : $ENV{PVE_MIGRATED_FROM
};
36 my $conf = PVE
::QemuConfig-
>load_config($vmid, $migratedfrom);
38 my $netconf = $conf->{$netid};
40 $netconf = $conf->{pending
}->{$netid} if !$migratedfrom && defined($conf->{pending
}->{$netid});
42 die "unable to get network config '$netid'\n"
43 if !defined($netconf);
45 my $net = PVE
::QemuServer
::parse_net
($netconf);
46 die "unable to parse network config '$netid'\n" if !$net;
48 # The nftable-based implementation from the newer proxmox-firewall does not requires FW bridges
49 my $create_firewall_bridges = $net->{firewall
} && !PVE
::Firewall
::is_nftables
();
52 PVE
::Network
::SDN
::Vnets
::add_dhcp_mapping
($net->{bridge
}, $net->{macaddr
}, $vmid, $conf->{name
});
53 PVE
::Network
::SDN
::Zones
::tap_create
($iface, $net->{bridge
});
54 PVE
::Network
::SDN
::Zones
::tap_plug
($iface, $net->{bridge
}, $net->{tag
}, $create_firewall_bridges, $net->{trunks
}, $net->{rate
});
56 PVE
::Network
::tap_create
($iface, $net->{bridge
});
57 PVE
::Network
::tap_plug
($iface, $net->{bridge
}, $net->{tag
}, $create_firewall_bridges, $net->{trunks
}, $net->{rate
});