Commit graph

23 commits

Author SHA1 Message Date
Yong Tang
aa7818e1d3
Update to avoid pseudo-random number (#5225)
* Update to avoid pseudo-random number

This PR update the usage of rand so that non-global seed is used.

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>

* Add concurrency-safe random source

See https://stackoverflow.com/questions/48958886/how-to-create-a-thread-safe-rand-source

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
2022-03-16 12:24:58 -04:00
Chris O'Haver
d8a0d97df2
deprecate Normalize and MustNormalize (#4648)
* 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-27 13:26:14 +02:00
Miek Gieben
5f41d8eb1f
reverse zone: fix Normalize (#4621)
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-05-17 13:19:54 -07:00
Miek Gieben
b003d06003
For caddy v1 in our org (#4018)
* For caddy v1 in our org

This RP changes all imports for caddyserver/caddy to coredns/caddy. This
is the v1 code of caddy.

For the coredns/caddy repo the following changes have been made:

* anything not needed by us is deleted
* all `telemetry` stuff is deleted
* all its import paths are also changed to point to coredns/caddy
* the v1 branch has been moved to the master branch
* a v1.1.0 tag has been added to signal the latest release

Signed-off-by: Miek Gieben <miek@miek.nl>

* Fix imports

Signed-off-by: Miek Gieben <miek@miek.nl>

* Group coredns/caddy with out plugins

Signed-off-by: Miek Gieben <miek@miek.nl>

* remove this file

Signed-off-by: Miek Gieben <miek@miek.nl>

* Relax import ordering

github.com/coredns is now also a coredns dep, this makes
github.com/coredns/caddy fit more natural in the list.

Signed-off-by: Miek Gieben <miek@miek.nl>

* Fix final import

Signed-off-by: Miek Gieben <miek@miek.nl>
2020-09-24 18:14:41 +02:00
Miek Gieben
24176a97e6
Move to CODEOWNERS (#3489)
* Move to CODEOWNERS

No change in who own what; just a move to CODEOWNERS. This allows
dreck cleanups.

Added .dreck.yaml for alias and exec.

Fixes: #3486

Signed-off-by: Miek Gieben <miek@miek.nl>

* stickler bot

Signed-off-by: Miek Gieben <miek@miek.nl>

* sort the file

Signed-off-by: Miek Gieben <miek@miek.nl>
2019-11-29 13:17:05 +00:00
Miek Gieben
004c5fca9d
all: simply registering plugins (#3287)
Abstract the caddy call and make it simpler.

See #3261 for some part of the discussion.

Go from:

~~~ go
func init() {
       caddy.RegisterPlugin("any", caddy.Plugin{
               ServerType: "dns",
               Action:     setup,
       })
}
~~~

To:

~~~ go
func init() { plugin.Register("any", setup) }
~~~

This requires some external documents in coredns.io to be updated as
well; the old way still works, so it's backwards compatible.

Signed-off-by: Miek Gieben <miek@miek.nl>
2019-09-20 08:02:30 +01:00
Cricket Liu
db489056b8 Making README consistent with other plugins' READMEs (#3245) 2019-09-08 08:23:38 +01:00
Yong Tang
f8bba51f84
Update Caddy to 1.0.1, and update import path (#2961)
* Update Caddy to 1.0.1, and update import path

This fix updates caddy to 1.0.1 and also
updates the import path to github.com/caddyserver/caddy

This fix fixes 2959

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>

* Also update plugin.cfg

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>

* Update and bump zplugin.go

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
2019-07-03 09:04:47 +08:00
Miek Gieben
22c6e3e179
plugins: set upstream unconditionally (#2956)
`upstream` is not needed as a setting; just set if unconditionally and
remove all documentation and tests for it.

At some point we want remove the hanlding for `upstream` as well and
error out on seeing it.

Signed-off-by: Miek Gieben <miek@miek.nl>
2019-07-02 16:23:47 +01:00
Chris O'Haver
ab1c0bb425
plugin/loop: Update troubleshooting step (#2804)
* Update README.md
2019-04-30 08:42:14 -04:00
Yong Tang
9dd288943a Move *proxy* to external (#2651)
* Move *proxy* to external

move the proxy plugin into coredns/proxy and remove it as a default
plugin. Link the proxy to deprecated in plugin.cfg

coredns/proxy doesn't compile because of the vendoring :(

Signed-off-by: Miek Gieben <miek@miek.nl>

* Add github.com/coredns/proxy

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
2019-03-04 07:32:38 +00:00
Miek Gieben
775cf92f03 plugin/loop: show from -> to (#2400)
Show from and to address when detecting a loop they may aid in
debugging.

Hard to create a unit test, but this is a startup run with self induced
loop:

~~~ corefile
.:1053 {
    loop
    log
    forward . 127.0.0.1:1053
}
~~~~

~~~
:1053
2018-12-16T10:11:03.695Z [INFO] CoreDNS-1.3.0
2018-12-16T10:11:03.695Z [INFO] linux/amd64, go1.11,
CoreDNS-1.3.0
linux/amd64, go1.11,
2018-12-16T10:11:03.696Z [FATAL] plugin/loop: Loop (127.0.0.1:51384 -> :1053) detected for zone ".", see https://coredns.io/plugins/loop#troubleshooting. Query: "HINFO 2781022615773629442.4133547885299871809."
~~~

Update the docs and polished that a bit as well.

Signed-off-by: Miek Gieben <miek@miek.nl>
2018-12-16 13:48:09 -08:00
StormXX
16197a1add fix a document error (#2376) 2018-12-07 09:45:13 +00:00
Chris O'Haver
9a393ac5c8 clean pre-submit checks (#2367)
Automatically submitted.
2018-12-05 21:20:20 +00:00
Chris O'Haver
b53cc51f53 plugin/loop: Improve loop troubleshoot docs (#2363)
* improve loop troubleshoot docs

* fix spelling
2018-12-04 11:58:20 +00:00
Matthias Lechner
e332c8d8cb Fix error handling when query fails (#2255) 2018-10-31 10:20:43 -07:00
Chris O'Haver
85e5ab77d6 add ipv6 loopback example (#2223) 2018-10-22 18:30:42 +01:00
Chris O'Haver
db92d5ecc3 Update README.md (#2213) 2018-10-18 15:19:22 +01:00
Chris O'Haver
6d2bc0a8f2 plugin/loop: tweak loop detected msg, add troubleshooting section (#2185)
Automatically submitted.
2018-10-12 17:24:40 +00:00
Miek Gieben
9546b606cb
K8s remove string ops (#2119)
* plugin/kubernetes: remove bunch a string ops

This removes a bunch of appends to where not needed, makes dnsutil.Join
take variadic args which removes the need to wrap in a new string slice.

Signed-off-by: Miek Gieben <miek@miek.nl>

* Fix calls to dnsutil.Join

Signed-off-by: Miek Gieben <miek@miek.nl>

* Revert these

Signed-off-by: Miek Gieben <miek@miek.nl>
2018-09-22 15:12:02 +01:00
Chris O'Haver
992e7928c7 Document current limitations of loop (#1996)
* Document current limitations of loop

* Update README.md
2018-07-23 20:37:41 +01:00
Miek Gieben
b7ae8d4e86
plugin/loop: add missing break (#1992)
The Onstartup loop wouldn't call break after the first success, thereby
sending the query multiple times and halting the process.

Some small other optimizations as well.

Signed-off-by: Miek Gieben <miek@miek.nl>
2018-07-22 11:54:02 +01:00
Miek Gieben
84ec780ffc
New plugin: loop (#1989)
* New plugin: loop

Add a plugin that detects loops. It does this by sending an unique query
to our selves. If we see the query more than twice we stop the process.
If there isn't a loop, the plugin disables it self and becomes a noop
plugin.

Signed-off-by: Miek Gieben <miek@miek.nl>
2018-07-20 19:45:17 +01:00