summaryrefslogtreecommitdiff
path: root/source4
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2011-06-02 17:09:17 +1000
committerAndrew Tridgell <tridge@samba.org>2011-06-06 12:26:10 +1000
commit7d59e9c549933c33182fbb0a7227be0eb69b4892 (patch)
tree1dfd32bc4d9684b3942fc3616489247e43154d98 /source4
parent40dc94a53f4f0f5dee285daf486912b0996d5f3e (diff)
downloadsamba-7d59e9c549933c33182fbb0a7227be0eb69b4892.tar.gz
samba-7d59e9c549933c33182fbb0a7227be0eb69b4892.tar.bz2
samba-7d59e9c549933c33182fbb0a7227be0eb69b4892.zip
s4-ipv6: added IPv6 support to samba_dnsupdate
Diffstat (limited to 'source4')
-rwxr-xr-xsource4/scripting/bin/samba_dnsupdate38
-rw-r--r--source4/setup/dns_update_list2
2 files changed, 33 insertions, 7 deletions
diff --git a/source4/scripting/bin/samba_dnsupdate b/source4/scripting/bin/samba_dnsupdate
index e86fba2983..cefe3ce859 100755
--- a/source4/scripting/bin/samba_dnsupdate
+++ b/source4/scripting/bin/samba_dnsupdate
@@ -89,6 +89,15 @@ if len(IPs) == 0:
print "No IP interfaces - skipping DNS updates"
sys.exit(0)
+IP6s = []
+IP4s = []
+for i in IPs:
+ if i.find(':') != -1:
+ IP6s.append(i)
+ else:
+ IP4s.append(i)
+
+
if opts.verbose:
print "IPs: %s" % IPs
@@ -122,7 +131,7 @@ class dnsobj(object):
if self.type == 'SRV':
self.dest = list[2].lower()
self.port = list[3]
- elif self.type == 'A':
+ elif self.type in ['A', 'AAAA']:
self.ip = list[2] # usually $IP, which gets replaced
elif self.type == 'CNAME':
self.dest = list[2].lower()
@@ -132,6 +141,7 @@ class dnsobj(object):
def __str__(self):
if d.type == "A": return "%s %s %s" % (self.type, self.name, self.ip)
+ if d.type == "AAAA": return "%s %s %s" % (self.type, self.name, self.ip)
if d.type == "SRV": return "%s %s %s %s" % (self.type, self.name, self.dest, self.port)
if d.type == "CNAME": return "%s %s %s" % (self.type, self.name, self.dest)
@@ -178,7 +188,7 @@ def check_dns_name(d):
if opts.verbose:
print "Failed to find DNS entry %s" % d
return False
- if d.type == 'A':
+ if d.type in ['A', 'AAAA']:
# we need to be sure that our IP is there
for rdata in ans:
if str(rdata) == str(d.ip):
@@ -247,6 +257,8 @@ def call_nsupdate(d):
f = os.fdopen(tmp_fd, 'w')
if d.type == "A":
f.write("update add %s %u A %s\n" % (normalised_name, default_ttl, d.ip))
+ if d.type == "AAAA":
+ f.write("update add %s %u AAAA %s\n" % (normalised_name, default_ttl, d.ip))
if d.type == "SRV":
if d.existing_port is not None:
f.write("update delete %s SRV 0 %s %s %s\n" % (normalised_name, d.existing_weight,
@@ -382,16 +394,28 @@ for line in file:
if line == '' or line[0] == "#":
continue
d = parse_dns_line(line, sub_vars)
+ if d.type == 'A' and len(IP4s) == 0:
+ continue
+ if d.type == 'AAAA' and len(IP6s) == 0:
+ continue
dns_list.append(d)
# now expand the entries, if any are A record with ip set to $IP
# then replace with multiple entries, one for each interface IP
for d in dns_list:
- if d.type == 'A' and d.ip == "$IP":
- d.ip = IPs[0]
- for i in range(len(IPs)-1):
+ if d.ip != "$IP":
+ continue
+ if d.type == 'A':
+ d.ip = IP4s[0]
+ for i in range(len(IP4s)-1):
+ d2 = dnsobj(str(d))
+ d2.ip = IP4s[i+1]
+ dns_list.append(d2)
+ if d.type == 'AAAA':
+ d.ip = IP6s[0]
+ for i in range(len(IP6s)-1):
d2 = dnsobj(str(d))
- d2.ip = IPs[i+1]
+ d2.ip = IP6s[i+1]
dns_list.append(d2)
# now check if the entries already exist on the DNS server
@@ -412,7 +436,7 @@ for d in update_list:
if am_rodc:
if d.name.lower() == domain.lower():
continue
- if d.type != 'A':
+ if not d.type in [ 'A', 'AAAA' ]:
call_rodc_update(d)
else:
call_nsupdate(d)
diff --git a/source4/setup/dns_update_list b/source4/setup/dns_update_list
index c69e155a80..91b182188b 100644
--- a/source4/setup/dns_update_list
+++ b/source4/setup/dns_update_list
@@ -2,6 +2,8 @@
# dynamic DNS update. It is processed by the samba_dnsupdate script
A ${DNSDOMAIN} $IP
A ${HOSTNAME} $IP
+AAAA ${DNSDOMAIN} $IP
+AAAA ${HOSTNAME} $IP
CNAME ${NTDSGUID}._msdcs.${DNSDOMAIN} ${HOSTNAME}
SRV _kerberos._tcp.${SITE}._sites.dc._msdcs.${DNSDOMAIN} ${HOSTNAME} 88
SRV _ldap._tcp.${SITE}._sites.dc._msdcs.${DNSDOMAIN} ${HOSTNAME} 389