Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 7 additions & 5 deletions lib/Ravada.pm
Original file line number Diff line number Diff line change
Expand Up @@ -231,10 +231,13 @@ sub _add_internal_network($self) {
my ($found) = $sth->fetchrow;
return if $found;

$sth = $CONNECTOR->dbh->prepare("SELECT * FROM networks WHERE name like 'internal%'");
my %done;
$sth = $CONNECTOR->dbh->prepare("SELECT * FROM networks");
$sth->execute();
($found) = $sth->fetchrow;
return if $found;
while ( my $row = $sth->fetchrow_hashref) {
return if $row->{name} =~ /^internal/;
$done{$row->{address}}++;
};

my @cmd = ("ip","route");
my ($in, $out, $err);
Expand All @@ -247,11 +250,10 @@ sub _add_internal_network($self) {
." VALUES(?,?,?,1,0)"
);
my $n=0;
my %done;
for my $net (split /\n/,$out) {
next if $net =~ /dev virbr/;
my ($address) = $net =~ m{(^[\d\.]+/\d+)};
next if !$address || $done{address}++;
next if !$address || $done{$address}++;
$sth->execute("internal$n",$address, ++$n+1);

}
Expand Down
Loading