Skip to content

Commit 394a327

Browse files
F #7675: option to configure FQDN for remote_addr
So the resolver on the host will provide the IP address for the opennebula-gate service. This way, with DNS view or a line in /etc/hosts the tproxy service will pick the desired IP to connect to the opennebula-gate
1 parent bb6f625 commit 394a327

1 file changed

Lines changed: 14 additions & 1 deletion

File tree

src/vnm_mad/remotes/lib/tproxy.rb

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,20 @@ def self.setup_tproxy(nic, direction)
4444
&& (nets & nic.slice(:network, :network_id).values.map(&:to_s)).empty?
4545

4646
next if conf[:service_port].nil?
47-
next if conf[:remote_addr].nil? || conf[:remote_addr] !~ Resolv::IPv4::Regex
47+
next if conf[:remote_addr].nil? || conf[:remote_addr].to_s.strip.empty?
48+
49+
unless conf[:remote_addr] =~ Resolv::IPv4::Regex
50+
begin
51+
remote_ip = Resolv.getaddress(conf[:remote_addr])
52+
next unless remote_ip =~ Resolv::IPv4::Regex
53+
54+
OpenNebula.log_info "Resolved remote_addr #{conf[:remote_addr]} to #{remote_ip}"
55+
conf[:remote_addr] = remote_ip
56+
rescue Resolv::ResolvError
57+
OpenNebula.log_warning "Can't resolve remote_addr #{conf[:remote_addr]}. Skipping."
58+
next
59+
end
60+
end
4861
next if conf[:remote_port].nil?
4962

5063
opts = {

0 commit comments

Comments
 (0)