diff options
author | Marcel Holtmann <marcel@holtmann.org> | 2009-06-26 12:32:28 +0200 |
---|---|---|
committer | Marcel Holtmann <marcel@holtmann.org> | 2009-06-26 12:32:28 +0200 |
commit | bbc1841b958afea4a1c528cd88af3ff97fc9e8a8 (patch) | |
tree | 2dd3a3ca7d712ef1ad0fe624eef909910ac8c4f8 /plugins/ethernet.c | |
parent | f1377fbb653b5dfd0dfdec47c44a11a6365866ce (diff) | |
download | connman-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.c | 30 |
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) |