+static int eth_tech_probe(struct connman_technology *technology)
+{
+ return 0;
+}
+
+static void eth_tech_remove(struct connman_technology *technology)
+{
+ DBG("");
+}
+
+static GList *eth_interface_list = NULL;
+
+static void eth_tech_add_interface(struct connman_technology *technology,
+ int index, const char *name, const char *ident)
+{
+ DBG("index %d name %s ident %s", index, name, ident);
+
+ if (g_list_find(eth_interface_list, GINT_TO_POINTER((int)index)))
+ return;
+
+ eth_interface_list = g_list_prepend(eth_interface_list,
+ (GINT_TO_POINTER((int) index)));
+}
+
+static void eth_tech_remove_interface(struct connman_technology *technology,
+ int index)
+{
+ DBG("index %d", index);
+
+ eth_interface_list = g_list_remove(eth_interface_list,
+ GINT_TO_POINTER((int) index));
+}
+
+static void eth_tech_enable_tethering(struct connman_technology *technology,
+ const char *bridge)
+{
+ GList *list;
+ struct ethernet_data *ethernet;
+
+ 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_technology_tethering_notify(technology, true);
+
+ connman_inet_ifup(index);
+
+ connman_inet_add_to_bridge(index, bridge);
+
+ eth_tethering = true;
+ }
+}
+
+static void eth_tech_disable_tethering(struct connman_technology *technology,
+ const char *bridge)
+{
+ GList *list;
+
+ 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);
+
+ connman_inet_remove_from_bridge(index, bridge);
+
+ connman_technology_tethering_notify(technology, false);
+
+ if (device)
+ connman_device_reconnect_service(device);
+
+ eth_tethering = false;
+ }
+}
+
+static int eth_tech_set_tethering(struct connman_technology *technology,
+ const char *identifier, const char *passphrase,
+ const char *bridge, bool enabled)
+{
+ if (!connman_technology_is_tethering_allowed(
+ CONNMAN_SERVICE_TYPE_ETHERNET))
+ return 0;
+
+ DBG("bridge %s enabled %d", bridge, enabled);
+
+ if (enabled)
+ eth_tech_enable_tethering(technology, bridge);
+ else
+ eth_tech_disable_tethering(technology, bridge);
+
+ return 0;
+}
+
+static struct connman_technology_driver eth_tech_driver = {
+ .name = "ethernet",
+ .type = CONNMAN_SERVICE_TYPE_ETHERNET,
+ .probe = eth_tech_probe,
+ .remove = eth_tech_remove,
+ .add_interface = eth_tech_add_interface,
+ .remove_interface = eth_tech_remove_interface,
+ .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
+