Index: conf/nas.a.rt.testbed.aaa/freeDiameter/CMakeFlags
===================================================================
--- conf/nas.a.rt.testbed.aaa/freeDiameter/CMakeFlags	(revision 14)
+++ conf/nas.a.rt.testbed.aaa/freeDiameter/CMakeFlags	(revision 15)
@@ -1,4 +1,5 @@
 -DBUILD_TEST_APP:BOOL=ON 
 -DBUILD_TEST_RT_ANY:BOOL=ON 
+-DBUILD_RT_REDIRECT:BOOL=ON 
 -DBUILD_DBG_MONITOR:BOOL=ON 
 -DBUILD_DBG_INTERACTIVE:BOOL=ON 
Index: conf/nas.a.rt.testbed.aaa/freeDiameter/freeDiameter.conf
===================================================================
--- conf/nas.a.rt.testbed.aaa/freeDiameter/freeDiameter.conf	(revision 14)
+++ conf/nas.a.rt.testbed.aaa/freeDiameter/freeDiameter.conf	(revision 15)
@@ -1,50 +1,8 @@
-# This is a sample configuration file for freeDiameter daemon.
 
-##############################################################
-#Identity = "aaa.koganei.wide.ad.jp";
-#Realm = "wide.ad.jp";
-
-##############################################################
-#Port = 3868;
-#SecPort = 3869;
-#TLS_old_method;
-#No_TCP;
-#No_SCTP;
-#Prefer_TCP;
-#SCTP_streams = 30;
 SCTP_streams = 3;
-
-##############################################################
-#No_IP;
-#No_IPv6;
-#ListenOn = "202.249.37.5";
-#ListenOn = "2001:200:903:2::202:1";
-#ListenOn = "fe80::21c:5ff:fe98:7d62%eth0";
-
-##############################################################
 TLS_Cred = "/root/ca_data/cert.pem" , "/root/ca_data/privkey.pem";
 TLS_CA = "/root/ca_data/ca.pem";
-# TLS_CRL = "/root/ca_data/crl.pem";
-
-#TLS_Prio = "NORMAL";
-#TLS_DH_Bits = 1024;
-
-##############################################################
-#TcTimer = 30;
-#TwTimer = 30;
-
-##############################################################
 NoRelay;
 
-##############################################################
-#LoadExtension = "/path/to/extension" [ : "/optional/configuration/file" ] ;
-
-##############################################################
-#ConnectPeer = "diameterid" [ params... ] ;
-#   params: No_TCP; No_SCTP; No_IP; No_IPv6; Prefer_TCP; TLS_old_method; No_TLS;
-#           Port = 3868; TcTimer = 30; TwTimer = 30; ConnectTo = "202.249.37.5"; TLS_Prio = "NORMAL";
-
-
-##############################################################
 # -------- Test configuration ---------
 
@@ -52,14 +10,20 @@
 # LoadExtension = "/root/freeDiameter/extensions/dbg_rt.fdx";
 # LoadExtension = "/root/freeDiameter/extensions/test_rt_any.fdx";
-#LoadExtension = "/root/freeDiameter/extensions/test_app.fdx"
-#		: "/root/conf/freeDiameter/test_app.conf";
+
+LoadExtension = "/root/freeDiameter/extensions/test_app.fdx"
+		: "/root/conf/freeDiameter/test_app.conf";
+# LoadExtension = "/root/freeDiameter/extensions/dbg_interactive.fdx";
+
+
 LoadExtension = "/root/freeDiameter/extensions/rt_default.fdx"
 		: "/root/conf/freeDiameter/rtd.conf";
-LoadExtension = "/root/freeDiameter/extensions/dbg_interactive.fdx";
+ConnectPeer = "proxy.a.rt.testbed.aaa" ;
 		
+		
+# For failover testing:
+#ConnectPeer = "proxy.b.rt.testbed.aaa" ;
 
-# ConnectPeer = "serv.simple.testbed.aaa" ;
-ConnectPeer = "proxy.a.rt.testbed.aaa" ;
-ConnectPeer = "proxy.b.rt.testbed.aaa" ;
+# For redirect testing:
+ConnectPeer = "relay.a.rt.testbed.aaa" ;
+LoadExtension = "/root/freeDiameter/extensions/rt_redirect.fdx";
 
