aboutsummaryrefslogtreecommitdiff
path: root/plugin/file/lookup.go (follow)
AgeCommit message (Collapse)AuthorFilesLines
2022-07-10add golangci-lint linter (#5499)Gravatar Ondřej Benkovský 1-6/+0
2022-07-07plugin/file/cache: Add metadata for wildcard record responses (#5308)Gravatar Chris O'Haver 1-1/+6
For responses synthesized by known wildcard records, publish metadata containing the wildcard record name Signed-off-by: Chris O'Haver <cohaver@infoblox.com>
2022-04-25plugin/file: unified NoData result (#5086)Gravatar xuweiwei 1-1/+1
Signed-off-by: xuweiwei <xuweiwei_yewu@cmss.chinamobile.com>
2022-01-21plugin/file: optimize cname get rr by type (#5080)Gravatar xuweiwei 1-1/+1
Signed-off-by: xuweiwei <xuweiwei_yewu@cmss.chinamobile.com>
2021-09-14plugin/file/auto: Write CNAME answer to client even if target lookup is ↵Gravatar Chris O'Haver 1-1/+1
SERVFAIL (#4863) * write cname answer to client even if target lookup is servfail Signed-off-by: Chris O'Haver <cohaver@infoblox.com> * fix existing unit test expectations Signed-off-by: Chris O'Haver <cohaver@infoblox.com>
2021-09-07plugin/file: fix wildcard CNAME answer (#4828)Gravatar Kohei Yoshida 1-3/+16
* plugin/file: fix wildcard CNAME answer Signed-off-by: Yoshida <ykhr53@yokohei.com> * plugin/file: fix synthesized CNAME answer Signed-off-by: Yoshida <ykhr53@yokohei.com>
2021-05-20Revert "plugin/file: Fix in wrong answers returned when wildcard and ↵Gravatar Miek Gieben 1-21/+5
concrete records exist (#4599)" (#4633) reverting as I don't want to release 1.8.4 with this enabled. This reverts commit fbf3f07f469a99fcbb5985a41c260a3fad26f908.
2021-05-17plugin/file: Fix in wrong answers returned when wildcard and concrete ↵Gravatar Jason Du 1-5/+21
records exist (#4599) * plugin/file: Fix in wrong answers returned when wildcard and concrete records exist Signed-off-by: Jason Du <xdu@infoblox.com> * Remove superfluous change Signed-off-by: Jason Du <xdu@infoblox.com> * Re-implementation and new test case If the domain's terminal is neither the matching wildcard, nor a domian directly under the wildcard, return NXDOMAIN Signed-off-by: Jason Du <xdu@infoblox.com> * Fix empty non-terminal & add test case Signed-off-by: Jason Du <xdu@infoblox.com> * Cleanup Signed-off-by: Jason Du <xdu@infoblox.com> * Fix case on domain name with character before * and add more test cases Signed-off-by: Jason Du <xdu@infoblox.com> * Use different IPs for records in cornerCasesWildcard zone file Signed-off-by: Jason Du <xdu@infoblox.com>
2021-01-28copy rrs (#4416)Gravatar Miek Gieben 1-6/+1
* Revert "make copies of RRs before returning them (#4409)" This reverts commit 8b2ff6c3889e0c23dceef4b10a1b1de58e463cb9. * Document copying responses See #4409 and the comments. This documents that issue, but doesn't change the in-tree plugins just yet. Signed-off-by: Miek Gieben <miek@miek.nl> * Update plugin.md Co-authored-by: Chris O'Haver <cohaver@infoblox.com> Co-authored-by: Chris O'Haver <cohaver@infoblox.com>
2021-01-21make copies of RRs before returning them (#4409)Gravatar Chris O'Haver 1-1/+6
Signed-off-by: Chris O'Haver <cohaver@infoblox.com>
2021-01-15plugin/file: guard against cname loops (#4387)Gravatar Miek Gieben 1-1/+14
Automatically submitted.
2020-12-09plugin/file: Use NXDOMAIN response if CNAME target is NXDOMAIN (#4303)Gravatar Chris O'Haver 1-8/+19
* pass through nxdomain results Signed-off-by: Chris O'Haver <cohaver@infoblox.com> * return srvfail and nodata results Signed-off-by: Chris O'Haver <cohaver@infoblox.com> * add test Signed-off-by: Chris O'Haver <cohaver@infoblox.com> * cover more response cases Signed-off-by: Chris O'Haver <cohaver@infoblox.com>
2020-05-11Fix query for SOA record for delegated zone (#3875)Gravatar Miek Gieben 1-7/+9
Addresses a bug in the file plugin where SOA queries to zone delegations are inappropriately returned the SOA for the delegating zone, and not a downward referral to the delegated zone. Here is an example of what I believe the expected downward referral in response to a SOA query for a delegated zone should be (note that no SOA record is returned): ~~~ ; <<>> DiG 9.11.3-1ubuntu1.5-Ubuntu <<>> @k.root-servers.net. miek.nl. SOA ; (2 servers found) ;; global options: +cmd ;; Got answer: ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 58381 ;; flags: qr rd; QUERY: 1, ANSWER: 0, AUTHORITY: 3, ADDITIONAL: 7 ;; WARNING: recursion requested but not available ;; OPT PSEUDOSECTION: ; EDNS: version: 0, flags:; udp: 4096 ;; QUESTION SECTION: ;miek.nl. IN SOA ;; AUTHORITY SECTION: nl. 172800 IN NS ns1.dns.nl. nl. 172800 IN NS ns2.dns.nl. nl. 172800 IN NS ns3.dns.nl. ;; ADDITIONAL SECTION: ns1.dns.nl. 172800 IN A 194.0.28.53 ns2.dns.nl. 172800 IN A 194.146.106.42 ns3.dns.nl. 172800 IN A 194.0.25.24 ns1.dns.nl. 172800 IN AAAA 2001:678:2c:0:194:0:28:53 ns2.dns.nl. 172800 IN AAAA 2001:67c:1010:10::53 ns3.dns.nl. 172800 IN AAAA 2001:678:20::24 ~~~ See #3852 for the original fix. Modified clouddns/route53 and removed the faulty tests there. Signed-off-by: Miek Gieben <miek@miek.nl>
2019-10-01plugin/file: fix panic in miekg/dns.CompareDomainName() (#3337)Gravatar Uladzimir Trehubenka 1-1/+1
Signed-off-by: utrehubenka <utrehubenka@infoblox.com>
2019-08-21typo fixes (#3169)Gravatar Chris O'Haver 1-2/+2
* spelling fixes * its/it's
2019-07-23plugin/file: simplify locking (#3024)Gravatar Miek Gieben 1-140/+63
* plugin/file: simplify locking Simplify the locking, remove the reloadMu and just piggyback on the other lock for accessing content, which assumes things can be move underneath. Copy the Apex and Zone to new vars to make sure the pointer isn't updated from under us. The releadMu isn't need at all, the time.Ticker firing while we're reading means we will just miss that tick and get it on the next go. Add rrutil subpackage and put some more generic functions in there, that are now used from file and the tree package. This removes some duplication. Rename additionalProcessing that didn't actually do that to externalLookup, because that's what being done at some point. Signed-off-by: Miek Gieben <miek@miek.nl> * Update plugin/file/lookup.go Co-Authored-By: Michael Grosser <development@stp-ip.net>
2019-07-18plugin/file: Rename do to walk and cleanup and document (#2987)Gravatar Miek Gieben 1-21/+21
* plugin/file: Rename do to walk, cleanup and document * This renames Do to Walk to be more inline with Go standards. Also make it return an error instead of a bool. Also give give walk access to rrs. Alternatively e.m could be exported, but just access the map of rrs should work as well. Another alternative would be adding a whole bunch of helper functions, but those need grab and return the data. Just having access to the rrs should be easiest for most Walks. * It adds Type and TypeForWildcard to show the different functions * *Removes* the identical RR check when inserting; this was only done for A, AAAA and MX and not finished; removed under the mantra garbage in garbage out. * Reuses Types to return all the types in an *tree.Elem Signed-off-by: Miek Gieben <miek@miek.nl> * better comments Signed-off-by: Miek Gieben <miek@miek.nl>
2019-06-30plugin/file: load secondary zones lazily on startup (#2944)Gravatar Miek Gieben 1-0/+2
This fixes a long standing bug: fixes: #1609 Load secondary zones in a go-routine; this required another mutex to protect some fields; I think those were needded anyway because a transfer can also happen when we're running; we just didn't have a test for that situation. The test had to be changed to wait for the transfer to happen at this is async now. Signed-off-by: Miek Gieben <miek@miek.nl>
2019-03-26Remove context.Context from request.Request (#2726)Gravatar Miek Gieben 1-9/+11
* Remove context.Context from request.Request This removes the context from request.Request and makes all the changes in the code to make it compile again. It's all mechanical. It did unearth some weirdness in that the context was kept in handler structs which may cause havoc with concurrently handling of requests. Fixes #2721 Signed-off-by: Miek Gieben <miek@miek.nl> * Make test compile Signed-off-by: Miek Gieben <miek@miek.nl>
2019-01-13Default to upstream to self (#2436)Gravatar Miek Gieben 1-1/+0
* Default to upstream to self This is a backwards incompatible change. This is a massive (cleanup) PR where we default to resolving external names by the coredns process itself, instead of directly forwarding them to some upstream. This ignores any arguments `upstream` may have had and makes it depend on proxy/forward configuration in the Corefile. This allows resolved upstream names to be cached and we have better healthchecking of the upstreams. It also means there is only one way to resolve names, by either using the proxy or forward plugin. The proxy/forward lookup.go functions have been removed. This also lessen the dependency on proxy, meaning deprecating proxy will become easier. Some tests have been removed as well, or moved to the top-level test directory as they now require a full coredns process instead of just the plugin. For the etcd plugin, the entire StubZone resolving is *dropped*! This was a hacky (but working) solution to say the least. If someone cares deeply it can be brought back (maybe)? The pkg/upstream is now very small and almost does nothing. Also the New() function was changed to return a pointer to upstream.Upstream. It also returns only one parameter, so any stragglers using it will encounter a compile error. All documentation has been adapted. This affected the following plugins: * etcd * file * auto * secondary * federation * template * route53 A followup PR will make any upstream directives with arguments an error, right now they are ignored. Signed-off-by: Miek Gieben <miek@miek.nl> * Fix etcd build - probably still fails unit test Signed-off-by: Miek Gieben <miek@miek.nl> * Slightly smarter lookup check in upstream Signed-off-by: Miek Gieben <miek@miek.nl> * Compilez Signed-off-by: Miek Gieben <miek@miek.nl>
2018-09-29Configurable zone reload interval in file plugin (#2110)Gravatar marqc 1-2/+2
* Configurable zone reload interval in file plugin * passing reload config from auto plugin to file plugin. removed noReload property from Zone struct. fixed tests based on short file reload hack
2018-06-12plugin/file: fix local CNAME lookup (#1866)Gravatar Miek Gieben 1-14/+11
* plugin/file: fix local CNAME lookup Issue #1864 explains it will, when we serve the child zone as well we should just recursive into ourself (upstream self). Thus relax the IsSubDomain check in file/lookup.go and just query (even if the query will hit a remote server). I've looped over all other plugins that do something similar (CNAME resolving) and they didn't do the IsSubDomain check; therefor I've removed it from *file* as well. Added test in file_upstream_test that shows this failed before but now results in a reply. Fixes #1864 * self does not need to be exported * Fix test We don't know if we had a valid reply. Check this.
2018-02-16plugin/auto/file/secondary: Use new upstream resolver (#1534)Gravatar Chris O'Haver 1-1/+1
* move file, auto, secondary to new upstream * include context in request
2017-12-11plugin/file: fix crash (#1301)Gravatar Miek Gieben 1-1/+4
When z.Tree.Prev returns zero we should break out of this loop, not use elem as if nothing has happened. Can be triggered by sending edns0 to unsigned zone.
2017-12-11plugin/file: Fix response for qtype=DS (#1300)Gravatar Miek Gieben 1-0/+9
DS is peculiar and needs some special cases to do the right things. For a direct query return the DS, but if we're hitting below the delegation return the NS+DS in a delegation response.
2017-12-11file/plugin: if there is a delegation use that (#1299)Gravatar Miek Gieben 1-5/+0
Don't put NS records in the answer section; if we see it is delegated we should put the records in the AUTHORITY section. This removes a special case, which is good.
2017-09-14Remove the word middleware (#1067)Gravatar Miek Gieben 1-0/+467
* Rename middleware to plugin first pass; mostly used 'sed', few spots where I manually changed text. This still builds a coredns binary. * fmt error * Rename AddMiddleware to AddPlugin * Readd AddMiddleware to remain backwards compat