![]() |
2010-05-10
, 14:31
|
Posts: 726 |
Thanked: 345 times |
Joined on Apr 2010
@ Sweden
|
#2
|
![]() |
2010-05-10
, 14:34
|
|
Posts: 4,384 |
Thanked: 5,524 times |
Joined on Jul 2007
@ ˙ǝɹǝɥʍou
|
#3
|
![]() |
2010-05-10
, 14:57
|
Posts: 726 |
Thanked: 345 times |
Joined on Apr 2010
@ Sweden
|
#4
|
But as long as the clients are running sessions that are attached to the virtual interface, a vpn reconnection shouldn't reset their connection, no?
![]() |
2010-05-10
, 15:06
|
Posts: 74 |
Thanked: 34 times |
Joined on Jan 2008
|
#5
|
![]() |
2010-05-10
, 15:11
|
Posts: 3,841 |
Thanked: 1,079 times |
Joined on Nov 2006
|
#6
|
![]() |
2010-05-10
, 15:12
|
Posts: 726 |
Thanked: 345 times |
Joined on Apr 2010
@ Sweden
|
#7
|
![]() |
2010-05-10
, 15:23
|
Posts: 74 |
Thanked: 34 times |
Joined on Jan 2008
|
#8
|
That's something else, I'd say. And much easier, if I were to guess.
I'm sure there are dbus messages sent when a new connection is established. If you register to listen for them, you can (re)start the VPN connection when you want to.
![]() |
2010-05-10
, 15:27
|
Posts: 726 |
Thanked: 345 times |
Joined on Apr 2010
@ Sweden
|
#9
|
yes I tried using dbus-scripts for this. but if I move from 3G to wifi I first get a msg about connecting to the wifi then I get an idle from 3G. so according to the last msg I close the openvpn service.
how can I know if there is actually still a connection to the WAN?
![]() |
2010-05-11
, 14:15
|
Posts: 74 |
Thanked: 34 times |
Joined on Jan 2008
|
#10
|
Eh? That's a state machine with two states: connected and not connected. The connected state has one attribute: what am I connected to?
So, if you've moved from "not connected" to "connected" with the attribute set to "wifi", and get a message from the 3G module, you can just ignore that.
Or am I missing something here?
#! /bin/sh # /etc/openvpn/dbus.openvpn # This script is invoked by dbus-scripts when connection changes # state. LOG=/var/log/dbus.openvpn.log STATUS_FILE=/var/log/dbus.openvpn-status DAEMON="/etc/init.d/openvpn" NAME="dbusScriptsOpenvpn" DESC="Sipn openvpn deam up and down by dbus-scripts" CONN_STATE=/etc/openvpn/connected # Connection serial in saved connection database CONN_ID=$5 #$6 is GPRS or WLAN_INFRA or WLAN_ADHOC TYPE=$6 STATUS=$7 Count=0 for arg ; do Count=$(( $Count + 1 )) echo "Parameter $Count = '$arg'" >>$LOG done test -f $DAEMON || exit 0 #current connection state is "connected" if test -f $CONN_STATE ; then if test "x$STATUS" = "xCONNECTED" ; then if test $CONN_ID = '78967400-a235-4a4e-91d2-9ca80c250247' ; then echo "Home lan sensed. killing openvpn" >>$LOG $DAEMON stop >>$LOG rm -r $CONN_STATE elif ! grep -q $TYPE $CON_FLAG ; then $DAEMON restart >>$LOG echo $TYPE > $CONN_STATE else $DAEMON restart >>$LOG fi elif test "x$STATUS" = "xIDLE" ; then if grep -q $TYPE $CON_FLAG ; then echo "current connection went idle , killing openvpn" $DAEMON stop >>$LOG rm -r $CONN_STATE fi else echo "Error: got this status: $STATUS while being connected" >>$LOG fi #current connection state is "not connected" elif test "x$STATUS" = "xCONNECTED" ; then #if connected to home access point dont run openvpn if test $CONN_ID = '78967400-a235-4a4e-91d2-9ca80c250247' ; then echo "Home lan sensed. leaving not connected" >>$LOG else echo "Starting $DESC:" >>$LOG $DAEMON start >>$LOG if [ "$?" -ne 0 ];then echo $TYPE > $CONN_STATE fi fi elif test "x$STATUS" = "xSCAN_START" -o "x$STATUS" = "xSCAN_STOP" ; then echo . elif test "x$STATUS" = "xCONNECTING" -o "x$STATUS" = "xDISCONNECTING" ; then echo . else echo "Error in calling /etc/openvpn/dbus.openvpn" >>$LOG fi # wget http://www.whatismyip.com -T 10 -O - -o /dev/null # if [ "$?" -ne 0 ];then # $DAEMON stop >>$LOG # echo "failed to access inet" >>$LOG # fi exit 0
Stopping virtual private network daemon:. Starting virtual private network daemon: openvpnParameter 1 = ':1.81' Parameter 2 = 'null' Parameter 3 = 'com.nokia.icd' Parameter 4 = 'status_changed' Parameter 5 = '1c7096bb-1788-487c-8c5c-3998e7b99fde' Parameter 6 = 'WLAN_INFRA' Parameter 7 = 'DISCONNECTING' Parameter 8 = 'com.nokia.icd.error.network_error' Error: got this status: DISCONNECTING while being connected Parameter 1 = ':1.81' Parameter 2 = 'null' Parameter 3 = 'com.nokia.icd' Parameter 4 = 'status_changed' Parameter 5 = '1c7096bb-1788-487c-8c5c-3998e7b99fde' Parameter 6 = 'WLAN_INFRA' Parameter 7 = 'IDLE' Parameter 8 = 'com.nokia.icd.error.network_error' Parameter 1 = ':1.81' Parameter 2 = 'null' Parameter 3 = 'com.nokia.icd' Parameter 4 = 'status_changed' Parameter 5 = '[SCAN]' Parameter 6 = 'GPRS' Parameter 7 = 'SCAN_START' Parameter 8 = '' Error: got this status: SCAN_START while being connected Parameter 1 = ':1.81' Parameter 2 = 'null' Parameter 3 = 'com.nokia.icd' Parameter 4 = 'status_changed' Parameter 5 = '[SCAN]' Parameter 6 = 'WLAN_INFRA' Parameter 7 = 'SCAN_START' Parameter 8 = '' Error: got this status: SCAN_START while being connected Parameter 1 = ':1.81' Parameter 2 = 'null' Parameter 3 = 'com.nokia.icd' Parameter 4 = 'status_changed' Parameter 5 = '[SCAN]' Parameter 6 = 'WLAN_ADHOC' Parameter 7 = 'SCAN_START' Parameter 8 = '' Error: got this status: SCAN_START while being connected Parameter 1 = ':1.81' Parameter 2 = 'null' Parameter 3 = 'com.nokia.icd' Parameter 4 = 'status_changed' Parameter 5 = '[SCAN]' Parameter 6 = 'GPRS' Parameter 7 = 'SCAN_STOP' Parameter 8 = '' Error: got this status: SCAN_STOP while being connected Parameter 1 = ':1.81' Parameter 2 = 'null' Parameter 3 = 'com.nokia.icd' Parameter 4 = 'status_changed' Parameter 5 = '7bc55dda-a470-4885-a802-c119f9ad4f88' Parameter 6 = 'GPRS' Parameter 7 = 'CONNECTING' Parameter 8 = '' Error: got this status: CONNECTING while being connected Parameter 1 = ':1.81' Parameter 2 = 'null' Parameter 3 = 'com.nokia.icd' Parameter 4 = 'status_changed' Parameter 5 = '[SCAN]' Parameter 6 = 'WLAN_INFRA' Parameter 7 = 'SCAN_STOP' Parameter 8 = '' Error: got this status: SCAN_STOP while being connected Parameter 1 = ':1.81' Parameter 2 = 'null' Parameter 3 = 'com.nokia.icd' Parameter 4 = 'status_changed' Parameter 5 = '[SCAN]' Parameter 6 = 'WLAN_ADHOC' Parameter 7 = 'SCAN_STOP' Parameter 8 = '' Error: got this status: SCAN_STOP while being connected Parameter 1 = ':1.81' Parameter 2 = 'null' Parameter 3 = 'com.nokia.icd' Parameter 4 = 'status_changed' Parameter 5 = '7bc55dda-a470-4885-a802-c119f9ad4f88' Parameter 6 = 'GPRS' Parameter 7 = 'CONNECTED' Parameter 8 = '' Stopping virtual private network daemon:. Starting virtual private network daemon: openvpnParameter 1 = ':1.81' Parameter 2 = 'null' Parameter 3 = 'com.nokia.icd' Parameter 4 = 'status_changed' Parameter 5 = '[SCAN]' Parameter 6 = 'WLAN_INFRA' Parameter 7 = 'SCAN_START' Parameter 8 = '' Error: got this status: SCAN_START while being connected Parameter 1 = ':1.81' Parameter 2 = 'null' Parameter 3 = 'com.nokia.icd' Parameter 4 = 'status_changed' Parameter 5 = '[SCAN]' Parameter 6 = 'WLAN_ADHOC' Parameter 7 = 'SCAN_START' Parameter 8 = '' Error: got this status: SCAN_START while being connected Parameter 1 = ':1.81' Parameter 2 = 'null' Parameter 3 = 'com.nokia.icd' Parameter 4 = 'status_changed' Parameter 5 = '[SCAN]' Parameter 6 = 'GPRS' Parameter 7 = 'SCAN_START' Parameter 8 = '' Error: got this status: SCAN_START while being connected Parameter 1 = ':1.81' Parameter 2 = 'null' Parameter 3 = 'com.nokia.icd' Parameter 4 = 'status_changed' Parameter 5 = '[SCAN]' Parameter 6 = 'GPRS' Parameter 7 = 'SCAN_STOP' Parameter 8 = '' Error: got this status: SCAN_STOP while being connected Parameter 1 = ':1.81' Parameter 2 = 'null' Parameter 3 = 'com.nokia.icd' Parameter 4 = 'status_changed' Parameter 5 = '[SCAN]' Parameter 6 = 'WLAN_INFRA' Parameter 7 = 'SCAN_STOP' Parameter 8 = '' Error: got this status: SCAN_STOP while being connected Parameter 1 = ':1.81' Parameter 2 = 'null' Parameter 3 = 'com.nokia.icd' Parameter 4 = 'status_changed' Parameter 5 = '[SCAN]' Parameter 6 = 'WLAN_ADHOC' Parameter 7 = 'SCAN_STOP' Parameter 8 = '' Error: got this status: SCAN_STOP while being connected Parameter 1 = ':1.81' Parameter 2 = 'null' Parameter 3 = 'com.nokia.icd' Parameter 4 = 'status_changed' Parameter 5 = '1c7096bb-1788-487c-8c5c-3998e7b99fde' Parameter 6 = 'WLAN_INFRA' Parameter 7 = 'CONNECTING' Parameter 8 = '' Error: got this status: CONNECTING while being connected Parameter 1 = ':1.81' Parameter 2 = 'null' Parameter 3 = 'com.nokia.icd' Parameter 4 = 'status_changed' Parameter 5 = '7bc55dda-a470-4885-a802-c119f9ad4f88' Parameter 6 = 'GPRS' Parameter 7 = 'DISCONNECTING' Parameter 8 = '' Error: got this status: DISCONNECTING while being connected Parameter 1 = ':1.81' Parameter 2 = 'null' Parameter 3 = 'com.nokia.icd' Parameter 4 = 'status_changed' Parameter 5 = '1c7096bb-1788-487c-8c5c-3998e7b99fde' Parameter 6 = 'WLAN_INFRA' Parameter 7 = 'CONNECTED' Parameter 8 = '' Stopping virtual private network daemon:. Starting virtual private network daemon: openvpnParameter 1 = ':1.81' Parameter 2 = 'null' Parameter 3 = 'com.nokia.icd' Parameter 4 = 'status_changed' Parameter 5 = '7bc55dda-a470-4885-a802-c119f9ad4f88' Parameter 6 = 'GPRS' Parameter 7 = 'IDLE' Parameter 8 = ''
The Following User Says Thank You to niv For This Useful Post: | ||
did anyone managed to sustain openvpn after switching to 3G connection?
Niv