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