Package: netapplet
Version: 1.0.8-2local1
Severity: normal
Tags: patch

Joachim Nilsson has made some useful patches to netapplet available at
http://vmlinux.org/jocke/bzr/index.py/repositories

I have attached a diff including two of his patches; one fixes scanning
for access points, the other downs the interface before reassociating
with a new access point and upping the interface.

-- System Information:
Debian Release: lenny/sid
  APT prefers testing
  APT policy: (500, 'testing')
Architecture: i386 (i686)

Kernel: Linux 2.6.24-1-686 (SMP w/2 CPU cores)
Locale: LANG=C, LC_CTYPE=en_CA.iso8859-1 (charmap=ISO-8859-1)
Shell: /bin/sh linked to /bin/bash

Versions of packages netapplet depends on:
ii  libart-2.0-2               2.3.20-1      Library of functions for 2D graphi
ii  libatk1.0-0                1.22.0-1      The ATK accessibility toolkit
ii  libbonobo2-0               2.22.0-1      Bonobo CORBA interfaces library
ii  libbonoboui2-0             2.22.0-1      The Bonobo UI library
ii  libc6                      2.7-10        GNU C Library: Shared libraries
ii  libcairo2                  1.6.4-1+b1    The Cairo 2D vector graphics libra
ii  libgconf2-4                2.22.0-1      GNOME configuration database syste
ii  libglade2-0                1:2.6.2-1     library to load .glade files at ru
ii  libglib2.0-0               2.16.3-2      The GLib library of C routines
ii  libgnome-keyring0          2.22.1-1      GNOME keyring services library
ii  libgnome2-0                2.20.1.1-1    The GNOME 2 library - runtime file
ii  libgnomecanvas2-0          2.20.1.1-1    A powerful object-oriented display
ii  libgnomeui-0               2.20.1.1-1    The GNOME 2 libraries (User Interf
ii  libgnomevfs2-0             1:2.22.0-2    GNOME Virtual File System (runtime
ii  libgtk2.0-0                2.12.9-3      The GTK+ graphical user interface 
ii  libice6                    2:1.0.4-1     X11 Inter-Client Exchange library
ii  libiw29                    29-1          Wireless tools - library
ii  liborbit2                  1:2.14.12-0.1 libraries for ORBit2 - a CORBA ORB
ii  libpango1.0-0              1.20.2-2      Layout and rendering of internatio
ii  libpopt0                   1.10-3        lib for parsing cmdline parameters
ii  libsm6                     2:1.0.3-1+b1  X11 Session Management library
ii  libx11-6                   2:1.0.3-7     X11 client-side library
ii  libxml2                    2.6.32.dfsg-2 GNOME XML library
ii  lsb-base                   3.2-11        Linux Standard Base 3.2 init scrip

Versions of packages netapplet recommends:
ii  gnome-system-tools            2.20.0-2   Cross-platform configuration utili

-- no debconf information
diff -urbBw netapplet-1.0.8/debian/changelog 
netapplet-1.0.8local/debian/changelog
--- netapplet-1.0.8/debian/changelog    2008-05-13 10:28:13.000000000 -0600
+++ netapplet-1.0.8local/debian/changelog       2008-05-13 10:27:50.000000000 
-0600
@@ -1,3 +1,19 @@
+netapplet (1.0.8-2local1) unstable; urgency=low
+
+  * src/netdaemon.c: 
+    - Scanning for access points (SIOCSIWSCAN) always failed so the scanning
+      function fell back to reporting the already associated access point.
+      Fixed by properly initializing the wrq struct, as is done by iwlist.c
+      in wireless-tools.
+    - Fix netdaemon_do_change_essid_debian() so that it properly takes the
+      iface down before associating to a new access point and then also
+      brings the iface back up again.  This actually works well with the
+      Debian logical mapping stanzas and the netapplet can now be used
+      instead of running ifup manually with different mappings, e.g.
+      ifup eth2=ZyXEL or ifup eth2=WRT54GL. 
+
+ -- Joachim Nilsson <[EMAIL PROTECTED]> Wed, 11 Jul 2007 23:48:04 +0200
+
 netapplet (1.0.8-2) unstable; urgency=low
 
   * Added LSB formatted dependency on init script (Closes: #460911)
diff -urbBw netapplet-1.0.8/src/netdaemon.c netapplet-1.0.8local/src/netdaemon.c
--- netapplet-1.0.8/src/netdaemon.c     2008-05-13 10:28:13.000000000 -0600
+++ netapplet-1.0.8local/src/netdaemon.c        2008-05-13 10:26:24.000000000 
-0600
@@ -1099,6 +1099,13 @@
        if (fd < 0)
                return;
 
+        /*
+         * Here we should look at the command line args and set the IW_SCAN_ 
flags
+         * properly
+         */
+        wrq.u.data.pointer = NULL;             /* Later */
+        wrq.u.data.flags = 0;
+        wrq.u.data.length = 0;
        strncpy (wrq.ifr_name, interface, IFNAMSIZ);
        if (ioctl (fd, SIOCSIWSCAN, &wrq) >= 0) {
                ScanningInfo *si;
@@ -1189,6 +1196,19 @@
        }
 }
 
+/**
+ * debian can make use of network mapping stanzas, which we don't support
+ * here (yet).  Instead we follow the SuSE notion of distrust and make 
+ * sure to bring down the interface before picking it up with a new ESSID.
+ *
+ * With proper support for mapping we should instead do it like this;
+ *
+ * 1. Find logical interface, in /etc/network/interfaces matching the
+ *    line "wireless-essid argv[3]" ==> MAPPING
+ *
+ * 2. If we find that logical mapping call ifup with an argument:
+ *    ifdown wlan0; ifup wlan0=MAPPING
+ */
 static void
 netdaemon_do_change_essid_debian (GIOChannel *channel, char **args)
 {
@@ -1209,6 +1229,10 @@
     argv[6] = NULL;
   }
 
+  /* First we release any old lease and clean up by calling "ifdown ethX" */
+  ifdown (argv[1]);
+
+  /* Next we associate to the new access point. */
   if (!g_spawn_sync (NULL, (char **) argv, NULL, 0, NULL, NULL,
                     NULL, NULL, NULL, &err)) {
     g_warning("Unable to execute iwconfig: %s",
@@ -1216,6 +1240,21 @@
     g_error_free(err);
   }
 
+  /* Bring the interface up */
+  if (ifup (argv[1])) {
+     netcommon_send_message (channel, "active", argv[1], NULL);
+     g_free (active_iface);
+     active_iface = g_strdup (argv[1]);
+  }
+
+  /* Don't leak. */
+  g_free ((char *)argv[0]);
+  g_free ((char *)argv[2]);
+  if (argv[4] != NULL) g_free ((char *)argv[4]);
+
+  /* Let's skip the next poll so we can wait for the interface to come up. */
+  skip_poll = TRUE;
+
   return;
 }
 

Reply via email to