Blame SOURCES/dhcp-dns_client_cancelupdate.patch

0c2dab
diff -up dhcp-4.2.5/client/dhclient.c.dns_client_cancelupdate dhcp-4.2.5/client/dhclient.c
0c2dab
--- dhcp-4.2.5/client/dhclient.c.dns_client_cancelupdate	2015-06-25 14:31:27.309035906 +0200
0c2dab
+++ dhcp-4.2.5/client/dhclient.c	2015-06-25 14:34:26.477642016 +0200
0c2dab
@@ -121,6 +121,8 @@ static int check_option_values(struct un
0c2dab
 			       const char *ptr, size_t len);
0c2dab
 
0c2dab
 static void setup_ib_interface(struct interface_info *ip);
0c2dab
+static void dhclient_ddns_cb_free(dhcp_ddns_cb_t *ddns_cb,
0c2dab
+                                   char* file, int line);
0c2dab
 
0c2dab
 int
0c2dab
 main(int argc, char **argv) {
0c2dab
@@ -4306,7 +4308,7 @@ client_dns_remove_action(dhcp_ddns_cb_t
0c2dab
 	}
0c2dab
 
0c2dab
 	/* If we are done or have an error clean up */
0c2dab
-	ddns_cb_free(ddns_cb, MDL);
0c2dab
+	dhclient_ddns_cb_free(ddns_cb, MDL);
0c2dab
 	return;
0c2dab
 }
0c2dab
 
0c2dab
@@ -4335,7 +4337,7 @@ client_dns_remove(struct client_state *c
0c2dab
 		result = client_dns_update(client, ddns_cb);
0c2dab
 
0c2dab
 		if (result != ISC_R_TIMEDOUT) {
0c2dab
-			ddns_cb_free(ddns_cb, MDL);
0c2dab
+			dhclient_ddns_cb_free(ddns_cb, MDL);
0c2dab
 		}
0c2dab
 	}
0c2dab
 }
0c2dab
@@ -4418,10 +4420,7 @@ client_dns_update_timeout (void *cp)
0c2dab
 	 * the control block and should free it.
0c2dab
 	 */
0c2dab
 	if (status != ISC_R_TIMEDOUT) {
0c2dab
-		if (client != NULL) {
0c2dab
-			client->ddns_cb = NULL;
0c2dab
-		}
0c2dab
-		ddns_cb_free(ddns_cb, MDL);
0c2dab
+		dhclient_ddns_cb_free(ddns_cb, MDL);
0c2dab
 	}
0c2dab
 }
0c2dab
 
0c2dab
@@ -4510,7 +4509,7 @@ client_dns_update_action(dhcp_ddns_cb_t
0c2dab
 		return;
0c2dab
 	}
0c2dab
 
0c2dab
-	ddns_cb_free(ddns_cb, MDL);
0c2dab
+	dhclient_ddns_cb_free(ddns_cb, MDL);
0c2dab
 	return;
0c2dab
 }
0c2dab
 
0c2dab
@@ -4873,3 +4872,17 @@ add_reject(struct packet *packet) {
0c2dab
 	 */
0c2dab
 	log_info("Server added to list of rejected servers.");
0c2dab
 }
0c2dab
+
0c2dab
+/* Wrapper function around common ddns_cb_free function that ensures
0c2dab
+ * we set the client_state pointer to the control block to NULL. */
0c2dab
+static void
0c2dab
+dhclient_ddns_cb_free(dhcp_ddns_cb_t *ddns_cb, char* file, int line) {
0c2dab
+    if (ddns_cb) {
0c2dab
+        struct client_state *client = (struct client_state *)ddns_cb->lease;
0c2dab
+        if (client != NULL) {
0c2dab
+            client->ddns_cb = NULL;
0c2dab
+        }
0c2dab
+
0c2dab
+        ddns_cb_free(ddns_cb, file, line);
0c2dab
+    }
0c2dab
+}