summaryrefslogtreecommitdiff
path: root/plugins/ethernet.c
diff options
context:
space:
mode:
authorMarcel Holtmann <marcel@holtmann.org>2009-06-26 12:32:28 +0200
committerMarcel Holtmann <marcel@holtmann.org>2009-06-26 12:32:28 +0200
commitbbc1841b958afea4a1c528cd88af3ff97fc9e8a8 (patch)
tree2dd3a3ca7d712ef1ad0fe624eef909910ac8c4f8 /plugins/ethernet.c
parentf1377fbb653b5dfd0dfdec47c44a11a6365866ce (diff)
downloadconnman-bbc1841b958afea4a1c528cd88af3ff97fc9e8a8.tar.gz
connman-bbc1841b958afea4a1c528cd88af3ff97fc9e8a8.tar.bz2
connman-bbc1841b958afea4a1c528cd88af3ff97fc9e8a8.zip
Add support for connect/disconnect on Ethernet devices
Diffstat (limited to 'plugins/ethernet.c')
-rw-r--r--plugins/ethernet.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/plugins/ethernet.c b/plugins/ethernet.c
index 30132713..2851bf50 100644
--- a/plugins/ethernet.c
+++ b/plugins/ethernet.c
@@ -129,6 +129,34 @@ static int ethernet_disable(struct connman_device *device)
return connman_inet_ifdown(ethernet->index);
}
+static int ethernet_connect(struct connman_device *device)
+{
+ struct ethernet_data *ethernet = connman_device_get_data(device);
+
+ DBG("device %p", device);
+
+ if (!(ethernet->flags & IFF_LOWER_UP))
+ return -ENOTCONN;
+
+ connman_device_set_carrier(device, TRUE);
+
+ return 0;
+}
+
+static int ethernet_disconnect(struct connman_device *device)
+{
+ struct ethernet_data *ethernet = connman_device_get_data(device);
+
+ DBG("device %p", device);
+
+ if (!(ethernet->flags & IFF_LOWER_UP))
+ return -ENOTCONN;
+
+ connman_device_set_carrier(device, FALSE);
+
+ return 0;
+}
+
static struct connman_device_driver ethernet_driver = {
.name = "ethernet",
.type = CONNMAN_DEVICE_TYPE_ETHERNET,
@@ -136,6 +164,8 @@ static struct connman_device_driver ethernet_driver = {
.remove = ethernet_remove,
.enable = ethernet_enable,
.disable = ethernet_disable,
+ .connect = ethernet_connect,
+ .disconnect = ethernet_disconnect,
};
static int ethernet_init(void)