aboutsummaryrefslogtreecommitdiff
path: root/plugin/normalize.go (follow)
AgeCommit message (Collapse)AuthorFilesLines
2021-06-04Fix IPv6 case for CIDR format reverse zones (#4652)Gravatar Chris O'Haver 1-1/+5
* fix ipv6 case for cidr.Class Signed-off-by: Chris O'Haver <cohaver@infoblox.com> * add check and test case for invalid ipv6 cidr Signed-off-by: Chris O'Haver <cohaver@infoblox.com> * net package is bad at detecting ipv6/ipv4 Signed-off-by: Chris O'Haver <cohaver@infoblox.com> * rename Class -> Split Signed-off-by: Chris O'Haver <cohaver@infoblox.com>
2021-05-27deprecate Normalize and MustNormalize (#4648)Gravatar Chris O'Haver 1-3/+53
* deprecate normalize and mustnormalize Signed-off-by: Chris O'Haver <cohaver@infoblox.com> * add runtime warning Signed-off-by: Chris O'Haver <cohaver@infoblox.com> * elaborate runtime warning Signed-off-by: Chris O'Haver <cohaver@infoblox.com> * include caller info Signed-off-by: Chris O'Haver <cohaver@infoblox.com>
2021-05-19Fix obsure crash in Corefile parsing (#4637)Gravatar Miek Gieben 1-1/+5
This was found by fuzzing. We need to make this a fully qualified domain name to catch all errors in dnsserver/register.go and not later when plugin.Normalize() is called again on these strings, with the prime difference being that the domain name is fully qualified. This was found by fuzzing where "ȶ" is deemed OK, but "ȶ." is not (might be a bug in miekg/dns actually). But here we were checking ȶ, which is OK, and later we barf in ȶ. leading to "index out of range". Added a tests and check manually if it would crash with the current code (yes), and fail with an error in this PR (yes). Signed-off-by: Miek Gieben <miek@miek.nl>
2021-05-17reverse zone: fix Normalize (#4621)Gravatar Miek Gieben 1-50/+46
Make normalize return multiple "hosts" (= reverse zones) when a non-octet boundary cidr is given. Added pkg/cidr package that holds the cidr calculation routines; felt they didn't really fit dnsutil. This change means the IPNet return parameter isn't needed, the hosts are all correct. The tests that tests this is also removed: TestSplitHostPortReverse The fallout was that zoneAddr _also_ doesn't need the IPNet member, that in turn make it visible that zoneAddr in address.go duplicated a bunch of stuff from register.go; removed/refactored that too. Created a plugin.OriginsFromArgsOrServerBlock to help plugins do the right things, by consuming ZONE arguments; this now expands reverse zones correctly. This is mostly mechanical. Remove the reverse test in plugin/kubernetes which is a copy-paste from a core test (which has since been fixed). Remove MustNormalize as it has no plugin users. This change is not backwards compatible to plugins that have a ZONE argument that they parse in the setup util. All in-tree plugins have been updated. Signed-off-by: Miek Gieben <miek@miek.nl>
2021-01-24Fix import ordering presubmit test (#4422)Gravatar Miek Gieben 1-0/+1
Automatically submitted.
2019-10-19add MustNormalize (#3385)Gravatar Chris O'Haver 1-2/+15
Signed-off-by: Chris O'Haver <cohaver@infoblox.com>
2019-08-21typo fixes (#3169)Gravatar Chris O'Haver 1-3/+3
* spelling fixes * its/it's
2019-01-08plugin/kubernetes: fix case preservation and add test (#2430)Gravatar Chris O'Haver 1-2/+2
* fix case preservation and add test * only fix case in k8s
2018-09-19Better naming (#2104)Gravatar Miek Gieben 1-3/+2
* Move functions from pkg/transport to pkg/parse Although "parse" is a fairly generic name I believe this is somewhat better named. pkg/transport keeps a few constants that are uses throughout for the rest is is renaming a bunch (and the fallout from there to make things compile again). Signed-off-by: Miek Gieben <miek@miek.nl> * Fix tests Signed-off-by: Miek Gieben <miek@miek.nl>
2018-09-19Cleanup ParseHostOrFile (#2100)Gravatar Miek Gieben 1-22/+4
Create plugin/pkg/transport that holds the transport related functions. This needed to be a new pkg to prevent cyclic import errors. This cleans up a bunch of duplicated code in core/dnsserver that also tried to parse a transport (now all done in transport.Parse). Signed-off-by: Miek Gieben <miek@miek.nl>
2018-07-28Fix ineffassign (#1959)Gravatar Yong Tang 1-1/+2
* Fix ineffassign This fix tries to fix ineffassign, as was reported in: https://goreportcard.com/report/github.com/coredns/coredns#ineffassign Signed-off-by: Yong Tang <yong.tang.github@outlook.com> * Update setup.go Revert this one change, so this can be merged.
2018-05-21make CoreDNS DoH Server (#1619)Gravatar Miek Gieben 1-3/+6
* WIP: make CoreDNS DoH Server * It works * Fix tests * Review from Tom - on diff. PR * correct mime type * Cleanups and use the pkg/nonwriter * rename and updates * implement get * implement GET * Code review comments * correct context * tweaks * code review
2018-01-23fix computation of reverse zone based on Ipv6 CIDRs (#1415)Gravatar Francois Tur 1-2/+7
2017-10-24CIDR query routing (#1159)Gravatar Miek Gieben 1-19/+21
* core: allow all CIDR ranges in zone specifications Allow (e.g.) a v4 reverse on a /17. If a zone is specified in such a way a FilterFunc is set in the config. This filter is checked against incoming queries. For all other queries this adds a 'x != nil' check which will not impact performace too much. Benchmark function is added as well to check for this as wel. Add multiple tests in tests/server_reverse_test.go. Benchmark shows in the non-reverse case this hardly impact the speed: ~~~ classless: pkg: github.com/coredns/coredns/core/dnsserver BenchmarkCoreServeDNS-4 1000000 1431 ns/op 16 B/op 1 allocs/op pkg: github.com/coredns/coredns/core/dnsserver BenchmarkCoreServeDNS-4 1000000 1429 ns/op 16 B/op 1 allocs/op master: pkg: github.com/coredns/coredns/core/dnsserver BenchmarkCoreServeDNS-4 1000000 1412 ns/op 16 B/op 1 allocs/op pkg: github.com/coredns/coredns/core/dnsserver BenchmarkCoreServeDNS-4 1000000 1429 ns/op 16 B/op 1 allocs/op ~~~ * README.md updates
2017-09-14Remove the word middleware (#1067)Gravatar Miek Gieben 1-0/+137
* 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