Blame SOURCES/libreswan-3.23-fixups.patch

936548
diff -Naur libreswan-3.23-orig/programs/pluto/connections.c libreswan-3.23/programs/pluto/connections.c
936548
--- libreswan-3.23-orig/programs/pluto/connections.c	2018-01-25 15:19:46.000000000 -0500
936548
+++ libreswan-3.23/programs/pluto/connections.c	2018-02-05 14:38:49.372280712 -0500
936548
@@ -3158,10 +3158,8 @@
936548
 					matching_peer_id && matching_peer_ca && matching_requested_ca,
936548
 					matching_peer_id, matching_peer_ca, matching_requested_ca);});
936548
 
936548
-			/* Ignore template from which we instantiated - this should never happen */
936548
 			if (c->kind == CK_INSTANCE && d->kind == CK_TEMPLATE && streq(c->name, d->name)) {
936548
-				libreswan_log("Warning: not switching back to template of current instance (FIXME)");
936548
-				continue;
936548
+				DBG(DBG_CONTROLMORE, DBG_log("template conn fits better than instance of it - different client on same IP/port requires new instance"));
936548
 			}
936548
 
936548
 			/* 'You Tarzan, me Jane' check based on received IDr */
936548
diff -Naur libreswan-3.23-orig/programs/pluto/hostpair.c libreswan-3.23/programs/pluto/hostpair.c
936548
--- libreswan-3.23-orig/programs/pluto/hostpair.c	2018-01-25 15:19:46.000000000 -0500
936548
+++ libreswan-3.23/programs/pluto/hostpair.c	2018-02-05 14:38:57.865635032 -0500
936548
@@ -144,17 +144,6 @@
936548
 		hisport = pluto_port;
936548
 
936548
 	for (prev = NULL, p = host_pairs; p != NULL; prev = p, p = p->next) {
936548
-		if (p->connections != NULL && (p->connections->kind == CK_INSTANCE) &&
936548
-				(p->connections->spd.that.id.kind == ID_NULL))
936548
-		{
936548
-			DBG(DBG_CONTROLMORE, {
936548
-				char ci[CONN_INST_BUF];
936548
-				DBG_log("find_host_pair: ignore CK_INSTANCE with ID_NULL hp:\"%s\"%s",
936548
-					p->connections->name,
936548
-					fmt_conn_instance(p->connections, ci));
936548
-			});
936548
-			continue;
936548
-		}
936548
 
936548
 		DBG(DBG_CONTROLMORE, {
936548
 			ipstr_buf b1;
936548
diff -Naur libreswan-3.23-orig/programs/pluto/ikev2.h libreswan-3.23/programs/pluto/ikev2.h
936548
--- libreswan-3.23-orig/programs/pluto/ikev2.h	2018-01-25 15:19:46.000000000 -0500
936548
+++ libreswan-3.23/programs/pluto/ikev2.h	2018-02-05 14:39:11.171190105 -0500
936548
@@ -162,7 +162,9 @@
936548
 extern bool ikev2_calculate_rsa_sha1(struct state *st,
936548
 				     enum original_role role,
936548
 				     unsigned char *idhash,
936548
-				     pb_stream *a_pbs);
936548
+				     pb_stream *a_pbs,
936548
+				     bool calc_no_ppk_auth,
936548
+				     chunk_t *no_ppk_auth);
936548
 
936548
 extern bool ikev2_create_psk_auth(enum keyword_authby authby,
936548
 				     struct state *st,
936548
diff -Naur libreswan-3.23-orig/programs/pluto/ikev2_parent.c libreswan-3.23/programs/pluto/ikev2_parent.c
936548
--- libreswan-3.23-orig/programs/pluto/ikev2_parent.c	2018-01-25 15:19:46.000000000 -0500
936548
+++ libreswan-3.23/programs/pluto/ikev2_parent.c	2018-02-05 14:39:11.173190188 -0500
936548
@@ -2783,7 +2783,9 @@
936548
 
936548
 	switch (a.isaa_type) {
936548
 	case IKEv2_AUTH_RSA:
936548
-		if (!ikev2_calculate_rsa_sha1(pst, role, idhash_out, &a_pbs)) {
936548
+		if (!ikev2_calculate_rsa_sha1(pst, role, idhash_out, &a_pbs,
936548
+			FALSE, /* store-only not set */
936548
+			NULL /* store-only chunk unused */)) {
936548
 			loglog(RC_LOG_SERIOUS, "Failed to find our RSA key");
936548
 			return STF_FATAL;
936548
 		}
936548
@@ -2792,7 +2794,7 @@
936548
 	case IKEv2_AUTH_PSK:
936548
 	case IKEv2_AUTH_NULL:
936548
 		if (!ikev2_create_psk_auth(authby, pst, idhash_out, &a_pbs,
936548
-			FALSE /* store-only not set */,
936548
+			FALSE, /* store-only not set */
936548
 			NULL /* store-only chunk unused */)) {
936548
 			loglog(RC_LOG_SERIOUS, "Failed to find our PreShared Key");
936548
 			return STF_FATAL;
936548
@@ -2812,7 +2814,9 @@
936548
 					return STF_INTERNAL_ERROR;
936548
 			}
936548
 
936548
-			if (!ikev2_calculate_rsa_sha1(pst, role, idhash_out, &a_pbs)) {
936548
+			if (!ikev2_calculate_rsa_sha1(pst, role, idhash_out, &a_pbs,
936548
+				FALSE, /* store-only not set */
936548
+				NULL /* store-only chunk unused */)) {
936548
 				loglog(RC_LOG_SERIOUS, "DigSig: failed to find our RSA key");
936548
 				return STF_FATAL;
936548
 			}
936548
@@ -3224,7 +3228,7 @@
936548
 		hmac_update(&id_ctx, id_start, id_len);
936548
 		hmac_final(idhash, &id_ctx);
936548
 
936548
-		if (pst->st_sk_pi_no_ppk != NULL) {
936548
+		if (pst->st_seen_ppk && !LIN(POLICY_PPK_INSIST, pc->policy)) {
936548
 			struct hmac_ctx id_ctx_npa;
936548
 
936548
 			hmac_init(&id_ctx_npa, pst->st_oakley.ta_prf, pst->st_sk_pi_no_ppk);
936548
@@ -3371,7 +3375,7 @@
936548
 			notifies++;
936548
 
936548
 		if (pst->st_seen_ppk)
936548
-			notifies++; /* used for two payloads */
936548
+			notifies++; /* used for one or two payloads */
936548
 
936548
 		/* code does not support AH + ESP, not recommend rfc8221 section-4 */
936548
 		struct ipsec_proto_info *proto_info
936548
@@ -3437,21 +3441,24 @@
936548
 		}
936548
 		if (pst->st_seen_ppk) {
936548
 			chunk_t notify_data = create_unified_ppk_id(&ppk_id_p);
936548
+			int np = LIN(POLICY_PPK_INSIST, cc->policy) ? ISAKMP_NEXT_v2NONE : ISAKMP_NEXT_v2N;
936548
 
936548
-			notifies--; /* used for 2 payloads */
936548
-				if (!ship_v2N(ISAKMP_NEXT_v2N, ISAKMP_PAYLOAD_NONCRITICAL,
936548
-						PROTO_v2_RESERVED, &empty_chunk,
936548
-						v2N_PPK_IDENTITY, &notify_data,
936548
-						&e_pbs_cipher))
936548
-					return STF_INTERNAL_ERROR;
936548
+			notifies--; /* used for one or two payloads */
936548
+			if (!ship_v2N(np, ISAKMP_PAYLOAD_NONCRITICAL,
936548
+					PROTO_v2_RESERVED, &empty_chunk,
936548
+					v2N_PPK_IDENTITY, &notify_data,
936548
+					&e_pbs_cipher))
936548
+				return STF_INTERNAL_ERROR;
936548
 			freeanychunk(notify_data);
936548
 
936548
-			ikev2_calc_no_ppk_auth(cc, pst, idhash_npa, &pst->st_no_ppk_auth);
936548
-			if (!ship_v2N(ISAKMP_NEXT_v2NONE, ISAKMP_PAYLOAD_NONCRITICAL,
936548
-				PROTO_v2_RESERVED, &empty_chunk,
936548
-				v2N_NO_PPK_AUTH, &pst->st_no_ppk_auth,
936548
-				&e_pbs_cipher))
936548
-					return STF_INTERNAL_ERROR;
936548
+			if (!LIN(POLICY_PPK_INSIST, cc->policy)) {
936548
+				ikev2_calc_no_ppk_auth(cc, pst, idhash_npa, &pst->st_no_ppk_auth);
936548
+				if (!ship_v2N(ISAKMP_NEXT_v2NONE, ISAKMP_PAYLOAD_NONCRITICAL,
936548
+					PROTO_v2_RESERVED, &empty_chunk,
936548
+					v2N_NO_PPK_AUTH, &pst->st_no_ppk_auth,
936548
+					&e_pbs_cipher))
936548
+						return STF_INTERNAL_ERROR;
936548
+			}
936548
 		}
936548
 
936548
 		passert(notifies == 0);
936548
diff -Naur libreswan-3.23-orig/programs/pluto/ikev2_ppk.c libreswan-3.23/programs/pluto/ikev2_ppk.c
936548
--- libreswan-3.23-orig/programs/pluto/ikev2_ppk.c	2018-01-25 15:19:46.000000000 -0500
936548
+++ libreswan-3.23/programs/pluto/ikev2_ppk.c	2018-02-05 14:39:11.173190188 -0500
936548
@@ -113,7 +113,24 @@
936548
 	enum keyword_authby authby = c->spd.this.authby;
936548
 	switch (authby) {
936548
 	case AUTH_RSASIG:
936548
-		/* TODO */
936548
+		if (ikev2_calculate_rsa_sha1(st, st->st_original_role, id_hash, NULL, TRUE, no_ppk_auth)) {
936548
+			if (st->st_hash_negotiated & NEGOTIATE_AUTH_HASH_SHA1) {
936548
+				/* make blobs separately, and somehow combine them and no_ppk_auth
936548
+				 * to get an actual no_ppk_auth */
936548
+				int len = ASN1_LEN_ALGO_IDENTIFIER + ASN1_SHA1_RSA_OID_SIZE + no_ppk_auth->len;
936548
+				u_char *blobs = alloc_bytes(len, "bytes for blobs for AUTH_DIGSIG NO_PPK_AUTH");
936548
+				u_char *ret = blobs;
936548
+				memcpy(blobs, len_sha1_rsa_oid_blob, ASN1_LEN_ALGO_IDENTIFIER);
936548
+				blobs += ASN1_LEN_ALGO_IDENTIFIER;
936548
+				memcpy(blobs, sha1_rsa_oid_blob, ASN1_SHA1_RSA_OID_SIZE);
936548
+				blobs += ASN1_SHA1_RSA_OID_SIZE;
936548
+				memcpy(blobs, no_ppk_auth->ptr, no_ppk_auth->len);
936548
+				chunk_t release = *no_ppk_auth;
936548
+				setchunk(*no_ppk_auth, ret, len);
936548
+				freeanychunk(release);
936548
+			}
936548
+		}
936548
+		return STF_OK;
936548
 		break;
936548
 	case AUTH_PSK:
936548
 		if (ikev2_create_psk_auth(AUTH_PSK, st, id_hash, NULL, TRUE, no_ppk_auth))
936548
diff -Naur libreswan-3.23-orig/programs/pluto/ikev2_rsa.c libreswan-3.23/programs/pluto/ikev2_rsa.c
936548
--- libreswan-3.23-orig/programs/pluto/ikev2_rsa.c	2018-01-25 15:19:46.000000000 -0500
936548
+++ libreswan-3.23/programs/pluto/ikev2_rsa.c	2018-02-05 14:39:11.173190188 -0500
936548
@@ -101,7 +101,9 @@
936548
 bool ikev2_calculate_rsa_sha1(struct state *st,
936548
 			      enum original_role role,
936548
 			      unsigned char *idhash,
936548
-			      pb_stream *a_pbs)
936548
+			      pb_stream *a_pbs,
936548
+			      bool calc_no_ppk_auth,
936548
+			      chunk_t *no_ppk_auth)
936548
 {
936548
 	unsigned char signed_octets[SHA1_DIGEST_SIZE + 16];
936548
 	size_t signed_len;
936548
@@ -136,8 +138,13 @@
936548
 		if (shr == 0)
936548
 			return FALSE;
936548
 		passert(shr == (int)sz);
936548
-		if (!out_raw(sig_val, sz, a_pbs, "rsa signature"))
936548
-			return FALSE;
936548
+		if (calc_no_ppk_auth == FALSE) {
936548
+			if (!out_raw(sig_val, sz, a_pbs, "rsa signature"))
936548
+				return FALSE;
936548
+		} else {
936548
+			clonetochunk(*no_ppk_auth, sig_val, sz, "NO_PPK_AUTH chunk");
936548
+			DBG(DBG_PRIVATE, DBG_dump_chunk("NO_PPK_AUTH payload", *no_ppk_auth));
936548
+		}
936548
 	}
936548
 
936548
 	return TRUE;
936548
diff -Naur libreswan-3.23-orig/programs/pluto/nss_cert_verify.c libreswan-3.23/programs/pluto/nss_cert_verify.c
936548
--- libreswan-3.23-orig/programs/pluto/nss_cert_verify.c	2018-01-25 15:19:46.000000000 -0500
936548
+++ libreswan-3.23/programs/pluto/nss_cert_verify.c	2018-02-05 14:38:52.685418927 -0500
936548
@@ -498,60 +498,83 @@
936548
 
936548
 bool cert_VerifySubjectAltName(const CERTCertificate *cert, const char *name)
936548
 {
936548
-	SECStatus rv;
936548
 	SECItem	subAltName;
936548
-	PLArenaPool *arena = NULL;
936548
-	CERTGeneralName *nameList = NULL;
936548
-	CERTGeneralName *current = NULL;
936548
-	bool san_ip = FALSE;
936548
-	unsigned int len = strlen(name);
936548
-	ip_address myip;
936548
-
936548
-	rv = CERT_FindCertExtension(cert, SEC_OID_X509_SUBJECT_ALT_NAME,
936548
+	SECStatus rv = CERT_FindCertExtension(cert, SEC_OID_X509_SUBJECT_ALT_NAME,
936548
 			&subAltName);
936548
 	if (rv != SECSuccess) {
936548
 		DBG(DBG_X509, DBG_log("certificate contains no subjectAltName extension"));
936548
 		return FALSE;
936548
 	}
936548
 
936548
-	if (tnatoaddr(name, 0, AF_UNSPEC, &myip) == NULL)
936548
-		san_ip = TRUE;
936548
+	ip_address myip;
936548
+	bool san_ip = (tnatoaddr(name, 0, AF_UNSPEC, &myip) == NULL);
936548
 
936548
-	arena = PORT_NewArena(DER_DEFAULT_CHUNKSIZE);
936548
+	PLArenaPool *arena = PORT_NewArena(DER_DEFAULT_CHUNKSIZE);
936548
 	passert(arena != NULL);
936548
 
936548
-	nameList = current = CERT_DecodeAltNameExtension(arena, &subAltName);
936548
-	passert(current != NULL);
936548
+	CERTGeneralName *nameList = CERT_DecodeAltNameExtension(arena, &subAltName);
936548
 
936548
-	do
936548
-	{
936548
+	if (nameList == NULL) {
936548
+		loglog(RC_LOG_SERIOUS, "certificate subjectAltName extension failed to decode");
936548
+		PORT_FreeArena(arena, PR_FALSE);
936548
+		return FALSE;
936548
+	}
936548
+
936548
+	/*
936548
+	 * nameList is a pointer into a non-empty circular linked list.
936548
+	 * This loop visits each entry.
936548
+	 * We have visited each when we come back to the start.
936548
+	 * We test only at the end, after we advance, because we want to visit
936548
+	 * the first entry the first time we see it but stop when we get to it
936548
+	 * the second time.
936548
+	 */
936548
+	CERTGeneralName *current = nameList;
936548
+	do {
936548
 		switch (current->type) {
936548
 		case certDNSName:
936548
 		case certRFC822Name:
936548
-			if (san_ip)
936548
-				break;
936548
-			if (current->name.other.len == len) {
936548
-				if (memcmp(current->name.other.data, name, len) == 0) {
936548
-					DBG(DBG_X509, DBG_log("subjectAltname %s found in certificate", name));
936548
-					PORT_FreeArena(arena, PR_FALSE);
936548
-					return TRUE;
936548
-				}
936548
-			}
936548
+		{
936548
+			/*
936548
+			 * Match the parameter name with the name in the certificate.
936548
+			 * The name in the cert may start with "*."; that will match
936548
+			 * any initial component in name (up to the first '.').
936548
+			 */
936548
+			/* we need to cast because name.other.data is unsigned char * */
936548
+			const char *c_ptr = (const void *) current->name.other.data;
936548
+			size_t c_len =  current->name.other.len;
936548
+
936548
+			const char *n_ptr = name;
936548
+			static const char wild[] = "*.";
936548
+			const size_t wild_len = sizeof(wild) - 1;
936548
+
936548
+			if (c_len > wild_len && startswith(c_ptr, wild)) {
936548
+				/* wildcard in cert: ignore first component of name */
936548
+				c_ptr += wild_len;
936548
+				c_len -= wild_len;
936548
+				n_ptr = strchr(n_ptr, '.');
936548
+				if (n_ptr == NULL)
936548
+					break;	/* cannot match */
936548
 
936548
-			if (current->name.other.len != 0 && current->name.other.len < IDTOA_BUF) {
936548
-				char osan[IDTOA_BUF];
936548
+				n_ptr++;	/* skip . */
936548
+			}
936548
 
936548
-				memcpy(osan,current->name.other.data, current->name.other.len);
936548
-				osan[current->name.other.len] = '\0';
936548
-				DBG(DBG_X509, DBG_log("subjectAltname (len=%d) %s not match %s", current->name.other.len, osan, name));
936548
-			} else {
936548
-				DBG(DBG_X509, DBG_log("subjectAltname <TOO BIG TO PRINT> does not match %s", name));
936548
+			if (c_len == strlen(n_ptr) && strncaseeq(n_ptr, c_ptr, c_len)) {
936548
+				/*
936548
+				 * ??? if current->name.other.data contains bad characters,
936548
+				 * what prevents them being logged?
936548
+				 */
936548
+				DBG(DBG_X509, DBG_log("subjectAltname %s matched %*s in certificate",
936548
+					name, current->name.other.len, current->name.other.data));
936548
+				PORT_FreeArena(arena, PR_FALSE);
936548
+				return TRUE;
936548
 			}
936548
 			break;
936548
+		}
936548
 
936548
 		case certIPAddress:
936548
 			if (!san_ip)
936548
 				break;
936548
+
936548
 			if ((current->name.other.len == 4) && (addrtypeof(&myip) == AF_INET)) {
936548
 				if (memcmp(current->name.other.data, &myip.u.v4.sin_addr.s_addr, 4) == 0) {
936548
 					DBG(DBG_X509, DBG_log("subjectAltname IPv4 matches %s", name));
936548
@@ -572,7 +595,7 @@
936548
 					break;
936548
 				}
936548
 			}
936548
-			DBG(DBG_X509, DBG_log("subjectAltnamea IP address family mismatch for %s", name));
936548
+			DBG(DBG_X509, DBG_log("subjectAltname IP address family mismatch for %s", name));
936548
 			break;
936548
 
936548
 		default:
936548
diff -Naur libreswan-3.23-orig/programs/_unbound-hook/_unbound-hook.in libreswan-3.23/programs/_unbound-hook/_unbound-hook.in
936548
--- libreswan-3.23-orig/programs/_unbound-hook/_unbound-hook.in	2018-01-25 15:19:46.000000000 -0500
936548
+++ libreswan-3.23/programs/_unbound-hook/_unbound-hook.in	2018-02-05 14:38:49.373280754 -0500
936548
@@ -1,31 +1,52 @@
936548
 #!/usr/bin/python
936548
+#
936548
+# Copyright (C) 2018 Paul Wouters <pwouters@redhat.com>
936548
+#
936548
+# This program is free software; you can redistribute it and/or modify it
936548
+# under the terms of the GNU General Public License as published by the
936548
+# Free Software Foundation; either version 2 of the License, or (at your
936548
+# option) any later version.  See <http://www.fsf.org/copyleft/gpl.txt>.
936548
+#
936548
+# This program is distributed in the hope that it will be useful, but
936548
+# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
936548
+# or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
936548
+# for more details.
936548
 
936548
 import sys
936548
-import base64
936548
-import commands
936548
+import subprocess
936548
 
936548
-log = ""
936548
-
936548
-status, myip = commands.getstatusoutput("ip -o route get 1.0.0.1")
936548
+# Get my %defaultroute IP address
936548
+myip = subprocess.check_output("ip -o route get 8.8.8.8", shell=True)
936548
 myip = myip.split("src")[1].strip().split()[0]
936548
 
936548
 argv = sys.argv
936548
-argc = len(sys.argv)
936548
+ourself = argv.pop(0)
936548
 
936548
-#log += "Number or arguments is %d\n"%argc
936548
-#if argc >= 4:
936548
-#	log += "QNAME:%s\n"%argv[1]
936548
-#	log += "TTL:%s\n"%argv[2]
936548
-#	log += "IP:%s\n"%argv[3]
936548
-#	log += "IPSECKEY:%s\n"%argv[4]
936548
-#	rr = argv[4]
936548
-#	pref, gwtype, algo, gw, pubkey = rr.split(" ")
936548
-#log += "-----------------------------\n"
936548
-
936548
-cmdname = "@IPSEC_EXECDIR@/whack --keyid @%s --addkey --pubkeyrsa 0s%s"%(argv[1], pubkey)
936548
-cmdip = "@IPSEC_EXECDIR@/whack --keyid %s --addkey --pubkeyrsa 0s%s"%(argv[3], pubkey)
936548
-cmdoe = "@IPSEC_EXECDIR@/whack --oppohere %s --oppothere %s"%(myip, argv[3])
936548
-ret, output = commands.getstatusoutput(cmdname)
936548
-ret, output = commands.getstatusoutput(cmdip)
936548
-ret, output = commands.getstatusoutput(cmdoe)
936548
-ret, output = commands.getstatusoutput("@IPSEC_EXECDIR@ whack --trafficstatus")
936548
+try:
936548
+    qname = argv.pop(0)
936548
+    ttl = argv.pop(0)
936548
+    ip = argv.pop(0)
936548
+except:
936548
+    sys.exit("Bad arguments to ipsec _unbound")
936548
+
936548
+while (argv != []):
936548
+    try:
936548
+        gwprec = argv.pop(0)
936548
+        gwtype = argv.pop(0)
936548
+        gwalg = argv.pop(0)
936548
+        gwid = argv.pop(0)
936548
+        pubkey = argv.pop(0)
936548
+        addkeyip = "ipsec whack --keyid @%s --addkey --pubkeyrsa 0s%s"%(ip, pubkey)
936548
+        addkeyhostname = "ipsec whack --keyid @%s --addkey --pubkeyrsa 0s%s"%(qname, pubkey)
936548
+        print("processing an IPSECKEY record for Opportunistic IPsec to %s(%s)"%(qname,ip))
936548
+        print(subprocess.call(addkeyip, shell=True))
936548
+        print(subprocess.call(addkeyhostname, shell=True))
936548
+    except:
936548
+        sys.exit("failed to process an IPSECKEY record for Opportunistic IPsec to %s(%s)"%(qname,ip))
936548
+
936548
+# done injecting all IPSECKEY records into pluto - try actual OE now
936548
+cmdoeip = "ipsec whack --oppohere %s --oppothere %s"%(myip, ip)
936548
+print(subprocess.check_output(cmdoeip, shell=True))
936548
+#cmdoeqname = "ipsec whack --oppohere %s --oppothere %s"%(myip, qname)
936548
+#ret, output = commands.getstatusoutput(cmdoeqname)
936548
+print(subprocess.check_output("ipsec whack --trafficstatus", shell=True))
936548
diff --git a/include/ietf_constants.h b/include/ietf_constants.h
936548
index 8a1ba5d..38fa4de 100644
936548
--- a/include/ietf_constants.h
936548
+++ b/include/ietf_constants.h
936548
@@ -1215,7 +1215,7 @@ enum ikev2_cp_attribute_type {
936548
 	IKEv2_EXTERNAL_SOURCE_IP4_NAT_INFO = 23,
936548
 	IKEv2_TIMEOUT_PERIOD_FOR_LIVENESS_CHECK = 24,
936548
 	IKEv2_INTERNAL_DNS_DOMAIN = 25,
936548
-	/* IKEv2_INTERNAL_DNSSEC_TA = 26 expected */
936548
+	IKEv2_INTERNAL_DNSSEC_TA = 26
936548
 };
936548
 
936548
 
936548
diff --git a/lib/libswan/constants.c b/lib/libswan/constants.c
936548
index 9ea9872..ab6db3e 100644
936548
--- a/lib/libswan/constants.c
936548
+++ b/lib/libswan/constants.c
936548
@@ -1365,13 +1365,12 @@ static const char *const ikev2_cp_attribute_type_name[] = {
936548
 	"IKEv2_EXTERNAL_SOURCE_IP4_NAT_INFO", /* 3gpp */
936548
 	"IKEv2_TIMEOUT_PERIOD_FOR_LIVENESS_CHECK", /* 3gpp */
936548
 	"IKEv2_INTERNAL_DNS_DOMAIN", /* draft-ietf-ipsecme-split-dns */
936548
-	/* "IKEv2_INTERNAL_DNSSEC_TA", draft-ietf-ipsecme-split-dns, no Code Point yet */
936548
+	"IKEv2_INTERNAL_DNSSEC_TA", /* draft-ietf-ipsecme-split-dns */
936548
 };
936548
 
936548
 enum_names ikev2_cp_attribute_type_names = {
936548
 	IKEv2_CP_ATTR_RESERVED,
936548
-	IKEv2_INTERNAL_DNS_DOMAIN,
936548
-	/* IKEv2_INTERNAL_DNSSEC_TA, */
936548
+	IKEv2_INTERNAL_DNSSEC_TA,
936548
 	ARRAY_REF(ikev2_cp_attribute_type_name),
936548
 	NULL, /* prefix */
936548
 	NULL
936548
diff --git a/programs/addconn/addconn.c b/programs/addconn/addconn.c
936548
index ae56972..e818e0e 100644
936548
--- a/programs/addconn/addconn.c
936548
+++ b/programs/addconn/addconn.c
936548
@@ -416,12 +416,11 @@ int main(int argc, char *argv[])
936548
 		if (verbose)
936548
 			printf("  Pass #1: Loading auto=add, auto=route and auto=start connections\n");
936548
 
936548
-		for (conn = cfg->conns.tqh_first;
936548
-			conn != NULL;
936548
-			conn = conn->link.tqe_next) {
936548
+		for (conn = cfg->conns.tqh_first; conn != NULL; conn = conn->link.tqe_next) {
936548
 			if (conn->desired_state == STARTUP_ADD ||
936548
 				conn->desired_state == STARTUP_ONDEMAND ||
936548
-				conn->desired_state == STARTUP_START) {
936548
+				conn->desired_state == STARTUP_START)
936548
+			{
936548
 				if (verbose)
936548
 					printf(" %s", conn->name);
936548
 				resolve_defaultroute(conn);
936548
@@ -436,30 +435,22 @@ int main(int argc, char *argv[])
936548
 		starter_whack_listen(cfg);
936548
 
936548
 		if (verbose)
936548
-			printf("  Pass #2: Routing auto=route and auto=start connections\n");
936548
+			printf("  Pass #2: Routing auto=route connections\n");
936548
 
936548
-		for (conn = cfg->conns.tqh_first;
936548
-			conn != NULL;
936548
-			conn = conn->link.tqe_next) {
936548
-			if (conn->desired_state == STARTUP_ADD ||
936548
-				conn->desired_state == STARTUP_ONDEMAND ||
936548
-				conn->desired_state == STARTUP_START) {
936548
+		for (conn = cfg->conns.tqh_first; conn != NULL; conn = conn->link.tqe_next) {
936548
+			if (conn->desired_state == STARTUP_ONDEMAND)
936548
+			{
936548
 				if (verbose)
936548
 					printf(" %s", conn->name);
936548
-				resolve_defaultroute(conn);
936548
-				if (conn->desired_state == STARTUP_ONDEMAND ||
936548
-				    conn->desired_state == STARTUP_START) {
936548
+				if (conn->desired_state == STARTUP_ONDEMAND)
936548
 					starter_whack_route_conn(cfg, conn);
936548
-				}
936548
 			}
936548
 		}
936548
 
936548
 		if (verbose)
936548
 			printf("  Pass #3: Initiating auto=start connections\n");
936548
 
936548
-		for (conn = cfg->conns.tqh_first;
936548
-			conn != NULL;
936548
-			conn = conn->link.tqe_next) {
936548
+		for (conn = cfg->conns.tqh_first; conn != NULL; conn = conn->link.tqe_next) {
936548
 			if (conn->desired_state == STARTUP_START) {
936548
 				if (verbose)
936548
 					printf(" %s", conn->name);
936548
diff --git a/programs/_updown.netkey/_updown.netkey.in b/programs/_updown.netkey/_updown.netkey.in
936548
index 64b2808..b343445 100644
936548
--- a/programs/_updown.netkey/_updown.netkey.in
936548
+++ b/programs/_updown.netkey/_updown.netkey.in
936548
@@ -745,6 +745,7 @@ case "${PLUTO_VERB}" in
936548
     up-client)
936548
 	# connection to my client subnet coming up
936548
 	# If you are doing a custom version, firewall commands go here.
936548
+	addvtiiface
936548
 	updateresolvconf
936548
 	addcat
936548
 	addsource