-
Notifications
You must be signed in to change notification settings - Fork 561
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Failed to parse S1AP and RANAP asn.1 #185
Comments
By the way, though S1AP and RANAP can be parsed and generate corresponding C code for S1AP and RANAP with commit 94f0b64, due to APER not support in this repository, S1AP and RANAP message can not be encoded or decoded yet. We still need to merge APER implementation, for example #125 or #115, in the future. |
Part of problems during parsing S1AP's ASN.1 was fixed in fix_s1ap branch of my fork. But there still be unsolved ones. It looks like current
|
@brchiu You state "though S1AP and RANAP can be parsed and generate corresponding C code for S1AP and RANAP with commit 94f0b64". I can confirm this, both for RANAP and S1AP. I then did a git bisect and found that ea6635b is the offending commit that breaks parsing of the S1AP/RANAP (and likely many other 3GPP) ASN1 syntax. Unfortunately that's a very large commit and the commit log doesn't provide a lot of explanation :/ |
hi, @laf0rge, I am quite interested in several open source projects related to telecom, e.g. your Osmocom and openairinterface... etc. @vlm add many good and useful features in subsequent commits. For example, the ability to parse into the content of PDU instead of leaving it as ANY type there in 94f0b64. I do appreciate his great effort. Moreover, APER is required to decode S1AP, RANAP .... etc message. I did some merge from @mouse07410's repository. It also in the midway of work. |
@brchiu APER is not the difficult part, I think that's rather easy to solve. It doesn't require too much knowledge about asn1c internals. APER encoding rules are very easy, and not all that different from UPER, so the existing code can be used as template. Also, there's the hacks by Eurecom/OAI and the code by @mouse07410 so lots of point to start. The proper approach to clean this up and complete is is by means of a test suite againts which the code can be validated. There's an industry-proven UPER implementation in Erlang, and I have access to proprietary asn1 compilers, so generating trusted test data from known implementations is also an option that way. I'm happy to contribute on that side in the months to come. However, the fact that asn1c fails to process the S1AP/RANAP syntax and has FATAL aborts is sad, particularly as it appears to be a regression. I strongly suggest you get your "minimal" sample for reproducing the bug submitted as a test case into upstream asn1c to avoid any such regressions from re-appearing. Fixing that looks like it requires quite a lot of knowledge about asn1c internals, and that's where I have no clue, sorry. |
I must say, it is a limitation but NOT an regression. @vlm's current implementation focus on handling J2735 and 1609 specs which does not heavily use parameterized type as 3GPP specs do. So newly added features can not work on multiple instances of parameterized type .... etc. That is the current situation. I don't have time to deal with merging of APER code simultaneously. Whether it is difficult part or not is irrelevant to me. If anyone expect S1AP .... etc to work in future asn1c, he/she had better to put effort on it. Wish you can contribute to it. |
On Mon, Oct 09, 2017 at 11:17:44AM +0000, Bi-Ruei, Chiu wrote:
I must say, it is a limitation but **NOT** an regression.
I think it depends on your point of view: If something used to work in
earlier versions but now no longer works, a strong case can be made to
call it a regression. But I don't think we need to argue about terminology
here.
@vlm's current implementation focus on handling J2735 and 1609 specs which does not heavily use
parameterized type as 3GPP specs do. So newly added features can not work on multiple instances of
parameterized type .... etc. That is the current situation.
I fully understand that and I understand there is a commercial requirement/contract
for @vlm to put his focus on those areas. That's natural and I'm perfectly
happy that he has time to work on asn1c at all, particularly as it seems now
with funding for some features. Yet, of course it is sad to see that on the
way some other promising new capabilities (such as being able to compile S1AP/RANAP/HNBAP/RUA/NBAP/...)
get broken again.
I don't have time to deal with merging of APER code simultaneously. Whether it is difficult part or not is irrelevant to me. If anyone expect S1AP .... etc to work in future asn1c, he/she had better to put effort on it.
I'm not saying that I'm "expecting" anyone else to do anything, or that I am entitled
to any kind of feature or functionality without either working on it or paying
for it being worked on.
I've just stated that I think APER is an area where I and/or the
@osmocom community and/or the @sysmocom team can help, as unlike as the issue #185
it is not a complex task involving intricate knowledge on asn1c internals.
Wish you can contribute to it.
Unfortunately I'm overworked as-is with other open source cellular related
work. So not right away, but within the weeks + months to come, I clearly have an
interest to contribute in that area.
…--
- Harald Welte <[email protected]> http://laforge.gnumonks.org/
============================================================================
"Privacy in residential applications is a desirable marketing option."
(ETSI EN 300 175-7 Ch. A6)
|
Status Update : With commit 3bbbd04, ASN.1 of S1AP, RANAP, X2AP, M3AP, LPPa, PCAP, XwAP can be parsed by However, there still be problem associated with ASN.1 of NBAP due to the following syntax it uses.
Moreover, because of lacking APER codec functions for several types, e.g. OPENTYPE, in #226, I am not able to test the built Wish people who need this feature can jointly help to improve it. |
Hi @brchiu, I added OpenType APER support (copy-pasted 😊 uper functions) in my repo 2be7f4b I could open a PR to your repo or you could just cherry-pick this commit in your branch to include it in #226 With it I'm able the APER encode and then decode the following S1AP message (in XER format)
|
@velichkov , Great ! However, a previous example decoded by @mouse07410 repository shows
Looks like |
I'm testing with the generated converter-example and with this sample-S1AP-InitialUEMessage.aper it fails with
so it does traverse down but the IOC table in ProtocolIE-Field.c is empty and I can't figure out why. Maybe here we need to call the |
It seems only IOC tables of Taking aforementioned
There still be some work to do. |
Part of IOC generation problems is solved in my local branch. However, due to complex relation between so many generated types, there is cyclic inclusion of header file occurs and some generated C files from S1AP ASN.1 fail to be compiled.
I think it might need a overhaul of file structure to solve this problem. |
Hi @brchiu,
You have made a great progress!
An alternative solution according to the documentation could be
I just tried with both options and the cyclic inclusion is removed at least for S1AP but the compilation fails with
|
hi, @velichkov, Many thanks for your suggestion. 👍 Below is the first several lines of my
However, after merged with #226, Based on the following excerpt,
Then checking
And in
Can any one have a solution to this ? |
🎉 Yeah, that's really a great news. Many thanks for your great efforts !!!
Could you upload the pcap file if you still have it?
I will try to fix it this weekend. |
I try to decode other S1AP sample messages available, i.e. 🎉 🎉 🎉 Below is an example :
As for the wireshark captures, I don't remember where I downloaded them, perhaps from Wireshark's wiki but they do not exist any more. We should have them for validating the decoding result. 😢 As for these binary UPDATE: I have sent pull request #234 and the binary files are there. @laf0rge, we have some progress for S1AP message processing. |
One memory leak in
|
Hi @brchiu, About the failure to decode asn1c/skeletons/constr_SEQUENCE.c Lines 1557 to 1572 in ddbabf4
This code was added in mouse07410#29 in commits 569eeaf and 12850ab |
Based on Velichkov's suggestion on comment : vlm#185 (comment)
Hi, @velichkov, Many thanks for your advice. It works ! |
Based on Velichkov's suggestion on comment : vlm#185 (comment)
I believe those lines were added to address a problem, mouse07410#30 to be specific. Does it apply to the current master here? If so, should anything be done about it? |
Hi @mouse07410,
Yes, I know.
Yes, it does.
Yes, someone needs to implement a proper fix. The master in your fork is currently broken as well and cannot decode this S1AP parameter and other SEQUENCEs as well (see mouse07410#31). It seems you shouldn't have accepted this fix as it is neither correct nor complete, there is no equivalent code in SEQUENCE_encode_aper so the encode/decode is not symmetrical. My priority right now is to help @brchiu in his efforts to improve IOC support. |
OK, makes sense. Thanks! |
On i686 the long is 4 bytes and the right shift with more then 32 bits is probably an undefined behaviour See vlm#185 (comment)
On i686 the long is 4 bytes and when converted to uint64_t some big unsigned values get converted to very big negative values See vlm#185 (comment)
Hi @acetcom, I just pushed 3 commits in my fork - two APER fixes (fec0acc, f5dc5cc) and one XER (8d06d92) $ file ./s1ap-dump
./s1ap-dump: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), dynamically linked, interpreter /lib/ld-linux.so.2, for GNU/Linux 2.6.32, BuildID[sha1]=58db588dc25d71cb014f8c63f3f4577123e710fb, with debug_info, not stripped
$ ./s1ap-dump -t
000b4080 8c000003 00000002 00010008 00020001 001a0079 78efefef efefefef
efefefef efefefef efefefef efefefef efefefef efefefef efefefef efefefef
efefefef efefefef efefefef efefefef efefefef efefefef efefefef efefefef
efefefef efefefef efefefef efefefef efefefef efefefef efefefef efefefef
efefefef efefefef efefefef efefefef ef The problems were also reproducible with |
Hi, @velichkov Great! NextEPC 32bit version is also successfully ported with this. For your reference, I've only changed the following code based on your s1ap branch.
The attached pcap was created by new S1AP API. And also, you can find the example code in NextEPC repository.
The new NextEPC will be released after testing real eNodeB. 1~2 week might be needed. Thank you very much!!! Best Regards, |
@velichkov what branch of your fork should I cherry-pick those three commits from (assuming it matters?)? Or maybe you can make a PR to my vlm_master branch (which will replace |
Hi @mouse07410,
The branch name is
Depends if you need 32bit support or not.
I prefer if you could merge my branch directly or review and cherry-pick some of the commits that you find useful because the whole procedure of creating additional branches, rebasing, opening PRs is tedious and time consuming. |
Thanks!
Actually, what I meant to ask was - do I need to know the branch name in order to cherry-pick a commit from your repo. ;-) It appears that I don't - cherry-picking worked OK without specifying the branch.
Fair enough, at least for those more straightforward "mergers". Could you tell me what |
On i686 the long is 4 bytes and the right shift with more then 32 bits is probably an undefined behaviour See vlm#185 (comment)
On i686 the long is 4 bytes and when converted to uint64_t some big unsigned values get converted to very big negative values See vlm#185 (comment)
Hi @mouse07410,
My master is pretty out of date because I don't use it. My
My changes are not specific to the S1AP protocol and they need to be integrated in the mainline. I saw you've already cherry-picked the three commits mentioned in the previous posts and most probably you will want a23f13f and ca9847d as well. The first fixes a segmentation fault while freeing OPEN_TYPE structs and with the second the |
Ah, OK. Good to know.
OK, good. I'm merging your Thanks! |
@velichkov OK, merged. My vlm_master now has your |
Hi, @velichkov and @mouse07410 I've tested mouse07410/vlm_master branch with NextEPC test framework. It is also correctly working. But, I'd just like to know the following difference between velichkov/s1ap and mouse07410/vlm_master. Currently, NextEPC is applied with velichkov/s1ap.
|
Ha, you noticed. ;-) The difference you see contains:
And also it looks like indentation could be tightened up a little in that file. ;-) |
For reference, mouse07410/vlm_master is also correctly working in 32bit machine. |
Hi @mouse07410,
The For example if |
Would you recommend then copying all (or most) of the checks that Or would you recommend abandoning (reverting) this patch? Update
Update2 @velichkov, I added a few checks, modeling them after |
@velichkov I hate to bother you, as you're already helping a lot - but would you mind taking a look at the fix I applied to |
Sorry for late response! Today(26/March), I've tested asn1c library with NextEPC test framework.
In 32bit machine, both are correctly worked for NextEPC. Thanks a lot! |
Hi @mouse07410,
I think these checks are sufficient. |
Thank you! |
Hi @velichkov Yesterday, I built an LTE network using srsENB and NextEPC. You can find the setup guide in the document. During the experiment, I've found one problem for decoding E-RAB Setup Response of S1AP message. I've attached srsenb.tar.gz file.
I think that id-CriticalityDiagnostics(58) seems to be related to the problem. The following is a result of execution.
My apologies in advance if the packet is wrong encoded. Thanks a lot! |
Hi @acetcom,
Most probably the srsENB encoding is not correct because wireshark does not decode it as well.
Yes the problem is related with this parameter. To get some more info run s1ap-dump with
|
Thank you for your quick reply. I released NextEPC v0.3.7(Supporting S1AP Release 14 with new S1AP library) yesterday, and I am really glad that I can keep it. From now on I will also use the -dd option. Sorry for this noise. |
hi, @acetcom, just for your information. |
Dear @brchiu ,
Do you have any clue that how this can be resolved? Maybe with similar approach which addressed the problem for S1AP. Thanks |
@abodin , these PRs for information object set are of no help to the problem encountered with GSMMAP.asn, you need to dig into asn1p_y.y to have a solution. Good luck ! |
https://github.com/bhati-github/5GCore_NMP.git |
I'd like to report another problem when processing S1AP, RANAP and NBAP asn1 files with newest repository acdca41.
They are OK to be parsed and C code generated in 94f0b64
If you need these asn.1 files, please let me know.
Thanks for your great effort !
The text was updated successfully, but these errors were encountered: