Closed Bug 808860 Opened 13 years ago Closed 9 years ago

B2G RIL: ril_worker should handle ipaddr w/wo carrying class info.

Categories

(Firefox OS Graveyard :: General, defect)

ARM
Gonk (Firefox OS)
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED WONTFIX

People

(Reporter: vliu, Assigned: vliu)

Details

Attachments

(2 files)

In our ril_worker, we can only deal with ipaddr which carrying class info in readDataCall_v6(). In Android reference code desing, it can handle ipaddr w/wo carrying class info to fulfill general case. We should add it in ril_worker.
Assignee: nobody → vliu
When I figured out the Android reference code , it considered the case for IPv4 and IPv6 and then assigned different value. addrPrefixLen = (ia instanceof Inet4Address) ? 32 : 128; There is a question on my mind that do we have any method or variable in ril_worker to identify if the ipaddr belongs to IPv4 or IPv6?
Currently we only consider IPv4 case in readDataCall_v6(). So let's handle the IPv4 case for missing class info. The IPv4/Ipv6 checking can be added later when IPv6 been implemented there, by filing another bug for IPv6 support.
Attached patch WIP V1. r=vicamoSplinter Review
Hi Vicamo, Can you please review the patch and give me any feedback. Thanks.
Attachment #679508 - Flags: review?(vyang)
Comment on attachment 679508 [details] [diff] [review] WIP V1. r=vicamo Review of attachment 679508 [details] [diff] [review]: ----------------------------------------------------------------- Great! Since that's in ril_worker and is a simple function, could you please also have some xpcshell-based test cases for it? You can find some examples in dom/system/gonk/tests. ::: dom/system/gonk/ril_worker.js @@ +4785,5 @@ > let prefix_len = options.ipaddr.split("/")[1]; > + if (!prefix_len) { > + // We assume point to point for IPv4 protocol. > + prefix_len = 32; > + } I think you can do: let prefix_len; [options.ip, prefix_len] = options.ipaddr.split("/"); ... Then you don't have to call split() twice.
Attachment #679508 - Flags: review?(vyang) → review+
Hi Vicamo, Can you please give me some feedbacks for my test program? Thanks.
Attachment #683018 - Flags: feedback?(vyang)
Comment on attachment 683018 [details] [diff] [review] xpc-shell test file. >function newUint8Worker() { > ... >} Please move this function from test_ril_worker_icc.js into header_helpers.js instead. > >/** > * Verify readDataCall_v6#test_ipaddr_with_without_class > */ >add_test(function test_ipaddr_with_without_class() { > let worker = newUint8Worker(); > let buf = worker.Buf; > let array_with_class = [...]; > let array_without_class = [...]; The two arrays are so terrible that I think no one but you can actually understand it. Please do as done in test_ril_worker_icc.js, utilize GsmPDUHelper.writeHexOctet(). > worker.RIL.readDataCall_v6(options); > worker.RIL.readDataCall_v6(options); Please also turn the main testing process into a function, so that we can add more similar test cases easily.
Attachment #683018 - Flags: feedback?(vyang)
Status: NEW → RESOLVED
Closed: 9 years ago
Resolution: --- → WONTFIX
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: