dhcpcd-discuss

Re: interaction with rfkill

Roy Marples

Wed Jul 29 16:27:48 2009

Iain wrote:
Roy Marples wrote:
Well, dhcpcd should Do The Right Thing, but you can remove and add an interface to the list like so
dhcpcd -x eth0
dhcpcd -n eth0

this works fine with my 3945, thanks.

A workaround at least :)


for info, here's what happens with the 3945:

root@craptop:~# ip addr
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 16436 qdisc noqueue state UNKNOWN
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
2: eth0: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN qlen 1000
    link/ether 00:1c:c4:c9:2c:97 brd ff:ff:ff:ff:ff:ff
3: wmaster0: <> mtu 0 qdisc noop state DOWN qlen 1000
    link/ieee802.11 00:1c:bf:a0:13:d7 brd 00:00:00:00:00:00
4: wlan0: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN qlen 1000
    link/ether 00:1c:bf:a0:13:d7 brd ff:ff:ff:ff:ff:ff

[so we can see the wlan0 interface just fine]

root@craptop:~# ip link set up dev wlan0
RTNETLINK answers: No such device

when the 'no such device' error is returned, I get this from dmesg:

[  141.451110] iwl3945 0000:10:00.0: Radio disabled by HW RF Kill switch


digging through the code for that message you can find the following in iwl3945-base.c

static int __iwl3945_up(struct iwl_priv *priv)
{


        int rc, i;

        if (test_bit(STATUS_EXIT_PENDING, &priv->status)) {
IWL_WARN(priv, "Exit pending; will not bring the NIC up\n");
                return -EIO;
        }

        if (test_bit(STATUS_RF_KILL_SW, &priv->status)) {
                IWL_WARN(priv, "Radio disabled by SW RF kill (module "
                            "parameter)\n");
                return -ENODEV;
        }

        if (!priv->ucode_data_backup.v_addr || !priv->ucode_data.v_addr) {
                IWL_ERR(priv, "ucode not available for device bring up\n");
                return -EIO;
        }

        /* If platform's RF_KILL switch is NOT set to KILL */
        if (iwl_read32(priv, CSR_GP_CNTRL) &
                                CSR_GP_CNTRL_REG_FLAG_HW_RF_KILL_SW)
                clear_bit(STATUS_RF_KILL_HW, &priv->status);
        else {
                set_bit(STATUS_RF_KILL_HW, &priv->status);
                if (!test_bit(STATUS_IN_SUSPEND, &priv->status)) {
IWL_WARN(priv, "Radio disabled by HW RF Kill switch\n");
                        return -ENODEV;
                }
        }

So as long as either the hardware or software rfkill switch is set then this driver will simply return -ENODEV and there's no chance for dhcpcd or wpa_supplicant to do anything from there.

So for now I'm just using the rfkill uevent to check for dhcpcd already being running and if it is I can use -n to add the interface, this works well enough. I'd still be interested in an option similar to -n but that doesn't start up dhcpcd if it's not already running.

My take on this is that it's a driver bug. If querying an interface returns ENODEV then dhcpcd - and other software - will rightly think it no longer exists.

I would be interested in seeing dhcpcd output running in a terminal
dhcpcd -dB

and then the rkwill switch is toggled a few times, about 10 secs between each toggle. Also, test starting dhcpcd with the switch on and then off.
If you could email back with those results, it should be interesting :)

Thanks

Roy

Follow-Ups:
Re: interaction with rfkillIain
References:
interaction with rfkillIain
Re: interaction with rfkillRoy Marples
Re: interaction with rfkillIain
Archive administrator: postmaster@marples.name