Re: autoconnect in Network manager



On Wednesday 24 of November 2010 03:57:09 pan son wrote:
> Hi,
> 
> I am writing my own client to NetworkManager and wanted to know how
> NetworkManager selects a network to connect to.
> 
> I am maintaining the connection parameters using gconf, and I see that the
> NetworkManager always connects to the very first network I connected to,
> even-though I am updating the connection for the connected AP, periodically
> same as nm-applet does.
> 
> What prompts the NetworkManager to connect to the most recent network?
> 
> Thanks,
> Pan

NetworkManager sorts the connection list according the timestamps and then
selects the first connection that matches the device (i.e. last used).
See connections_to_slist() and connection_sort() in src/nm-manager.c

activating:
-> src/nm-policy.c:auto_activate_device()
  -> src/nm-device.c:nm_device_get_best_auto_connection()
    -> get_best_auto_connection, which is src/nm-device-wifi.c: 
real_get_best_auto_connection() (in case of wireless)

I suggest you check you've stored and updated timestamps correctly:
e.g.
$ nmcli -f all con list

Jirka


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