Closed Bug 1163476 Opened 10 years ago Closed 10 years ago

[emu-x86-kk][emu-kk] how to improve DNS configuration so emu connection won't be affected by host machine's configuration

Categories

(Firefox OS Graveyard :: Emulator, defect, P3)

ARM
Gonk (Firefox OS)
defect

Tracking

(Not tracked)

RESOLVED FIXED
FxOS-S9 (16Oct)

People

(Reporter: hsinyi, Assigned: jessica)

References

Details

Attachments

(2 files)

STR: 1) turn on 3G and wait for "3G icon" appearing on status bar 2) open browser app to browse == log snippet == 05-10 23:44:36.196 I/Gecko ( 987): -*- RILNetworkInterface[0:1]: notifyRILNetworkInterface type: 1, state: 1 05-10 23:44:36.196 W/NetworkUtils( 987): Error (-3) occurred in CommandResult NetworkUtils::removeDefaultRouteLegacy(NetworkParams&) (../../../../gecko/dom/system/gonk/NetworkUtils.cpp:1969) 05-10 23:44:36.196 E/NetworkUtils( 987): addHostRouteLegacy does not support empty gateway. 05-10 23:44:36.306 E/BandwidthController( 978): No such iface rmnet0 to delete 05-10 23:44:47.846 W/GeckoConsole( 987): [JavaScript Error: "TypeError: element is null" {file: "chrome://global/content/forms.js" line: 755}] 05-10 23:44:47.896 W/GeckoConsole( 987): Content JS WARN: InputMethodGlue: sendKey() rejected with error InputContext got destroyed 05-10 23:44:47.896 W/GeckoConsole( 987): at InputMethodGlue.prototype.sendKey/< (app://keyboard.gaiamobile.org/js/keyboard/input_method_manager.js:218:5) 05-10 23:44:47.896 W/GeckoConsole( 987): Content JS WARN: InputMethodGlue: call setUpperCase() when inputContext does not exist. 05-10 23:44:47.896 W/GeckoConsole( 987): at InputMethodGlue.prototype.setUpperCase (app://keyboard.gaiamobile.org/js/keyboard/input_method_manager.js:250:1) 05-10 23:45:11.386 W/Browser ( 1783): [JavaScript Warning: "Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at https://marketplace.firefox.com/api/v2/apps/search/rocketbar/?q=w&limit=4&lang=en-US&region=restofworld. (Reason: CORS request failed)."]
sorry comment 0 doesn't seem to point to the right cause. After keying in a web site in the browser app, nothing is shown. All I saw is a blank screen.
Summary: [emu-x86-kk] cannot browse due to NetworkUtils error → [emu-x86-kk] cannot browse correctly. A blank screen is shown.
Okay, it turns out that it's my host machine configuration issue that let emulator detect 127.0.0.1 as DNS. If the DNS is set as 10.0.2.3, everything works perfectly. So, close this as WORKSFORME.
Status: NEW → RESOLVED
Closed: 10 years ago
Resolution: --- → WORKSFORME
(In reply to Hsin-Yi Tsai [:hsinyi] from comment #3) > Okay, it turns out that it's my host machine configuration issue that let > emulator detect 127.0.0.1 as DNS. If the DNS is set as 10.0.2.3, everything > works perfectly. So, close this as WORKSFORME. To let emulator detects useable DNS, we'd make sure the host machine doesn't accidentally set localhost nameserver 127.0.0.1 as DNS in /etc/resolv.config You may refer to [1] to set your DNS on ubuntu. Though I understand this is a host machine configuration issue, I'd also like to ask for reconsideration to revert [2]. For the sake of emulator users and consistent testing environments, does it make more sense to you that emulator tries to reply "useable" DNS upon the request of setupDataCall? [1] http://unix.stackexchange.com/questions/128220/how-do-i-set-my-dns-on-ubuntu-14-04 [2] https://github.com/jessi3py/platform_external_qemu/commit/ba829a51ee50e3bdfb807406fca54c2c7a4a41d7
Flags: needinfo?(jjong)
Flags: needinfo?(echen)
I am in favor of reporting usable DNSes, in that case we are sure internet connection will work through data call, no matter how the host machine is configured. Here [1] is a bit of history about reporting usable DNSes in android_modem.c. But then I was asked to revert this to keep the original state.. Is there anything we can do better besides from modifying android_modem.c? [1] https://github.com/mozilla-b2g/platform_external_qemu/pull/87
Flags: needinfo?(jjong)
It makes sense to me. With it, we can make emulator more friendly to the users and the testing environments.
Flags: needinfo?(echen)
Let me reopen this for further discussion, thanks for the input :)
Status: RESOLVED → REOPENED
Resolution: WORKSFORME → ---
Summary: [emu-x86-kk] cannot browse correctly. A blank screen is shown. → [emu-x86-kk][emu-kk] how to improve DNS configuration so emu connection won't be affected by host machine's configuration
No longer blocks: Emulator_L_Local
Priority: -- → P3
An alternative is to add the "-dns-server" [1] option when running emulator, e.g. "-dns-server 8.8.8.8", then we don't need to change qemu's logic. However, currently the mcc/mnc used in emulator maps to an apn setting that has protocol default to IPv6, so the dns server will be converted into an IPv6 address, which is not usable. I am thinking whether we should change emulator's default to an apn setting with IPv4 (IPv6 is covered by tests). [1] http://developer.android.com/tools/help/emulator.html#startup-options
Hi Edgar, per comment 8.. - Do you think adding "-dns-server 8.8.8.8,8.8.4.4" in run-emulator.sh is a good idea? - If yes, we still need to set emulator to use IPv4 address by default. Currently, the MCC/MNC reported in qemu is 310-260 [1] which matches with T-Mobile apn [2], and has IPv6 as the default protocol. We could change qemu's default MCC/MNC or we could set ro.moz.ril.ipv6 back to false, and set it to true when running tests. What do you think? [1] https://github.com/mozilla-b2g/platform_external_qemu/blob/master/telephony/android_modem.c#l76-l77 [2] https://github.com/mozilla-b2g/gaia/blob/master/shared/resources/apn.json#L1301
Flags: needinfo?(echen)
(In reply to Jessica Jong [:jjong] [:jessica] from comment #9) > Hi Edgar, per comment 8.. > > - Do you think adding "-dns-server 8.8.8.8,8.8.4.4" in run-emulator.sh is a > good idea? Sounds good. Thanks for finding this. With this, we don't have to hard-coded the dnses in qemu and also have a easy way to customize them. > - If yes, we still need to set emulator to use IPv4 address by default. > Currently, the MCC/MNC reported in qemu is 310-260 [1] which matches with > T-Mobile apn [2], and has IPv6 as the default protocol. We could change > qemu's default MCC/MNC or we could set ro.moz.ril.ipv6 back to false, and > set it to true when running tests. > Changing default MCC/MNC is ok. I haven't better idea than this. > What do you think? > > > [1] > https://github.com/mozilla-b2g/platform_external_qemu/blob/master/telephony/ > android_modem.c#l76-l77 > [2] > https://github.com/mozilla-b2g/gaia/blob/master/shared/resources/apn. > json#L1301
Flags: needinfo?(echen)
Thanks for the feedback, I'll upload the corresponding patches for review. (In reply to Edgar Chen [:edgar][:echen] from comment #10) > (In reply to Jessica Jong [:jjong] [:jessica] from comment #9) > > Hi Edgar, per comment 8.. > > > > - Do you think adding "-dns-server 8.8.8.8,8.8.4.4" in run-emulator.sh is a > > good idea? > > Sounds good. Thanks for finding this. > With this, we don't have to hard-coded the dnses in qemu and also have a > easy way to customize them. > > > - If yes, we still need to set emulator to use IPv4 address by default. > > Currently, the MCC/MNC reported in qemu is 310-260 [1] which matches with > > T-Mobile apn [2], and has IPv6 as the default protocol. We could change > > qemu's default MCC/MNC or we could set ro.moz.ril.ipv6 back to false, and > > set it to true when running tests. > > > > Changing default MCC/MNC is ok. I haven't better idea than this. > > > What do you think? > > > > > > [1] > > https://github.com/mozilla-b2g/platform_external_qemu/blob/master/telephony/ > > android_modem.c#l76-l77 > > [2] > > https://github.com/mozilla-b2g/gaia/blob/master/shared/resources/apn. > > json#L1301
Comment on attachment 8668328 [details] [review] Github PR for B2G: set -dns-server in run-emulator.sh Hi Michael, we'd like to set specified dns servers to make sure network connectivity works regardless of the host machine configuration. Would you mind reviewing this? Thanks.
Attachment #8668328 - Flags: review?(mwu)
Comment on attachment 8668328 [details] [review] Github PR for B2G: set -dns-server in run-emulator.sh I.. don't know, really. Maybe tzimmermann has more of an opinion?
Attachment #8668328 - Flags: review?(mwu) → review?(tzimmermann)
Comment on attachment 8668328 [details] [review] Github PR for B2G: set -dns-server in run-emulator.sh Hi This is not generic because - it's hard coded, - it solves a single problem on a specific host, and - the DNS refers to a Google service over which we have no control. If you want to solve this, please add a command-line switch and/or environment variable to 'run-emulator.sh' (preferably both). The default should be the current behavior of using the host configuration.
Attachment #8668328 - Flags: review?(tzimmermann) → review-
Thank you Thomas for the feedback, using command-line switch and/or environment variable sounds like a good idea. Just wanted to confirm with you, so the usage would be: ./run-emulator.sh EMU_DNS_SERVER=8.8.8.8,8.8.4.4 and/or, export EMU_DNS_SERVER=8.8.8.8,8.8.4.4 ./run-emulator.sh of course, the dns servers are configurable. And if not set, host configuration is used. (In reply to Thomas Zimmermann [:tzimmermann] [:tdz] from comment #15) > Comment on attachment 8668328 [details] [review] > Github PR for B2G: set -dns-server in run-emulator.sh > > Hi > > This is not generic because > > - it's hard coded, > - it solves a single problem on a specific host, and > - the DNS refers to a Google service over which we have no control. > > If you want to solve this, please add a command-line switch and/or > environment variable to 'run-emulator.sh' (preferably both). The default > should be the current behavior of using the host configuration.
(In reply to Jessica Jong [:jjong] [:jessica] from comment #16) > Thank you Thomas for the feedback, using command-line switch and/or > environment variable sounds like a good idea. > > Just wanted to confirm with you, so the usage would be: > ./run-emulator.sh EMU_DNS_SERVER=8.8.8.8,8.8.4.4 I think it'd rather be: "./run-emulator.sh -dns-server 8.8.8.8,8.8.4.4" for command line args. > and/or, > export EMU_DNS_SERVER=8.8.8.8,8.8.4.4 > ./run-emulator.sh > > of course, the dns servers are configurable. > And if not set, host configuration is used. > > (In reply to Thomas Zimmermann [:tzimmermann] [:tdz] from comment #15) > > Comment on attachment 8668328 [details] [review] > > Github PR for B2G: set -dns-server in run-emulator.sh > > > > Hi > > > > This is not generic because > > > > - it's hard coded, > > - it solves a single problem on a specific host, and > > - the DNS refers to a Google service over which we have no control. > > > > If you want to solve this, please add a command-line switch and/or > > environment variable to 'run-emulator.sh' (preferably both). The default > > should be the current behavior of using the host configuration.
Comment on attachment 8668328 [details] [review] Github PR for B2G: set -dns-server in run-emulator.sh Hi Thomas, I have updated the patch based on your feedback. Would you mind checking again? Thanks.
Attachment #8668328 - Flags: review- → review?(tzimmermann)
Comment on attachment 8668328 [details] [review] Github PR for B2G: set -dns-server in run-emulator.sh Thanks a lot for going the extra mile and fixing this bug! The patch looks good. I only left some comments on minor style issues in the PR. Please check before landing.
Attachment #8668328 - Flags: review?(tzimmermann) → review+
Sorry for not replying to your earlier questions. I missed them while going through my inbox.
(In reply to Thomas Zimmermann [:tzimmermann] [:tdz] from comment #19) > Comment on attachment 8668328 [details] [review] > Github PR for B2G: set -dns-server in run-emulator.sh > > Thanks a lot for going the extra mile and fixing this bug! > > The patch looks good. I only left some comments on minor style issues in the > PR. Please check before landing. I've updated the patch. Thanks for your valuable comments!
Assignee: nobody → jjong
Keywords: checkin-needed
Status: REOPENED → RESOLVED
Closed: 10 years ago10 years ago
Keywords: checkin-needed
Resolution: --- → FIXED
Target Milestone: --- → FxOS-S9 (16Oct)
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: