-from http://blueman.tuxfamily.org
authorMichał 'Wolvverine' Panasiewicz <wolvverine@pld-linux.org>
Fri, 23 May 2008 18:13:06 +0000 (18:13 +0000)
committercvs2git <feedback@pld-linux.org>
Sun, 24 Jun 2012 12:13:13 +0000 (12:13 +0000)
Changed files:
    bluez-utils-bnep_ifup.patch -> 1.1
    bluez-utils-nap_bridge_fix.patch -> 1.1

bluez-utils-bnep_ifup.patch [new file with mode: 0644]
bluez-utils-nap_bridge_fix.patch [new file with mode: 0644]

diff --git a/bluez-utils-bnep_ifup.patch b/bluez-utils-bnep_ifup.patch
new file mode 100644 (file)
index 0000000..081e2ae
--- /dev/null
@@ -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));
diff --git a/bluez-utils-nap_bridge_fix.patch b/bluez-utils-nap_bridge_fix.patch
new file mode 100644 (file)
index 0000000..980ea33
--- /dev/null
@@ -0,0 +1,62 @@
+--- network/bridge.c.orig      2008-05-05 14:37:28.000000000 +0300
++++ network/bridge.c   2008-05-05 14:31:39.000000000 +0300
+@@ -53,7 +53,7 @@
+       if (stat("/sys/module/bridge", &st) < 0)
+               return -EOPNOTSUPP;
+ #endif
+-
++      info("bridge init");
+       bridge_socket = socket(AF_INET, SOCK_STREAM, 0);
+       if (bridge_socket < 0)
+               return -errno;
+@@ -74,7 +74,7 @@
+ {
+       int err;
+       const char *name = bridge_get_name(id);
+-
++      info("bridge create %s", name);
+       err = ioctl(bridge_socket, SIOCBRADDBR, name);
+       if (err < 0)
+               return -errno;
+@@ -86,7 +86,7 @@
+ {
+       int err;
+       const char *name = bridge_get_name(id);
+-
++      info("remove from bridge");
+       err = bnep_if_down(name);
+       if (err < 0)
+               return err;
+@@ -118,9 +118,7 @@
+       if (err < 0)
+               return err;
+-      /* Only run scripts in GN bridges */
+-      if (id != BNEP_SVC_GN)
+-              return 0;
++      info("bridge_add_interface %s", dev);
+       err = bnep_if_up(name, id);
+       if (err < 0)
+--- network/server.c.orig      2008-05-05 14:37:17.000000000 +0300
++++ network/server.c   2008-05-03 11:57:39.000000000 +0300
+@@ -665,6 +665,9 @@
+       if (bridge_create(BNEP_SVC_GN) < 0)
+               error("Can't create GN bridge");
++              
++      if (bridge_create(BNEP_SVC_NAP) < 0)
++              error("Can't create NAP bridge");
+       return 0;
+ fail:
+@@ -690,6 +693,9 @@
+       if (bridge_remove(BNEP_SVC_GN) < 0)
+               error("Can't remove GN bridge");
++              
++      if (bridge_remove(BNEP_SVC_NAP) < 0)
++              error("Can't remove NAP bridge");
+       dbus_connection_unref(connection);
+       connection = NULL;
This page took 0.052411 seconds and 4 git commands to generate.