Blame SOURCES/dhcp-4.2.5-ddns_port_lazy_init.patch

45d60a
--- a/common/dns.c	
45d60a
+++ a/common/dns.c	
45d60a
@@ -1381,6 +1381,24 @@ void ddns_interlude(isc_task_t  *taskp,
45d60a
 }
45d60a
 
45d60a
 /*
45d60a
+ * Moved here from omapip/isclib.c, function dhcp_context_create.
45d60a
+ * Create dnsclient only before the first use.
45d60a
+ */
45d60a
+static isc_result_t
45d60a
+dns_client_lazy() {
45d60a
+	if (dhcp_gbl_ctx.dnsclient == NULL)
45d60a
+		return dns_client_createx(dhcp_gbl_ctx.mctx,
45d60a
+				    dhcp_gbl_ctx.actx,
45d60a
+				    dhcp_gbl_ctx.taskmgr,
45d60a
+				    dhcp_gbl_ctx.socketmgr,
45d60a
+				    dhcp_gbl_ctx.timermgr,
45d60a
+				    0,
45d60a
+				    &dhcp_gbl_ctx.dnsclient);
45d60a
+	else
45d60a
+		return ISC_R_SUCCESS;
45d60a
+}
45d60a
+
45d60a
+/*
45d60a
  * This routine does the generic work for sending a ddns message to
45d60a
  * modify the forward record (A or AAAA) and calls one of a set of
45d60a
  * routines to build the specific message.
45d60a
@@ -1403,6 +1421,10 @@ ddns_modify_fwd(dhcp_ddns_cb_t *ddns_cb, const char *file, int line)
45d60a
 	/* Get a pointer to the clientname to make things easier. */
45d60a
 	clientname = (unsigned char *)ddns_cb->fwd_name.data;
45d60a
 
45d60a
+	result = dns_client_lazy();
45d60a
+	if (result != ISC_R_SUCCESS)
45d60a
+		return result;
45d60a
+
45d60a
 	/* Extract and validate the type of the address. */
45d60a
 	if (ddns_cb->address.len == 4) {
45d60a
 		ddns_cb->address_type = dns_rdatatype_a;
45d60a
@@ -1586,6 +1608,10 @@ ddns_modify_ptr(dhcp_ddns_cb_t *ddns_cb, const char *file, int line)
45d60a
 	unsigned char buf[256];
45d60a
 	int buflen;
45d60a
 
45d60a
+	result = dns_client_lazy();
45d60a
+	if (result != ISC_R_SUCCESS)
45d60a
+		return result;
45d60a
+
45d60a
 	/*
45d60a
 	 * Try to lookup the zone in the zone cache.  As with the forward
45d60a
 	 * case it's okay if we don't have one, the DNS code will try to
45d60a
--- a/omapip/isclib.c	
45d60a
+++ a/omapip/isclib.c	
45d60a
@@ -130,17 +130,7 @@ dhcp_context_create(void) {
45d60a
 	if (result != ISC_R_SUCCESS)
45d60a
 		goto cleanup;
45d60a
 
45d60a
-#if defined (NSUPDATE)
45d60a
-	result = dns_client_createx(dhcp_gbl_ctx.mctx,
45d60a
-				    dhcp_gbl_ctx.actx,
45d60a
-				    dhcp_gbl_ctx.taskmgr,
45d60a
-				    dhcp_gbl_ctx.socketmgr,
45d60a
-				    dhcp_gbl_ctx.timermgr,
45d60a
-				    0,
45d60a
-				    &dhcp_gbl_ctx.dnsclient);
45d60a
-	if (result != ISC_R_SUCCESS)
45d60a
-		goto cleanup;
45d60a
-#else
45d60a
+#if !defined (NSUPDATE)
45d60a
 	/* The dst library is inited as part of dns_lib_init, we don't
45d60a
 	 * need it if NSUPDATE is enabled */
45d60a
 	result = dst_lib_init(dhcp_gbl_ctx.mctx, NULL, 0);