my $nodename = PVE::INotify::nodename();
my $int_ip = PMG::Cluster::remote_node_ip($nodename);
- my $int_net_cidr = PMG::Utils::find_local_network_for_ip($int_ip);
$vars->{ipconfig}->{int_ip} = $int_ip;
- # $vars->{ipconfig}->{int_net_cidr} = $int_net_cidr;
my $transportnets = [];
$vars->{postfix}->{transportnets} = join(' ', @$transportnets);
my $mynetworks = [ '127.0.0.0/8', '[::1]/128' ];
- push @$mynetworks, $int_net_cidr;
+
+ if (my $int_net_cidr = PMG::Utils::find_local_network_for_ip($int_ip, 1)) {
+ push @$mynetworks, $int_net_cidr;
+ } else {
+ if ($int_ip =~ m/^$IPV6RE$/) {
+ push @$mynetworks, "$int_ip/128";
+ } else {
+ push @$mynetworks, "$int_ip/32";
+ }
+ }
my $netlist = PVE::INotify::read_file('mynetworks');
push @$mynetworks, keys %$netlist;
}
sub find_local_network_for_ip {
- my ($ip) = @_;
+ my ($ip, $noerr) = @_;
my $testip = Net::IP->new($ip);
}
}
+ return undef if $noerr;
+
die "unable to detect local network for ip '$ip'\n";
}