Index: npl/syn3/webint/src/vpn/autoconf_syn3.php
===================================================================
--- npl/syn3/webint/src/vpn/autoconf_syn3.php	(revision 07ead9677fe38b647bfd3acd7185176963262a58)
+++ npl/syn3/webint/src/vpn/autoconf_syn3.php	(revision a35989d1d54109e3359ab21b867e44437ecdf090)
@@ -1,4 +1,4 @@
 <?
-/* 
+/*
 (C) 2004-2013 DatuX - info@datux.nl
 
@@ -23,5 +23,5 @@
 ?>
 
-<? 
+<?
 /*
 Redirection verhaal met betrekking tot auto configure:
@@ -33,5 +33,5 @@
 testtunnel							instellingen testen
 listtunnels.php						klaar :D
-	
+
 */
 	$name=$_REQUEST[name];
@@ -39,6 +39,6 @@
 	$passwd=$_REQUEST[passwd];
 
-	Title(_AutoVPNConfig($name)); 
-	
+	Title(_AutoVPNConfig($name));
+
 	//read tunnel
 	$tunnel=vpn_ReadTunnel($name);
@@ -52,18 +52,28 @@
 	$remote_par.="&new_right=$tunnel[leftid]";
 	$remote_par.="&new_rightsubnet=$tunnel[leftsubnet]";
+
 	if ($tunnel[compress]=='yes')
 		$remote_par.="&new_compress=on";
 	else
 		$remote_par.="&new_compress=off";
+
+	if ($tunnel[ikev2]=='insist')
+		$remote_par.="&new_ikev2=on";
+	else
+		$remote_par.="&new_ikev2=off";
+
+
+	if ($tunnel[pfs]=='yes')
+		$remote_par.="&new_pfs=on";
+	else
+		$remote_par.="&new_pfs=off";
+
 	$remote_par.="&new_authby=$tunnel[authby]";
 	$remote_par.="&new_rightrsasigkey=".rawurlencode(vpn_ReadPubKey());
 	$remote_par.="&new_secret=".rawurlencode($secret);
-	
+
 	// url aan ONZE kant, waar pubkey andere kant uiteindelijk heen moet
 	$remote_par.="&puburi=".rawurlencode("https://$_SERVER[HTTP_HOST]/vpn/edittunnel.php?name=$name&save=1");
-	
+
 	// jump naar de tunnel config aan de andere kant
 	Redirect("https://$ip:10000/vpn/edittunnel.php?$remote_par");
-
-	
-	
Index: npl/syn3/webint/src/vpn/edittunnel.php
===================================================================
--- npl/syn3/webint/src/vpn/edittunnel.php	(revision 07ead9677fe38b647bfd3acd7185176963262a58)
+++ npl/syn3/webint/src/vpn/edittunnel.php	(revision a35989d1d54109e3359ab21b867e44437ecdf090)
@@ -28,5 +28,8 @@
 	Title(_VPNtunnelSettings($name));
 
+	//default settings
 	$new_pfs="on";
+	$new_ikev2="off";
+	$new_leftsourceip=GetFirstLanIp();
 
 	//read current configuration
@@ -38,4 +41,5 @@
 		$new_leftid=$tunnel[leftid];
 		$new_rightsubnet=$tunnel[rightsubnet];
+		$new_leftsourceip=$tunnel[leftsourceip];
 		$new_authby=$tunnel[authby];
 		$new_right=$tunnel[right];
@@ -52,4 +56,8 @@
 		 	$new_pfs="off";
 
+		if ($tunnel[ikev2]=='insist')
+			$new_ikev2="on";
+		else
+		 	$new_ikev2="off";
 	}
 
@@ -60,9 +68,9 @@
 	if (!vpn_ValidName($new_name))
 		$errors[new_name]=_EnterValidName();
-	elseif (!ValidIp($new_leftid))
+	elseif (!ValidIp($new_leftid) && !ValidHostname($new_leftid))
 		$errors[new_leftid]=_EnterValidIp();
 	elseif (!ValidSubnet($new_leftsubnet))
 		$errors[new_leftsubnet]=_EnterValidSubnet();
-	elseif (!ValidIp($new_right))
+	elseif (!ValidIp($new_right) && !ValidHostname($new_right))
 		$errors[new_right]=_EnterValidIp();
 	elseif (!ValidSubnet($new_rightsubnet))
@@ -89,4 +97,6 @@
 	)
 		$errors[new_secret]=_EnterValidPassword();
+	elseif ($new_leftsourceip && !ValidIp($new_leftsourceip))
+		$errors[new_leftsourceip]=_EnterValidIp();
 
 
@@ -104,5 +114,15 @@
 		$tunnel[rightsubnet]=$new_rightsubnet;
 		$tunnel[right]=$new_right;
-		$tunnel[rightrsasigkey]=vpn_ReadableToPub($new_rightrsasigkey);
+
+		$rightrsasigkey=vpn_ReadableToPub($new_rightrsasigkey);
+		if ($rightrsasigkey)
+		{
+			$tunnel[rightrsasigkey]=$rightrsasigkey;
+		}
+		else
+		{
+			unset($tunnel[rightrsasigkey]);
+		}
+
 		if ($new_compress=="on")
 			$tunnel[compress]='yes';
