dougbw / coredns_omada

CoreDNS plugin for TP-Link Omada SDN
Apache License 2.0
84 stars 9 forks source link

Reverse lookup for devices; position of coredns-omada in the plugin chain #30

Closed eckhbeck closed 7 months ago

eckhbeck commented 7 months ago

Hi,

I was wondering if there is a reason why devices are not added to reverse zone. So I gave it a try and added it in update.go to see if it would work and it actually did ;-) If you think this makes sense I could fork the repo and file a PR if you prefer it, but as it's a simple copy/paste of code and some small adjustments, I wouldn't mind if you just add it yourself.

The other thing is that I would like to start a discussion as I want to see coredns-omada at an "earlier place" in the "plugin chain". Btw, I saw the other issue regarding not putting it right at the beginning and the suggestion to have it before forward, so I know why it is currently right before forward. I would like to see it before file/auto or even hosts as I would like to have coredns-omada handle most of the request and fall back to file/auto or even hosts for requests which are not "in omada clients/devices". The way it works in file/auto is, that the plugins are authoritive for whatever (sub-)domain the zone is configured for and wouldn't pass along the "plugin chain" if they can't handle the query. So they will not pass any query to coredns-omada. That would completely 'disable' coredns-omada for the sub-domain(s) in question. So I would like coredns-omada to handle most queries it can from 'clients/devices' and pass 'the rest' to file/auto which handle some fixed entries I added to zone files (or maybe to hosts bit preferably to file/auto). And for that coredns-omada would need to be before the other plugins in the chain.

Hope this makes sense.

Regards

dougbw commented 7 months ago

Hi, feel free to raise a PR for the reverse zone for devices. I was planning to refactor that update function at some point as it has grown as features have been added but happy to get it added in for now.

Regarding the plugin order I would need to investigate the best place for it although its hard to predict which plugins users are using. Based on your use case it would seem that putting it directly above the file plugin and using the fallback option in the hosts plugin should work.

(The host plugin supports fallthrough which should allow queries to fall back to omada - see the hosts plugin syntax.)

eckhbeck commented 7 months ago

Thanks for the reply. I quickly forked the repo and created a PR for you to review.

Regarding the hosts plugin. I know about the fallthrough feature of the hosts plugin. To 'rely' on that would be ok too ;-) I would prefer file/auto anyway, to be honest.