Closed Bug 1149829 Opened 9 years ago Closed 9 years ago

nsINetworkInterface is broken on b2g emulator

Categories

(Firefox OS Graveyard :: RIL, defect)

ARM
Gonk (Firefox OS)
defect
Not set
normal

Tracking

(firefox39 affected, firefox40 fixed, b2g-v2.2 unaffected, b2g-master fixed)

RESOLVED FIXED
2.2 S10 (17apr)
Tracking Status
firefox39 --- affected
firefox40 --- fixed
b2g-v2.2 --- unaffected
b2g-master --- fixed

People

(Reporter: bwc, Assigned: edgar)

References

Details

Attachments

(1 file, 1 obsolete file)

After bypassing bug 1149792, we still permafail because nICEr is unable to get any local interfaces. Maybe only localhost is available now?
Nils, do you have a patch laying around to enable localhost that I can try?
Flags: needinfo?(drno)
See Also: → 1149792
Bug 1128130 has a patch on it which should accomplish that.
Flags: needinfo?(drno)
I've verified in another try push that |isNetworkReady| in network.js still fails once the network-ready event fires:

https://treeherder.mozilla.org/#/jobs?repo=try&revision=60e4840433c5

https://dxr.mozilla.org/mozilla-central/source/dom/media/tests/mochitest/network.js#13
https://dxr.mozilla.org/mozilla-central/source/dom/media/tests/mochitest/network.js#63

Additionally, it appears that the GetAddresses call is always returning 0 addresses here, even though we wait for a network-ready event before starting the test (the logging bears this out):

https://dxr.mozilla.org/mozilla-central/source/media/mtransport/gonk_addrs.cpp?from=gonk_addrs.cpp&case=true#73

The try run:

https://treeherder.mozilla.org/#/jobs?repo=try&revision=34498d08886c
Component: WebRTC: Signaling → WebRTC: Networking
Summary: nICEr is unable to get local interfaces on b2g emulator → nsINetworkInterface is broken on b2g emulator
Not sure what the component is here, exactly. The logging shows that there are two network interfaces, but neither has any addresses. I am not sure what type these two interfaces are (maybe one wifi and one radio; I don't see anything that would register a loopback interface, which is unfortunate).
Component: WebRTC: Networking → RIL
Product: Core → Firefox OS
Version: Trunk → unspecified
I doubt this is a problem in isNetworkReady, since even once the network-ready event fires we still don't actually have any addresses, but maybe you know who to ask about this?
Flags: needinfo?(schien)
Let me explain how this worked before.

The network interface for b2g emulator is in gonk layer and there is no default network interface on b2g. B2G will only get the local address after turning on either 3G data or wifi and that's the entire code of isNetworkReady for.

@hsinyi, do you know if anything changed about setting up 3G data on emulator? The code we used in WebRTC test cases [1] is enabling radio network via mozMobileConnections and waiting for |datachange| event. I'm wondering if that trick still works on current codebase.

[1] https://dxr.mozilla.org/mozilla-central/source/dom/media/tests/mochitest/NetworkPreparationChromeScript.js
Flags: needinfo?(schien) → needinfo?(htsai)
I believe Edgar can answer better than I do ;)
Flags: needinfo?(htsai) → needinfo?(echen)
(In reply to Shih-Chiang Chien [:schien] (UTC+8) (use ni? plz) from comment #6)
> Let me explain how this worked before.
> 
> The network interface for b2g emulator is in gonk layer and there is no
> default network interface on b2g. B2G will only get the local address after
> turning on either 3G data or wifi and that's the entire code of
> isNetworkReady for.
> 
> @hsinyi, do you know if anything changed about setting up 3G data on
> emulator? The code we used in WebRTC test cases [1] is enabling radio
> network via mozMobileConnections and waiting for |datachange| event. I'm
> wondering if that trick still works on current codebase.

It should work on current codebase.

> 
> [1]
> https://dxr.mozilla.org/mozilla-central/source/dom/media/tests/mochitest/
> NetworkPreparationChromeScript.js
Flags: needinfo?(echen)
(In reply to Byron Campen [:bwc] from comment #4)
> Not sure what the component is here, exactly. The logging shows that there
> are two network interfaces, but neither has any addresses. I am not sure
> what type these two interfaces are (maybe one wifi and one radio; I don't
> see anything that would register a loopback interface, which is unfortunate).

Hi Byron, could you help to push try again with enabling ril log by changing |DEBUG_ALL| to true? Maybe we can get some clues from the log. Thank you.

[1] https://dxr.mozilla.org/mozilla-central/source/dom/system/gonk/ril_consts.js#17
Flags: needinfo?(docfaraday)
Try run with DEBUG_ALL=true

https://treeherder.mozilla.org/#/jobs?repo=try&revision=ac2dc88a6722
Flags: needinfo?(docfaraday)
From the log, the cellular data is established and the ip address is "10.0.2.100/24".

11:10:49     INFO -  -*- RadioInterface[0]: Received message from worker: {"radioTech":3,"apn":"epc.tmobile.com","chappap":3,"pdptype":"IP","rilMessageClientId":0,"rilMessageToken":7,"rilMessageType":"setupDataCall","rilRequestType":27,"rilRequestError":0,"status":0,"suggestedRetryTime":54864,"cid":"1","active":2,"type":"IP","ifname":"rmnet0","addresses":["10.0.2.100/24"],"dnses":["10.26.75.40","10.26.75.41"],"gateways":["10.0.2.2"],"state":1}

I am going to check dose the ip address of nsINetworkInterface be updated correctly. ni? me for tracking.
Flags: needinfo?(echen)
Attached patch Test patch, v1 (obsolete) — Splinter Review
Hi Byron, I found there is something wrong in RIL's nsINetworkInterface.getAddresses(). Could you try this patch to see if it helps? Thank you.
Flags: needinfo?(echen) → needinfo?(docfaraday)
Blocks: 1137088
Let's see what happens!

https://treeherder.mozilla.org/#/jobs?repo=try&revision=1a58fa017990
Flags: needinfo?(docfaraday)
Ok, it looks like we're getting network interfaces now.
Assignee: nobody → echen
Hardware: x86 → ARM
Gecko 39 also have this bug, remember to uplift to aurora. :)
When I tried to write a test case for nsINetworkInterfaceListService, I found another issue: addresses/gateways/dnses in RIL's nsINetworkInterface won't be clean after disconnect, I will provide a fix here, too.
Attached patch Patch, v2Splinter Review
Attachment #8589574 - Attachment is obsolete: true
Comment on attachment 8590128 [details] [diff] [review]
Patch, v2

Review of attachment 8590128 [details] [diff] [review]:
-----------------------------------------------------------------

- Fix the getAddresses issue.
- Clean addresses/gateways/dnses when disconnect.
- Add test case for NetworkInterfaceListService.

Hi Hsinyi, would you mind reviewing this? Thank you.
Attachment #8590128 - Flags: review?(htsai)
Comment on attachment 8590128 [details] [diff] [review]
Patch, v2

Review of attachment 8590128 [details] [diff] [review]:
-----------------------------------------------------------------

Looks good to me.
Attachment #8590128 - Flags: review?(htsai) → review+
https://hg.mozilla.org/mozilla-central/rev/76007d3799af
Status: NEW → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
Target Milestone: --- → 2.2 S10 (17apr)
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: