No functional changes.
Signed-off-by: Christoph Heiss <c.heiss@proxmox.com>
Tested-by: Friedrich Weber <f.weber@proxmox.com>
warn $@ if $@; # avoid errors - just warn
}
warn $@ if $@; # avoid errors - just warn
}
-sub net_tap_plug : prototype($$$$$$;$) {
- my ($iface, $bridge, $tag, $firewall, $trunks, $rate, $opts) = @_;
+sub net_tap_plug : prototype($$) {
+ my ($iface, $net) = @_;
+ my ($bridge, $tag, $firewall, $trunks, $rate, $hwaddr) =
+ $net->@{'bridge', 'tag', 'firewall', 'trunks', 'rate', 'hwaddr'};
if ($have_sdn) {
PVE::Network::SDN::Zones::tap_plug($iface, $bridge, $tag, $firewall, $trunks, $rate);
if ($have_sdn) {
PVE::Network::SDN::Zones::tap_plug($iface, $bridge, $tag, $firewall, $trunks, $rate);
- PVE::Network::SDN::Zones::add_bridge_fdb($iface, $opts->{mac}, $bridge, $firewall)
- if defined($opts->{mac});
+ PVE::Network::SDN::Zones::add_bridge_fdb($iface, $hwaddr, $bridge, $firewall);
- PVE::Network::tap_plug($iface, $bridge, $tag, $firewall, $trunks, $rate, $opts);
+ PVE::Network::tap_plug($iface, $bridge, $tag, $firewall, $trunks, $rate, { mac => $hwaddr });
PVE::LXC::Config->write_config($vmid, $conf);
}
PVE::LXC::Config->write_config($vmid, $conf);
}
- my ($bridge, $mac, $firewall, $rate) = $newnet->@{'bridge', 'hwaddr', 'firewall', 'rate'};
- PVE::LXC::net_tap_plug($veth, $bridge, $newnet->{tag}, $firewall, $newnet->{trunks}, $rate, { mac => $mac });
+ PVE::LXC::net_tap_plug($veth, $newnet);
# This includes the rate:
foreach (qw(bridge tag firewall rate)) {
# This includes the rate:
foreach (qw(bridge tag firewall rate)) {
} else {
PVE::Network::veth_create($veth, $vethpeer, $newnet->{bridge}, $newnet->{hwaddr});
}
} else {
PVE::Network::veth_create($veth, $vethpeer, $newnet->{bridge}, $newnet->{hwaddr});
}
- PVE::LXC::net_tap_plug(
- $veth, $newnet->{bridge}, $newnet->{tag}, $newnet->{firewall}, $newnet->{trunks},
- $newnet->{rate}, { mac => $newnet->{hwaddr} },
- );
+
+ PVE::LXC::net_tap_plug($veth, $newnet);
# attach peer in container
my $cmd = ['lxc-device', '-n', $vmid, 'add', $vethpeer, "$eth" ];
# attach peer in container
my $cmd = ['lxc-device', '-n', $vmid, 'add', $vethpeer, "$eth" ];
my $net = PVE::LXC::Config->parse_lxc_network($netconf);
my $net = PVE::LXC::Config->parse_lxc_network($netconf);
-my $tag = $net->{tag};
-my $firewall = $net->{firewall};
my $bridge = $net->{bridge};
my $bridge = $net->{bridge};
-my $trunks = $net->{trunks};
-my $rate = $net->{rate};
-my $hwaddr = $net->{hwaddr};
-
die "missing bridge configuration" if !$bridge;
if (-d "/sys/class/net/$iface") {
die "missing bridge configuration" if !$bridge;
if (-d "/sys/class/net/$iface") {
PVE::Tools::run_command("/sbin/ip link set dev $iface up mtu $bridgemtu");
PVE::Tools::run_command("/sbin/ip addr add 0.0.0.0/0 dev $iface");
PVE::Tools::run_command("/sbin/ip link set dev $iface up mtu $bridgemtu");
PVE::Tools::run_command("/sbin/ip addr add 0.0.0.0/0 dev $iface");
-
- PVE::LXC::net_tap_plug($iface, $bridge, $tag, $firewall, $trunks, $rate, { mac => $hwaddr });
+ PVE::LXC::net_tap_plug($iface, $net);