summaryrefslogtreecommitdiff
path: root/plugins/ethernet.c
diff options
context:
space:
mode:
authorNishant Chaprana <n.chaprana@samsung.com>2018-08-10 11:11:37 (GMT)
committerNishant Chaprana <n.chaprana@samsung.com>2018-08-24 04:50:11 (GMT)
commitd04bfa0350781ebfb8cbb2e64fabdfb2f36cd302 (patch)
tree750ce9bb53579e1ee54d91aa3a6c976e55f1a8db /plugins/ethernet.c
parent037a4a5e75f3fc0845a924bb94addc2549550e63 (diff)
downloadconnman-d04bfa0350781ebfb8cbb2e64fabdfb2f36cd302.zip
connman-d04bfa0350781ebfb8cbb2e64fabdfb2f36cd302.tar.gz
connman-d04bfa0350781ebfb8cbb2e64fabdfb2f36cd302.tar.bz2
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.c65
1 files changed, 65 insertions, 0 deletions
diff --git a/plugins/ethernet.c b/plugins/ethernet.c
index 9a4d741..aadfe89 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(&eth_mesh_driver);
+ if (err < 0)
+ return err;
+#endif
+
err = connman_network_driver_register(&eth_network_driver);
if (err < 0)
return err;
@@ -455,6 +516,10 @@ static void ethernet_exit(void)
{
connman_technology_driver_unregister(&eth_tech_driver);
+#if defined TIZEN_EXT_WIFI_MESH
+ connman_mesh_eth_driver_unregister(&eth_mesh_driver);
+#endif
+
connman_network_driver_unregister(&eth_network_driver);
connman_device_driver_unregister(&eth_dev_driver);