-
Index: conf/nas.a.rt.testbed.aaa/freeDiameter/rtd.conf
===================================================================
--- conf/nas.a.rt.testbed.aaa/freeDiameter/rtd.conf	(revision 12)
+++ conf/nas.a.rt.testbed.aaa/freeDiameter/rtd.conf	(revision 15)
@@ -1,3 +1,4 @@
-# Our local proxy is default route for all messages
+# Our local relay is default route for all messages
+* : "relay.a.rt.testbed.aaa" += 6; # This is "default + 1" so that it is prefered when possible
 * : "proxy.a.rt.testbed.aaa" += DEFAULT;
 * : "proxy.b.rt.testbed.aaa" += DEFAULT;
Index: conf/proxy.a.rt.testbed.aaa/freeDiameter/CMakeFlags
===================================================================
--- conf/proxy.a.rt.testbed.aaa/freeDiameter/CMakeFlags	(revision 14)
+++ conf/proxy.a.rt.testbed.aaa/freeDiameter/CMakeFlags	(revision 15)
@@ -1,3 +1,2 @@
--DBUILD_TEST_RT_ANY:BOOL=ON \
 -DBUILD_DBG_MONITOR:BOOL=ON \
 -DBUILD_DBG_RT:BOOL=ON \
Index: conf/proxy.a.rt.testbed.aaa/freeDiameter/freeDiameter.conf
===================================================================
--- conf/proxy.a.rt.testbed.aaa/freeDiameter/freeDiameter.conf	(revision 14)
+++ conf/proxy.a.rt.testbed.aaa/freeDiameter/freeDiameter.conf	(revision 15)
@@ -1,62 +1,22 @@
-# This is a sample configuration file for freeDiameter daemon.
 
-##############################################################
-#Identity = "aaa.koganei.wide.ad.jp";
-#Realm = "wide.ad.jp";
-
-##############################################################
-#Port = 3868;
-#SecPort = 3869;
-#TLS_old_method;
-#No_TCP;
-#No_SCTP;
-#Prefer_TCP;
-#SCTP_streams = 30;
 SCTP_streams = 3;
-
-##############################################################
-#No_IP;
-#No_IPv6;
-#ListenOn = "202.249.37.5";
-#ListenOn = "2001:200:903:2::202:1";
-#ListenOn = "fe80::21c:5ff:fe98:7d62%eth0";
-
-##############################################################
 TLS_Cred = "/root/ca_data/cert.pem" , "/root/ca_data/privkey.pem";
 TLS_CA = "/root/ca_data/ca.pem";
-# TLS_CRL = "/root/ca_data/crl.pem";
-
-#TLS_Prio = "NORMAL";
-#TLS_DH_Bits = 1024;
-
-##############################################################
-#TcTimer = 30;
-#TwTimer = 30;
-
-##############################################################
 #NoRelay;
 
-##############################################################
-#LoadExtension = "/path/to/extension" [ : "/optional/configuration/file" ] ;
-
-
-##############################################################
-#ConnectPeer = "diameterid" [ params... ] ;
-#   params: No_TCP; No_SCTP; No_IP; No_IPv6; Prefer_TCP; TLS_old_method; No_TLS;
-#           Port = 3868; TcTimer = 30; TwTimer = 30; ConnectTo = "202.249.37.5"; TLS_Prio = "NORMAL";
-
-
-##############################################################
 # -------- Test configuration ---------
 
 #LoadExtension = "/root/freeDiameter/extensions/dbg_monitor.fdx";
 #LoadExtension = "/root/freeDiameter/extensions/dbg_rt.fdx";
+#LoadExtension = "/root/freeDiameter/extensions/test_rt_any.fdx";
+
 LoadExtension = "/root/freeDiameter/extensions/acl_wl.fdx"
 		: "/root/conf/freeDiameter/acl_wl.conf";
-# LoadExtension = "/root/freeDiameter/extensions/test_rt_any.fdx";
 
+# For netemul tests:
 LoadExtension = "/root/freeDiameter/extensions/test_netemul.fdx"
 		: "/root/conf/freeDiameter/netemul.conf";
-		
+
 ConnectPeer = "proxy.b.rt.testbed.aaa" ;
+ConnectPeer = "serv.b.rt.testbed.aaa" ;
 
