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

Suggestion for improvement: Keep all manual added entries intact #1

Closed
WolfspiritM opened this issue Sep 18, 2015 · 1 comment
Closed

Comments

@WolfspiritM
Copy link
Contributor

Hello,

Thank you for working on this script. I started using it myself and ran into the problem that I want to keep adding A Records myself. The script only prints them when they are in the range of static leases but that ended with multiple lines of the same host whenever the host releases and renews it's IP.

I fixed that with a way that is (in my opinion) way better then keeping out every A Record or PTR record.
I changed the printDhcpAsRecords Function to add a ";dynamic" comment at the end of every line that is dynamicly added:

           if (RecordType == "PTR") {print 1000 + arr[4] "\t" ReverseIP ".in-addr.arpa. " RENEW " PTR " NAME "." YourNetworkName ". ;dynamic"}
           if (RecordType == "A") print 2000 + arr[4] "\t" NAME "." YourNetworkName ". " RENEW " A " IP " ;dynamic"

After that I changed the printPartialDNSFile to include that check like that:

       if( $3 == "A"){
          # Do not print dynamic entries. They will be added afterwards from the lease files.
          if ($5 != ";dynamic") {
            PrintThis=1;
          } else{
            PrintThis=0;
          }
        } else if($3 == "PTR" ){
          if ($5 != ";dynamic") {
            PrintThis=1;
          } else{
            PrintThis=0;
          }
        } else
          PrintThis=1;

The DSM UI will not remove this comment if you add new entries as well as it doesn't seem to care about the comment. The only time it is removed is if you manually edit a dynamic A entry which will make it to a static one.

Thought I will share this change here. Maybe you'd like to include it into the script.

@gclayburg
Copy link
Owner

@WolfspiritM I haven't seen the problem that you describe on my system. Perhaps your environment is different than mine. Could you generate a pull request for this change? Maybe your solution is a more general solution to the problem.

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

No branches or pull requests

2 participants