Split horizon usage

31 views
Skip to first unread message

Eli Heady

unread,
Feb 18, 2025, 1:08:35 PMFeb 18
to dnscontro...@googlegroups.com
Hi dnscontrol peeps,

What huge improvements lately! It is so great.

I am trying to use the split horizon feature described at https://docs.dnscontrol.org/language-reference/top-level-functions/d#split-horizon-dns

The doc says "If you define domains example.com!george and example.com!john then: --domains=example.com will not match either domain." I am seeing the opposite (both are matched), and additionally I can't target the individual domains. I assume I am doing something wrong here, but I don't see it.

I am using 4.16.0 from homebrew

dnsconfig.js:
var noreg = NewRegistrar("none");
var r53 = NewDnsProvider("r53");
var ibm = NewDnsProvider("softlayer");

D("example.com!ibm", noreg,
    NO_PURGE,
    DnsProvider(ibm),
    // ...
);

D("example.com!r53", noreg,
    NO_PURGE,
    DnsProvider(r53),
    // ...
);

Tested with a target of "example.com" -- I expect no zones to match, but see 1 zone processed and both tagged domains included (and I'm ignoring the error from the Softlayer API, just including it for completeness as I guess there is the remote chance it causes both domains to get targeted in a preview operation?)

dns % dnscontrol preview --populate-on-preview=false --domains='example.com'
WARNING: The SOFTLAYER provider is unmaintained: https://github.com/StackExchange/dnscontrol/issues/1079CONCURRENTLY gathering 1 zone(s)
SERIALLY gathering 1 zone(s)
Serially Gathering: "example.com"
Waiting for concurrent gathering(s) to complete...DONE
******************** Domain: example.com!ibm
INFO#1: Domain "example.com" provider softlayer Error: didn't find a domain matching example.com
******************** Domain: example.com!r53
Done. 0 corrections.



Tested with a target of "example.com!ibm" (expect only softlayer to match, but see 0 zones)

dns % dnscontrol preview --populate-on-preview=false --domains='example.com\!ibm'
WARNING: The SOFTLAYER provider is unmaintained: https://github.com/StackExchange/dnscontrol/issues/1079CONCURRENTLY gathering 0 zone(s)
SERIALLY gathering 0 zone(s)
Done. 0 corrections.

Suspecting this could be a shell quoting/escaping issue, I tried zsh and bash and combinations of quotes. The above output is zsh 5.9. I also tried the following alternatives with bash 5.2 with the same results (0 zones matched): 
--domains='example.com!ibm'
--domains=example.com\!ibm
--domains="example.com\!ibm"

No one else seems to be hitting this so I assume it is something dumb related to my environment ... yet I'm stumped. Any ideas?

Thanks,
Eli

Tom Limoncelli

unread,
Feb 18, 2025, 2:48:09 PMFeb 18
to Eli Heady, dnscontro...@googlegroups.com
Hi Eli!

Sadly the documentation is wrong.  The code compares the .Name ("example.com"), not the "DomainUniqueName" (example.com!paul).  See https://github.com/StackExchange/dnscontrol/blob/3f8f9e78186bc74d780bc185b34884359346373e/commands/ppreviewPush.go#L349

It wouldn't be too difficult to change this in an upwards compatible manner.  If the filter contains a "!" then match against the "domain!tag" string, not the "domain".  (i.e. use dc.GetUniqueName() instead of dc.Name).

Would you be interested in submitting a PR?

Tom


--
You received this message because you are subscribed to the Google Groups "DNSControl-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to dnscontrol-disc...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/dnscontrol-discuss/CAPM_dJi6sd1v5qHfhEWQF-ZBO7Nd0fBFDBGC_XtspGWRuJnyxQ%40mail.gmail.com.

Eli Heady

unread,
Feb 18, 2025, 5:15:41 PMFeb 18
to Tom Limoncelli, dnscontro...@googlegroups.com
aha, thank you for the quick fix! Yes I would be happy to make a PR for this.

Thanks!
Eli

Tom Limoncelli

unread,
Feb 18, 2025, 5:21:28 PMFeb 18
to Eli Heady, dnscontro...@googlegroups.com
Great! Please let me know how I can help.

Tom

Eli Heady

unread,
Feb 19, 2025, 9:48:05 AMFeb 19
to Tom Limoncelli, dnscontro...@googlegroups.com

Lance A. Brown

unread,
Feb 19, 2025, 10:33:23 AMFeb 19
to dnscontro...@googlegroups.com

Is this line at the bottom of D.md a typo?

The quotes don't match and probably isn't doing what is needful.

--[Lance]

Eli Heady

unread,
Feb 21, 2025, 4:39:44 PMFeb 21
to Lance A. Brown, dnscontro...@googlegroups.com
You're correct and a fix is included in the PR I am working on. Thanks for pointing it out.

Eli

Eli Heady

unread,
Feb 21, 2025, 4:49:09 PMFeb 21
to Lance A. Brown, dnscontro...@googlegroups.com
erm, thanks for fixing it! :)
Reply all
Reply to author
Forward
0 new messages