Index: conf/proxy.b.rt.testbed.aaa/freeDiameter/freeDiameter.conf
===================================================================
--- conf/proxy.b.rt.testbed.aaa/freeDiameter/freeDiameter.conf	(revision 14)
+++ conf/proxy.b.rt.testbed.aaa/freeDiameter/freeDiameter.conf	(revision 15)
@@ -1,58 +1,15 @@
-# This is a sample configuration file for freeDiameter daemon.
-
-##############################################################
-#Identity = "aaa.koganei.wide.ad.jp";
-#Realm = "wide.ad.jp";
-
-##############################################################
-#Port = 3868;
-#SecPort = 3869;
-#TLS_old_method;
-#No_TCP;
-#No_SCTP;
-#Prefer_TCP;
-#SCTP_streams = 30;
 SCTP_streams = 3;
-
-##############################################################
-#No_IP;
-#No_IPv6;
-#ListenOn = "202.249.37.5";
-#ListenOn = "2001:200:903:2::202:1";
-#ListenOn = "fe80::21c:5ff:fe98:7d62%eth0";
-
-##############################################################
 TLS_Cred = "/root/ca_data/cert.pem" , "/root/ca_data/privkey.pem";
 TLS_CA = "/root/ca_data/ca.pem";
-# TLS_CRL = "/root/ca_data/crl.pem";
-
-#TLS_Prio = "NORMAL";
-#TLS_DH_Bits = 1024;
-
-##############################################################
-#TcTimer = 30;
-#TwTimer = 30;
-
-##############################################################
 #NoRelay;
 
-##############################################################
-#LoadExtension = "/path/to/extension" [ : "/optional/configuration/file" ] ;
-
-
-##############################################################
-#ConnectPeer = "diameterid" [ params... ] ;
-#   params: No_TCP; No_SCTP; No_IP; No_IPv6; Prefer_TCP; TLS_old_method; No_TLS;
-#           Port = 3868; TcTimer = 30; TwTimer = 30; ConnectTo = "202.249.37.5"; TLS_Prio = "NORMAL";
-
-
-##############################################################
 # -------- Test configuration ---------
 
 #LoadExtension = "/root/freeDiameter/extensions/dbg_monitor.fdx";
 #LoadExtension = "/root/freeDiameter/extensions/dbg_rt.fdx";
+# LoadExtension = "/root/freeDiameter/extensions/test_rt_any.fdx";
+
 LoadExtension = "/root/freeDiameter/extensions/acl_wl.fdx"
 		: "/root/conf/freeDiameter/acl_wl.conf";
-# LoadExtension = "/root/freeDiameter/extensions/test_rt_any.fdx";
 
 LoadExtension = "/root/freeDiameter/extensions/test_netemul.fdx"
@@ -60,3 +17,4 @@
 		
 ConnectPeer = "proxy.a.rt.testbed.aaa" ;
-Realm = "a.rt.testbed.aaa" ;
+ConnectPeer = "serv.b.rt.testbed.aaa" ;
+# Realm = "a.rt.testbed.aaa" ;
Index: conf/relay.a.rt.testbed.aaa/freeDiameter/CMakeFlags
===================================================================
--- conf/relay.a.rt.testbed.aaa/freeDiameter/CMakeFlags	(revision 15)
+++ conf/relay.a.rt.testbed.aaa/freeDiameter/CMakeFlags	(revision 15)
@@ -0,0 +1,4 @@
+-DBUILD_APP_REDIRECT:BOOL=ON 
+-DBUILD_TESTING:BOOL=OFF 
+-DCMAKE_BUILD_TYPE:STRING=Debug 
+-DDEFAULT_CONF_PATH:PATH=/root/conf/freeDiameter
Index: conf/relay.a.rt.testbed.aaa/freeDiameter/ard.conf
===================================================================
--- conf/relay.a.rt.testbed.aaa/freeDiameter/ard.conf	(revision 15)
+++ conf/relay.a.rt.testbed.aaa/freeDiameter/ard.conf	(revision 15)
@@ -0,0 +1,1 @@
+# Redirects tests
Index: conf/relay.a.rt.testbed.aaa/freeDiameter/freeDiameter.conf
===================================================================
--- conf/relay.a.rt.testbed.aaa/freeDiameter/freeDiameter.conf	(revision 0)
+++ conf/relay.a.rt.testbed.aaa/freeDiameter/freeDiameter.conf	(revision 15)
@@ -1,58 +1,15 @@
-# This is a sample configuration file for freeDiameter daemon.
-
-##############################################################
-#Identity = "aaa.koganei.wide.ad.jp";
-#Realm = "wide.ad.jp";
-
-##############################################################
-#Port = 3868;
-#SecPort = 3869;
-#TLS_old_method;
-#No_TCP;
-#No_SCTP;
-#Prefer_TCP;
-#SCTP_streams = 30;
 SCTP_streams = 3;
