Re: Auto Connect through NetworkManager



Hi,
    I met this problem also. I have a related mail. The subject is:
"Question in function nm_device_state_changed()"
about this issue. After fix the function
nm_device_state_changed(NMDevice *device, NMDeviceState state,                          NMDeviceStateReason reason):

Then we can add below codes to solve this:
src/NetworkManagerPolicy.c
static void device_state_changed (NMDevice *device,
                      NMDeviceState new_state,
                      NMDeviceState old_state,
                      NMDeviceStateReason reason,
                      gpointer user_data)
{
    ...
    switch (new_state) {
    case NM_DEVICE_STATE_FAILED:
        ....
        schedule_activate_check (policy, device);
        break;
    case NM_DEVICE_STATE_ACTIVATED:
        ....
        break;
    case NM_DEVICE_STATE_UNMANAGED:
    case NM_DEVICE_STATE_UNAVAILABLE:
    case NM_DEVICE_STATE_DISCONNECTED:
        update_routing_and_dns (policy, FALSE);
/* Add this check to avoid auto connect if user disconnect the connection*/
        if(reason != NM_DEVICE_STATE_REASON_USER_REQUESTED)
                    schedule_activate_check (policy, device);
        break;
    default:
        break;
    }
}

Or another way, in specific device(e.g. GSM):
1.  In device_state_changed() function, set a reason flag when *NM_DEVICE_STATE_REASON_USER_REQUESTED* reason found.
2.  Reload the *can_activate* function check the reason flag, if it is user disconnect, return false.

Above just what I thought to resolve this problem. Of course, need Dan give us the best solution.



2009/5/13 sanjeev sharma <sanjeevsharmaengg gmail com>
Hi All,

Is there any possibility to Disable "Auto Connect" through
NetworkManager Code. in my Scenario If "Auto Connect"  Is enabled In
GSM Profile and User Click on Disconnect button then I wanted to Set
"Auto Connect" flag disabled so networkManager won't retry to Start
Connection again.

I don't want to change "Auto Connect" manually through Connection
editior because during resume my System has been checking mail and its
will start Connection if only Auto Connect is set.

Through some pointer on it.

sanjeev sharma
_______________________________________________
NetworkManager-list mailing list
NetworkManager-list gnome org
http://mail.gnome.org/mailman/listinfo/networkmanager-list



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]