Closed Bug 979739 Opened 9 years ago Closed 8 years ago

setStaticIpMode

Categories

(Firefox OS Graveyard :: Wifi, defect)

defect
Not set
normal

Tracking

(blocking-b2g:-)

RESOLVED FIXED
2.1 S3 (29aug)
blocking-b2g -

People

(Reporter: wang.rong, Assigned: chucklee)

References

Details

(Whiteboard: [p=1])

Attachments

(5 files, 2 obsolete files)

User Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:13.0) Gecko/20100101 Firefox/13.0.1 (Beta/Release)
Build ID: 20120615040358

Steps to reproduce:

We need to test wifi connection with static ip and find that a function is provided in gecko.

 nsIDOMDOMRequest setStaticIpMode(in jsval network,
                                     in jsval info);

And then we called this function.


Actual results:

we met a lot of problems with using this function. It doesn't work.


Expected results:

It should work fine with us.
blocking-b2g: --- → 1.3?
blocking-b2g: 1.3? → -
Assignee: nobody → chulee
The error is caused by wrong-formatted |mask_str|.
Also did some refactory by using ip transform functions in netHelpers.

Tested in Gaia with following code:

var network = navigator.mozWifiManager.connection.network;
navigator.mozWifiManager.setStaticIpMode( network, {
  enabled: true,
  ipaddr: "192.168.5.2",
  maskLength: 24,
  gateway: "192.168.5.254",
  dns1: "192.168.5.1",
  dns2: "192.168.5.254"
});
Attachment #8386649 - Flags: review?(vchang)
Comment on attachment 8386649 [details] [diff] [review]
Fix netmask string format error and use netHelper.

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

This patch looks fine for me, but I would like the reporter to give it a shoot before landing the patch.
Attachment #8386649 - Flags: review?(vchang) → review+
Can you help us to double check if this patch works for you ?
Flags: needinfo?(wang.rong)
The function stringtoIp is one problem and there is another problem we met.

here, netFromDOM() makes setNetworkKey not equal to curNetworkKey in  WifiManager.setStaticIpMode().
we delete it and stringtoIp, then nsIDOMDOMRequest setStaticIpMode(in jsval network,
                                     in jsval info);
can work properly.


  setStaticIpMode: function(msg) {
    const message = "WifiManager:setStaticMode:Return";
    let self = this;
    let network = msg.data.network;
    let info = msg.data.info;

    //netFromDOM(network, null);
    info.ipaddr_str = info.ipaddr;
    info.proxy_str = info.proxy;
    info.gateway_str = info.gateway;
    info.dns1_str = info.dns1;
    info.dns2_str = info.dns2;

    WifiManager.setStaticIpMode(network, info, function(ok) {
      if (ok) {
        self._sendMessage(message, true, true, msg);
      } else {
        self._sendMessage(message, false, "Set static ip mode failed", msg);
      }
    });
  },
