Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 261655 - net-misc/netifrc: switch from using net-wireless/wireless-tools to net-wireless/iw
Summary: net-misc/netifrc: switch from using net-wireless/wireless-tools to net-wirele...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Hosted Projects
Classification: Unclassified
Component: netifrc (show other bugs)
Hardware: All Linux
: High enhancement
Assignee: netifrc Team
URL:
Whiteboard: netifrc:iw
Keywords:
Depends on:
Blocks: 469296
  Show dependency tree
 
Reported: 2009-03-08 08:52 UTC by Alexander E. Patrakov
Modified: 2019-07-09 19:55 UTC (History)
6 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Alexander E. Patrakov 2009-03-08 08:52:50 UTC
My zd1211rw-based wireless card is configured as follows:

modules="iwconfig"
channel_wlan0="11"
essid_wlan0="t503"
mode_wlan0="ad-hoc"
key_t503="s:'xxxxxxxxxxxxx' enc open"
config_wlan0="192.168.2.1 netmask 255.255.255.0 brd 192.168.2.255"

When booting with linux-2.6.28 configured to get the regdom information from iw (i.e., CONFIG_WIRELESS_OLD_REGULATORY is not set), this fails to set mode to ad-hoc, but works when I stop and then start the net.wlan0 script manually, or replug the card. I traced the problem to a race in iwconfig.sh.

For debugging, I modified the iwconfig_set_mode function as follows:

iwconfig_set_mode()
{
        local mode="$1"
        [ "${mode}" = "$(iwconfig_get_mode)" ] && return 0

        # Devicescape stack requires the interface to be down
        echo "<4>=== _down called ===" >/dev/kmsg
        _down
        echo "<4>=== _down finished ===" >/dev/kmsg
        sleep 1   # yes, this is a race
        echo "<4>=== slept 1 second ===" >/dev/kmsg
        iwconfig "${IFACE}" mode "${mode}" || return 1
        echo "<4>=== iwconfig finished ===" >/dev/kmsg
        _up
        echo "<4>=== _up finished ===" >/dev/kmsg
}

This resulted in the following piece of dmesg:

[   14.484735] NET: Registered protocol family 24
[   14.621152] e1000e 0000:00:19.0: irq 2297 for MSI/MSI-X
[   14.672035] e1000e 0000:00:19.0: irq 2297 for MSI/MSI-X
[   14.672448] ADDRCONF(NETDEV_UP): eth0: link is not ready
[   14.854989] usb 3-4: firmware: requesting zd1211/zd1211b_ub
[   14.926082] usb 3-4: firmware: requesting zd1211/zd1211b_uphr
[   14.979504] zd1211rw 3-4:1.0: firmware version 4725
[   15.019506] zd1211rw 3-4:1.0: zd1211b chip 0586:3410 v4810 high 00-19-cb AL2230_RF pa0 g--NS
[   15.021887] cfg80211: Calling CRDA for country: DE
[   15.039194] ADDRCONF(NETDEV_UP): wlan0: link is not ready
[   15.224603] === _down called ===
[   15.238768] === _down finished ===
[   15.275992] cfg80211: Regulatory domain changed to country: DE
[   15.275994]  (start_freq - end_freq @ bandwidth), (max_antenna_gain, max_eirp)
[   15.275997]  (2400000 KHz - 2483500 KHz @ 40000 KHz), (N/A, 2000 mBm)
[   15.275999]  (5150000 KHz - 5255000 KHz @ 40000 KHz), (N/A, 2301 mBm)
[   15.276007]  (5470000 KHz - 5650000 KHz @ 40000 KHz), (N/A, 3000 mBm)
[   16.135861] 0000:00:19.0: eth0: Link is Up 100 Mbps Full Duplex, Flow Control: RX/TX
[   16.135863] 0000:00:19.0: eth0: 10/100 speed: disabling TSO
[   16.136192] ADDRCONF(NETDEV_CHANGE): eth0: link becomes ready
[   16.264064] === slept 1 second ===
[   16.266254] === iwconfig finished ===
[   16.286365] === _up finished ===
[   18.287009] wlan0: Trigger new scan to find an IBSS to join
[   21.223011] wlan0: Trigger new scan to find an IBSS to join
[   24.154010] wlan0: Trigger new scan to find an IBSS to join
[   25.107067] wlan0: Creating new IBSS network, BSSID fa:cb:a0:be:9d:bb

So it seems that any attempt to set the mode to ad-hoc fails if the kernel didn't receive the regdom information. However, the kernel queries the regulatory domain asynchronously over the air (yes, there is an access point nearby that supplies wrong information) and then asks udev to call iw, but the iwconfig.sh script doesn't wait for this to complete.

Reproducible: Always

Steps to Reproduce:




$ emerge --info
Portage 2.1.6.7 (default/linux/x86/2008.0/desktop, gcc-4.1.2, glibc-2.6.1-r0, 2.6.28-gentoo-r2 i686)
=================================================================
System uname: Linux-2.6.28-gentoo-r2-i686-Intel-R-_Core-TM-2_CPU_6420_@_2.13GHz-with-glibc2.0
Timestamp of tree: Sat, 07 Mar 2009 05:15:01 +0000
app-shells/bash:     3.2_p39
dev-java/java-config: 1.3.7-r1, 2.1.6-r1
dev-lang/python:     2.5.2-r7
dev-util/cmake:      2.4.8
sys-apps/baselayout: 2.0.0
sys-apps/openrc:     0.4.3-r1
sys-apps/sandbox:    1.2.18.1-r2
sys-devel/autoconf:  2.13, 2.63
sys-devel/automake:  1.5, 1.7.9-r1, 1.8.5-r3, 1.9.6-r2, 1.10.2
sys-devel/binutils:  2.18-r3
sys-devel/gcc-config: 1.4.0-r4
sys-devel/libtool:   1.5.26
virtual/os-headers:  2.6.27-r2
ACCEPT_KEYWORDS="x86"
CBUILD="i686-pc-linux-gnu"
CFLAGS="-O2 -fno-strict-aliasing -march=i686 -pipe"
CHOST="i686-pc-linux-gnu"
CONFIG_PROTECT="/etc /var/lib/hsqldb"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/env.d /etc/env.d/java/ /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/revdep-rebuild /etc/terminfo /etc/texmf/web2c /etc/udev/rules.d"
CXXFLAGS="-O2 -fno-strict-aliasing -march=i686 -pipe"
DISTDIR="/home/distfiles"
FEATURES="distlocks fixpackages parallel-fetch protect-owned sandbox sfperms strict unmerge-orphans userfetch userpriv"
GENTOO_MIRRORS="http://distfiles.gentoo.org http://www.ibiblio.org/pub/Linux/distributions/gentoo"
LANG="ru_RU.UTF-8"
LDFLAGS="-Wl,-O1"
LINGUAS="ru"
MAKEOPTS="-j3"
PKGDIR="/home/packages"
PORTAGE_CONFIGROOT="/"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --stats --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages"
PORTAGE_TMPDIR="/tmp"
PORTDIR="/usr/portage"
SYNC="rsync://mirror.yandex.ru/gentoo-portage"
USE="X a52 aac acl acpi alsa amr applet archive artworkextra automount avahi beagle berkdb bluetooth bzip2 cairo caps cdda cddb cdr cjk cli consolekit cracklib crypt css cups dbus dirac djvu dri dvb dvd dvdr dvdread eds emboss encode epiphany evo exif fam ffmpeg firefox flac fontconfig fuse gamin gdbm gedit gif gimp gnome gnome-keyring gnuplot gphoto2 gsm gstreamer gtk hal iconv icq idn ipod ipv6 isdnlog jabber jack jbig jpeg jpeg2k ladspa lame lash latex lcms ldap libnotify libsamplerate mad midi mikmod mmx mmxext mono moonlight mozilla mp3 mpeg mplayer mudflap nautilus ncurses network networkmanager nls nocd nptl nptlonly nsplugin ogg opengl openmp pam pango pch pcre pdf perl png policykit ppds pppd pulseaudio python quicktime raw rdesktop readline reflection scanner schroedinger sdl session smp speex spell spl sse sse2 ssl ssse3 startup-notification svg sysfs tcpd theora threads tiff truetype unicode usb v4l2 videos vim-syntax vnc vorbis wifi win32codecs x264 x86 xattr xcb xcomposite xinerama xml xmp xorg xulrunner xv xvid zlib" ALSA_CARDS="ali5451 als4000 atiixp atiixp-modem bt87x ca0106 cmipci emu10k1 emu10k1x ens1370 ens1371 es1938 es1968 fm801 hda-intel intel8x0 intel8x0m maestro3 trident usb-audio via82xx via82xx-modem ymfpci" ALSA_PCM_PLUGINS="adpcm alaw asym copy dmix dshare dsnoop empty extplug file hooks iec958 ioplug ladspa lfloat linear meter mmap_emul mulaw multi null plug rate route share shm softvol" APACHE2_MODULES="actions alias auth_basic authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias" CAMERAS="ptp2" DVB_CARDS="tda10046lifeview" ELIBC="glibc" INPUT_DEVICES="keyboard mouse evdev" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LINGUAS="ru" USERLAND="GNU" VIDEO_CARDS="intel"
Unset:  CPPFLAGS, CTARGET, EMERGE_DEFAULT_OPTS, FFLAGS, INSTALL_MASK, LC_ALL, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS, PORTDIR_OVERLAY
Comment 1 Lars Wendler (Polynomial-C) (RETIRED) gentoo-dev 2009-03-08 09:49:49 UTC
Reassigning to base-system, CCing maintainer.
Comment 2 Davide Pesavento (RETIRED) gentoo-dev 2009-03-19 21:36:12 UTC
(In reply to comment #0)
> However, the kernel queries the
> regulatory domain asynchronously over the air (yes, there is an access point
> nearby that supplies wrong information) and then asks udev to call iw, but the
> iwconfig.sh script doesn't wait for this to complete.
> 

udev calls crda, not iw.
Comment 3 Roy Marples 2009-12-21 09:40:56 UTC
You should use wpa_supplicant instead of iwconfig. I'm not that interested in fixing what I see as a kernel driver issue in openrc.
Comment 4 Alexander E. Patrakov 2009-12-21 16:59:25 UTC
not an option if the user wants to set a fixed speed
Comment 5 David J Cozatt 2010-11-11 20:14:00 UTC
random david # emerge -vp iw wireless-regdb crda

These are the packages that would be merged, in order:

Calculating dependencies... done!
[ebuild   R   ] net-wireless/wireless-regdb-20091125  0 kB
[ebuild   R   ] net-wireless/iw-0.9.21  0 kB
[ebuild   R   ] net-wireless/crda-1.1.1  0 kB

Total: 3 packages (3 reinstalls), Size of downloads: 0 kB

The wireless.kernel is moving away from wireless-tools.  (iwconfig is part of wireless-tools)

http://wireless.kernel.org/en/users/Documentation/iw

"iw is a new nl80211 based CLI configuration utility for wireless devices. It supports almost all new drivers that have been added to the kernel recently.

iw is still under development. Features are added 'as we go'. The only documentation that exists for iw is this page. Please help expand it.

There is a page listing use cases with iwconfig and iw: replacing iwconfig."


iw, crda - so #emerge -vp iw wireless-regdb crda wpa_supplicant 
are preferred by the wireless-kernel team
turn off the iwconfig modules! in your conf.d/.net 

!iwconfig in the modules section

if it is working for you now should be only minor adjustments 
in my experience this configuration does not work with networkmanager 
or any of the current gui tools 

There are ways to set bitrate with iw 
Comment 6 William Hubbs gentoo-dev 2010-11-14 18:31:23 UTC
openrc team,

looking over this bug, it looks like we might need to deprecate wireless-tools in favor of iw and wpa_supplicant.

What does everyone else think?  Take a look and comment on this bug.

Thanks,

William
Comment 7 Robin Johnson archtester Gentoo Infrastructure gentoo-dev Security 2010-12-12 07:21:03 UTC
WilliamH++ to updating for usage of iw.
Comment 8 David J Cozatt 2011-05-12 22:21:30 UTC
This all works for me. Using p54pci and ath5 and -Dnl80211 the latter loads via cardbus
Comment 9 Rick Farina (Zero_Chaos) gentoo-dev 2012-11-23 04:29:06 UTC
This bug hasn't seen any love in a while so I'll just add the point that we almost certainly don't need to call iw directly for 99% of use cases wpa_supplicant gets the job done.  Even if we want to run in AP mode by default that would be calling hostapd (which likely should be done by the hostapd init script not the common net init scripts).
Comment 10 Brian Evans (RETIRED) gentoo-dev 2017-05-11 12:43:55 UTC
I've posted an iw.sh module to https://gitweb.gentoo.org/proj/netifrc.git/log/?h=iw

Feel free to merge that branch
Comment 11 Brian Evans (RETIRED) gentoo-dev 2019-07-09 19:52:40 UTC
support for iw has been added.  Closing