-
-##############################################################
-#No_IP;
-#No_IPv6;
-#ListenOn = "202.249.37.5";
-#ListenOn = "2001:200:903:2::202:1";
-#ListenOn = "fe80::21c:5ff:fe98:7d62%eth0";
-
-##############################################################
 TLS_Cred = "/root/ca_data/cert.pem" , "/root/ca_data/privkey.pem";
 TLS_CA = "/root/ca_data/ca.pem";
-# TLS_CRL = "/root/ca_data/crl.pem";
-
-#TLS_Prio = "NORMAL";
-#TLS_DH_Bits = 1024;
-
-##############################################################
-#TcTimer = 30;
-#TwTimer = 30;
-
-##############################################################
 #NoRelay;
 
 ##############################################################
-#LoadExtension = "/path/to/extension" [ : "/optional/configuration/file" ] ;
 
-##############################################################
-#ConnectPeer = "diameterid" [ params... ] ;
-#   params: No_TCP; No_SCTP; No_IP; No_IPv6; Prefer_TCP; TLS_old_method; No_TLS;
-#           Port = 3868; TcTimer = 30; TwTimer = 30; ConnectTo = "202.249.37.5"; TLS_Prio = "NORMAL";
+# LoadExtension = "/root/freeDiameter/extensions/dbg_monitor.fdx";
+# LoadExtension = "/root/freeDiameter/extensions/dbg_rt.fdx";
 
+ConnectPeer = "nas.a.rt.testbed.aaa" ;
+ConnectPeer = "proxy.a.rt.testbed.aaa" ;
 
-##############################################################
-# -------- Test configuration ---------
-
-LoadExtension = "/root/freeDiameter/extensions/dbg_monitor.fdx";
-LoadExtension = "/root/freeDiameter/extensions/dbg_rt.fdx";
-# LoadExtension = "/root/freeDiameter/extensions/test_rt_any.fdx";
-#LoadExtension = "/root/freeDiameter/extensions/test_app.fdx"
-#		: "/root/conf/freeDiameter/test_app.conf";
-
-# ConnectPeer = "serv.simple.testbed.aaa" ;
-
+LoadExtension = "/root/freeDiameter/extensions/app_redirect.fdx"
+		: "/root/conf/freeDiameter/ard.conf";
Index: conf/serv.b.rt.testbed.aaa/freeDiameter/freeDiameter.conf
===================================================================
--- conf/serv.b.rt.testbed.aaa/freeDiameter/freeDiameter.conf	(revision 14)
+++ conf/serv.b.rt.testbed.aaa/freeDiameter/freeDiameter.conf	(revision 15)
@@ -1,50 +1,7 @@
-# This is a sample configuration file for freeDiameter daemon.
-
-##############################################################
-#Identity = "aaa.koganei.wide.ad.jp";
-#Realm = "wide.ad.jp";
-
-##############################################################
-#Port = 3868;
-#SecPort = 3869;
-#TLS_old_method;
-#No_TCP;
-#No_SCTP;
-#Prefer_TCP;
-#SCTP_streams = 30;
 SCTP_streams = 3;
-
-##############################################################
-#No_IP;
-#No_IPv6;
-#ListenOn = "202.249.37.5";
-#ListenOn = "2001:200:903:2::202:1";
-#ListenOn = "fe80::21c:5ff:fe98:7d62%eth0";
-
-##############################################################
 TLS_Cred = "/root/ca_data/cert.pem" , "/root/ca_data/privkey.pem";
 TLS_CA = "/root/ca_data/ca.pem";
-# TLS_CRL = "/root/ca_data/crl.pem";
-
-#TLS_Prio = "NORMAL";
-#TLS_DH_Bits = 1024;
-
-##############################################################
-#TcTimer = 30;
-#TwTimer = 30;
-
-##############################################################
 NoRelay;
 
-##############################################################
-#LoadExtension = "/path/to/extension" [ : "/optional/configuration/file" ] ;
-
-##############################################################
-#ConnectPeer = "diameterid" [ params... ] ;
-#   params: No_TCP; No_SCTP; No_IP; No_IPv6; Prefer_TCP; TLS_old_method; No_TLS;
-#           Port = 3868; TcTimer = 30; TwTimer = 30; ConnectTo = "202.249.37.5"; TLS_Prio = "NORMAL";
-
-
-##############################################################
 # -------- Test configuration ---------
 
