public inbox for ipfire-scm@lists.ipfire.org
 help / color / mirror / Atom feed
* [git.ipfire.org] IPFire 2.x development tree branch, next, updated. e22bcd38d6857cd1ee7292cbf634db80d0dd813c
@ 2016-10-06 10:43 git
  0 siblings, 0 replies; only message in thread
From: git @ 2016-10-06 10:43 UTC (permalink / raw)
  To: ipfire-scm

[-- Attachment #1: Type: text/plain, Size: 3337 bytes --]

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "IPFire 2.x development tree".

The branch, next has been updated
       via  e22bcd38d6857cd1ee7292cbf634db80d0dd813c (commit)
       via  71cf56fe53a1f561a8d11f2f354a0cc91bfe37ba (commit)
      from  eef9b2529c3cab522dac4f4bcfa1a0075376514e (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit e22bcd38d6857cd1ee7292cbf634db80d0dd813c
Author: Michael Tremer <michael.tremer(a)ipfire.org>
Date:   Thu Oct 6 10:42:49 2016 +0100

    unbound: Correctly format PTR records
    
    Signed-off-by: Michael Tremer <michael.tremer(a)ipfire.org>

commit 71cf56fe53a1f561a8d11f2f354a0cc91bfe37ba
Author: Michael Tremer <michael.tremer(a)ipfire.org>
Date:   Thu Oct 6 10:41:54 2016 +0100

    core106: Restart DHCP server to import leases into DNS
    
    Signed-off-by: Michael Tremer <michael.tremer(a)ipfire.org>

-----------------------------------------------------------------------

Summary of changes:
 config/rootfiles/core/106/update.sh       |  3 +++
 config/unbound/unbound-dhcp-leases-bridge | 19 +++++++++++++++++--
 2 files changed, 20 insertions(+), 2 deletions(-)

Difference in files:
diff --git a/config/rootfiles/core/106/update.sh b/config/rootfiles/core/106/update.sh
index e025cfd..09d183e 100644
--- a/config/rootfiles/core/106/update.sh
+++ b/config/rootfiles/core/106/update.sh
@@ -81,6 +81,9 @@ if grep -q "ENABLED=on" /var/ipfire/vpn/settings; then
 	/etc/init.d/ipsec start
 fi
 
+# Restart DHCP server to import leases into unbound
+/etc/init.d/dhcp restart
+
 # This update need a reboot...
 touch /var/run/need_reboot
 
diff --git a/config/unbound/unbound-dhcp-leases-bridge b/config/unbound/unbound-dhcp-leases-bridge
index 0ef14e1..c62d233 100644
--- a/config/unbound/unbound-dhcp-leases-bridge
+++ b/config/unbound/unbound-dhcp-leases-bridge
@@ -49,6 +49,20 @@ def setup_logging(loglevel=logging.INFO):
 
 log = logging.getLogger("dhcp")
 
+def ip_address_to_reverse_pointer(address):
+	parts = address.split(".")
+	parts.reverse()
+
+	return "%s.in-addr.arpa" % ".".join(parts)
+
+def reverse_pointer_to_ip_address(rr):
+	parts = rr.split(".")
+
+	# Only take IP address part
+	parts = reversed(parts[0:4])
+
+	return ".".join(parts)
+
 class UnboundDHCPLeasesBridge(object):
 	def __init__(self, dhcp_leases_file, unbound_leases_file):
 		self.leases_file = dhcp_leases_file
@@ -301,7 +315,8 @@ class Lease(object):
 			(self.fqdn, "%s" % LOCAL_TTL, "IN A", self.ipaddr),
 
 			# Reverse record
-			(self.ipaddr, "%s" % LOCAL_TTL, "IN PTR", self.fqdn),
+			(ip_address_to_reverse_pointer(self.ipaddr), "%s" % LOCAL_TTL,
+				"IN PTR", self.fqdn),
 		]
 
 
@@ -333,7 +348,7 @@ class UnboundConfigWriter(object):
 			if record_type == "A":
 				ret[hostname] = content
 			elif record_type == "PTR":
-				ret[content] = hostname
+				ret[content] = reverse_pointer_to_ip_address(hostname)
 
 		return ret
 


hooks/post-receive
--
IPFire 2.x development tree

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2016-10-06 10:43 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-10-06 10:43 [git.ipfire.org] IPFire 2.x development tree branch, next, updated. e22bcd38d6857cd1ee7292cbf634db80d0dd813c git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox