Commit Graph

15 Commits

Author SHA1 Message Date
Oliver Smith 16441ffbb3 debian, asn1tostruct.py: switch to python3
Make build work with python3 and drop the python2 dependency.

Related: OS#2819
Change-Id: Idb9d7a349ddb7619c784823f740648c7956bae5e
2019-12-11 11:37:21 +01:00
Bernhard M. Wiedemann 7a97fcafed asn1tostruct: allow to override build date
in order to make builds reproducible.
See https://reproducible-builds.org/ for why this is good
and https://reproducible-builds.org/specs/source-date-epoch/
for the definition of this variable.

Also do not record build user name to not have it vary.

Change-Id: I5cfa465cc82f009f28dd7f12ced0e72a05fda842
2018-05-30 13:21:57 +02:00
Neels Hofmeyr f33d16404d compiler warning: asn1tostruct.py: return 0 at end of *_free_*()
Part of the resulting diff in the generated code:

--- /tmp/hnbap_decoder.c	2017-12-24 17:06:50.983979866 +0100
+++ /tmp/hnbap_decoder.c	2017-12-24 17:07:10.760223354 +0100
@@ -1179,6 +1179,7 @@
     TNLUpdateResponseIEs_t *tnlUpdateResponseIEs) {

     ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF_Context_ID, &tnlUpdateResponseIEs->context_ID);
+    return 0;
 }

 int hnbap_free_tnlupdaterequesties(
@@ -1187,6 +1188,7 @@
     ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF_Context_ID, &tnlUpdateRequestIEs->context_ID);
     ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF_RABList, &tnlUpdateRequestIEs->rabList);
     ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF_Update_cause, &tnlUpdateRequestIEs->update_cause);
+    return 0;
 }

 int hnbap_free_errorindicationies(
@@ -1197,12 +1199,14 @@
     if ((errorIndicationIEs->presenceMask & ERRORINDICATIONIES_CRITICALITYDIAGNOSTICS_PRESENT)
         == ERRORINDICATIONIES_CRITICALITYDIAGNOSTICS_PRESENT)
         ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF_CriticalityDiagnostics, &errorIndicationIEs->criticalityDiagnostics);
+    return 0;
 }

 int hnbap_free_hnbconfigtransferrequesties(
     HNBConfigTransferRequestIEs_t *hnbConfigTransferRequestIEs) {

     ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF_NeighbourInfoRequestList, &hnbConfigTransferRequestIEs->neighbourInfoRequestList);
+    return 0;
 }

 int hnbap_free_tnlupdatefailureies(

[etc.]

Related: OS#2670
Change-Id: Ieba12c09c33a81da964bf88a858714d922ced8c0
2017-12-25 00:46:12 +01:00
Neels Hofmeyr 6eeef115a9 hnbap,rua,ranap decode: fix segfault on decode error
Looking at hnbap_decode_hnbregisterrequesties(), I noticed a segfault if
decoding the HNB Register Request PDU fails, which is due to an unchecked
return value in code generated by asn1tostruct.py.

Add return value and NULL pointer checks and hence fix null dereference on
erratic PDUs across HNBAP, RUA and RANAP protocols. Similar checks exist in
other places, this one was simply missing.

Since the result of asn1tostruct.py is not committed, here is an example diff
of the resulting change, of which there are 128 instances in total:

@@ -304,7 +329,12 @@
     memset(hnbRegisterRequestIEs, 0, sizeof(HNBRegisterRequestIEs_t));
     HNBAP_DEBUG("Decoding message HNBRegisterRequestIEs (%s:%d)\n", __FILE__, __LINE__);

-    ANY_to_type_aper(any_p, &asn_DEF_HNBRegisterRequest, (void**)&hNBRegisterRequest_p);
+    tempDecoded = ANY_to_type_aper(any_p, &asn_DEF_HNBRegisterRequest, (void**)&hNBRegisterRequest_p);
+
+    if (tempDecoded < 0 || hNBRegisterRequest_p == NULL) {
+        HNBAP_DEBUG("Decoding of message HNBRegisterRequestIEs failed\n");
+        return -1;
+    }

     for (i = 0; i < hNBRegisterRequest_p->hnbRegisterRequest_ies.list.count; i++) {
         IE_t *ie_p;

Change-Id: I6cb9cc9a88d22f03befa43f0968a874476fa079d
2017-12-20 23:31:45 +01:00
Pau Espin 166a3767bd asn1tostruct.py: specify python version in shebang
The script is expected to be run using python 2.x, but nowadays some
distros are already using python 3 as default, which will fail to run
this script.

This change fixes compilation in my Archlinux box.

Change-Id: I6eb95351538a64f2b23d638824972818591b1b66
2017-04-05 11:22:53 +02:00
Neels Hofmeyr f706d6c065 asn1tostruct.py: use '#\!/usr/bin/env python', not '#\!/usr/bin/python'
Change-Id: I0686467e59b35e68bccb38ccfe645f5ccac97941
2016-07-12 00:44:18 +02:00
Daniel Willmann 19dea8b49b asn1: Generate _free_*ies function declarations
ranap_ies_defs.h is checked in so update it

hnbap_ies_defs.h and rua_ies_defs.h need to be regenerated
2016-02-22 11:15:04 +01:00
Daniel Willmann 86a14053d8 asn1tostruct.py: Zero IEs_t target struct in decode function 2016-01-12 09:46:21 +01:00
Daniel Willmann d10002cf8d asn1tostruct: Add memory free functions and use them in HNBAP 2016-01-07 12:27:41 +01:00
Neels Hofmeyr c13ebf78c8 asn1tostruct.py: don't generate unused local struct instances. 2016-01-05 13:39:22 +01:00
Daniel Willmann d174e76f1d asn1tostruct.py: Fix memory leaks in generated code
The decode_*ies functions did not clean up after them. This change is
taken from changes made to asn1tostruct.py in openair-cn repository.
2015-12-22 16:40:46 +01:00
Harald Welte a0c74240fa asn1tostruct: Avoid erroneous double-underscores
We shouldn't generate names like
RANAP_RAB_SetupList_EnhancedRelocCompleteReq__t when creating the
_encode() and _decode() functiosn, as the '-IEs' at the end must be
stripped before converting all '-' to '_'.
2015-12-16 16:45:48 +01:00
Harald Welte 84839c04ea asn1tostruct.py: Add support for type prefixing
If asn1c generates prefixed type names, the asn1tostruct.py of course
also needs to be modified to do so.
2015-09-10 18:33:14 +02:00
Harald Welte 547b76c5b4 asn1tostruct.py: Don't claim copyright on auto-generated code
It is a legal impossibility to claim copyright on something that
has been automatically generated by a computer program.
2015-08-30 22:48:59 +02:00
Harald Welte 245daf9422 import ans1tostruct.py from Eurecom OpenAirInterface 2015-08-30 22:48:59 +02:00