[pve-devel] [PATCH pve-container] redhat: fix unused values
Wolfgang Bumiller
w.bumiller at proxmox.com
Thu Oct 22 11:02:01 CEST 2015
Move ip_is_in_cidr checks on $d->{gw} into the
defined($d->{gw}) guarded if block to avoid warnings and
useless route files being created when using dhcp.
---
src/PVE/LXC/Setup/Redhat.pm | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/src/PVE/LXC/Setup/Redhat.pm b/src/PVE/LXC/Setup/Redhat.pm
index 2ed9cda..b85b8a2 100644
--- a/src/PVE/LXC/Setup/Redhat.pm
+++ b/src/PVE/LXC/Setup/Redhat.pm
@@ -212,12 +212,12 @@ sub setup_network {
$data .= "NETMASK=$ipinfo->{netmask}\n";
if (defined($d->{gw})) {
$data .= "GATEWAY=$d->{gw}\n";
+ if (!PVE::Network::is_ip_in_cidr($d->{gw}, $d->{ip}, 4)) {
+ $routes .= "$d->{gw} dev $d->{name}\n";
+ $routes .= "default via $d->{gw}\n";
+ }
}
}
- if (!PVE::Network::is_ip_in_cidr($d->{gw}, $d->{ip}, 4)) {
- $routes .= "$d->{gw} dev $d->{name}\n";
- $routes .= "default via $d->{gw}\n";
- }
}
if ($d->{ip6} && $d->{ip6} ne 'manual') {
@@ -234,12 +234,12 @@ sub setup_network {
$data .= "IPV6ADDR=$d->{ip6}\n";
if (defined($d->{gw6})) {
$data .= "IPV6_DEFAULTGW=$d->{gw6}\n";
+ if (!PVE::Network::is_ip_in_cidr($d->{gw6}, $d->{ip6}, 6)) {
+ $routes .= "$d->{gw6} dev $d->{name}\n";
+ $routes .= "default via $d->{gw6}\n";
+ }
}
}
- if (!PVE::Network::is_ip_in_cidr($d->{gw6}, $d->{ip6}, 6)) {
- $routes .= "$d->{gw6} dev $d->{name}\n";
- $routes .= "default via $d->{gw6}\n";
- }
}
next unless $data;
--
2.1.4
More information about the pve-devel
mailing list