Blame SOURCES/libreswan-3.20-1372279-down-error.patch

0f2847
diff -Naur libreswan-3.20-orig/programs/pluto/connections.c libreswan-3.20/programs/pluto/connections.c
0f2847
--- libreswan-3.20-orig/programs/pluto/connections.c	2017-03-14 11:53:11.000000000 -0400
0f2847
+++ libreswan-3.20/programs/pluto/connections.c	2017-05-30 15:00:02.409386255 -0400
0f2847
@@ -97,13 +97,13 @@
0f2847
  * Move the winner (if any) to the front.
0f2847
  * If none is found, and strict, a diagnostic is logged to whack.
0f2847
  */
0f2847
-struct connection *con_by_name(const char *nm, bool strict)
0f2847
+struct connection *con_by_name(const char *nm, bool strict, bool quiet)
0f2847
 {
0f2847
 	struct connection *p, *prev;
0f2847
 
0f2847
 	for (prev = NULL, p = connections;; prev = p, p = p->ac_next) {
0f2847
 		if (p == NULL) {
0f2847
-			if (strict)
0f2847
+			if (strict && !quiet)
0f2847
 				whack_log(RC_UNKNOWN_NAME,
0f2847
 					"no connection named \"%s\"", nm);
0f2847
 			break;
0f2847
@@ -401,13 +401,13 @@
0f2847
 	bool f = FALSE;
0f2847
 
0f2847
 	passert(name != NULL);
0f2847
-	struct connection *c = con_by_name(name, strict);
0f2847
+	struct connection *c = con_by_name(name, strict, TRUE);
0f2847
 
0f2847
 	if (c == NULL) {
0f2847
 		(void)foreach_connection_by_alias(name, delete_connection_wrap,
0f2847
 						  &f);
0f2847
 	} else {
0f2847
-		for (; c != NULL; c = con_by_name(name, FALSE))
0f2847
+		for (; c != NULL; c = con_by_name(name, FALSE, FALSE))
0f2847
 			delete_connection(c, FALSE);
0f2847
 	}
0f2847
 }
0f2847
@@ -1269,7 +1269,7 @@
0f2847
 
0f2847
 	alg_info_ike = NULL;
0f2847
 
0f2847
-	if (con_by_name(wm->name, FALSE) != NULL) {
0f2847
+	if (con_by_name(wm->name, FALSE, FALSE) != NULL) {
0f2847
 		loglog(RC_DUPNAME, "attempt to redefine connection \"%s\"",
0f2847
 			wm->name);
0f2847
 		return;
0f2847
@@ -1927,7 +1927,7 @@
0f2847
 		snprintf(namebuf, sizeof(namebuf), "%s#%s", group->name, targetbuf);
0f2847
 	}
0f2847
 
0f2847
-	if (con_by_name(namebuf, FALSE) != NULL) {
0f2847
+	if (con_by_name(namebuf, FALSE, FALSE) != NULL) {
0f2847
 		loglog(RC_DUPNAME,
0f2847
 			"group name + target yields duplicate name \"%s\"",
0f2847
 			namebuf);
0f2847
diff -Naur libreswan-3.20-orig/programs/pluto/connections.h libreswan-3.20/programs/pluto/connections.h
0f2847
--- libreswan-3.20-orig/programs/pluto/connections.h	2017-03-14 11:53:11.000000000 -0400
0f2847
+++ libreswan-3.20/programs/pluto/connections.h	2017-05-30 15:00:21.716149232 -0400
0f2847
@@ -413,7 +413,7 @@
0f2847
 
0f2847
 struct state;   /* forward declaration of tag (defined in state.h) */
0f2847
 extern struct connection
0f2847
-*con_by_name(const char *nm, bool strict);
0f2847
+*con_by_name(const char *nm, bool strict, bool quiet);
0f2847
 
0f2847
 stf_status ikev2_find_host_connection(struct connection **cp,
0f2847
 		const ip_address *me, u_int16_t my_port, const ip_address *him,
0f2847
diff -Naur libreswan-3.20-orig/programs/pluto/foodgroups.c libreswan-3.20/programs/pluto/foodgroups.c
0f2847
--- libreswan-3.20-orig/programs/pluto/foodgroups.c	2017-03-14 11:53:11.000000000 -0400
0f2847
+++ libreswan-3.20/programs/pluto/foodgroups.c	2017-05-30 15:00:02.409386255 -0400
0f2847
@@ -344,7 +344,7 @@
0f2847
 		for (t = targets; t != NULL; t = t->next) {
0f2847
 			if (t->group == g) {
0f2847
 				struct connection *ci = con_by_name(t->name,
0f2847
-								    FALSE);
0f2847
+								    FALSE, FALSE);
0f2847
 
0f2847
 				if (ci != NULL) {
0f2847
 					set_cur_connection(ci);
0f2847
@@ -367,7 +367,7 @@
0f2847
 	g->connection->policy &= ~POLICY_GROUTED;
0f2847
 	for (t = targets; t != NULL; t = t->next) {
0f2847
 		if (t->group == g) {
0f2847
-			struct connection *ci = con_by_name(t->name, FALSE);
0f2847
+			struct connection *ci = con_by_name(t->name, FALSE, FALSE);
0f2847
 
0f2847
 			if (ci != NULL) {
0f2847
 				set_cur_connection(ci);
0f2847
diff -Naur libreswan-3.20-orig/programs/pluto/ikev1.c libreswan-3.20/programs/pluto/ikev1.c
0f2847
--- libreswan-3.20-orig/programs/pluto/ikev1.c	2017-03-14 11:53:11.000000000 -0400
0f2847
+++ libreswan-3.20/programs/pluto/ikev1.c	2017-05-30 15:00:02.410386295 -0400
0f2847
@@ -696,7 +696,7 @@
0f2847
 
0f2847
 				/* to find and store the connection associated with tmp_name */
0f2847
 				/* ??? how do we know that tmp_name hasn't been freed? */
0f2847
-				struct connection *tmp_c = con_by_name(tmp_name, FALSE);
0f2847
+				struct connection *tmp_c = con_by_name(tmp_name, FALSE, FALSE);
0f2847
 
0f2847
 				DBG_cond_dump(DBG_PARSING,
0f2847
 					      "redirected remote end info:", n_pbs->cur + pbs_left(
0f2847
diff -Naur libreswan-3.20-orig/programs/pluto/initiate.c libreswan-3.20/programs/pluto/initiate.c
0f2847
--- libreswan-3.20-orig/programs/pluto/initiate.c	2017-03-14 11:53:11.000000000 -0400
0f2847
+++ libreswan-3.20/programs/pluto/initiate.c	2017-05-30 15:00:02.410386295 -0400
0f2847
@@ -344,7 +344,7 @@
0f2847
 			 char *remote_host)
0f2847
 {
0f2847
 	struct initiate_stuff is;
0f2847
-	struct connection *c = con_by_name(name, FALSE);
0f2847
+	struct connection *c = con_by_name(name, FALSE, FALSE);
0f2847
 	int count;
0f2847
 
0f2847
 	passert(name != NULL);
0f2847
diff -Naur libreswan-3.20-orig/programs/pluto/rcv_whack.c libreswan-3.20/programs/pluto/rcv_whack.c
0f2847
--- libreswan-3.20-orig/programs/pluto/rcv_whack.c	2017-03-14 11:53:11.000000000 -0400
0f2847
+++ libreswan-3.20/programs/pluto/rcv_whack.c	2017-05-30 15:00:02.411386334 -0400
0f2847
@@ -301,7 +301,7 @@
0f2847
 				set_debugging(base_debugging);
0f2847
 			} else if (!m->whack_connection) {
0f2847
 				struct connection *c = con_by_name(m->name,
0f2847
-								   TRUE);
0f2847
+								   TRUE, FALSE);
0f2847
 
0f2847
 				if (c != NULL) {
0f2847
 					c->extra_debugging = m->debugging;
0f2847
@@ -456,7 +456,7 @@
0f2847
 		if (!listening) {
0f2847
 			whack_log(RC_DEAF, "need --listen before --route");
0f2847
 		} else {
0f2847
-			struct connection *c = con_by_name(m->name, TRUE);
0f2847
+			struct connection *c = con_by_name(m->name, TRUE, FALSE);
0f2847
 
0f2847
 			if (c != NULL) {
0f2847
 				set_cur_connection(c);
0f2847
@@ -476,7 +476,7 @@
0f2847
 	}
0f2847
 
0f2847
 	if (m->whack_unroute) {
0f2847
-		struct connection *c = con_by_name(m->name, TRUE);
0f2847
+		struct connection *c = con_by_name(m->name, TRUE, FALSE);
0f2847
 
0f2847
 		if (c != NULL) {
0f2847
 			const struct spd_route *sr;
0f2847
diff -Naur libreswan-3.20-orig/programs/pluto/terminate.c libreswan-3.20/programs/pluto/terminate.c
0f2847
--- libreswan-3.20-orig/programs/pluto/terminate.c	2017-03-14 11:53:11.000000000 -0400
0f2847
+++ libreswan-3.20/programs/pluto/terminate.c	2017-05-30 15:00:02.411386334 -0400
0f2847
@@ -92,8 +92,9 @@
0f2847
 	/*
0f2847
 	 * Loop because more than one may match (master and instances)
0f2847
 	 * But at least one is required (enforced by con_by_name).
0f2847
+	 * Don't log an error if not found before we checked aliases
0f2847
 	 */
0f2847
-	struct connection *c = con_by_name(name, TRUE);
0f2847
+	struct connection *c = con_by_name(name, TRUE, TRUE);
0f2847
 
0f2847
 	if (c != NULL) {
0f2847
 		while (c != NULL) {