Hi,

On Fri, 2015-05-22 at 09:58 +0530, Saurav Babu wrote:
> <EP-584CD5AB95AE4A3A879836122994DB42>
> 
> >> > So, in which cases does this issue manifest itself? From the code we can
> >> > read what it does, but what is causing an IP address to change to
> >> > something else? What's the use case and environment for this to happen?
> >> 
> >> Here MAC Address is changing. Below is scenario:
> >>  1. Ethernet is up with some MAC Address and connman creates ipdevice
> >> with that address
> >>  2. After some time if MAC Address is changed then MAC Address is not
> >> updated in connman
> >>  3. When "Ethernet" property of service is obtained then it returns
> >> initial MAC address, not the updated one.
> >> 
> >>  I'm not sure if it is a valid case where device's MAC Address is
> >> changed but in Ubuntu  you can cross check by updating MAC address for
> >> ethernet using "ifconfig" and then  getting service property using
> >> connmanctl.
> >> 
> >>  In my case there is a device where MAC Address is set by some other
> >> process which sometimes  starts after connman is started. Initially
> >> MAC Address for ethernet is set as FF:FF:FF:FF:FF:FF by kernel. But
> >> after MAC Address is updated by other process it is not reflected in
> >> connman's service.
> 
> > If the MAC address changes, the current service needs to be
> > disconnected, as another one may have a different IP address
> > configuration method defined based on the MAC address. Either that other
> > service exists saved to disk or matched from another
> > pre-provisioned .config file.
> >
> > So once the MAC address changes, one needs to disconnect the existing
> > service and have ConnMan apply the correct settings according to that
> > new MAC address.
> 
>  Disconnecting the service doesn't change the Ethernet property of service.
>  I had a service named ethernet_e8039a65a6fc_cable with MAC Address 
> E8:03:9A:65:A6:FC
>  Service's ethernet property was
>  "Ethernet = [ Method=auto, Interface=eth0, Address=E8:03:9A:65:A6:FC, 
> MTU=1500 ]"
>  Now when I changed the MAC Address for ethernet using ifconfig
>  "ifconfig eth0 hw ether 00:11:22:33:44:55"
>  Service's ethernet property remained same
>  "Ethernet = [ Method=auto, Interface=eth0, Address=E8:03:9A:65:A6:FC, 
> MTU=1500 ]"
> 
>  Even after I disconnected the service using connmanctl then also it remained 
> the same
> 
>  I even tried to disable and enable ethernet but with no success, Address in 
> Ethernet
>  property was never updated to the newer one.

In src/ipdevice.c, __connman_ipconfig_newlink(), after ConnMan has found
an ipdevice with ipdevice = g_hash_table_lookup(ipdevice_hash,
GINT_TO_POINTER(index)); one apparently needs to perform another
additional check that the MAC address is (still) the same as previously.
If the MAC address in newlink is equal to ipdevice->address, all is fine
and the code can do a goto update;

If the MAC address has changed, the newlink event will turn into the
same set of actions as a dellink. And after that the event will continue
as a newlink, now without an ipdevice so that a new network and service
will be generated.

All this because:
 - a .config file can match against the new MAC address
 - settings may already be saved against the new MAC address, which is
   used as a part of the (network and) service identifier
 - if ConnMan is restarted after a MAC address change, it will not know
   about the previously existing MAC address and matches anyway against
   .config files and/or saved settings using the "new" MAC address. Here
   the behavior would be inconsistent, so a change in MAC address should
   lead to the same behavior whether ConnMan was running or not.

Cheers,

        Patrik


_______________________________________________
connman mailing list
connman@connman.net
https://lists.connman.net/mailman/listinfo/connman

Reply via email to