Bug 18388 - some iwconfig actions can be done only *before* the interface is up
Summary: some iwconfig actions can be done only *before* the interface is up
Status: CLOSED WONTFIX
Alias: None
Product: Branch 4.1
Classification: Distributions
Component: etcnet (show other bugs)
Version: unspecified
Hardware: all Linux
: P2 normal
Assignee: Nobody's working on this, feel free to take it
QA Contact: qa-4.1@altlinux.org
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-12-29 04:36 MSK by Ivan Zakharyaschev
Modified: 2014-11-05 20:41 MSK (History)
1 user (show)

See Also:


Attachments
wireless-prep.patch (2.18 KB, patch)
2008-12-29 04:36 MSK, Ivan Zakharyaschev
no flags Details | Diff
wireless-prep-example.tar (10.00 KB, application/x-tar)
2008-12-29 04:40 MSK, Ivan Zakharyaschev
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Ivan Zakharyaschev 2008-12-29 04:36:35 MSK
Created attachment 3171 [details]
wireless-prep.patch

etcnet-0.9.7-alt0.M41.1
wireless-tools-29-alt2

On iwl3945, setting the mode can't be done when the interface is up:

# iwconfig wlan0 mode ad-hoc
Error for wireless request "Set Mode" (8B06) :
    SET failed on device wlan0 ; Device or resource busy.
# 

But /etc/net/ifaces/*/iwconfig is called when the interface is already up.

So I needed to add the processing of new /etc/net/ifaces/*/iwconfig_prep files before the iface is brought up in order to have iface profiles which switch the modes.

The patch and the example are attached.
Comment 1 Ivan Zakharyaschev 2008-12-29 04:40:32 MSK
Created attachment 3172 [details]
wireless-prep-example.tar

    Doing the actual setting of the mode at the preparation stage.
    
    Before the iface is UP!
    Doing it with the same value once again when it is UP doesn't harm. (And even has a benefit: it is a check that the mode has actually been set; if the used etcnet code doesn't support this "extension" (the "_prep" files), it will fail on processing the "iwconfig" and report an error.)
    I have modified the code for this feature (in another commit).
Comment 2 Ivan Zakharyaschev 2008-12-29 04:52:25 MSK
Another solution would be probably to write an explicit call to "iwconfig ..." in wlan0/ifup-pre. I have not tried this approach.

If there are many actions of iwconfig that should be done "before", then probably it makes sense to have this extension for processing special "iwconfig_prep" files, and describing it in the documentation, so that people will write a working configuration straight on after getting acquainted with etcnet.
Comment 3 Ivan Zakharyaschev 2008-12-29 05:05:02 MSK
And, I forgot to tell: I couldn't move the whole processing of iwconfig to an earlier stage, because the situation with essid is exactly the opposite: it *can't* be set before the iface is up:

# modprobe -r iwl3945
# modprobe iwl3945
# ifdown wlan0
# iwconfig wlan0 mode ad-hoc
# iwconfig wlan0 essid test2
Error for wireless request "Set ESSID" (8B1A) :
    SET failed on device wlan0 ; Input/output error.
# 

So, I needed the two parts of iwconfig options.
Comment 4 Ivan Zakharyaschev 2008-12-31 05:41:39 MSK
https://bugzilla.altlinux.org/show_bug.cgi?id=15588 is about the same problem, but perhaps with a somewhat different solution.

*** This bug has been marked as a duplicate of bug 15588 ***
Comment 5 Ivan Zakharyaschev 2008-12-31 05:47:20 MSK
Does this hack/solution without wlanconfig (unlike https://bugzilla.altlinux.org/show_bug.cgi?id=15588 ) represent something worth including into the package?

For example, I use it on Desktop 4.1.1RC 2008/11/15 system without any wlanconfig, with the iwl3??? driver.
Comment 6 Denis Ovsienko 2009-06-15 01:36:11 MSD
(In reply to comment #2)
> Another solution would be probably to write an explicit call to "iwconfig ..."
> in wlan0/ifup-pre. I have not tried this approach.

ifup-pre is the right tool for special cases like this.

> If there are many actions of iwconfig that should be done "before", then
> probably it makes sense to have this extension for processing special
> "iwconfig_prep" files, and describing it in the documentation, so that people
> will write a working configuration straight on after getting acquainted with
> etcnet.

I don't want to make a decision right now about pushing (or not) this multi-stage approach, because it's not clear, how many real application is there for iwconfig_prep. I know about this case only by far, but I assume, that there can be more. That said, I suggest doing the job with ifup-pre for now.
Comment 7 Michael Shigorin 2014-11-05 20:41:57 MSK
В 4.1/branch исправления не будут вноситься уже технически (заглушена очередь на сборку), поэтому прошу ошибки, актуальные для sisyphus/p7/t7, перевесить на текущие ветки или сизиф.