riebl / vanetza

Open-source implementation of the ETSI C-ITS protocol stack
Other
204 stars 156 forks source link

Issues with socktap-cam and gpsfake #64

Closed logoff closed 6 years ago

logoff commented 6 years ago

I'm trying to use vanetza in a small project. My intention is to send periodical CAMs, so socktap-cam application seems to be good starting point.

I'm indoor, so I want to use gpsfake with pre-recorded real GPS sessions during development. I'm experiencing some issues executing socktap-cam with recorded sessions. I recorded some GPS sessions with gpsfake and now I'm playing it with this command:

gpsfake -c 1 20180621-1.gps

Then I run gpsmon and I see good results.

But when I run socktap-cam in my Raspberry Pi I get this error:

socktap-cam: /home/pi/vanetza/vanetza/asn1/its/per_support.c:238: per_long_range_rebase: Assertion `lb <= ub' failed.
Aborted

I see where is it produced: https://github.com/riebl/vanetza/blob/master/vanetza/asn1/its/per_support.c#L238

In my Linux PC I don't get this error. I don't know why...

What is the explanation of this error? How could I get rid of it?

valt2017 commented 6 years ago

It seems to be the problem with ASN compiler running on 32bit machine. I assume your Linux PC is 64bit... You should apply the fix mentioned in this forum https://github.com/vlm/asn1c/issues/252. Then generate again the .c and .h files from ASN files with updated ASN compiler.

riebl commented 6 years ago

@logoff Can you confirm that the solution proposed by @valt2017 is fixing your problem? If this is the case I might regenerate the bundled ASN.1 code accordingly.

logoff commented 6 years ago

I don't have a clear idea about how to apply the fix. My understanding is that I need to recompile ASN.1, but I don't know exactly how, Could you please give some pointers to do it? Thank you.

riebl commented 6 years ago

@logoff I have created a branch asn1_update for you including aforementioned bugfix for asn1c. Please pull this branch of Vanetza and check if your problem is fixed then.

logoff commented 6 years ago

I tested socktap-cam app in a Raspberry Pi 3 with a 32 bit ARM architecture with the new branch and it worked as expected. So it seems the applied changes solved the issue.

valt2017 commented 6 years ago

It also worked for me on several embedded 32bit platforms. If you plan to use also DENM messages on 32bits you may discover the issue with TimestampIts field mentioned here: https://sourceforge.net/p/asn1c/discussion/357921/thread/4c43bdf3/ We can discuss possible workarounds then.

riebl commented 6 years ago

@logoff @valt2017 Thank you very much for your feedback!

@valt2017 I suppose one can prevent the described problem by using asn_uint642INTEGER instead of asn_ulong2INTEGER. However, I haven't tried this yet. Do you have any experience in this regard?

valt2017 commented 6 years ago

My first attempt was to force ASN compiler to use 64bit integer automatically instead of 32bit by switches or patches mentioned in the forums dedicated to implementation of 32bit compilation support. It did not solve this but I haven't tested all versions...maybe when I have time in the future. My second "dirty" attempt was from ETSI ITS Wireshark plugin or OpenC2X sources - changing TimestampIts in ASN file from INTEGER to BITSTRING(SIZE(42)). I can confirm it works for me as expected. I haven't found any other issues that prevent the use of Vanetza on 32bit systems (Tested only with simple CAM, DENM, IVI, MAP and SPAT messages). If you have discovered something else, please let me know.

riebl commented 6 years ago

Former asn1_update branch has been merged into master with 9b9d332f284e09b276d77f91e7ed9bfd81de46f1. @valt2017 Please feel free to open another issue ticket if you experience any problems regarding TimestampIts. Thanks again for supporting the development of Vanetza!