@@ -118,4 +138,14 @@
 		else
 			$tunnel[pfs]="no";
+
+		if ($new_ikev2=='on')
+			$tunnel[ikev2]="insist";
+		else
+			$tunnel[ikev2]="never";
+
+		if ($new_leftsourceip)
+			$tunnel[leftsourceip]=$new_leftsourceip;
+		else
+			unset($tunnel[leftsourceip]);
 
 		vpn_WriteTunnel($new_name,$tunnel);
@@ -208,4 +238,13 @@
 
 <p>
+IKE v2:
+<?InputCheckBox("new_ikev2",$errors);?>
+
+
+<p>
+Source IP:
+<?InputText("new_leftsourceip",$errors);?>
+
+<p>
 <table>
 	<tr>
Index: npl/syn3/webint/src/vpn/listtunnels.php
===================================================================
--- npl/syn3/webint/src/vpn/listtunnels.php	(revision 07ead9677fe38b647bfd3acd7185176963262a58)
+++ npl/syn3/webint/src/vpn/listtunnels.php	(revision a35989d1d54109e3359ab21b867e44437ecdf090)
@@ -30,5 +30,5 @@
 <? Title(_VPNTunnels()); ?>
 
-<? Head($errors,'',10); ?>
+<? Head($errors,'',60); ?>
 
 <h1><?=$TITLE?></h1>
@@ -50,5 +50,5 @@
     $status=vpn_GetStatus();
 
-    // echo "<pre>";print_r($status);
+    //  echo "<pre>TEST ";print_r($status);
 
     $untested=0;
@@ -65,5 +65,5 @@
         {
             //status NOT ok?
-            if ($status[$name][state] != "STATE_QUICK_I2" && $status[$name][state] != "STATE_QUICK_R2" )
+            if ($status[$name][state] != "STATE_QUICK_I2" && $status[$name][state] != "STATE_QUICK_R2" && $status[$name][state] != "STATE_V2_IPSEC_R" && $status[$name][state] != "STATE_V2_IPSEC_I")
                 LinkDefault("testtunnel.php?name=$name&mode=down", _Started(), "<img src='../img/CAUTION.gif'>",_ConfirmDisable($name));
             else
Index: npl/syn3/webint/src/vpn/openswan.php
===================================================================
--- npl/syn3/webint/src/vpn/openswan.php	(revision 07ead9677fe38b647bfd3acd7185176963262a58)
+++ npl/syn3/webint/src/vpn/openswan.php	(revision a35989d1d54109e3359ab21b867e44437ecdf090)
@@ -43,31 +43,6 @@
 			return false; //return ok-code
 
-		// global $VPN_STARTERRORS;
 		vpn_Stop();
-		// LogInfo(_LogVPNStarting());
 		SvcUp("ipsec");
-		// FileWriteRaw("/etc/sysconfig/pluto_updown", "DEFAULTSOURCE=".GetFirstLanIp()."\n");
-		// Cmd("pgrphack closefd /usr/sbin/ipsec setup start |grep 'FATAL:' 1>&2",'',$out,$err);
-
-		// if ($err)
-		// {
-		// 	FileWrite($VPN_STARTERRORS,$err);
-		// 	LogError(_LogVPNstartErrors(implode(" ",$err)));
-		// 	return ($err);
-		// }
-		// else
-		// {
-		// 	FileWrite($VPN_STARTERRORS,'');
-		// 	sleep(2); //wacht zodat VPN subsysteem up is
-		// 	//kijk of er tunnels up moeten
-		// 	$tunnels=vpn_ReadTunnels();
-		// 	foreach ($tunnels as $name=>$conf)
-		// 	{
-		// 		//hij moet up zijn, EN hij is reeds getest
-		// 		if ((!vpn_TunnelIsDownOnBoot($name)) && vpn_TunnelIsTested($name))
-		// 			vpn_TunnelUp($name);
-		// 	}
-		// 	return false;
-		// }
 	}
 
@@ -307,5 +282,5 @@
 		foreach ($raw as $line)
 		{
-			if (preg_match("/^[^a-z]*([a-z]*)=(.*)$/",$line,$matches))
+			if (preg_match("/^[^a-z-0-9]*([a-z0-9]*)=(.*)$/",$line,$matches))
 				$ret[$matches[1]]=$matches[2];
 		}
@@ -435,5 +410,5 @@
 		global $VPN_PRIO;
 
-		if (Cmd("ipsec whack --status",'',$output)!=0)
+		if (Cmd("ipsec whack --status",'',$output)<0)
 		{
 			LogError("Error reading ipsec status. Please check if ipsec-service is running");
@@ -444,5 +419,5 @@
 			foreach ($output as $line)
 			{
-				if (preg_match('/^.*#([0-9])*:.*"(.*?)"[:0-9]* ([A-Z0-9_]+) /',$line,$matches))
+ 				if (preg_match('/^.*#([0-9])*:.*"(.*?)"[:0-9]* ([A-Z0-9_]+) /',$line,$matches))
 				{
 					$nr=$matches[1];
