Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do not remove manually added DNS-Records #2

Merged
merged 2 commits into from
Sep 24, 2015

Conversation

WolfspiritM
Copy link
Contributor

This PR adds the ability to keep manually added Records intact.
It does so by adding a ";dynamic" comment at the end of the line in the zonefile.

static.home.lan.     86400   A       192.168.178.12
dhcp.home.lan.       86400   A       192.168.178.101    ;dynamic

The DSM UI ignores this comment completly and won't remove it from the lines until the line is manually edited (for example the IP was changed) which will correctly mark it as a static DNS entry.

On next run the script will read every line except for the ones that include the ";dynamic" comment to create a new zonefile and rebuild the dynamic lines based on the DHCP lease files. It also makes sure that no static/manual DNS-Record entry will be overwritten nor can a DHCP Client add itself to a static/manual added Record by specifying the same DNS name in the DHCP Request.

For the above example if there is a new DHCP client with the name "static" it will not be added to the DNS as the static.home.lan A-Record already exists.

The handling of static IP-Adresses as it was currently implemented has been removed as I don't feel it's needed anymore.

I also made the zonefiles more editor and parser friendly by implementing tabs instead of spaces as the DSM UI does.

As I was working on the awk script I cleaned up a few unused variables, too.

Might need some testing before finally pulling.

@gclayburg
Copy link
Owner

@WolfspiritM This looks like a good fix. I'm going to test it out on my system over the next few days.

@gclayburg gclayburg merged commit 620ef6f into gclayburg:master Sep 24, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants