Open Bug 1228309 Opened 10 years ago Updated 3 years ago

'online' event triggered when WiFi is turned on, before connecting to any network

Categories

(Core :: Networking, defect, P3)

x86_64
Linux
defect

Tracking

()

Tracking Status
firefox45 --- affected

People

(Reporter: marco, Unassigned)

References

Details

(Whiteboard: [necko-backlog])

Attachments

(1 file)

I'm using the example here: https://bug336359.bmoattachments.org/attachment.cgi?id=220609 The 'online' event is triggered as soon as I enable WiFi, even if I'm not connected to any network.
These events can be useful when developing apps that support working offline.
Blocks: WADI
> The 'online' event is triggered as soon as I enable WiFi On which OS?
Flags: needinfo?(mar.castelluccio)
Weird, I thought I mentioned this was on Linux (Fedora 22).
Flags: needinfo?(mar.castelluccio)
OS: Unspecified → Linux
Hardware: Unspecified → x86_64
Thanks. So it looks like we notify about offline status changes from nsIOService::SetOffline and nsIOService::SetConnectivityInternal. In both cases we use NS_IsOffline to determine what to fire, which just calls GetOffline() and GetConnectivity() on the ioservice. SetOffline is mainly called from the ioservice itself, when it gets profile-change-net-teardown/restore notifications. In practice, that doesn't happen in the situation you describe, so we're not offline for SetOffline() purposes at any point. As for connectivity, on Linux that's handled by netwerk/system/linux/nsNotifyAddrListener_Linux.cpp as far as I can tell. This seems to simply look for AF_INEt or AF_INET6 interfaces, as returned by getifaddrs() (filtering out non-running and loopback interfaces). I wonder what that function actually returns on your system when you're in the "not connected to a wireless network" state. Could you try running the example program at the end of http://man7.org/linux/man-pages/man3/getifaddrs.3.html and report what it outputs? In any case, this is clearly not a DOM issue, since it's the networking layer that thinks we're online.
Component: DOM → Networking
Flags: needinfo?(mar.castelluccio)
Flags: needinfo?(daniel)
The online event as triggered by the Firefox networking layer is triggered when there is a network interface that is up and thus potentially capable of communicating with another host (thus it doesn't count loopback devices or interfaces that aren't up and running). And the reverse is then that if no such interface can be found, it is clearly offline. There are some minor differences between different platforms on this, mostly depending on what information the underlying system-specific APIs provide and how they function but the basics are the same. A wifi network interface on Linux should probably not be in RUNNING unless it is connected to an access point? I can't see that mine does.
Flags: needinfo?(daniel)
Attached file Log
The output is the same in the states "WiFi ON, connected to internet" and "WiFi OFF, not connected to internet".
Flags: needinfo?(mar.castelluccio)
Hrm. In the "wifi on, not connected to internet" case, where is that 10.246.35.72 IP coming from? I mean, if you're not on a wireless network, how do you have an IP?
I'm not sure what that means. Maybe connected to the LAN but not to internet? Or got an IP but still not finished setting up the connection? In that state, the NetworkManager indicator shows my status as being "connecting...". It's able to somehow detect when the connection is actually completely set up.
> Maybe connected to the LAN but not to internet? It certainly looks like you're connected to the LAN, yes. The original bug report says "before connecting to any network", but it looks like in that state you're connected to a wireless network... so in what sense are you not connected to the internet? Is that wireless AP not connected to the internet? Something else?
(In reply to Boris Zbarsky [:bz] from comment #9) > > Maybe connected to the LAN but not to internet? > > It certainly looks like you're connected to the LAN, yes. The original bug > report says "before connecting to any network", but it looks like in that > state you're connected to a wireless network... so in what sense are you not > connected to the internet? Is that wireless AP not connected to the > internet? Something else? The access point is connected to the internet. I can't open any website from Firefox (fails to connect). NetworkManager (https://wiki.gnome.org/Projects/NetworkManager) says I'm in the process of connecting, but I'm not connected yet to the WiFi network. I don't know what this means.
Marco, could you clarify about the AP, is it your router? The router for anyone else? Some physical characteristics?
It's an AP in a Mozilla office.
Whiteboard: [necko-backlog]
Priority: -- → P1
Priority: P1 → P3
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: