diff options
author | Nishant Chaprana <n.chaprana@samsung.com> | 2018-08-10 16:41:37 +0530 |
---|---|---|
committer | Nishant Chaprana <n.chaprana@samsung.com> | 2018-08-24 10:20:11 +0530 |
commit | d04bfa0350781ebfb8cbb2e64fabdfb2f36cd302 (patch) | |
tree | 750ce9bb53579e1ee54d91aa3a6c976e55f1a8db /plugins/ethernet.c | |
parent | 037a4a5e75f3fc0845a924bb94addc2549550e63 (diff) | |
download | connman-d04bfa0350781ebfb8cbb2e64fabdfb2f36cd302.tar.gz connman-d04bfa0350781ebfb8cbb2e64fabdfb2f36cd302.tar.bz2 connman-d04bfa0350781ebfb8cbb2e64fabdfb2f36cd302.zip |
[connman] Added Tizen Wi-Fi Meshsubmit/tizen/20180824.072908
Change-Id: Iec2ec99fb7d4fc6d9c0539e5a9e7c903e1969580
Signed-off-by: Nishant Chaprana <n.chaprana@samsung.com>
Diffstat (limited to 'plugins/ethernet.c')
-rw-r--r--[-rwxr-xr-x] | plugins/ethernet.c | 65 |
1 files changed, 65 insertions, 0 deletions
diff --git a/plugins/ethernet.c b/plugins/ethernet.c index 9a4d7413..aadfe897 100755..100644 --- a/plugins/ethernet.c +++ b/plugins/ethernet.c @@ -48,6 +48,9 @@ #include <connman/rtnl.h> #include <connman/log.h> #include <connman/setting.h> +#if defined TIZEN_EXT_WIFI_MESH +#include <connman/mesh.h> +#endif static bool eth_tethering = false; @@ -252,6 +255,10 @@ static void ethernet_newlink(unsigned flags, unsigned change, void *user_data) } else { DBG("carrier off"); remove_network(device, ethernet); +#if defined TIZEN_EXT_WIFI_MESH + /* Remove ethernet from mesh bridge */ + __connman_mesh_remove_ethernet_from_bridge(); +#endif } } @@ -430,6 +437,54 @@ static struct connman_technology_driver eth_tech_driver = { .set_tethering = eth_tech_set_tethering, }; +#if defined TIZEN_EXT_WIFI_MESH +static int eth_mesh_add_to_bridge(const char *bridge) +{ + GList *list; + struct ethernet_data *ethernet; + + DBG("Add ethernet to bridge %s", bridge); + + for (list = eth_interface_list; list; list = list->next) { + int index = GPOINTER_TO_INT(list->data); + struct connman_device *device = + connman_device_find_by_index(index); + + if (device) { + ethernet = connman_device_get_data(device); + if (ethernet) + remove_network(device, ethernet); + } + + connman_inet_ifup(index); + + connman_inet_add_to_bridge(index, bridge); + } + + return 0; +} + +static int eth_mesh_remove_from_bridge(const char *bridge) +{ + GList *list; + + DBG("Remove ethernet from bridge %s", bridge); + + for (list = eth_interface_list; list; list = list->next) { + int index = GPOINTER_TO_INT(list->data); + + connman_inet_remove_from_bridge(index, bridge); + } + + return 0; +} + +static struct connman_mesh_eth_driver eth_mesh_driver = { + .add_to_bridge = eth_mesh_add_to_bridge, + .remove_from_bridge = eth_mesh_remove_from_bridge, +}; +#endif + static int ethernet_init(void) { int err; @@ -438,6 +493,12 @@ static int ethernet_init(void) if (err < 0) return err; +#if defined TIZEN_EXT_WIFI_MESH + err = connman_mesh_eth_driver_register(ð_mesh_driver); + if (err < 0) + return err; +#endif + err = connman_network_driver_register(ð_network_driver); if (err < 0) return err; @@ -455,6 +516,10 @@ static void ethernet_exit(void) { connman_technology_driver_unregister(ð_tech_driver); +#if defined TIZEN_EXT_WIFI_MESH + connman_mesh_eth_driver_unregister(ð_mesh_driver); +#endif + connman_network_driver_unregister(ð_network_driver); connman_device_driver_unregister(ð_dev_driver); |