Hi Marcel
I worked out two patches(see attachment) to reimplement the gatway switching 
feature. The feature in current connman has some issues. See below bugs:
 Bug 2740 -  Can't get gateway when switch from wifi to ethernet networks
 Bug 2741 -  Can't get gateway when switch from wifi to ethernet networks
 Bug 3447 -  DNS information doesn't get refreshed correctly on changing 
networks
 Bug 3506 -  No default gateway route after wake up

The patch works like below:
 1. maintain a struct gateway_data list in connection.c
 
    my_ap 
gateway_data
  -------------
 | index     |
 |--------------|
 | gateway |
 |------------- | 
 | element |
 |--------------|
 | order      |
 |--------------| 
 | active     |
  --------------
       |
       |
      V
    ethernet 
gateway_data
  -------------
 | index     |
 |--------------|
 | gateway |
 |------------- | 
 | element |
 |--------------|
 | order      |
 |--------------| 
 | active     |
  --------------
       |
       |
      V
   bluetooth 
gateway_data
  -------------
 | index     |
 |--------------|
 | gateway |
 |------------- | 
 | element |
 |--------------|
 | order      |
 |--------------| 
 | active     |
  --------------

2. The handle of gateway_data list:
   1). When connection created,  the corresponing gateway_data is created and 
added into the list
   2). When connection removed,  the corresponing gateway_data is remove and 
freed from the list

3. The handle of gateway switch
   1). When new gateway_data is added into the list and it has the highest 
order, the active gateway will be switch to it. 
   2). When the gateway_data is removed and freed from list and it is the 
active gateway, the new gateway will be selected and activeated.
   3). If the services orders have been changed, __connman_upate_gateway() 
needs to be called to update the order of each gateway_data and reset the 
active gateway according to the new orders.

I have tried the patch and it can works fine. please review it. 

Attachment: add_connman_service_get_order.patch
Description: add_connman_service_get_order.patch

Attachment: gateway-switching.patch
Description: gateway-switching.patch

_______________________________________________
connman mailing list
[email protected]
http://lists.connman.net/listinfo/connman

Reply via email to