SOURCES: bluez-utils-bnep_ifup.patch (NEW) -from http://blueman.tuxfamily.org

wolvverine wolvverine at pld-linux.org
Fri May 23 20:12:54 CEST 2008


Author: wolvverine                   Date: Fri May 23 18:12:54 2008 GMT
Module: SOURCES                       Tag: HEAD
---- Log message:
-from http://blueman.tuxfamily.org

---- Files affected:
SOURCES:
   bluez-utils-bnep_ifup.patch (NONE -> 1.1)  (NEW)

---- Diffs:

================================================================
Index: SOURCES/bluez-utils-bnep_ifup.patch
diff -u /dev/null SOURCES/bluez-utils-bnep_ifup.patch:1.1
--- /dev/null	Fri May 23 20:12:54 2008
+++ SOURCES/bluez-utils-bnep_ifup.patch	Fri May 23 20:12:48 2008
@@ -0,0 +1,158 @@
+--- network/bridge.c.orig	2008/05/06 18:40:54	1.11
++++ network/bridge.c	2008/05/06 21:46:05	1.12
+@@ -119,6 +119,7 @@
+ 	if (ifindex == 0)
+ 		return -ENODEV;
+ 
++	memset(&ifr, 0, sizeof(ifr));
+ 	strncpy(ifr.ifr_name, name, IFNAMSIZ);
+ 	ifr.ifr_ifindex = ifindex;
+
+--- network/common.c.orig	2008/02/02 03:37:43	1.20
++++ network/common.c	2008/05/06 21:46:05	1.21
+@@ -164,6 +164,7 @@
+ {
+ 	struct bnep_conndel_req req;
+ 
++	memset(&req, 0, sizeof(req));
+ 	baswap((bdaddr_t *)&req.dst, dst);
+ 	req.flags = 0;
+ 	if (ioctl(ctl, BNEPCONNDEL, &req)) {
+@@ -192,10 +193,12 @@
+ 	}
+ 
+ 	for (i=0; i < req.cnum; i++) {
+-		struct bnep_conndel_req req;
+-		memcpy(req.dst, ci[i].dst, ETH_ALEN);
+-		req.flags = 0;
+-		ioctl(ctl, BNEPCONNDEL, &req);
++		struct bnep_conndel_req del;
++
++		memset(&del, 0, sizeof(del));
++		memcpy(del.dst, ci[i].dst, ETH_ALEN);
++		del.flags = 0;
++		ioctl(ctl, BNEPCONNDEL, &del);
+ 	}
+ 	return 0;
+ }
+@@ -204,6 +207,7 @@
+ {
+ 	struct bnep_connadd_req req;
+ 
++	memset(&req, 0, sizeof(req));
+ 	strncpy(req.device, dev, 16);
+ 	req.device[15] = '\0';
+ 	req.sock = sk;
+@@ -223,17 +227,31 @@
+ {
+ }
+ 
++static int bnep_exec(const char **argv)
++{
++	int pid;
++	GSpawnFlags flags = G_SPAWN_DO_NOT_REAP_CHILD | G_SPAWN_SEARCH_PATH;
++
++	if (!g_spawn_async(NULL, (char **) argv, NULL, flags, bnep_setup, NULL,
++				&pid, NULL)) {
++		error("Unable to execute %s %s", *argv[0], *argv[1]);
++		return -EINVAL;
++	}
++
++	return pid;
++}
++
+ int bnep_if_up(const char *devname, uint16_t id)
+ {
+-	int sd, err, pid;
++	int sd, err;
+ 	struct ifreq ifr;
+ 	const char *argv[5];
+-	struct bnep_data *bnep;
+-	GSpawnFlags flags;
++	struct bnep_data *bnep = NULL;
+ 	GSList *l;
+ 
+ 	/* Check if a script is running */
+-	if ((l = g_slist_find_custom(pids, devname, find_devname))) {
++	l = g_slist_find_custom(pids, devname, find_devname);
++	if (l) {
+ 		bnep = l->data;
+ 
+ 		if (bnep->script && !strcmp(bnep->script, "avahi-autoipd")) {
+@@ -242,13 +260,8 @@
+ 			argv[2] = "--refresh";
+ 			argv[3] = NULL;
+ 
+-			flags = G_SPAWN_DO_NOT_REAP_CHILD | G_SPAWN_SEARCH_PATH;
+-			g_spawn_async(NULL, (char **) argv, NULL, flags,
+-					bnep_setup, (gpointer) devname, &pid,
+-					NULL);
++			bnep->pid = bnep_exec(argv);
+ 		}
+-
+-		return bnep->pid;
+ 	}
+ 
+ 	sd = socket(AF_INET6, SOCK_DGRAM, 0);
+@@ -265,6 +278,9 @@
+ 		return -err;
+ 	}
+ 
++	if (bnep)
++		return bnep->pid;
++
+ 	bnep = g_new0(struct bnep_data, 1);
+ 	bnep->devname = g_strdup(devname);
+ 
+@@ -291,15 +307,8 @@
+ 	} else
+ 		argv[2] = NULL;
+ 
+-	flags = G_SPAWN_DO_NOT_REAP_CHILD | G_SPAWN_SEARCH_PATH;
+-	if (!g_spawn_async(NULL, (char **) argv, NULL, flags, bnep_setup,
+-				(gpointer) devname, &pid, NULL)) {
+-		error("Unable to execute %s", argv[0]);
+-		return -EINVAL;
+-	}
+-
+-	bnep->pid = pid;
+-	g_child_watch_add(pid, script_exited, bnep);
++	bnep->pid = bnep_exec(argv);
++	g_child_watch_add(bnep->pid, script_exited, bnep);
+ 
+ done:
+ 	pids = g_slist_append(pids, bnep);
+@@ -325,7 +334,7 @@
+ 	if (!bnep->pid)
+ 		goto done;
+ 
+-	if (bnep->script && !strcmp (bnep->script, "avahi-autoipd")) {
++	if (bnep->script && !strcmp(bnep->script, "avahi-autoipd")) {
+ 		argv[0] = bnep->script;
+ 		argv[1] = devname;
+ 		argv[2] = "--kill";
+@@ -352,12 +361,7 @@
+ 	ifr.ifr_flags &= ~IFF_UP;
+ 
+ 	/* Bring down the interface */
+-	if ((ioctl(sd, SIOCSIFFLAGS, (caddr_t) &ifr)) < 0) {
+-		err = errno;
+-		error("Could not bring down %d. %s(%d)", devname, strerror(err),
+-			err);
+-		return -err;
+-	}
++	ioctl(sd, SIOCSIFFLAGS, (caddr_t) &ifr);
+ 
+ 	pids = g_slist_remove(pids, bnep);
+
+--- network/connection.c.orig	2008/02/02 03:37:43	1.46
++++ network/connection.c	2008/05/06 21:46:05	1.47
+@@ -90,6 +90,7 @@
+ 						DBUS_TYPE_INVALID);
+ 	}
+ 	info("%s disconnected", nc->dev);
++	bnep_if_down(nc->dev);
+ 	nc->state = DISCONNECTED;
+ 	memset(nc->dev, 0, 16);
+ 	strncpy(nc->dev, prefix, strlen(prefix));
+ 
================================================================


More information about the pld-cvs-commit mailing list