mirror of
https://github.com/StackExchange/dnscontrol.git
synced 2025-10-06 11:56:50 +08:00
BUGFIX: REV fails in D_EXTEND for IPv6 addresses (#3552)
This commit is contained in:
parent
5715b842f5
commit
7a4c16f447
6 changed files with 100 additions and 0 deletions
|
@ -1275,6 +1275,9 @@ function recordBuilder(type, opts) {
|
|||
record.name = d.subdomain;
|
||||
} else if (record.name.match(/^\d+\.\d+\.\d+\.\d+$/)) {
|
||||
// leave it alone
|
||||
} else if (d.name.endsWith('.ip6.arpa')) {
|
||||
record.name = d.subdomain;
|
||||
d.subdomain = undefined;
|
||||
} else if (record.name.endsWith('.in-addr.arpa')) {
|
||||
if (record.name.endsWith(d.subdomain)) {
|
||||
record.name = record.name.slice(
|
||||
|
|
|
@ -121,6 +121,7 @@ func TestParsedFiles(t *testing.T) {
|
|||
} else {
|
||||
zoneFile = filepath.Join(testDir, testName, dc.Name+".zone")
|
||||
}
|
||||
//fmt.Printf("DEBUG: zonefile = %q\n", zoneFile)
|
||||
expectedZone, err := os.ReadFile(zoneFile)
|
||||
if err != nil {
|
||||
continue
|
||||
|
|
16
pkg/js/parse_tests/055-b3550-ipv6ptr.js
Normal file
16
pkg/js/parse_tests/055-b3550-ipv6ptr.js
Normal file
|
@ -0,0 +1,16 @@
|
|||
var REG_NONE = NewRegistrar("none");
|
||||
var DSP_BIND = NewDnsProvider("bind", "BIND");
|
||||
|
||||
D(REV("2011:abcd::/32"), REG_NONE, DnsProvider(DSP_BIND),
|
||||
PTR("2011:abcd::11", "host11.example.com."),
|
||||
PTR(REV("2011:abcd::22"), "host22.example.com."),
|
||||
);
|
||||
|
||||
D(REV("2001:db8::/32"), REG_NONE, DnsProvider(DSP_BIND),
|
||||
PTR("2001:db8::11", "server11.example.com."),
|
||||
PTR(REV("2001:db8::22"), "server22.example.com."),
|
||||
);
|
||||
|
||||
D_EXTEND("d.c.b.a.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.8.b.d.0.1.0.0.2.ip6.arpa",
|
||||
PTR("2001:db8::abcd", "abcd.example.com.")
|
||||
);
|
73
pkg/js/parse_tests/055-b3550-ipv6ptr.json
Normal file
73
pkg/js/parse_tests/055-b3550-ipv6ptr.json
Normal file
|
@ -0,0 +1,73 @@
|
|||
{
|
||||
"dns_providers": [
|
||||
{
|
||||
"name": "bind",
|
||||
"type": "BIND"
|
||||
}
|
||||
],
|
||||
"domains": [
|
||||
{
|
||||
"dnsProviders": {
|
||||
"bind": -1
|
||||
},
|
||||
"meta": {
|
||||
"dnscontrol_tag": "",
|
||||
"dnscontrol_uniquename": "d.c.b.a.1.1.0.2.ip6.arpa"
|
||||
},
|
||||
"name": "d.c.b.a.1.1.0.2.ip6.arpa",
|
||||
"records": [
|
||||
{
|
||||
"name": "1.1.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0",
|
||||
"target": "host11.example.com.",
|
||||
"ttl": 300,
|
||||
"type": "PTR"
|
||||
},
|
||||
{
|
||||
"name": "2.2.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0",
|
||||
"target": "host22.example.com.",
|
||||
"ttl": 300,
|
||||
"type": "PTR"
|
||||
}
|
||||
],
|
||||
"registrar": "none"
|
||||
},
|
||||
{
|
||||
"dnsProviders": {
|
||||
"bind": -1
|
||||
},
|
||||
"meta": {
|
||||
"dnscontrol_tag": "",
|
||||
"dnscontrol_uniquename": "8.b.d.0.1.0.0.2.ip6.arpa"
|
||||
},
|
||||
"name": "8.b.d.0.1.0.0.2.ip6.arpa",
|
||||
"records": [
|
||||
{
|
||||
"name": "1.1.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0",
|
||||
"target": "server11.example.com.",
|
||||
"ttl": 300,
|
||||
"type": "PTR"
|
||||
},
|
||||
{
|
||||
"name": "2.2.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0",
|
||||
"target": "server22.example.com.",
|
||||
"ttl": 300,
|
||||
"type": "PTR"
|
||||
},
|
||||
{
|
||||
"name": "d.c.b.a.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0",
|
||||
"subdomain": "d.c.b.a.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0",
|
||||
"target": "abcd.example.com.",
|
||||
"ttl": 300,
|
||||
"type": "PTR"
|
||||
}
|
||||
],
|
||||
"registrar": "none"
|
||||
}
|
||||
],
|
||||
"registrars": [
|
||||
{
|
||||
"name": "none",
|
||||
"type": "-"
|
||||
}
|
||||
]
|
||||
}
|
|
@ -0,0 +1,4 @@
|
|||
$TTL 300
|
||||
1.1.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0 IN PTR server11.example.com.
|
||||
2.2.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0 IN PTR server22.example.com.
|
||||
d.c.b.a.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0 IN PTR abcd.example.com.
|
|
@ -0,0 +1,3 @@
|
|||
$TTL 300
|
||||
1.1.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0 IN PTR host11.example.com.
|
||||
2.2.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0 IN PTR host22.example.com.
|
Loading…
Add table
Reference in a new issue