Blame SOURCES/dhcp-4.2.5-ddns_port_lazy_init.patch

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