@@ -52,4 +9,5 @@
 # LoadExtension = "/root/freeDiameter/extensions/dbg_rt.fdx";
 # LoadExtension = "/root/freeDiameter/extensions/test_rt_any.fdx";
+
 LoadExtension = "/root/freeDiameter/extensions/test_app.fdx"
 		: "/root/conf/freeDiameter/test_app.conf";
@@ -57,3 +15,2 @@
 ConnectPeer = "proxy.b.rt.testbed.aaa" ;
 ConnectPeer = "proxy.a.rt.testbed.aaa" ;
-
Index: conf/supauth.eap.testbed.aaa/wpasupplicant/wpa_supplicant.conf
===================================================================
--- conf/supauth.eap.testbed.aaa/wpasupplicant/wpa_supplicant.conf	(revision 7)
+++ conf/supauth.eap.testbed.aaa/wpasupplicant/wpa_supplicant.conf	(revision 15)
@@ -12,4 +12,5 @@
 	eap=TLS
 	identity="client@eap.testbed.aaa"
+#	identity="clientinvalid@eap.testbed.aaa"
 	ca_cert="/home/aaa/ca/ca_data/mgr.testbed.aaa/public/cacert.pem"
 	client_cert="/home/aaa/ca/ca_data/mgr.testbed.aaa/clients/client/cert.pem"
Index: mrb/routing_testbed.sh
===================================================================
--- mrb/routing_testbed.sh	(revision 0)
+++ mrb/routing_testbed.sh	(revision 15)
@@ -20,4 +20,6 @@
 	./vm_start.sh "rt-nas.a.rt.testbed.aaa" &
 	sleep 3
+	./vm_start.sh "rt-relay.a.rt.testbed.aaa" &
+	sleep 3
 	./vm_start.sh "rt-proxy.a.rt.testbed.aaa" &
 	sleep 3
@@ -34,4 +36,5 @@
 	./vm_pause.sh "rt-rtmgr.testbed.aaa" &
 	./vm_pause.sh "rt-nas.a.rt.testbed.aaa" &
+	./vm_pause.sh "rt-relay.a.rt.testbed.aaa" &
 	./vm_pause.sh "rt-proxy.a.rt.testbed.aaa" &
 	./vm_pause.sh "rt-proxy.b.rt.testbed.aaa" &
@@ -44,4 +47,5 @@
 	./vm_stop.sh "rt-rtmgr.testbed.aaa" &
 	./vm_stop.sh "rt-nas.a.rt.testbed.aaa" &
+	./vm_stop.sh "rt-relay.a.rt.testbed.aaa" &
 	./vm_stop.sh "rt-proxy.a.rt.testbed.aaa" &
 	./vm_stop.sh "rt-proxy.b.rt.testbed.aaa" &
Index: scripts/freeDiameter-install.sh
===================================================================
--- scripts/freeDiameter-install.sh	(revision 14)
+++ scripts/freeDiameter-install.sh	(revision 15)
@@ -2,5 +2,5 @@
 
 # Install dependencies for freeDiameter
-aptitude install flex bison libsctp1 libsctp-dev libgcrypt-dev libgcrypt11-dbg libgnutls26 libgnutls26-dbg libgnutls-dev mercurial cmake gdb python-dev swig
+aptitude install flex bison libsctp1 libsctp-dev libgcrypt-dev libgcrypt11-dbg libgnutls26 libgnutls26-dbg libgnutls-dev mercurial cmake gdb python-dev swig libidn11-dev
 
 # Install the link to the configuration
Index: scripts/freeDiameter-run.sh
===================================================================
--- scripts/freeDiameter-run.sh	(revision 0)
+++ scripts/freeDiameter-run.sh	(revision 15)
@@ -12,3 +12,3 @@
 
 echo fd-$HOST-$DATE.log > /home/aaa/logs/LATEST-$HOST-fd.log
-/root/freeDiameter/freeDiameter/freeDiameterd -dd $* 2>&1 | tee -i /home/aaa/logs/fd-$HOST-$DATE.log
+/root/freeDiameter/freeDiameterd/freeDiameterd -dd $* 2>&1 | tee -i /home/aaa/logs/fd-$HOST-$DATE.log
