Package: kismet
Version: 2004.04.R1-5
Severity: wishlist

Hi.

After the interface name is changed with the new cisco kernel driver,
the /proc/driver/aironet/<interface_name> still is the original
interface name.  This arguably is the kernel driver bug.  Moreover,
there really is no way at all to tell the old name after the renaming --
unless you have just one card on the system, that is, or You resort to
some active trickery).

I suggest setting the Node Name to a random magic temporarily using
iwconfig foo nick <magic>, then look in through
/proc/driver/aironet/*/Config:NodeName; bingo, the one with the Node
Name set to this magic is the one, then reset it back.  A script to
outline this idea is attached; if you like it and don't want to
incorporate it yourself, I probably will be likely to do it myself.

Cheers,
Jan.

-- System Information:
Debian Release: 3.1
  APT prefers testing
  APT policy: (700, 'testing')
Architecture: i386 (i686)
Kernel: Linux 2.4.28-jan
Locale: LANG=C, LC_CTYPE=cs_CZ.ISO-8859-2 (charmap=ISO-8859-2)

Versions of packages kismet depends on:
ii  ethereal-common           0.10.6-1       Network traffic analyser (common f
ii  libbz2-1.0                1.0.2-1        A high-quality block-sorting file 
ii  libc6                     2.3.2.ds1-18   GNU C Library: Shared libraries an
ii  libdps1                   4.3.0.dfsg.1-8 Display PostScript (DPS) client li
ii  libexpat1                 1.95.8-1       XML parsing C library - runtime li
ii  libfreetype6              2.1.7-2.3      FreeType 2 font engine, shared lib
ii  libgcc1                   1:3.4.3-6      GCC support library
ii  libglib1.2                1.2.10-9       The GLib library of C routines
ii  libgmp3                   4.1.4-5        Multiprecision arithmetic library
ii  libice6                   4.3.0.dfsg.1-8 Inter-Client Exchange library
ii  libjasper-1.701-1         1.701.0-2      The JasPer JPEG-2000 runtime libra
ii  libjpeg62                 6b-9           The Independent JPEG Group's JPEG 
ii  liblcms1                  1.13-1         Color management library
ii  libmagick6                6:6.0.6.2-1.5  Image manipulation library
ii  libncurses5               5.4-4          Shared libraries for terminal hand
ii  libpng12-0                1.2.8rel-1     PNG library - runtime
ii  libsm6                    4.3.0.dfsg.1-8 X Window System Session Management
ii  libstdc++5                1:3.3.4-13     The GNU Standard C++ Library v3
ii  libtiff4                  3.6.1-4        Tag Image File Format library
ii  libx11-6                  4.3.0.dfsg.1-8 X Window System protocol client li
ii  libxext6                  4.3.0.dfsg.1-8 X Window System miscellaneous exte
ii  libxml2                   2.6.11-5       GNOME XML library
ii  libxt6                    4.3.0.dfsg.1-8 X Toolkit Intrinsics
ii  wireless-tools            27-1           Tools for manipulating Linux Wirel
ii  xlibs                     4.3.0.dfsg.1-8 X Window System client libraries m
ii  zlib1g                    1:1.2.2-3      compression library - runtime

-- no debconf information
-- 
 )^o-o^|    jabber: [EMAIL PROTECTED]
 | .v  K    e-mail: jjminar FastMail FM
 `  - .'     phone: +44(0)7981 738 696
  \ __/Jan     icq: 345 355 493
 __|o|__Minář  irc: [EMAIL PROTECTED]
#!/bin/sh
#
# get_orig_airo_if_name -- print the original aironet interface name on stdout
#
# Usage: get_orig_airo_if_name <current_if_name>
#
# Note that we need the capability to set a device nickname, which typically
# requires being root, as well as read access to $PROCDIR, which may not be
# world-readable on a given system.
#
# Exit code: 0 on success, non-0 otherwise

set -e

[ "$#" -ne 1 ] && {
        echo "Usage: get_orig_airo_if_name <interface>" >&2
        exit 1
}

IF="$1"
# XXX Scrap this when the iwconfig invocation below is fixed
case "$IF" in --help)
        {
                echo "Yes, \`$IF' is a fair device name, but iwconfig would"
                echo "choke on it. See Debian Bug#289657. Aborting."
        } >&2
        exit 1;
        ;;
esac

PROCDIR="/proc/driver/aironet"
# If we loop too many times, something almost certainly is wrong
TRIES=20
WE="${0##*/}"

if [ "$(ls "$PROCDIR" | wc -l)" -lt 1 ]; then
        echo "$WE: Nothing in $PROCDIR, aborting." >&2
        exit 1
fi

while [ "$((TRIES--))" -gt 0 ]; do
        # (1) Get enough randomness, so we don't loop thru all the devices
        # unnecessarily, but don't drain the entropy sources too much.  This is
        # kind of moot because of (3)
        #
        # (2) Convert the random bytes to some printable representation: md5sum
        # is a part of Debian base, and is pretty light on resources.
        #
        # (3) The max length of a nickname is 16 bytes, AFAICT from RTFSing,
        # and:
        #
        # # iwconfig ap0 nick `perl -e 'print "A" x 17'`
        # Error for wireless request "Set Nickname" (8B1C) :         
        #    SET failed on device ap0 ; Argument list too long.

        MAGIC="`head -c 8 /dev/urandom | md5sum | head -c16`"
        # XXX Should be ``iwconfig -- "$IF"'' -- see Debian Bug#289657
        # Fix the above warning when this is fixed
        iwconfig "$IF" nick "$MAGIC"
        for a in "$PROCDIR"/*; do
                # We could just ``grep "$MAGIC"'', but let's be anal
                if grep "^NodeName: $MAGIC\$" "$a/Config" > /dev/null; then
                        echo "${a##"$PROCDIR/"}"
                        exit 0
                fi
        done
done

echo "$WE: Unable to get the original device name for \`$IF'." >&2
exit 1

Attachment: pgppjiFFKG4n4.pgp
Description: PGP signature

Reply via email to