mirror of
https://github.com/cmur2/dyndnsd.git
synced 2024-12-21 14:54:22 +01:00
Support IPv6 addresses
This also checks for IPv6-mapped IPv4 addresses. Closes #1.
This commit is contained in:
parent
c3331d19ca
commit
d2747549fe
@ -85,7 +85,7 @@ module Dyndnsd
|
||||
|
||||
# malformed myip?
|
||||
begin
|
||||
IPAddr.new(params["myip"], Socket::AF_INET)
|
||||
IPAddr.new(params["myip"])
|
||||
rescue ArgumentError
|
||||
params["myip"] = env["REMOTE_ADDR"]
|
||||
end
|
||||
|
@ -19,8 +19,10 @@ module Dyndnsd
|
||||
out << "@ IN NS #{@dns}"
|
||||
out << ""
|
||||
zone['hosts'].each do |hostname,ip|
|
||||
ip = IPAddr.new(ip).native
|
||||
type = ip.ipv6? ? "AAAA" : "A"
|
||||
name = hostname.chomp('.' + @domain)
|
||||
out << "#{name} IN A #{ip}"
|
||||
out << "#{name} IN #{type} #{ip}"
|
||||
end
|
||||
out << ""
|
||||
out << @additional_zone_content
|
||||
|
Loading…
Reference in New Issue
Block a user