1 |
diff -Nur e-smith-tinydns-2.4.0/createlinks e-smith-tinydns-2.4.0.bz2388/createlinks |
diff -Nur e-smith-tinydns-2.4.0.old2388/createlinks e-smith-tinydns-2.4.0.bz2388/createlinks |
2 |
--- e-smith-tinydns-2.4.0/createlinks 2006-03-14 23:01:42.000000000 +0100 |
--- e-smith-tinydns-2.4.0.old2388/createlinks 2015-01-27 19:31:32.953849658 +0100 |
3 |
+++ e-smith-tinydns-2.4.0.bz2388/createlinks 2015-01-17 18:02:35.489764844 +0100 |
+++ e-smith-tinydns-2.4.0.bz2388/createlinks 2015-01-27 20:23:29.080882560 +0100 |
4 |
@@ -26,3 +26,19 @@ |
@@ -26,3 +26,19 @@ |
5 |
service_link_enhanced("tinydns", "K65", "6"); |
service_link_enhanced("tinydns", "K65", "6"); |
6 |
service_link_enhanced("tinydns", "K65", "0"); |
service_link_enhanced("tinydns", "K65", "0"); |
21 |
+ service_link_enhanced("dhcp-dns", "K65", "0"); |
+ service_link_enhanced("dhcp-dns", "K65", "0"); |
22 |
+ service_link_enhanced("dhcp-dns", "K65", "1"); |
+ service_link_enhanced("dhcp-dns", "K65", "1"); |
23 |
+ safe_symlink("/var/service/dhcp-dns/", "root/service/dhcp-dns"); |
+ safe_symlink("/var/service/dhcp-dns/", "root/service/dhcp-dns"); |
24 |
diff -Nur e-smith-tinydns-2.4.0/root/etc/e-smith/db/configuration/defaults/dhcp-dns/status e-smith-tinydns-2.4.0.bz2388/root/etc/e-smith/db/configuration/defaults/dhcp-dns/status |
diff -Nur e-smith-tinydns-2.4.0.old2388/root/etc/e-smith/db/configuration/defaults/dhcp-dns/status e-smith-tinydns-2.4.0.bz2388/root/etc/e-smith/db/configuration/defaults/dhcp-dns/status |
25 |
--- e-smith-tinydns-2.4.0/root/etc/e-smith/db/configuration/defaults/dhcp-dns/status 1970-01-01 01:00:00.000000000 +0100 |
--- e-smith-tinydns-2.4.0.old2388/root/etc/e-smith/db/configuration/defaults/dhcp-dns/status 1970-01-01 01:00:00.000000000 +0100 |
26 |
+++ e-smith-tinydns-2.4.0.bz2388/root/etc/e-smith/db/configuration/defaults/dhcp-dns/status 2015-01-16 20:02:12.050969025 +0100 |
+++ e-smith-tinydns-2.4.0.bz2388/root/etc/e-smith/db/configuration/defaults/dhcp-dns/status 2015-01-27 20:30:30.481143377 +0100 |
27 |
@@ -0,0 +1 @@ |
@@ -0,0 +1 @@ |
28 |
+enabled |
+disabled |
29 |
diff -Nur e-smith-tinydns-2.4.0/root/etc/e-smith/db/configuration/defaults/dhcp-dns/type e-smith-tinydns-2.4.0.bz2388/root/etc/e-smith/db/configuration/defaults/dhcp-dns/type |
diff -Nur e-smith-tinydns-2.4.0.old2388/root/etc/e-smith/db/configuration/defaults/dhcp-dns/type e-smith-tinydns-2.4.0.bz2388/root/etc/e-smith/db/configuration/defaults/dhcp-dns/type |
30 |
--- e-smith-tinydns-2.4.0/root/etc/e-smith/db/configuration/defaults/dhcp-dns/type 1970-01-01 01:00:00.000000000 +0100 |
--- e-smith-tinydns-2.4.0.old2388/root/etc/e-smith/db/configuration/defaults/dhcp-dns/type 1970-01-01 01:00:00.000000000 +0100 |
31 |
+++ e-smith-tinydns-2.4.0.bz2388/root/etc/e-smith/db/configuration/defaults/dhcp-dns/type 2015-01-16 20:02:12.050969025 +0100 |
+++ e-smith-tinydns-2.4.0.bz2388/root/etc/e-smith/db/configuration/defaults/dhcp-dns/type 2015-01-27 20:23:29.075882144 +0100 |
32 |
@@ -0,0 +1 @@ |
@@ -0,0 +1 @@ |
33 |
+service |
+service |
34 |
diff -Nur e-smith-tinydns-2.4.0/root/etc/e-smith/templates/var/service/tinydns/root/data/65dhcpARecords e-smith-tinydns-2.4.0.bz2388/root/etc/e-smith/templates/var/service/tinydns/root/data/65dhcpARecords |
diff -Nur e-smith-tinydns-2.4.0.old2388/root/etc/e-smith/templates/var/service/tinydns/root/data/65dhcpARecords e-smith-tinydns-2.4.0.bz2388/root/etc/e-smith/templates/var/service/tinydns/root/data/65dhcpARecords |
35 |
--- e-smith-tinydns-2.4.0/root/etc/e-smith/templates/var/service/tinydns/root/data/65dhcpARecords 1970-01-01 01:00:00.000000000 +0100 |
--- e-smith-tinydns-2.4.0.old2388/root/etc/e-smith/templates/var/service/tinydns/root/data/65dhcpARecords 1970-01-01 01:00:00.000000000 +0100 |
36 |
+++ e-smith-tinydns-2.4.0.bz2388/root/etc/e-smith/templates/var/service/tinydns/root/data/65dhcpARecords 2015-01-17 19:45:33.892642388 +0100 |
+++ e-smith-tinydns-2.4.0.bz2388/root/etc/e-smith/templates/var/service/tinydns/root/data/65dhcpARecords 2015-01-28 00:28:30.792458726 +0100 |
37 |
@@ -0,0 +1,107 @@ |
@@ -0,0 +1,128 @@ |
38 |
+{ |
+{ |
39 |
+ use strict; |
+ use strict; |
40 |
+ use warnings; |
+ use warnings; |
41 |
+ use esmith::Logger; |
+ use esmith::Logger; |
42 |
+ use esmith::ConfigDB; |
+ use esmith::ConfigDB; |
43 |
|
+ use esmith::HostsDB; |
44 |
+ # we need perl-Time-TAI64 for timestamp conversion |
+ # we need perl-Time-TAI64 for timestamp conversion |
45 |
+ use Time::TAI64 qw /unixtai64/; |
+ use Time::TAI64 qw /unixtai64/; |
46 |
+ # we need perl-Date-Manip to convert to a unix timestamp |
+ # we need perl-Date-Manip to convert to a unix timestamp |
47 |
+ use Date::Manip qw /UnixDate/; |
+ use Date::Manip qw /UnixDate/; |
48 |
+ use File::Copy; |
+ use File::Copy; |
49 |
+ |
+ |
50 |
+ my $DB = esmith::ConfigDB->open_ro or die ("cannot open configuration database"); |
+ my $DB = esmith::ConfigDB->open_ro or die ("Unable to open configuration database"); |
51 |
|
+ my $hosts = esmith::HostsDB->open_ro or die ("Unable to open Host database"); |
52 |
+ |
+ |
53 |
+ #we start a hash for name because we don't want several same names & ip |
+ #test if the service is enabled return if not |
54 |
|
+ my $dhcpdns = $DB->get_prop('dhcp-dns','status') || 'disabled'; |
55 |
|
+ return '' if $dhcpdns ne 'enabled'; |
56 |
|
+ |
57 |
|
+ #we start a hash for name & ip |
58 |
+ my %allocated_name = (); |
+ my %allocated_name = (); |
59 |
+ my %allocated_ip_dhcplease = (); |
+ my %allocated_ip_dhcplease = (); |
60 |
+ |
+ |
61 |
|
+ #start a hash of all hosts |
62 |
|
+ my @hosts = $hosts->keys; |
63 |
|
+ my %hostsdb; |
64 |
|
+ @hostsdb{@hosts} = (); |
65 |
|
+ |
66 |
+ # copy of dhcpd.leases file to /tmp because working directly on the original |
+ # copy of dhcpd.leases file to /tmp because working directly on the original |
67 |
+ # is not a good idea |
+ # is not a good idea |
68 |
+ copy("/var/lib/dhcpd/dhcpd.leases","/tmp/tmpdhcpd.leases") |
+ copy("/var/lib/dhcpd/dhcpd.leases","/tmp/tmpdhcpd.leases") |
69 |
+ or die ("Error dhcp-dns Service : Unable to copy the /var/lib/dhcpd/dhcpd.leases"); |
+ or die ("Error dhcp-dns Service : Unable to copy the /var/lib/dhcpd/dhcpd.leases"); |
70 |
+ |
+ |
71 |
+ #we create a fonction because we want to write in log |
+ #we want to write in log |
72 |
+ sub log2messages |
+ sub log2messages |
73 |
+ { |
+ { |
74 |
+ my $message = shift; |
+ my $message = shift; |
136 |
+ # Determine TTL |
+ # Determine TTL |
137 |
+ my $ttl = ''; |
+ my $ttl = ''; |
138 |
+ $ttl = 0 unless ($ts <= time); |
+ $ttl = 0 unless ($ts <= time); |
139 |
+ $OUT .= "=$name.$localdomain:$ip:$ttl:$endtai\n" unless ($name eq $servername); |
+ |
140 |
+ log2messages("The hostname of this server ($servername) is already in use with a different IP address in /var/lib/dhcpd/dhcpd.leases") |
+ # verify if dhcp client name is not used in host DB |
141 |
+ if ($name eq $servername); |
+ if (! exists $hostsdb{"$name\.$localdomain"}) |
142 |
|
+ { |
143 |
|
+ $OUT .= "=$name.$localdomain:$ip:$ttl:$endtai\n" unless (($name eq $servername) || ($name !~ /^[a-zA-Z0-9][a-zA-Z0-9-]*$/)); |
144 |
|
+ log2messages("The hostname of this server ($servername) is already in use with a different IP address in /var/lib/dhcpd/dhcpd.leases") |
145 |
|
+ if ($name eq $servername); |
146 |
|
+ log2messages("The hostname of the dhcp client ($name) has illegal characters in /var/lib/dhcpd/dhcpd.leases") |
147 |
|
+ if ($name !~ /^[a-zA-Z0-9][a-zA-Z0-9-]*$/); |
148 |
|
+ } |
149 |
|
+ else |
150 |
|
+ { |
151 |
|
+ log2messages("The hostname of the dhcp client ($name) is already used in the hosts database"); |
152 |
|
+ } |
153 |
+ } |
+ } |
154 |
+ |
+ |
155 |
+ $allocated_ip_dhcplease{$ip} = 1; |
+ $allocated_ip_dhcplease{$ip} = 1; |
163 |
+ unlink "/tmp/tmpdhcpd.leases" |
+ unlink "/tmp/tmpdhcpd.leases" |
164 |
+ or log2messages("Error dhcp-dns Service : Unable to remove the /tmp/tmpdhcpd.leases"); |
+ or log2messages("Error dhcp-dns Service : Unable to remove the /tmp/tmpdhcpd.leases"); |
165 |
+} |
+} |
166 |
+ |
diff -Nur e-smith-tinydns-2.4.0.old2388/root/var/service/dhcp-dns/dhcp-dns e-smith-tinydns-2.4.0.bz2388/root/var/service/dhcp-dns/dhcp-dns |
167 |
diff -Nur e-smith-tinydns-2.4.0/root/var/service/dhcp-dns/dhcp-dns e-smith-tinydns-2.4.0.bz2388/root/var/service/dhcp-dns/dhcp-dns |
--- e-smith-tinydns-2.4.0.old2388/root/var/service/dhcp-dns/dhcp-dns 1970-01-01 01:00:00.000000000 +0100 |
168 |
--- e-smith-tinydns-2.4.0/root/var/service/dhcp-dns/dhcp-dns 1970-01-01 01:00:00.000000000 +0100 |
+++ e-smith-tinydns-2.4.0.bz2388/root/var/service/dhcp-dns/dhcp-dns 2015-01-28 00:24:48.209462754 +0100 |
169 |
+++ e-smith-tinydns-2.4.0.bz2388/root/var/service/dhcp-dns/dhcp-dns 2015-01-17 18:06:32.318810671 +0100 |
@@ -0,0 +1,49 @@ |
|
@@ -0,0 +1,45 @@ |
|
170 |
+#!/usr/bin/perl |
+#!/usr/bin/perl |
171 |
+use strict; |
+use strict; |
172 |
+use warnings; |
+use warnings; |
173 |
|
+use esmith::ConfigDB; |
174 |
|
+ |
175 |
|
+my $DB = esmith::ConfigDB->open_ro or die ("Unable to open configuration database"); |
176 |
|
+my $dhcpdns = $DB->get_prop('dhcp-dns','status') || 'disabled'; |
177 |
+ |
+ |
178 |
+my $lease_file = "/var/lib/dhcpd/dhcpd.leases"; |
+my $lease_file = "/var/lib/dhcpd/dhcpd.leases"; |
179 |
+ |
+ |
183 |
+# seconds to wait |
+# seconds to wait |
184 |
+my $update_freq = 30; |
+my $update_freq = 30; |
185 |
+ |
+ |
186 |
+#we create a function because we want to write in log |
+#we want to write in log |
187 |
+sub log2messages |
+sub log2messages |
188 |
+ { |
+ { |
189 |
+ my $message = shift; |
+ my $message = shift; |
194 |
+ |
+ |
195 |
+########################################################################### |
+########################################################################### |
196 |
+# Main Loop |
+# Main Loop |
197 |
+while (1) { |
+while ($dhcpdns eq 'enabled') { |
198 |
+ |
+ |
199 |
+ # check the file's last updated time, if it's been changed, update |
+ # check the file's last updated time, if it's been changed, update |
200 |
+ # the DNS and save the modified time. This will ALWAYS run once - on |
+ # the DNS and save the modified time. This will ALWAYS run once - on |
216 |
+ |
+ |
217 |
+} # end main |
+} # end main |
218 |
+########################################################################### |
+########################################################################### |
219 |
diff -Nur e-smith-tinydns-2.4.0/root/var/service/dhcp-dns/run e-smith-tinydns-2.4.0.bz2388/root/var/service/dhcp-dns/run |
diff -Nur e-smith-tinydns-2.4.0.old2388/root/var/service/dhcp-dns/run e-smith-tinydns-2.4.0.bz2388/root/var/service/dhcp-dns/run |
220 |
--- e-smith-tinydns-2.4.0/root/var/service/dhcp-dns/run 1970-01-01 01:00:00.000000000 +0100 |
--- e-smith-tinydns-2.4.0.old2388/root/var/service/dhcp-dns/run 1970-01-01 01:00:00.000000000 +0100 |
221 |
+++ e-smith-tinydns-2.4.0.bz2388/root/var/service/dhcp-dns/run 2015-01-16 20:02:12.055969339 +0100 |
+++ e-smith-tinydns-2.4.0.bz2388/root/var/service/dhcp-dns/run 2015-01-27 20:23:29.079882477 +0100 |
222 |
@@ -0,0 +1,4 @@ |
@@ -0,0 +1,4 @@ |
223 |
+#!/bin/sh |
+#!/bin/sh |
224 |
+ |
+ |