summaryrefslogtreecommitdiffstats
path: root/network
diff options
context:
space:
mode:
authorLuiz Augusto von Dentz <luiz.dentz@openbossa.org>2007-04-13 21:32:36 +0000
committerLuiz Augusto von Dentz <luiz.dentz@openbossa.org>2007-04-13 21:32:36 +0000
commitecde90ac204a58ea86026a9f9b556a52ac15187f (patch)
treed196a4655e64e6df521cadf0cc5f2b49588f04bf /network
parent476855d7cdf0fc2259f1aab3946b9719e567a808 (diff)
Bring up interfaces on servers
Diffstat (limited to 'network')
-rw-r--r--network/server.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/network/server.c b/network/server.c
index 2e6ae84c..aaa14b41 100644
--- a/network/server.c
+++ b/network/server.c
@@ -30,6 +30,8 @@
#include <stdlib.h>
#include <errno.h>
#include <sys/socket.h>
+#include <sys/ioctl.h>
+#include <net/if.h>
#include <bluetooth/bluetooth.h>
#include <bluetooth/bnep.h>
@@ -266,7 +268,8 @@ static void authorization_callback(DBusPendingCall *pcall, void *data)
char devname[16];
DBusError derr;
uint16_t response;
- int sk;
+ int sk, sd;
+ struct ifreq ifr;
if (!ns->pauth) {
dbus_message_unref(reply);
@@ -306,6 +309,13 @@ static void authorization_callback(DBusPendingCall *pcall, void *data)
goto failed;
}
+ sd = socket(AF_INET6, SOCK_DGRAM, 0);
+ strcpy(ifr.ifr_name, devname);
+ ifr.ifr_flags |= IFF_UP;
+ if((ioctl(sd, SIOCSIFFLAGS, (caddr_t)&ifr)) == -1) {
+ error("Could not bring up %d", devname);
+ }
+
/* FIXME: Enable routing if applied */
/* FIXME: send the D-Bus message to notify the new bnep iface */