[srslte-users] RRC msg decoding
Francisco Paisana
francisco.paisana at softwareradiosystems.com
Sun Feb 23 12:53:38 UTC 2020
Hey Merlin,
The message you provided is technically decodable ASN1. The only issue is
that you are accessing a ASN1 CHOICE field that is not active. You just
need to add an extra check before calling
"c1->security_mode_cmd().crit_exts.c1().security_mode_cmd()". Something of
the sort:
> if(c1->security_mode_cmd().crit_exts.c1().type()
!= security_mode_cmd_s::crit_exts_c_::c1_c_::type_opts::security_mode_cmd_r8)
{
> log->error("We do not handle non-r8 security mode commands\n");
> return;
> }
Basically, the type "c1->security_mode_cmd().crit_exts.c1()" works like a
"safe union". It has methods to access or set its content (e.g.
.security_mode_cmd() is the one in use in this case). If you try to use an
access method that does not correspond to the stored type, you will get
that log warning message. This rule applies to all ASN1 CHOICE types, which
can be identified in our asn1 naming convention by their suffix "_c" or
"_c_".
Regards,
Francisco
On Fri, Feb 21, 2020 at 3:30 PM Merlin Chlosta <
merlin.chlosta+srslte-users at rub.de> wrote:
> Hi all,
>
> I need some pointers how the new ASN1 decoding works. In my lab setup,
> srsUE receives a somewhat malformed message, and doesn't seem to notice.
>
> > 15:23:47.983714 [RRC ] [D] SRB1 - Rx securityModeCommand (129 B)
> > 0000: 34 da 35 8d ab 88 ac 3d b7 f7 af 86 1d 2f 0f 05
> > 0010: d6 0a 5e df 29 04 42 68 72 06 6b 1b 86 53 9b 21
> > 15:23:47.983730 [RRC ] [D] Content:
> > [{"DL-DCCH-Message": {
> > "message": {
> > "c1": {
> > "securityModeCommand": {
> > "rrc-TransactionIdentifier": 2,
> > "criticalExtensions": {
> > "c1": {
> > }}}}}}}]
> > 15:23:47.983739 [RRC ] [E] Invalid field access for choice type "c1"
> ("securityModeCommand-r8"!="spare1")
> So the fields for ciphering and integrity algorithms are missing here.
> The message handler doesn't seem to check for that case and just tries
> to access the values:
>
> > case dl_dcch_msg_type_c::c1_c_::types::security_mode_cmd:
> > transaction_id = c1->security_mode_cmd().rrc_transaction_id;
> >
> > cipher_algo = (CIPHERING_ALGORITHM_ID_ENUM)c1->security_mode_cmd()
> > .crit_exts.c1()
> > .security_mode_cmd_r8()
> > .security_cfg_smc
> > .security_algorithm_cfg
> > .ciphering_algorithm.value;
>
> The only check seems to occur during printing (hence the "invalid field
> access") warning.
>
> What am I missing here? Any help is appreciated. Thanks!
>
> Viele Grüße
> Merlin
> _______________________________________________
> srslte-users mailing list
> srslte-users at lists.softwareradiosystems.com
> http://www.softwareradiosystems.com/mailman/listinfo/srslte-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.srsran.com/pipermail/srsran-users/attachments/20200223/6ca16075/attachment.htm>
More information about the srsran-users
mailing list