Closed Bug 530484 Opened 10 years ago Closed 10 years ago

Implement Necko-WiFi on Solaris

Categories

(Core :: Networking, defect)

x86
Solaris
defect
Not set

Tracking

()

RESOLVED FIXED
mozilla1.9.3a3

People

(Reporter: ginnchen+exoracle, Assigned: ginnchen+exoracle)

References

Details

Attachments

(1 file, 1 obsolete file)

This is to implement wifi scan on Solaris.

I'm going to use "pfexec dladm scan-wifi" command, pfexec is to get proper privilege.

Here's the man page.

     dladm scan-wifi [[-p] -o field[,...]] [wifi-link]

         Scans for WiFi networks, either on all  WiFi  links,  or
         just on the specified wifi-link.

        -o field[,...], --output=field[,...]

             A case-insensitive, comma-separated list  of  output
             fields to display. The field name must be one of the
             fields listed below, or the  special  value  all  to
             display all fields. For each WiFi network found, the
             following fields can be displayed:

             LINK

                 The name of the link the WiFi network is on.

             ESSID

                 The ESSID (name) of the WiFi network.

             BSSID

                 Either  the  hardware  address   of   the   WiFi
                 network's  Access  Point  (for BSS networks), or
                 the WiFi  network's  randomly  generated  unique
                 token (for IBSS networks).

             SEC
                Either none for a  WiFi  network  that  uses  no
                 security,  wep  for a WiFi network that requires
                 WEP (Wired Equivalent Privacy),  or  wpa  for  a
                 WiFi  network that requires WPA (Wi-Fi Protected
                 Access).

             MODE

                 The supported connection modes: one or  more  of
                 a, b, or g.

             STRENGTH

                 The strength of the signal:  one  of  excellent,
                 very good, good, weak, or very weak.

             SPEED

                 The maximum speed of the WiFi network, in  mega-
                 bits per second.

             BSSTYPE

                 Either bss for BSS (infrastructure) networks, or
                 ibss for IBSS (ad-hoc) networks.

         -p, --parseable

             Display using a stable machine-parseable format. The
             -o option is required with -p. See "Parseable Output
             Format", below.

  Parseable Output Format
     Many dladm subcommands have an option that  displays  output
     in  a  machine-parseable format. The output format is one or
     more  lines  of  colon  (:)  delimited  fields.  The  fields
     displayed are specific to the subcommand used and are listed
     under the entry for the -o option for  a  given  subcommand.
     Output  includes only those fields requested by means of the
     -o option, in the order requested.

     When you request multiple fields, any literal colon  charac-
     ters  are  escaped  by  a backslash (\) before being output.
     Similarly, literal backslash characters will also be escaped
     (\\). This escape format is parseable by using shell read(1)
     functions with the environment variable IFS=: (see EXAMPLES,
     below). Note that escaping is not done when you request only
     a single field.

So if I use "pfexec dladm scan-wifi -p -o BSSID,ESSID,STRENGTH".
I will get something like this:

0\:e\:b\:7c\:19\:0:ap-2:excellent
0\:e\:14\:19\:d8\:80:ap-1:very good

(the mac address is fake in this example.)
Attached patch patch (obsolete) — Splinter Review
Attachment #414000 - Flags: review?(mozbugz)
Status: NEW → ASSIGNED
strnlen() is a function with a short history. N/A on Solaris 10.
We may want to avoid using it.

We can use strlen() directly or use PL_strnlen().
is there no better way than to spawn?
The only public interface for wifi scan on Solaris is command line.

BTW: I should move OS_LIBS += $(GLIB_LIBS) to netwerk/build/Makefile.in
Comment on attachment 414000 [details] [diff] [review]
patch

take a look at the updated linux version:

http://mxr.mozilla.org/mozilla-central/source/netwerk/wifi/src/nsWifiScannerUnix.cpp#164

specifically mKeepGoing.

otherwise, in general it looks fine.
Attachment #414000 - Flags: review?(mozbugz) → review-
(In reply to comment #5)
> (From update of attachment 414000 [details] [diff] [review])
> take a look at the updated linux version:
> 
> http://mxr.mozilla.org/mozilla-central/source/netwerk/wifi/src/nsWifiScannerUnix.cpp#164
> 
> specifically mKeepGoing.
> 
> otherwise, in general it looks fine.

Sorry, I didn't get it.
The last change of nsWifiScannerUnix.cpp is for copyright holder.
nsWifiScannerSolaris has the same line of "while (mKeepGoing == PR_TRUE) {" as nsWifiScannerUnix.cpp.

I would like to update the copyright holder and fix trailing space in some lines.
Attached patch patch v2Splinter Review
The change for mKeepGoing was landed on Feb 7. Now I understood what you mean.

Changes:
1) while (mKeepGoing)
2) move OS_LIBS += $(GLIB_LIBS) to netwerk/build/Makefile.in
3) use PL_strnlen() instead of strnlen()
4) copyright change like other files in this directory.
5) remove trailing spaces at end of line, I'll file another bug for other files in this directory.
Attachment #414000 - Attachment is obsolete: true
Attachment #426221 - Flags: review?(mozbugz)
this looks pretty good.  is scan-wifi output localized at all?  I am worried about "very weak" being a different string on localization of Solaris.
AFAIK, it will not be localized.
Attachment #426221 - Flags: review?(mozbugz) → review+
http://hg.mozilla.org/mozilla-central/rev/fbd35e0d81b5
Status: ASSIGNED → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
Flags: in-testsuite-
Target Milestone: --- → mozilla1.9.3a3
I may be mistaken, but I've got the feeling that nsWifiScannerSolaris.cpp
didn't really end up in the tree. Shouldn't it have been pushed as well?
See http://hg.mozilla.org/mozilla-central/file/fbd35e0d81b5/netwerk/wifi/src/
and http://hg.mozilla.org/mozilla-central/rev/fbd35e0d81b5
Ginn, can you figure out what happened?  it isn't just a missing file, but maybe a partial push
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
I noticed this problem 2 hours ago.
I forgot to use "hg add" when I committed it.

Pushed:
http://hg.mozilla.org/mozilla-central/rev/0f648585f4d9
Status: REOPENED → RESOLVED
Closed: 10 years ago10 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.