diff -urN openswan-2.4.13-orig/programs/_updown/_updown.in openswan-2.4.13/programs/_updown/_updown.in
--- openswan-2.4.13-orig/programs/_updown/_updown.in	2011-04-27 10:45:25.000000000 +0800
+++ openswan-2.4.13/programs/_updown/_updown.in	2011-04-27 15:10:24.000000000 +0800
@@ -422,7 +422,9 @@
 					route add default dev $PLUTO_INTERFACE
 					flush-ipconntrack &
 				fi
-				
+				[ -z "$(uci -q -P /var/state get network.ipsecup)" ] && uci -q -P /var/state set network.ipsecup=ipsec_up
+				VPNUP=$(cat /proc/uptime | awk '{print $1}')
+				uci -q -P /var/state set network.ipsecup.$PLUTO_CONNECTION=$VPNUP
 				/sbin/ipsec_static_route add $said $PLUTO_PEER $PLUTO_MY_CLIENT $PLUTO_PEER_CLIENT $PLUTO_CONNECTION
 			;;
 			del)
@@ -447,7 +449,7 @@
 				[ "$del_eroute" == "1" ] && {
 					ipsec eroute --del --eraf inet --src $PLUTO_MY_CLIENT --dst 0.0.0.0/0
 				}
-				
+				uci -q -P /var/state revert network.ipsecup.$PLUTO_CONNECTION
 				/sbin/ipsec_static_route del tun0x0000 $PLUTO_PEER $PLUTO_MY_CLIENT $PLUTO_PEER_CLIENT $PLUTO_CONNECTION
 			;;
 			esac
