diff options
| author | Luiz Augusto von Dentz <luiz.dentz@openbossa.org> | 2007-04-13 21:32:36 +0000 | 
|---|---|---|
| committer | Luiz Augusto von Dentz <luiz.dentz@openbossa.org> | 2007-04-13 21:32:36 +0000 | 
| commit | ecde90ac204a58ea86026a9f9b556a52ac15187f (patch) | |
| tree | d196a4655e64e6df521cadf0cc5f2b49588f04bf /network/server.c | |
| parent | 476855d7cdf0fc2259f1aab3946b9719e567a808 (diff) | |
Bring up interfaces on servers
Diffstat (limited to 'network/server.c')
| -rw-r--r-- | network/server.c | 12 | 
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 */ | 