Flags: needinfo?(wang.rong)
(In reply to Wang Rong from comment #5)
> The function stringtoIp is one problem and there is another problem we met.
> 
> here, netFromDOM() makes setNetworkKey not equal to curNetworkKey in 
> WifiManager.setStaticIpMode().
> we delete it and stringtoIp, then nsIDOMDOMRequest setStaticIpMode(in jsval
> network,
>                                      in jsval info);
> can work properly.
> 
> 
>   setStaticIpMode: function(msg) {
>     const message = "WifiManager:setStaticMode:Return";
>     let self = this;
>     let network = msg.data.network;
>     let info = msg.data.info;
> 
>     //netFromDOM(network, null);

We don't have this function all in our code base.
Hi,

I am unable to connect to wifi using static ip but i am unable to ping after connecting to wifi. Please attach the complete wifiWorker.js and domWifiManager files. So that it will be helpfull for me.

Thanks
(In reply to sb00349044 from comment #7)
> Hi,
> 
> I am able to connect to wifi using static ip but i am unable to ping after
> connecting to wifi. Please attach the complete wifiWorker.js and
> domWifiManager files. So that it will be helpfull for me.
> 
> Thanks
As given in the above comment, Where i have to put this function 
var network = navigator.mozWifiManager.connection.network;
navigator.mozWifiManager.setStaticIpMode( network, {
  enabled: true,
  ipaddr: "192.168.5.2",
  maskLength: 24,
  gateway: "192.168.5.254",
  dns1: "192.168.5.1",
  dns2: "192.168.5.254"
});

Where i have to give static IP address.
Attached file WifiWorker.js (obsolete) —
As given in the above comment, Where i have to put this function 
var network = navigator.mozWifiManager.connection.network;
navigator.mozWifiManager.setStaticIpMode( network, {
  enabled: true,
  ipaddr: "192.168.5.2",
  maskLength: 24,
  gateway: "192.168.5.254",
  dns1: "192.168.5.1",
  dns2: "192.168.5.254"
});

Where i have to give static IP address. I attached wifiworker.js
Attachment #8471525 - Flags: feedback?
Comment on attachment 8471525 [details]
WifiWorker.js

The API is exposed to Gaia, so you should implement static IP function using the API in app, not trying to change anything in gecko.
That's the sample code is for.
Although you didn't mentioned what use case you are dealing with, I think you probably need to handle it in wifi part of settings app[1].
If you are not familiar with developing app,you might need get some background knowledge first[2].

[1] https://github.com/mozilla-b2g/gaia/tree/master/apps/settings
[2] https://developer.mozilla.org/en-US/Apps/Quickstart
Attachment #8471525 - Attachment is obsolete: true
Attachment #8471525 - Flags: feedback?
(In reply to Chuck Lee [:chucklee] from comment #12)
> Comment on attachment 8471525 [details]
> WifiWorker.js
> 
> The API is exposed to Gaia, so you should implement static IP function using
> the API in app, not trying to change anything in gecko.
> That's the sample code is for.
> Although you didn't mentioned what use case you are dealing with, I think
> you probably need to handle it in wifi part of settings app[1].
> If you are not familiar with developing app,you might need get some
> background knowledge first[2].
> 
> [1] https://github.com/mozilla-b2g/gaia/tree/master/apps/settings
> [2] https://developer.mozilla.org/en-US/Apps/Quickstart


I not making any apps. Just for testing purpose i want to give static IP.
Only i need to check weather wifi is working or not using staticIPMode. I do not require any apps from frontend side. DHCP is not working. So i want to check with staticip weather wifi is working or not.
You should still use app to set Static IP even for test purpose. You can use API to set static IP before associate[1].

[1] https://github.com/mozilla-b2g/gaia/blob/master/apps/settings/js/modules/wifi_context.js#L342
Just noticed that I forgot to checkin the patch, wait for try reopen.
Depends on: 1040308
https://hg.mozilla.org/mozilla-central/rev/87f68f0f9911
Status: UNCONFIRMED → RESOLVED
Closed: 8 years ago
Resolution: --- → FIXED
Target Milestone: --- → 2.1 S3 (29aug)
Hi,

I am using staticIpmode to connect wifi. I am able to connect wifi.
After connecting to wifi, i try to access market place. I am unable to access the market place.
 
Please check below logs:
08-20 08:03:44.695 I/Gecko   ( 1149): *** AUS:SVC Checker:onError - request.status: 2152398878

08-20 08:03:44.695 E/GeckoConsole( 1149): AUS:SVC Checker:onError - request.status: 2152398878

08-20 08:03:44.695 I/Gecko   ( 1149): *** AUS:SVC getStatusTextFromCode - transfer error: Update server not found (check your internet connection), code: 2152398878

08-20 08:03:44.695 E/GeckoConsole( 1149): AUS:SVC getStatusTextFromCode - transfer error: Update server not found (check your internet connection), code: 2152398878

08-20 08:03:44.695 I/Gecko   ( 1149): *** AUS:SVC UpdateService:onError - error during background update. error code: 2152398878, status text: Update server not found (check your internet connection)

08-20 08:03:44.695 E/GeckoConsole( 1149): AUS:SVC UpdateService:onError - error during background update. error code: 2152398878, status text: Update server not found (check your internet connection)
Attachment #8476610 - Flags: feedback?
It doesn't seem to be problem of static IP, if you set the parameters correctly, and static IP works correctly on flame.
The log shows there's something wrong in your platform library and start to killing daemons, including netd.

> 08-20 08:03:41.648 D/AndroidRuntime(13650): 
> 08-20 08:03:41.648 D/AndroidRuntime(13650): >>>>>> AndroidRuntime START com.android.internal.os.ZygoteInit <<<<<<
> 08-20 08:03:41.648 D/AndroidRuntime(13650): CheckJNI is OFF
> 08-20 08:03:41.648 E/AndroidRuntime(13650): JNI_CreateJavaVM failed
> 08-20 08:03:41.656 I/Gecko   ( 1149): [Parent 1149] WARNING: End of file: file /home/techm/surya/suryabuild/27_feb_build/home/techm/marvell/gecko/ipc/chromium/src/base/message_pump_libevent.cc, line 393
> 08-20 08:03:41.656 I/Gonk    ( 1149): Error connecting to : netd (Connection refused) - will retry
> 08-20 08:03:41.656 I/Gonk    ( 1149): Fail to connect to Netd
> 08-20 08:03:41.664 W/AudioSystem( 1149): AudioPolicyService server died!
> 08-20 08:03:41.664 W/AudioSystem( 1149): AudioFlinger server died!
> 08-20 08:03:41.664 I/ServiceManager(  104): service 'media.audio_policy' died
> 08-20 08:03:41.664 I/ServiceManager(  104): service 'media.audio_flinger' died
> 08-20 08:03:41.664 I/ServiceManager(  104): service 'media.player' died
> 08-20 08:03:41.664 I/ServiceManager(  104): service 'media.camera' died
> 08-20 08:03:41.664 I/ServiceManager(  104): service 'MarvellWFDAVManager' died
> 08-20 08:03:41.664 I/ServiceManager( 1149): Waiting for service media.audio_policy...
> 08-20 08:03:41.679 I/Netd    (13652): Netd 1.0 starting

Maybe some static IP settings is lost during the process.
You can check IP, routing table, and dns settings of the devices to make sure if the static IP is set correctly.
Another error in log, I think you should solve these issues first.

> 08-20 08:03:41.687 W/InterfaceController(13652): Warning (Cannot load library: load_library(linker.cpp:745): library "/system/lib/libnetcmdiface.so" not found) while opening the net interface command library
I used static ip mode to conenct ip address. Now i am able to connect static ip address. In ui it is showing as connect. But in connectionInfoUpdate  ipAddress:(void 0) or  ipAddress:"". I clicked on browser and type url. Once i click on go button. Some times it showing unable to connect network url and some time b2g is restarting. PFB logs and attached adb logs.


Line 9977: 08-20 08:01:24.242 I/Gecko   ( 1201): -*- WifiWorker component: Firing connectionInfoUpdate: ({signalStrength:-66, relSignalStrength:75, linkSpeed:54, ipAddress:""})
	Line 10951: 08-20 08:01:29.203 I/Gecko   ( 1201): -*- WifiWorker component: Firing connectionInfoUpdate: ({signalStrength:-67, relSignalStrength:73, linkSpeed:54, ipAddress:(void 0)})
Attachment #8480456 - Flags: feedback?
(In reply to Chuck Lee [:chucklee] from comment #22)
> Another error in log, I think you should solve these issues first.
> 
> > 08-20 08:03:41.687 W/InterfaceController(13652): Warning (Cannot load library: load_library(linker.cpp:745): library "/system/lib/libnetcmdiface.so" not found) while opening the net interface command library

I am using static ip adress.
Now i am able to connect internet. Monday i able to browse internet in browse. Today i am unable to browse internet in browser. It showing Server not found. Can't find the server at http://www.google.com.

PFA below logs:

09-04 03:32:53.062 I/Gonk    (11520): Error connecting to : netd (Connection refused) - will retry

09-04 03:32:53.062 I/Gonk    (11520): Fail to connect to Netd

09-04 03:32:53.070 E/        (11520): GetPrevFBAcquireFd: FB acquire fence is invalid!
(In reply to Chuck Lee [:chucklee] from comment #21)
> It doesn't seem to be problem of static IP, if you set the parameters
> correctly, and static IP works correctly on flame.
> The log shows there's something wrong in your platform library and start to
> killing daemons, including netd.
> 
> > 08-20 08:03:41.648 D/AndroidRuntime(13650): 
> > 08-20 08:03:41.648 D/AndroidRuntime(13650): >>>>>> AndroidRuntime START com.android.internal.os.ZygoteInit <<<<<<
> > 08-20 08:03:41.648 D/AndroidRuntime(13650): CheckJNI is OFF
> > 08-20 08:03:41.648 E/AndroidRuntime(13650): JNI_CreateJavaVM failed
> > 08-20 08:03:41.656 I/Gecko   ( 1149): [Parent 1149] WARNING: End of file: file /home/techm/surya/suryabuild/27_feb_build/home/techm/marvell/gecko/ipc/chromium/src/base/message_pump_libevent.cc, line 393
> > 08-20 08:03:41.656 I/Gonk    ( 1149): Error connecting to : netd (Connection refused) - will retry
> > 08-20 08:03:41.656 I/Gonk    ( 1149): Fail to connect to Netd
> > 08-20 08:03:41.664 W/AudioSystem( 1149): AudioPolicyService server died!
> > 08-20 08:03:41.664 W/AudioSystem( 1149): AudioFlinger server died!
> > 08-20 08:03:41.664 I/ServiceManager(  104): service 'media.audio_policy' died
> > 08-20 08:03:41.664 I/ServiceManager(  104): service 'media.audio_flinger' died
> > 08-20 08:03:41.664 I/ServiceManager(  104): service 'media.player' died
> > 08-20 08:03:41.664 I/ServiceManager(  104): service 'media.camera' died
> > 08-20 08:03:41.664 I/ServiceManager(  104): service 'MarvellWFDAVManager' died
> > 08-20 08:03:41.664 I/ServiceManager( 1149): Waiting for service media.audio_policy...
> > 08-20 08:03:41.679 I/Netd    (13652): Netd 1.0 starting
> 
> Maybe some static IP settings is lost during the process.
> You can check IP, routing table, and dns settings of the devices to make
> sure if the static IP is set correctly.

Hi below parametes i am passing for the static ip address.
setStaticIpMode(network, {
		  enabled: true,
		  ipaddr: "192.168.0.106",
		  proxy:"",
		  maskLength: 24,
		  gateway: "192.168.0.1",
		  dns1: "8.8.8.8",
		  dns2: "8.8.4.4"
		}) 

Please let me know parameter are correct or not.
(In reply to sb00349044 from comment #25)
> Hi below parametes i am passing for the static ip address.
> setStaticIpMode(network, {
> 		  enabled: true,
> 		  ipaddr: "192.168.0.106",
> 		  proxy:"",
> 		  maskLength: 24,
> 		  gateway: "192.168.0.1",
> 		  dns1: "8.8.8.8",
> 		  dns2: "8.8.4.4"
> 		}) 
> 
> Please let me know parameter are correct or not.

I mean use console command including "adb shell netcfg", "adb shell cat /proc/net/route", and "adb shell getprop | grep dns" to check if your IP/Gateway/DNS settings are set correctly.
Also you still have to check the crash I found in log above.
Attached image wifi_checking.png
PFA screen shot.

Please let me know your view.
Attachment #8489204 - Flags: feedback?
Net network settings seems correct to me, I don't know why it doesn't work.
Attached file wifi-03.txt
Hi 
Check the below logs for static IP. Please let us know any thing is wrong.
Attachment #8490644 - Flags: feedback?
This issue is resolved. U can close this issue.
You need to log in before you can comment on or make changes to this bug.