diff --git a/SOURCES/12-dhcpd b/SOURCES/12-dhcpd
index 12282f1..6a67501 100644
--- a/SOURCES/12-dhcpd
+++ b/SOURCES/12-dhcpd
@@ -6,8 +6,10 @@ STATUS=$2 # The new state of the interface
 # whenever interface is brought up by NM (rhbz #565921)
 if [ "$STATUS" = "up" ]; then
     # restart the services
-    systemctl -q is-enabled dhcpd.service && systemctl restart dhcpd.service
-    systemctl -q is-enabled dhcpd6.service && systemctl restart dhcpd6.service
+    # In case this dispatcher script is called several times in a short period of time, it might happen that
+    # systemd refuses to further restart the units. Therefore we use reset-failed command to prevent it.
+    systemctl -q is-enabled dhcpd.service && systemctl restart dhcpd.service && systemctl reset-failed dhcpd.service
+    systemctl -q is-enabled dhcpd6.service && systemctl restart dhcpd6.service && systemctl reset-failed dhcpd6.service
 fi
 
 exit 0
diff --git a/SOURCES/README.scripts b/SOURCES/README.scripts
new file mode 100644
index 0000000..bb480a4
--- /dev/null
+++ b/SOURCES/README.scripts
@@ -0,0 +1,9 @@
+Please use this directory for on-commit scripts instead of `/etc/dhcp` to
+make them work with the system selinux policy.
+
+NOTE: To make dhcpd daemon able to execute the scripts /etc/dhcp directory
+MUST be accessible by dhcpd group. Due to huge impact on dhclient users
+it was not done during the installation so please adjust access rights accordingly
+
+For example:
+# chgrp dhcpd /etc/dhcp
diff --git a/SOURCES/azure-cloud.sh b/SOURCES/azure-cloud.sh
new file mode 100644
index 0000000..30762ed
--- /dev/null
+++ b/SOURCES/azure-cloud.sh
@@ -0,0 +1,25 @@
+#!/bin/sh
+#
+# This script provides support for dynamic DNS update in Microsoft Azure
+# cloud. To enable this feature, change the configuration variables below
+# and make the script executable.
+
+primary_interface="eth0"
+required_domain="mydomain.local"
+dns_server="my-dns-server.mydomain.local"
+
+# change the configuration variables above
+
+[ "$interface" == "$primary_interface" ] || exit
+
+case "$reason" in
+BOUND|RENEW|REBIND|REBOOT)
+    fqdn="`hostname`.$required_domain"
+    nsupdate <<EOF
+server $dns_server
+update delete $fqdn a
+update add $fqdn 3600 a $new_ip_address
+send
+EOF
+    ;;
+esac
diff --git a/SOURCES/dhclient-script b/SOURCES/dhclient-script
index 7d486cf..9f725a0 100644
--- a/SOURCES/dhclient-script
+++ b/SOURCES/dhclient-script
@@ -197,6 +197,14 @@ exit_with_hooks() {
         . ${ETCDIR}/dhclient-exit-hooks
     fi
 
+    if [ -d ${ETCDIR}/dhclient-exit-hooks.d ]; then
+        for f in ${ETCDIR}/dhclient-exit-hooks.d/*.sh ; do
+            if [ -x ${f} ]; then
+                . ${f}
+            fi
+        done
+    fi
+
     exit ${exit_status}
 }
 
diff --git a/SOURCES/dhcp-4.2.5-centos-branding.patch b/SOURCES/dhcp-4.2.5-centos-branding.patch
deleted file mode 100644
index f3e7113..0000000
--- a/SOURCES/dhcp-4.2.5-centos-branding.patch
+++ /dev/null
@@ -1,14 +0,0 @@
-diff -uNrp dhcp-4.1.1-P1.orig/omapip/errwarn.c dhcp-4.1.1-P1/omapip/errwarn.c
---- dhcp-4.1.1-P1.orig/omapip/errwarn.c 2012-08-15 14:04:33.149141000 +0000
-+++ dhcp-4.1.1-P1/omapip/errwarn.c      2012-08-15 14:13:05.582416057 +0000
-@@ -81,8 +81,8 @@ void log_fatal (const char * fmt, ... )
-   log_error ("have been made to the base software release in order to make");
-   log_error ("it work better with this distribution.");
-   log_error ("%s", "");
--  log_error ("Please report for this software via the Red Hat Bugzilla site:");
--  log_error ("    http://bugzilla.redhat.com");
-+  log_error ("Please report for this software via the CentOS Bugs Database:");
-+  log_error ("    http://bugs.centos.org/");
-   log_error ("%s", "");
-   log_error ("exiting.");
- #endif
diff --git a/SOURCES/dhcp-4.2.5-rh1355827.patch b/SOURCES/dhcp-4.2.5-rh1355827.patch
new file mode 100644
index 0000000..2bf7619
--- /dev/null
+++ b/SOURCES/dhcp-4.2.5-rh1355827.patch
@@ -0,0 +1,44 @@
+--- dhcp-4.2.5.orig/server/mdb.c	2016-05-03 12:46:04.933000000 -0400
++++ dhcp-4.2.5/server/mdb.c	2016-05-18 14:38:27.553000000 -0400
+@@ -720,8 +720,9 @@ void new_address_range (cfile, low, high
+ {
+ #if defined(COMPACT_LEASES)
+ 	struct lease *address_range;
++	unsigned s;
+ #endif
+-	unsigned min, max, i;
++	unsigned min, max, i, num_addrs;
+ 	char lowbuf [16], highbuf [16], netbuf [16];
+ 	struct shared_network *share = subnet -> shared_network;
+ 	struct lease *lt = (struct lease *)0;
+@@ -777,9 +778,29 @@ void new_address_range (cfile, low, high
+ 		min = host_addr (high, subnet -> netmask);
+ 	}
+ 
++	/* get the number of addresses we want, and add it to the pool info
++	* this value is only for use when setting up lease chains and will
++	* be overwritten when expire_all_pools is run
++	*/
++	num_addrs = max - min + 1;
++
+ 	/* Get a lease structure for each address in the range. */
+ #if defined (COMPACT_LEASES)
+-	address_range = new_leases (max - min + 1, MDL);
++	s = (num_addrs + 1) * sizeof (struct lease);
++	 /* Check unsigned overflow in new_leases().
++	    With 304 byte lease structure (x86_64), this happens at
++	    range 10.0.0.0 10.215.148.52; */
++	if (((s % sizeof (struct lease)) != 0) ||
++	    ((s / sizeof (struct lease)) != (num_addrs + 1))) {
++		strcpy (lowbuf, piaddr (low));
++		strcpy (highbuf, piaddr (high));
++		parse_warn (cfile, "%s-%s is an overly large address range.",
++			   lowbuf, highbuf);
++		log_info ("Consider breaking large address ranges into multiple scopes of less than 14 million IPs each.");
++		log_info ("For more information, please visit:  https://support.roguewave.com/resources/blogs/openlogic-blogs/how-to-extend-isc-dhcp/");
++		log_fatal ("Memory overflow.");
++	}
++	address_range = new_leases (num_addrs, MDL);
+ 	if (!address_range) {
+ 		strcpy (lowbuf, piaddr (low));
+ 		strcpy (highbuf, piaddr (high));
diff --git a/SPECS/dhcp.spec b/SPECS/dhcp.spec
index 352e3d5..5b27867 100644
--- a/SPECS/dhcp.spec
+++ b/SPECS/dhcp.spec
@@ -18,7 +18,7 @@
 Summary:  Dynamic host configuration protocol software
 Name:     dhcp
 Version:  4.2.5
-Release:  47%{?dist}
+Release:  58%{?dist}
 # NEVER CHANGE THE EPOCH on this package.  The previous maintainer (prior to
 # dcantrell maintaining the package) made incorrect use of the epoch and
 # that's why it is at 12 now.  It should have never been used, but it was.
@@ -36,6 +36,8 @@ Source5:  56dhclient
 Source6:  dhcpd.service
 Source7:  dhcpd6.service
 Source8:  dhcrelay.service
+Source9: azure-cloud.sh
+Source10: README.scripts
 
 
 Patch0:   dhcp-4.2.0-errwarn-message.patch
@@ -93,7 +95,8 @@ Patch59:  dhcp-dns_client_cancelupdate.patch
 Patch60:  dhcp-prepend.patch
 Patch61:  dhcp-addignore.patch
 Patch62:  dhcp-max-fd-value.patch
-Patch63:  dhcp-4.2.5-centos-branding.patch
+# https://bugzilla.redhat.com/show_bug.cgi?id=1355827
+Patch63:  dhcp-4.2.5-rh1355827.patch
 
 BuildRequires: autoconf
 BuildRequires: automake
@@ -400,6 +403,8 @@ rm -rf includes/isc-dhcp
 
 # unclosed TCP connections to OMAPI or failover ports can cause DoS (CVE-2016-2774)
 %patch62 -p1 -b .max-fd
+
+# https://bugzilla.redhat.com/show_bug.cgi?id=1355827
 %patch63 -p1
 
 # Update paths in all man pages
@@ -462,6 +467,14 @@ CFLAGS="%{optflags} -fno-strict-aliasing" \
 # Empty directory for dhclient.d scripts
 %{__mkdir} -p %{buildroot}%{dhcpconfdir}/dhclient.d
 
+# Install sample configuration file for Microsoft Azure
+%{__mkdir} -p %{buildroot}%{dhcpconfdir}/dhclient-exit-hooks.d/
+%{__install} -p -m 0644 %{SOURCE9} %{buildroot}%{dhcpconfdir}/dhclient-exit-hooks.d/
+
+# Create directory for on-commit scripts
+%{__mkdir} -p %{buildroot}%{dhcpconfdir}/scripts
+%{__install} -p -m 0644 %{SOURCE10} %{buildroot}%{dhcpconfdir}/scripts/
+
 # NetworkManager dispatcher script
 %{__mkdir} -p %{buildroot}%{_sysconfdir}/NetworkManager/dispatcher.d
 %{__install} -p -m 0755 %{SOURCE3} %{buildroot}%{_sysconfdir}/NetworkManager/dispatcher.d
@@ -606,7 +619,6 @@ done
 %files
 %doc server/dhcpd.conf.example server/dhcpd6.conf.example
 %doc contrib/ldap/
-%attr(0750,root,root) %dir %{dhcpconfdir}
 %attr(0755,dhcpd,dhcpd) %dir %{_localstatedir}/lib/dhcpd
 %attr(0644,dhcpd,dhcpd) %verify(mode) %config(noreplace) %{_localstatedir}/lib/dhcpd/dhcpd.leases
 %attr(0644,dhcpd,dhcpd) %verify(mode) %config(noreplace) %{_localstatedir}/lib/dhcpd/dhcpd6.leases
@@ -631,11 +643,16 @@ done
 %if %sdt
 %{tapsetdir}/*.stp
 %endif
+# This is needed for on-commit scripts
+# Directory must be accessible by dhcpd process
+%attr(0750,root,dhcpd) %dir %{dhcpconfdir}/scripts
+%attr(0640,root,dhcpd) %{dhcpconfdir}/scripts/README.scripts
 
 %files -n dhclient
 %doc client/dhclient.conf.example client/dhclient6.conf.example README.dhclient.d
-%attr(0750,root,root) %dir %{dhcpconfdir}
 %dir %{dhcpconfdir}/dhclient.d
+%dir %{dhcpconfdir}/dhclient-exit-hooks.d/
+%{dhcpconfdir}/dhclient-exit-hooks.d/azure-cloud.sh
 %dir %{_localstatedir}/lib/dhclient
 %dir %{_sysconfdir}/NetworkManager
 %dir %{_sysconfdir}/NetworkManager/dispatcher.d
@@ -652,6 +669,8 @@ done
 %doc LICENSE README RELNOTES doc/References.txt
 %attr(0644,root,root) %{_mandir}/man5/dhcp-options.5.gz
 %attr(0644,root,root) %{_mandir}/man5/dhcp-eval.5.gz
+%attr(0750,root,root) %dir %{dhcpconfdir}
+
 
 %files libs
 %{_libdir}/libdhcpctl.so.*
@@ -668,8 +687,36 @@ done
 
 
 %changelog
-* Thu Nov 03 2016 CentOS Sources <bugs@centos.org> - 4.2.5-47.el7.centos
-- Roll in CentOS Branding
+* Tue May 16 2017 Pavel Zhukov <pzhukov@redhat.com> - 12:4.2.5-58
+- Resolves 1374119: Add dns server variable to azure-cloud.sh script
+
+* Thu May  4 2017 Pavel Zhukov <pzhukov@redhat.com> - 12:4.2.5-57
+- Move scripts to dhcp package
+- Do not relax permissions of scripts as we don't need this now
+
+* Thu May  4 2017 Pavel Zhukov <pzhukov@redhat.com> - 12:4.2.5-55
+- Resolves: #1349044 - Add disclamer for chaging /etc/dhcp permission for scripts
+- Fix syntax error in attr
+
+* Tue May 02 2017 Pavel Zhukov <pzhukov@redhat.com> - 12:4.2.5-53
+- Fix ownership of %{dhcpconfdir} to allow daemon access it
+
+* Mon Mar 27 2017 Pavel Šimerda <psimerda@redhat.com> - 12:4.2.5-52
+- Resolves: #1349044 - move /etc/dhcp and /etc/dhcp/scripts to dhcp-common
+  subpackage
+
+* Mon Mar 27 2017 Pavel Šimerda <psimerda@redhat.com> - 12:4.2.5-51
+- Resolves: #1349044 - add /etc/dhcp/scripts directory for on-commit scripts
+
+* Thu Feb 16 2017 Pavel Šimerda <psimerda@redhat.com> - 12:4.2.5-50
+- Resolves: #1321945 - dhclient hook script for Azure cloud
+
+* Thu Feb 16 2017 Pavel Šimerda <psimerda@redhat.com> - 12:4.2.5-49
+- Resolves: #1355827 - dhcpd has a segfault at startup with a big ip range
+
+* Thu Feb 16 2017 Pavel Šimerda <psimerda@redhat.com> - 12:4.2.5-48
+- Resolves: #1302282 - systemd fails to keep dhcpd running after repeated
+  restarts by NetworkManager dispatcher.d script
 
 * Tue Aug 09 2016 Jiri Popelka <jpopelka@redhat.com> - 12:4.2.5-47
 - 1269596 - fix undefined variable in dhclient-script