Bug 12652 - WiFi bad 50_ipv4_network_setup script drains battery after disconnect
: WiFi bad 50_ipv4_network_setup script drains battery after disconnect
Status: UNCONFIRMED
Product: Maemo 5 Community SSU
general
: stable
: N900 Maemo
: Unspecified major (vote)
: ---
Assigned To: unassigned
: general
:
:
:
:
  Show dependency tree
 
Reported: 2012-08-13 07:22 UTC by David Fries
Modified: 2012-08-13 07:25 UTC (History)
0 users (show)

See Also:


Attachments
ifclearv4_0.1.tar.gz (9.87 KB, application/x-compressed-tar)
2012-08-13 07:22 UTC, David Fries
Details
ifclearv4_0.1.dsc 1of2 (541 bytes, application/pgp-signature)
2012-08-13 07:24 UTC, David Fries
Details
ifclearv4_0.1_armel.deb 2of2 (4.11 KB, application/x-deb)
2012-08-13 07:25 UTC, David Fries
Details
ifclearv4_0.1_armel.changes (1020 bytes, application/pgp-signature)
2012-08-13 07:25 UTC, David Fries
Details


Note

You need to log in before you can comment on or make changes to this bug.


Description David Fries (reporter) 2012-08-13 07:22:51 UTC
Created an attachment (id=3462) [details]
ifclearv4_0.1.tar.gz

SOFTWARE VERSION: 
(Settings > General > About product)
21.2011.38-1
CSSU 21.2011.38-1Tmaemo4.1
kernel 2.6.28.10-power51r1

EXACT STEPS LEADING TO PROBLEM: 
(Explain in detail what you do (e.g. tap on OK) and what you see (e.g. message
Connection Failed appears))
1. connect to Wi-Fi access point
2. go out of range by leaving the area

EXPECTED OUTCOME: 
connection lost with the same result of manually disconnecting before leaving
the area

ACTUAL OUTCOME: 
connction lost, wlan0 left up without an ip address, battery drained

Look at `ifconfig |grep wlan` to see if the interface is up without an ip
address and iwconfig wlan0 to verify it isn't associated to an access point, if
the bq27x00_battery is loaded watch
/sys/class/power_supply/bq27200-0/current_now for around 300,000 (backlight on
is normally 110,000).  I almost hesitate to suggest it, but one easy way to get
out of range is to put the N900 into a microwave (while the microwave is off),
as it both has a window and it is specifically designed to block microwaves.

REPRODUCIBILITY: 
(always, less than 1/10, 5/10, 9/10)
It feels like 8/10 when doing it by accident, when trying to reproduce 1/20

EXTRA SOFTWARE INSTALLED: 

OTHER COMMENTS: 

The problem is a race between icd2 running run-parts which runs
/etc/network/if-post-down.d/zz_static_ip_if_down which will `ifconfig wlan0
down` the interface, and another script /etc/maemo-dhcp.d/50_ipv4_network_setup
which runs `ifconfig wlan0 0.0.0.0` to clear the ip address.  If the zz_static*
script runs first the 50_ipv4* script will up the interface, because ifconfig
automatically ups an interface if an ip address is given.  When going out of
range of the access point this sequence leaves the interface up without power
saving and drains the battery in less than eight hours.  Manually bringing the
interface down, scanning for an access point will bring the interface down when
completed.  This can be mitigated with the WiFi auto scan, but since I have
that disabled I've had the battery drain multiple times before I realized what
was going on.  My first attempt was to add 'down' to the ifconfig command in
the 50_ipv4* script, and I no longer saw it eating the battery, but it is also
run when connecting to a DHCP network preventing DHCP from work, so that isn't
a viable solution.

I've attached a propsed hackaround package ifclearv4 to fix the problem.  It
consists of two parts, a program to clear the ip address without changing the
up/down status of the interface, and a modification to the 50_ipv4* script to
run that program instead of ifconfig in the deconfig section.  Note
zeroconf.deconfig also does ifconfig...  0.0.0.0, but it is working with an ip
alias and apparently noone even bothered to check if it was correct, as it
gives two ip addresses ifconfig issues an error, but as it is an ip alias that
ip alias interface does go down, which I guess was the goal so I left it.

I welcome other suggestions with dealing with this bug, but short of replacing
icd2, I'm not sure what else to do.  busybox-power comes with the ip command
which might work, but it isn't installed by default.

If this is the acceptable approach I'll setup a repository to fill in Vcs-Git:
and XSBC-Bugtracker: of the control file.  This doesn't depend on CSSU, so it
could go in the extras repository for others to install, but given the severify
it would be nice for CSSU to install it by default.
Comment 1 David Fries (reporter) 2012-08-13 07:24:47 UTC
Created an attachment (id=3463) [details]
ifclearv4_0.1.dsc  1of2
Comment 2 David Fries (reporter) 2012-08-13 07:25:13 UTC
Created an attachment (id=3464) [details]
ifclearv4_0.1_armel.deb  2of2
Comment 3 David Fries (reporter) 2012-08-13 07:25:45 UTC
Created an attachment (id=3465) [details]
ifclearv4_0.1_armel.changes