Change in ...osmo-ggsn[master]: in46_addr: Improve in46a_ntop documentation

2019-08-27 Thread osmith
osmith has posted comments on this change. ( 
https://gerrit.osmocom.org/c/osmo-ggsn/+/15247 )

Change subject: in46_addr: Improve in46a_ntop documentation
..


Patch Set 2:

(1 comment)

https://gerrit.osmocom.org/#/c/15247/2/lib/in46_addr.c
File lib/in46_addr.c:

https://gerrit.osmocom.org/#/c/15247/2/lib/in46_addr.c@67
PS2, Line 67: dston
"dst on"



--
To view, visit https://gerrit.osmocom.org/c/osmo-ggsn/+/15247
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-ggsn
Gerrit-Branch: master
Gerrit-Change-Id: I27238c330f9b805ac9e734e735d2c7ae158fe524
Gerrit-Change-Number: 15247
Gerrit-PatchSet: 2
Gerrit-Owner: pespin 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge 
Gerrit-CC: osmith 
Gerrit-Comment-Date: Wed, 28 Aug 2019 05:58:30 +
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Gerrit-MessageType: comment


Change in ...osmo-ggsn[master]: ggsn: Move PCO handling code into its own file

2019-08-27 Thread osmith
osmith has posted comments on this change. ( 
https://gerrit.osmocom.org/c/osmo-ggsn/+/15246 )

Change subject: ggsn: Move PCO handling code into its own file
..


Patch Set 2: Code-Review+1


--
To view, visit https://gerrit.osmocom.org/c/osmo-ggsn/+/15246
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-ggsn
Gerrit-Branch: master
Gerrit-Change-Id: Ieaa7e71f17c7fd9377c76ef53362eab596d669a6
Gerrit-Change-Number: 15246
Gerrit-PatchSet: 2
Gerrit-Owner: pespin 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: daniel 
Gerrit-Reviewer: osmith 
Gerrit-Reviewer: pespin 
Gerrit-CC: laforge 
Gerrit-Comment-Date: Wed, 28 Aug 2019 05:56:47 +
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment


Change in ...osmo-mgw[master]: SDP: store all ptmap entries

2019-08-27 Thread neels
neels has posted comments on this change. ( 
https://gerrit.osmocom.org/c/osmo-mgw/+/15141 )

Change subject: SDP: store all ptmap entries
..


Patch Set 5: Code-Review+2

combining votes


--
To view, visit https://gerrit.osmocom.org/c/osmo-mgw/+/15141
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-mgw
Gerrit-Branch: master
Gerrit-Change-Id: I2a69c21e68c602daf804744212d335ab1eafd81b
Gerrit-Change-Number: 15141
Gerrit-PatchSet: 5
Gerrit-Owner: neels 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge 
Gerrit-Reviewer: neels 
Gerrit-Reviewer: pespin 
Gerrit-Comment-Date: Wed, 28 Aug 2019 03:01:40 +
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment


Change in ...osmo-mgw[master]: mgcp_codec_add: fix audio_name size check

2019-08-27 Thread neels
neels has uploaded this change for review. ( 
https://gerrit.osmocom.org/c/osmo-mgw/+/15301


Change subject: mgcp_codec_add: fix audio_name size check
..

mgcp_codec_add: fix audio_name size check

Needs to account for terminating '\0'.

Change-Id: I27896beef6ffcc1cb6207daaba6c8b2b03eb513d
---
M src/libosmo-mgcp/mgcp_codec.c
1 file changed, 1 insertion(+), 1 deletion(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-mgw refs/changes/01/15301/1

diff --git a/src/libosmo-mgcp/mgcp_codec.c b/src/libosmo-mgcp/mgcp_codec.c
index 704b7e6..9e55ab0 100644
--- a/src/libosmo-mgcp/mgcp_codec.c
+++ b/src/libosmo-mgcp/mgcp_codec.c
@@ -179,7 +179,7 @@
/* Now we extract the codec subtype name, rate and channels. The latter
 * two are optional. If they are not present we use the safe defaults
 * above. */
-   if (strlen(audio_name) > sizeof(audio_codec)) {
+   if (strlen(audio_name) >= sizeof(audio_codec)) {
LOGP(DLMGCP, LOGL_ERROR, "Audio codec too long: %s\n", 
osmo_quote_str(audio_name, -1));
goto error;
}

--
To view, visit https://gerrit.osmocom.org/c/osmo-mgw/+/15301
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-mgw
Gerrit-Branch: master
Gerrit-Change-Id: I27896beef6ffcc1cb6207daaba6c8b2b03eb513d
Gerrit-Change-Number: 15301
Gerrit-PatchSet: 1
Gerrit-Owner: neels 
Gerrit-MessageType: newchange


Change in ...osmo-mgw[master]: mgcp_codec: codec_set(): log about all possible errors

2019-08-27 Thread neels
neels has posted comments on this change. ( 
https://gerrit.osmocom.org/c/osmo-mgw/+/15138 )

Change subject: mgcp_codec: codec_set(): log about all possible errors
..


Patch Set 4:

(1 comment)

https://gerrit.osmocom.org/#/c/15138/4/src/libosmo-mgcp/mgcp_codec.c
File src/libosmo-mgcp/mgcp_codec.c:

https://gerrit.osmocom.org/#/c/15138/4/src/libosmo-mgcp/mgcp_codec.c@182
PS4, Line 182:  if (strlen(audio_name) > sizeof(audio_codec)) {
> this should probably be >=
unrelated to this patch, which is just about logging. fixing separately.



--
To view, visit https://gerrit.osmocom.org/c/osmo-mgw/+/15138
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-mgw
Gerrit-Branch: master
Gerrit-Change-Id: I0b44b574c814882b6f8ae7cd738a6f481cd721fd
Gerrit-Change-Number: 15138
Gerrit-PatchSet: 4
Gerrit-Owner: neels 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: neels 
Gerrit-Reviewer: pespin 
Gerrit-Comment-Date: Wed, 28 Aug 2019 02:55:42 +
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: pespin 
Gerrit-MessageType: comment


Change in ...osmo-mgw[master]: ptmap: implicitly match '/8000' and '/8000/1'

2019-08-27 Thread neels
neels has posted comments on this change. ( 
https://gerrit.osmocom.org/c/osmo-mgw/+/15137 )

Change subject: ptmap: implicitly match  '/8000' and '/8000/1'
..


Patch Set 4: Code-Review+2

combining votes


--
To view, visit https://gerrit.osmocom.org/c/osmo-mgw/+/15137
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-mgw
Gerrit-Branch: master
Gerrit-Change-Id: Iab00bf9a55b1847f85999077114b37e70fb677c2
Gerrit-Change-Number: 15137
Gerrit-PatchSet: 4
Gerrit-Owner: neels 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge 
Gerrit-Reviewer: neels 
Gerrit-Reviewer: pespin 
Gerrit-Comment-Date: Wed, 28 Aug 2019 02:53:09 +
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment


Build failure of network:osmocom:nightly/osmo-trx in Debian_Unstable/x86_64

2019-08-27 Thread OBS Notification
Visit 
https://build.opensuse.org/package/live_build_log/network:osmocom:nightly/osmo-trx/Debian_Unstable/x86_64

Package network:osmocom:nightly/osmo-trx failed to build in 
Debian_Unstable/x86_64

Check out the package for editing:
  osc checkout network:osmocom:nightly osmo-trx

Last lines of build log:
[  991s] ar: `u' modifier ignored since `D' is the default (see `U')
[  991s] libtool: link: ranlib .libs/libtransceiver_common.a
[  991s] libtool: link: ( cd ".libs" && rm -f "libtransceiver_common.la" && ln 
-s "../libtransceiver_common.la" "libtransceiver_common.la" )
[  991s] /bin/bash ../libtool  --tag=CXX   --mode=link g++ -lpthread 
-I/usr/include/ -I/usr/include/ -I/usr/include/ -g -O2 
-fdebug-prefix-map=/usr/src/packages/BUILD=. -fstack-protector-strong -Wformat 
-Werror=format-security  -Wl,-z,relro -Wl,-z,now -o osmo-trx-uhd 
osmo_trx_uhd-osmo-trx.o ./device/uhd/libdevice.la libtransceiver_common.la 
../Transceiver52M/arch/x86/libarch.la ../GSM/libGSM.la 
../CommonLibs/libcommon.la -lfftw3f -ltalloc -losmocore -ltalloc -losmoctrl 
-losmogsm -losmocore -ltalloc -losmovty -losmocore -luhd 
[  992s] libtool: link: g++ -I/usr/include/ -I/usr/include/ -I/usr/include/ -g 
-O2 -fdebug-prefix-map=/usr/src/packages/BUILD=. -fstack-protector-strong 
-Wformat -Werror=format-security -Wl,-z -Wl,relro -Wl,-z -Wl,now -o 
osmo-trx-uhd osmo_trx_uhd-osmo-trx.o  ./device/uhd/.libs/libdevice.a 
./.libs/libtransceiver_common.a ../Transceiver52M/arch/x86/.libs/libarch.a 
../GSM/.libs/libGSM.a ../CommonLibs/.libs/libcommon.a -lpthread -lfftw3f 
/usr/lib/x86_64-linux-gnu/libosmoctrl.so 
/usr/lib/x86_64-linux-gnu/libosmogsm.so -ltalloc 
/usr/lib/x86_64-linux-gnu/libosmovty.so 
/usr/lib/x86_64-linux-gnu/libosmocore.so -luhd
[  992s] /usr/bin/ld: ./device/uhd/.libs/libdevice.a(UHDDevice.o): undefined 
reference to symbol '_ZN5boost6system16generic_categoryEv'
[  992s] /usr/bin/ld: /usr/lib/x86_64-linux-gnu/libboost_system.so.1.67.0: 
error adding symbols: DSO missing from command line
[  992s] collect2: error: ld returned 1 exit status
[  992s] make[4]: *** [Makefile:681: osmo-trx-uhd] Error 1
[  992s] make[4]: Leaving directory '/usr/src/packages/BUILD/Transceiver52M'
[  992s] make[3]: *** [Makefile:820: all-recursive] Error 1
[  992s] make[3]: Leaving directory '/usr/src/packages/BUILD/Transceiver52M'
[  992s] make[2]: *** [Makefile:513: all-recursive] Error 1
[  992s] make[2]: Leaving directory '/usr/src/packages/BUILD'
[  992s] make[1]: *** [Makefile:444: all] Error 2
[  992s] make[1]: Leaving directory '/usr/src/packages/BUILD'
[  992s] dh_auto_build: make -j1 returned exit code 2
[  992s] make: *** [debian/rules:6: build] Error 255
[  992s] dpkg-buildpackage: error: debian/rules build subprocess returned exit 
status 2
[  992s] 
[  992s] lamb01 failed "build osmo-trx_1.1.1.10.77f3.dsc" at Wed Aug 28 
02:08:20 UTC 2019.
[  992s] 
[  992s] ### VM INTERACTION START ###
[  996s] [  929.512958] sysrq: SysRq : Power Off
[  996s] [  929.529151] reboot: Power down
[  996s] ### VM INTERACTION END ###
[  996s] 
[  996s] lamb01 failed "build osmo-trx_1.1.1.10.77f3.dsc" at Wed Aug 28 
02:08:25 UTC 2019.
[  996s] 

-- 
Configure notifications at https://build.opensuse.org/user/notifications
openSUSE Build Service (https://build.opensuse.org/)


Build failure of network:osmocom:nightly/osmo-trx in Debian_Testing/x86_64

2019-08-27 Thread OBS Notification
Visit 
https://build.opensuse.org/package/live_build_log/network:osmocom:nightly/osmo-trx/Debian_Testing/x86_64

Package network:osmocom:nightly/osmo-trx failed to build in 
Debian_Testing/x86_64

Check out the package for editing:
  osc checkout network:osmocom:nightly osmo-trx

Last lines of build log:
[  297s] ar: `u' modifier ignored since `D' is the default (see `U')
[  297s] libtool: link: ranlib .libs/libtransceiver_common.a
[  297s] libtool: link: ( cd ".libs" && rm -f "libtransceiver_common.la" && ln 
-s "../libtransceiver_common.la" "libtransceiver_common.la" )
[  297s] /bin/bash ../libtool  --tag=CXX   --mode=link g++ -lpthread 
-I/usr/include/ -I/usr/include/ -I/usr/include/ -g -O2 
-fdebug-prefix-map=/usr/src/packages/BUILD=. -fstack-protector-strong -Wformat 
-Werror=format-security  -Wl,-z,relro -Wl,-z,now -o osmo-trx-uhd 
osmo_trx_uhd-osmo-trx.o ./device/uhd/libdevice.la libtransceiver_common.la 
../Transceiver52M/arch/x86/libarch.la ../GSM/libGSM.la 
../CommonLibs/libcommon.la -lfftw3f -ltalloc -losmocore -ltalloc -losmoctrl 
-losmogsm -losmocore -ltalloc -losmovty -losmocore -luhd 
[  298s] libtool: link: g++ -I/usr/include/ -I/usr/include/ -I/usr/include/ -g 
-O2 -fdebug-prefix-map=/usr/src/packages/BUILD=. -fstack-protector-strong 
-Wformat -Werror=format-security -Wl,-z -Wl,relro -Wl,-z -Wl,now -o 
osmo-trx-uhd osmo_trx_uhd-osmo-trx.o  ./device/uhd/.libs/libdevice.a 
./.libs/libtransceiver_common.a ../Transceiver52M/arch/x86/.libs/libarch.a 
../GSM/.libs/libGSM.a ../CommonLibs/.libs/libcommon.a -lpthread -lfftw3f 
/usr/lib/x86_64-linux-gnu/libosmoctrl.so 
/usr/lib/x86_64-linux-gnu/libosmogsm.so -ltalloc 
/usr/lib/x86_64-linux-gnu/libosmovty.so 
/usr/lib/x86_64-linux-gnu/libosmocore.so -luhd
[  298s] /usr/bin/ld: ./device/uhd/.libs/libdevice.a(UHDDevice.o): undefined 
reference to symbol '_ZN5boost6system16generic_categoryEv'
[  298s] /usr/bin/ld: /usr/lib/x86_64-linux-gnu/libboost_system.so.1.67.0: 
error adding symbols: DSO missing from command line
[  298s] collect2: error: ld returned 1 exit status
[  298s] make[4]: *** [Makefile:681: osmo-trx-uhd] Error 1
[  298s] make[4]: Leaving directory '/usr/src/packages/BUILD/Transceiver52M'
[  298s] make[3]: *** [Makefile:820: all-recursive] Error 1
[  298s] make[3]: Leaving directory '/usr/src/packages/BUILD/Transceiver52M'
[  298s] make[2]: *** [Makefile:513: all-recursive] Error 1
[  298s] make[2]: Leaving directory '/usr/src/packages/BUILD'
[  298s] make[1]: *** [Makefile:444: all] Error 2
[  298s] make[1]: Leaving directory '/usr/src/packages/BUILD'
[  298s] dh_auto_build: make -j1 returned exit code 2
[  298s] make: *** [debian/rules:6: build] Error 255
[  298s] dpkg-buildpackage: error: debian/rules build subprocess returned exit 
status 2
[  298s] 
[  298s] sheep83 failed "build osmo-trx_1.1.1.10.77f3.dsc" at Wed Aug 28 
01:53:40 UTC 2019.
[  298s] 
[  298s] ### VM INTERACTION START ###
[  301s] [  288.143363] sysrq: SysRq : Power Off
[  301s] [  288.149436] reboot: Power down
[  301s] ### VM INTERACTION END ###
[  301s] 
[  301s] sheep83 failed "build osmo-trx_1.1.1.10.77f3.dsc" at Wed Aug 28 
01:53:45 UTC 2019.
[  301s] 

-- 
Configure notifications at https://build.opensuse.org/user/notifications
openSUSE Build Service (https://build.opensuse.org/)


Change in ...osmo-mgw[master]: mgcp_codec: split codec_free() off of codec_init()

2019-08-27 Thread neels
neels has submitted this change and it was merged. ( 
https://gerrit.osmocom.org/c/osmo-mgw/+/15132 )

Change subject: mgcp_codec: split codec_free() off of codec_init()
..

mgcp_codec: split codec_free() off of codec_init()

Both are used only in the same .c file, so make them static.

Move codec_set() guts into codec_add(): codec_set is only called by codec_add.
If codec_set were left separate, it'd look like the codec_init() is a bug and
lacks a codec_free() first. When looking at the entire context in codec_add(),
it becomes obvious that codec_init() should be called, not codec_free(),
because it is populating a previously unused entry.

Preparation to fix a memleak in a conn's codec list.

Change-Id: I120cab0a352a1e7b31c8f9c720c47b2c291311d7
---
M src/libosmo-mgcp/mgcp_codec.c
1 file changed, 35 insertions(+), 39 deletions(-)

Approvals:
  neels: Looks good to me, approved
  pespin: Looks good to me, but someone else must approve
  Jenkins Builder: Verified



diff --git a/src/libosmo-mgcp/mgcp_codec.c b/src/libosmo-mgcp/mgcp_codec.c
index d5b99e8..30c185c 100644
--- a/src/libosmo-mgcp/mgcp_codec.c
+++ b/src/libosmo-mgcp/mgcp_codec.c
@@ -76,18 +76,24 @@
 }

 /* Initalize or reset codec information with default data. */
-void codec_init(struct mgcp_rtp_codec *codec)
+static void codec_init(struct mgcp_rtp_codec *codec)
+{
+   *codec = (struct mgcp_rtp_codec){
+   .payload_type = -1,
+   .frame_duration_num = DEFAULT_RTP_AUDIO_FRAME_DUR_NUM,
+   .frame_duration_den = DEFAULT_RTP_AUDIO_FRAME_DUR_DEN,
+   .rate = DEFAULT_RTP_AUDIO_DEFAULT_RATE,
+   .channels = DEFAULT_RTP_AUDIO_DEFAULT_CHANNELS,
+   };
+}
+
+static void codec_free(struct mgcp_rtp_codec *codec)
 {
if (codec->subtype_name)
talloc_free(codec->subtype_name);
if (codec->audio_name)
talloc_free(codec->audio_name);
-   memset(codec, 0, sizeof(*codec));
-   codec->payload_type = -1;
-   codec->frame_duration_num = DEFAULT_RTP_AUDIO_FRAME_DUR_NUM;
-   codec->frame_duration_den = DEFAULT_RTP_AUDIO_FRAME_DUR_DEN;
-   codec->rate = DEFAULT_RTP_AUDIO_DEFAULT_RATE;
-   codec->channels = DEFAULT_RTP_AUDIO_DEFAULT_CHANNELS;
+   *codec = (struct mgcp_rtp_codec){};
 }

 /*! Initalize or reset codec information with default data.
@@ -99,13 +105,30 @@
conn->end.codec = NULL;
 }

-/* Set members of struct mgcp_rtp_codec, extrapolate in missing information. 
Param audio_name is expected in uppercase. */
-static int codec_set(void *ctx, struct mgcp_rtp_codec *codec, int 
payload_type, const char *audio_name,
-unsigned int pt_offset, const struct mgcp_codec_param 
*param)
+/*! Add codec configuration depending on payload type and/or codec name. This
+ *  function uses the input parameters to extrapolate the full codec 
information.
+ *  \param[out] codec configuration (caller provided memory).
+ *  \param[out] conn related rtp-connection.
+ *  \param[in] payload_type codec type id (e.g. 3 for GSM, -1 when undefined).
+ *  \param[in] audio_name audio codec name, in uppercase (e.g. "GSM/8000/1").
+ *  \param[in] param optional codec parameters (set to NULL when unused).
+ *  \returns 0 on success, -EINVAL on failure. */
+int mgcp_codec_add(struct mgcp_conn_rtp *conn, int payload_type, const char 
*audio_name, const struct mgcp_codec_param *param)
 {
int rate;
int channels;
char audio_codec[64];
+   struct mgcp_rtp_codec *codec;
+   unsigned int pt_offset = conn->end.codecs_assigned;
+   void *ctx = conn->conn;
+
+   /* The amount of codecs we can store is limited, make sure we do not
+* overrun this limit. */
+   if (conn->end.codecs_assigned >= MGCP_MAX_CODECS)
+   return -EINVAL;
+
+   /* First unused entry */
+   codec = >end.codecs[conn->end.codecs_assigned];

/* Initalize the codec struct with some default data to begin with */
codec_init(codec);
@@ -226,41 +249,14 @@
} else
codec->param_present = false;

+   conn->end.codecs_assigned++;
return 0;
 error:
/* Make sure we leave a clean codec entry on error. */
-   codec_init(codec);
-   memset(codec, 0, sizeof(*codec));
+   codec_free(codec);
return -EINVAL;
 }

-/*! Add codec configuration depending on payload type and/or codec name. This
- *  function uses the input parameters to extrapolate the full codec 
information.
- *  \param[out] codec configuration (caller provided memory).
- *  \param[out] conn related rtp-connection.
- *  \param[in] payload_type codec type id (e.g. 3 for GSM, -1 when undefined).
- *  \param[in] audio_name audio codec name, in uppercase (e.g. "GSM/8000/1").
- *  \param[in] param optional codec parameters (set to NULL when unused).
- *  \returns 0 on success, -EINVAL on failure. */
-int 

Change in ...osmo-mgw[master]: fix memleak: actually free strings in mgcp_codec_reset_all()

2019-08-27 Thread neels
neels has submitted this change and it was merged. ( 
https://gerrit.osmocom.org/c/osmo-mgw/+/15133 )

Change subject: fix memleak: actually free strings in mgcp_codec_reset_all()
..

fix memleak: actually free strings in mgcp_codec_reset_all()

The audio_name and subtype_name are allocated from talloc, so they need to be
freed before resetting the codec array. Use mgcp_codec_free() to ensure this.

Change-Id: I07f207dcb7ce66bbf3445a30af41e696677b384f
---
M src/libosmo-mgcp/mgcp_codec.c
1 file changed, 3 insertions(+), 1 deletion(-)

Approvals:
  laforge: Looks good to me, but someone else must approve
  pespin: Looks good to me, approved
  Jenkins Builder: Verified



diff --git a/src/libosmo-mgcp/mgcp_codec.c b/src/libosmo-mgcp/mgcp_codec.c
index 30c185c..7f1a6d1 100644
--- a/src/libosmo-mgcp/mgcp_codec.c
+++ b/src/libosmo-mgcp/mgcp_codec.c
@@ -100,7 +100,9 @@
  *  \param[out] conn related rtp-connection. */
 void mgcp_codec_reset_all(struct mgcp_conn_rtp *conn)
 {
-   memset(conn->end.codecs, 0, sizeof(conn->end.codecs));
+   int i;
+   for (i = 0; i < conn->end.codecs_assigned; i++)
+   codec_free(>end.codecs[i]);
conn->end.codecs_assigned = 0;
conn->end.codec = NULL;
 }

--
To view, visit https://gerrit.osmocom.org/c/osmo-mgw/+/15133
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-mgw
Gerrit-Branch: master
Gerrit-Change-Id: I07f207dcb7ce66bbf3445a30af41e696677b384f
Gerrit-Change-Number: 15133
Gerrit-PatchSet: 3
Gerrit-Owner: neels 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge 
Gerrit-Reviewer: neels 
Gerrit-Reviewer: pespin 
Gerrit-MessageType: merged


Change in ...osmo-mgw[master]: mgcp_codec: split codec_free() off of codec_init()

2019-08-27 Thread neels
neels has posted comments on this change. ( 
https://gerrit.osmocom.org/c/osmo-mgw/+/15132 )

Change subject: mgcp_codec: split codec_free() off of codec_init()
..


Patch Set 2: Code-Review+2

now I notice there are actually two +1s I can combine


--
To view, visit https://gerrit.osmocom.org/c/osmo-mgw/+/15132
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-mgw
Gerrit-Branch: master
Gerrit-Change-Id: I120cab0a352a1e7b31c8f9c720c47b2c291311d7
Gerrit-Change-Number: 15132
Gerrit-PatchSet: 2
Gerrit-Owner: neels 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge 
Gerrit-Reviewer: neels 
Gerrit-Reviewer: pespin 
Gerrit-Comment-Date: Tue, 27 Aug 2019 21:52:50 +
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment


Change in ...osmocom-bb[master]: trx_toolkit/trx_sniff.py: also validate() sniffed messages

2019-08-27 Thread fixeria
fixeria has uploaded this change for review. ( 
https://gerrit.osmocom.org/c/osmocom-bb/+/15298


Change subject: trx_toolkit/trx_sniff.py: also validate() sniffed messages
..

trx_toolkit/trx_sniff.py: also validate() sniffed messages

Change-Id: Ica3e4702fdabfdae0c1025b650ff32c8e85a6edf
---
M src/target/trx_toolkit/trx_sniff.py
1 file changed, 1 insertion(+), 0 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmocom-bb refs/changes/98/15298/1

diff --git a/src/target/trx_toolkit/trx_sniff.py 
b/src/target/trx_toolkit/trx_sniff.py
index 72976f7..f4b7662 100755
--- a/src/target/trx_toolkit/trx_sniff.py
+++ b/src/target/trx_toolkit/trx_sniff.py
@@ -109,6 +109,7 @@
# Attempt to parse the payload as a DATA message
try:
msg.parse_msg(msg_raw)
+   msg.validate()
except ValueError as e:
log.warning("Ignoring an incorrect message: %s" % e)
self.cnt_burst_dropped_num += 1

--
To view, visit https://gerrit.osmocom.org/c/osmocom-bb/+/15298
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmocom-bb
Gerrit-Branch: master
Gerrit-Change-Id: Ica3e4702fdabfdae0c1025b650ff32c8e85a6edf
Gerrit-Change-Number: 15298
Gerrit-PatchSet: 1
Gerrit-Owner: fixeria 
Gerrit-MessageType: newchange


Change in ...osmocom-bb[master]: trx_toolkit/trx_sniff.py: also print header for incorrect messages

2019-08-27 Thread fixeria
fixeria has uploaded this change for review. ( 
https://gerrit.osmocom.org/c/osmocom-bb/+/15299


Change subject: trx_toolkit/trx_sniff.py: also print header for incorrect 
messages
..

trx_toolkit/trx_sniff.py: also print header for incorrect messages

Change-Id: I376f1e7af46750e53305109cf4a9f64427b9960c
---
M src/target/trx_toolkit/trx_sniff.py
1 file changed, 4 insertions(+), 1 deletion(-)



  git pull ssh://gerrit.osmocom.org:29418/osmocom-bb refs/changes/99/15299/1

diff --git a/src/target/trx_toolkit/trx_sniff.py 
b/src/target/trx_toolkit/trx_sniff.py
index f4b7662..7e5c2bd 100755
--- a/src/target/trx_toolkit/trx_sniff.py
+++ b/src/target/trx_toolkit/trx_sniff.py
@@ -111,7 +111,10 @@
msg.parse_msg(msg_raw)
msg.validate()
except ValueError as e:
-   log.warning("Ignoring an incorrect message: %s" % e)
+   desc = msg.desc_hdr()
+   if desc is "":
+   desc = "parsing error"
+   log.warning("Ignoring an incorrect message (%s): %s" % 
(desc, e))
self.cnt_burst_dropped_num += 1
return


--
To view, visit https://gerrit.osmocom.org/c/osmocom-bb/+/15299
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmocom-bb
Gerrit-Branch: master
Gerrit-Change-Id: I376f1e7af46750e53305109cf4a9f64427b9960c
Gerrit-Change-Number: 15299
Gerrit-PatchSet: 1
Gerrit-Owner: fixeria 
Gerrit-MessageType: newchange


Change in ...osmocom-bb[master]: trx_toolkit/trx_sniff.py: properly handle unknown header version error

2019-08-27 Thread fixeria
fixeria has uploaded this change for review. ( 
https://gerrit.osmocom.org/c/osmocom-bb/+/15300


Change subject: trx_toolkit/trx_sniff.py: properly handle unknown header 
version error
..

trx_toolkit/trx_sniff.py: properly handle unknown header version error

Change-Id: Ie04782ced1fab7bc363549bfa37528f5a124e99d
---
M src/target/trx_toolkit/trx_sniff.py
1 file changed, 4 insertions(+), 0 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmocom-bb refs/changes/00/15300/1

diff --git a/src/target/trx_toolkit/trx_sniff.py 
b/src/target/trx_toolkit/trx_sniff.py
index 7e5c2bd..13c31e7 100755
--- a/src/target/trx_toolkit/trx_sniff.py
+++ b/src/target/trx_toolkit/trx_sniff.py
@@ -110,6 +110,10 @@
try:
msg.parse_msg(msg_raw)
msg.validate()
+   except IndexError as e:
+   log.warning("Ignoring message: %s" % e)
+   self.cnt_burst_dropped_num += 1
+   return
except ValueError as e:
desc = msg.desc_hdr()
if desc is "":

--
To view, visit https://gerrit.osmocom.org/c/osmocom-bb/+/15300
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmocom-bb
Gerrit-Branch: master
Gerrit-Change-Id: Ie04782ced1fab7bc363549bfa37528f5a124e99d
Gerrit-Change-Number: 15300
Gerrit-PatchSet: 1
Gerrit-Owner: fixeria 
Gerrit-MessageType: newchange


Change in ...osmocom-bb[master]: trx_toolkit/trx_sniff.py: print exact message parsing error

2019-08-27 Thread fixeria
fixeria has uploaded this change for review. ( 
https://gerrit.osmocom.org/c/osmocom-bb/+/15297


Change subject: trx_toolkit/trx_sniff.py: print exact message parsing error
..

trx_toolkit/trx_sniff.py: print exact message parsing error

For sure, the following message is much more informative:

  Ignoring an incorrect message: Unhandled version 12

than:

  Failed to parse message, dropping...

NOTE: since the way of printing exceptions is different in both
Python versions, I had to drop Python 2 support.

Change-Id: I5fb02ce508c58ff94e47accc0ed655939eb53062
---
M src/target/trx_toolkit/trx_sniff.py
1 file changed, 5 insertions(+), 5 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmocom-bb refs/changes/97/15297/1

diff --git a/src/target/trx_toolkit/trx_sniff.py 
b/src/target/trx_toolkit/trx_sniff.py
index 0323e85..72976f7 100755
--- a/src/target/trx_toolkit/trx_sniff.py
+++ b/src/target/trx_toolkit/trx_sniff.py
@@ -1,10 +1,10 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
 # -*- coding: utf-8 -*-
 
 # TRX Toolkit
 # Scapy-based TRX interface sniffer
 #
-# (C) 2018 by Vadim Yanitskiy 
+# (C) 2018-2019 by Vadim Yanitskiy 
 #
 # All Rights Reserved
 #
@@ -22,7 +22,7 @@
 # with this program; if not, write to the Free Software Foundation, Inc.,
 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.

-APP_CR_HOLDERS = [("2018", "Vadim Yanitskiy ")]
+APP_CR_HOLDERS = [("2018-2019", "Vadim Yanitskiy ")]

 import logging as log
 import argparse
@@ -109,8 +109,8 @@
# Attempt to parse the payload as a DATA message
try:
msg.parse_msg(msg_raw)
-   except:
-   log.warning("Failed to parse message, dropping...")
+   except ValueError as e:
+   log.warning("Ignoring an incorrect message: %s" % e)
self.cnt_burst_dropped_num += 1
return


--
To view, visit https://gerrit.osmocom.org/c/osmocom-bb/+/15297
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmocom-bb
Gerrit-Branch: master
Gerrit-Change-Id: I5fb02ce508c58ff94e47accc0ed655939eb53062
Gerrit-Change-Number: 15297
Gerrit-PatchSet: 1
Gerrit-Owner: fixeria 
Gerrit-MessageType: newchange


Change in ...osmocom-bb[master]: trx_toolkit/data_msg.py: raise exceptions from validate() methods

2019-08-27 Thread fixeria
fixeria has uploaded this change for review. ( 
https://gerrit.osmocom.org/c/osmocom-bb/+/15296


Change subject: trx_toolkit/data_msg.py: raise exceptions from validate() 
methods
..

trx_toolkit/data_msg.py: raise exceptions from validate() methods

Raising exceptions is a Pythonic way to handle errors, which in this
particular case will help us to know *why* exactly a given message
is incorrect or incomplete.

Change-Id: Ia961f83c717066af61699c80536468392b8ce064
---
M src/target/trx_toolkit/data_dump.py
M src/target/trx_toolkit/data_if.py
M src/target/trx_toolkit/data_msg.py
3 files changed, 74 insertions(+), 61 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmocom-bb refs/changes/96/15296/1

diff --git a/src/target/trx_toolkit/data_dump.py 
b/src/target/trx_toolkit/data_dump.py
index 97518bd..da42023 100644
--- a/src/target/trx_toolkit/data_dump.py
+++ b/src/target/trx_toolkit/data_dump.py
@@ -296,7 +296,7 @@
assert(messages_check[i].tn == messages_ref[i].tn)

# Validate a message
-   assert(messages_check[i].validate())
+   messages_check[i].validate()

log.info("Check append_msg(): OK")

@@ -318,7 +318,7 @@
assert(messages_check[i].tn == messages_ref[i].tn)

# Validate a message
-   assert(messages_check[i].validate())
+   messages_check[i].validate()

log.info("Check append_all(): OK")

@@ -340,8 +340,8 @@
assert(msg10.tn == messages_ref[10].tn)

# Validate both messages
-   assert(msg0.validate())
-   assert(msg10.validate())
+   msg0.validate()
+   msg10.validate()

log.info("Check parse_msg(): OK")

@@ -362,6 +362,6 @@
assert(messages_check[i].tn == messages_ref[i + 10].tn)

# Validate a message
-   assert(messages_check[i].validate())
+   messages_check[i].validate()

log.info("Check parse_all(): OK")
diff --git a/src/target/trx_toolkit/data_if.py 
b/src/target/trx_toolkit/data_if.py
index e43b388..418c3f8 100644
--- a/src/target/trx_toolkit/data_if.py
+++ b/src/target/trx_toolkit/data_if.py
@@ -107,8 +107,7 @@

def send_msg(self, msg, legacy = False):
# Validate a message
-   if not msg.validate():
-   raise ValueError("Message incomplete or incorrect")
+   msg.validate()

# Generate TRX message
payload = msg.gen_msg(legacy)
diff --git a/src/target/trx_toolkit/data_msg.py 
b/src/target/trx_toolkit/data_msg.py
index de5f908..a1046ec 100644
--- a/src/target/trx_toolkit/data_msg.py
+++ b/src/target/trx_toolkit/data_msg.py
@@ -227,30 +227,27 @@

return buf

-   # Validates the message fields
+   # Validates the message fields (throws ValueError)
def validate(self):
if not self.ver in self.known_versions:
-   return False
+   raise ValueError("Unknown TRXD header version")

if self.fn is None:
-   return False
+   raise ValueError("TDMA frame-number is not set")

if self.fn < 0 or self.fn > GSM_HYPERFRAME:
-   return False
+   raise ValueError("TDMA frame-number %d is out of range" 
% self.fn)

if self.tn is None:
-   return False
+   raise ValueError("TDMA time-slot is not set")

if self.tn < 0 or self.tn > 7:
-   return False
-
-   return True
+   raise ValueError("TDMA time-slot %d is out of range" % 
self.tn)

# Generates a TRX DATA message
def gen_msg(self, legacy = False):
# Validate all the fields
-   if not self.validate():
-   raise ValueError("Message incomplete or incorrect")
+   self.validate()

# Allocate an empty byte-array
buf = bytearray()
@@ -342,27 +339,24 @@

return length

-   # Validates the message fields
+   # Validates the message fields (throws ValueError)
def validate(self):
# Validate common fields
-   if not DATAMSG.validate(self):
-   return False
+   DATAMSG.validate(self)

if self.pwr is None:
-   return False
+   raise ValueError("Tx Attenuation level is not set")

if self.pwr < self.PWR_MIN or self.pwr > self.PWR_MAX:
-   return False
+   raise ValueError("Tx Attenuation %d is out of range" % 
self.pwr)

# FIXME: properly handle IDLE / NOPE indications
if self.burst is None:
-   return 

Change in ...osmo-ttcn3-hacks[master]: sgsn: Proper shutdown of RAN_Adapter components

2019-08-27 Thread pespin
Hello Jenkins Builder,

I'd like you to reexamine a change. Please visit

https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/15295

to look at the new patch set (#2).

Change subject: sgsn: Proper shutdown of RAN_Adapter components
..

sgsn: Proper shutdown of RAN_Adapter components

Otherwise TTCN3 errors sproadically during shutdown:

SCCP_Emulation.ttcn:5661 Receive operation on port SCCP_SP_PORT succeeded, 
message from SGSN_Test_0-RAN(414)
...
SCCP_Emulation.ttcn:5293 Sent on MTP3_SCCP_PORT to SGSN_Test_0-M3UA(415) 
@SCCP_Types.ASP_MTP3_TRANSFERreq_sccp
SCCP_Emulation.ttcn:5293 Outgoing message was mapped to 
@MTP3asp_Types.ASP_MTP3_TRANSFERreq
SCCP_Emulation.ttcn:5293 Dynamic test case error: Sending data on the 
connection of port MTP3_SCCP_PORT to 415:MTP3_SP_PORT failed. (Broken pipe)
SCCP_Emulation.ttcn:5293 setverdict(error): none -> error
"""

Similar shutdown is already done in f_cleanup() of SCCP_Tests.ttcn.

Related: OS#4176
Change-Id: I471eb851e5d41de5d8d974ec81be27024d7d313a
---
M library/RAN_Adapter.ttcnpp
M sgsn/SGSN_Tests.ttcn
2 files changed, 90 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-ttcn3-hacks 
refs/changes/95/15295/2
--
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/15295
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Change-Id: I471eb851e5d41de5d8d974ec81be27024d7d313a
Gerrit-Change-Number: 15295
Gerrit-PatchSet: 2
Gerrit-Owner: pespin 
Gerrit-Reviewer: Jenkins Builder
Gerrit-MessageType: newpatchset


Change in ...osmo-ttcn3-hacks[master]: sgsn: Proper shutdown of RAN_Adapter components

2019-08-27 Thread pespin
pespin has uploaded this change for review. ( 
https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/15295


Change subject: sgsn: Proper shutdown of RAN_Adapter components
..

sgsn: Proper shutdown of RAN_Adapter components

Otherwise TTCN3 errors sproadically during shutdown:

SCCP_Emulation.ttcn:5661 Receive operation on port SCCP_SP_PORT succeeded, 
message from SGSN_Test_0-RAN(414)
...
SCCP_Emulation.ttcn:5293 Sent on MTP3_SCCP_PORT to SGSN_Test_0-M3UA(415) 
@SCCP_Types.ASP_MTP3_TRANSFERreq_sccp
SCCP_Emulation.ttcn:5293 Outgoing message was mapped to 
@MTP3asp_Types.ASP_MTP3_TRANSFERreq
SCCP_Emulation.ttcn:5293 Dynamic test case error: Sending data on the 
connection of port MTP3_SCCP_PORT to 415:MTP3_SP_PORT failed. (Broken pipe)
SCCP_Emulation.ttcn:5293 setverdict(error): none -> error
"""

Similar shutdown is already done in f_cleanup() of SCCP_Tests.ttcn.

Related: OS#4176
Change-Id: I471eb851e5d41de5d8d974ec81be27024d7d313a
---
M library/RAN_Adapter.ttcnpp
M sgsn/SGSN_Tests.ttcn
2 files changed, 89 insertions(+), 1 deletion(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-ttcn3-hacks 
refs/changes/95/15295/1

diff --git a/library/RAN_Adapter.ttcnpp b/library/RAN_Adapter.ttcnpp
index e995e8d..9ed1be1 100644
--- a/library/RAN_Adapter.ttcnpp
+++ b/library/RAN_Adapter.ttcnpp
@@ -47,9 +47,11 @@
MSC_SCCP_MTP3_parameters sccp_pars,
SCCP_PAR_Address sccp_addr_own,
SCCP_PAR_Address sccp_addr_peer,
+   RAN_Transport transport,

/* handler mode */
-   RAN_Emulation_CT vc_RAN
+   RAN_Emulation_CT vc_RAN,
+   boolean vc_RAN_started
 }

 type record RAN_Configuration {
@@ -79,6 +81,7 @@
};
ba.sccp_addr_own := valueof(ts_SccpAddr_PC_SSN(cfg.own_pc, cfg.own_ssn, 
cfg.sio, cfg.sccp_service_type));
ba.sccp_addr_peer := valueof(ts_SccpAddr_PC_SSN(cfg.peer_pc, 
cfg.peer_ssn, cfg.sio, cfg.sccp_service_type));
+   ba.transport := cfg.transport;
 }


@@ -177,6 +180,9 @@
}
log("Starting RAN_Emulation");
ba.vc_RAN.start(RAN_Emulation.main(valueof(ops), ""));
+   ba.vc_RAN_started := true;
+   } else {
+   ba.vc_RAN_started := false;
}


@@ -186,5 +192,27 @@
ba.vc_SCCP.start(SCCPStart(ba.sccp_pars));
 }

+function f_ran_adapter_cleanup(inout RAN_Adapter ba) {
+   if (ba.vc_RAN_started) {
+   if (ba.transport == RANAP_TRANSPORT_IuCS) {
+#ifdef RAN_EMULATION_RANAP
+   disconnect(ba.vc_RAN:RANAP, ba.vc_SCCP:SCCP_SP_PORT);
+#endif
+   } else {
+#ifdef RAN_EMULATION_BSSAP
+   disconnect(ba.vc_RAN:BSSAP, ba.vc_SCCP:SCCP_SP_PORT);
+#endif
+   }
+   ba.vc_RAN.stop;
+   }
+   if (ba.transport == BSSAP_TRANSPORT_AoIP or
+   ba.transport == RANAP_TRANSPORT_IuCS) {
+   unmap(ba.vc_M3UA:SCTP_PORT, system:sctp);
+   disconnect(ba.vc_M3UA:MTP3_SP_PORT, ba.vc_SCCP:MTP3_SCCP_PORT);
+   ba.vc_M3UA.stop;
+   }
+   ba.vc_SCCP.stop;
+}
+

 }
diff --git a/sgsn/SGSN_Tests.ttcn b/sgsn/SGSN_Tests.ttcn
index a7cc57f..a7b3490 100644
--- a/sgsn/SGSN_Tests.ttcn
+++ b/sgsn/SGSN_Tests.ttcn
@@ -328,6 +328,14 @@
f_vty_enable_echo_interval(g_use_echo);
 }

+function f_cleanup() runs on test_CT {
+   var integer i;
+   for (i := 0; i < NUM_RNC; i := i+1) {
+   f_ran_adapter_cleanup(g_ranap[i]);
+   }
+   self.stop;
+}
+
 private function RncUnitdataCallback(RANAP_PDU ranap)
 runs on RAN_Emulation_CT return template RANAP_PDU {
var template RANAP_PDU resp := omit;
@@ -454,6 +462,7 @@
 testcase TC_wait_ns_up() runs on test_CT {
f_init();
f_sleep(20.0);
+   f_cleanup();
 }

 function f_send_llc(template (value) PDU_LLC llc_pdu, integer gb_index := 0) 
runs on BSSGP_ConnHdlr {
@@ -684,6 +693,7 @@
f_sleep(1.0);
vc_conn := f_start_handler(refers(f_TC_attach), testcasename(), g_gb, 
1);
vc_conn.done;
+   f_cleanup();
 }

 testcase TC_attach_mnc3() runs on test_CT {
@@ -692,6 +702,7 @@
f_sleep(1.0);
vc_conn := f_start_handler(refers(f_TC_attach), testcasename(), g_gb, 
1001);
vc_conn.done;
+   f_cleanup();
 }

 private function f_TC_attach_umts_aka_umts_res(charstring id) runs on 
BSSGP_ConnHdlr {
@@ -704,6 +715,7 @@
f_sleep(1.0);
vc_conn := f_start_handler(refers(f_TC_attach_umts_aka_umts_res), 
testcasename(), g_gb, 1002);
vc_conn.done;
+   f_cleanup();
 }

 private function f_TC_attach_umts_aka_gsm_sres(charstring id) runs on 
BSSGP_ConnHdlr {
@@ -716,6 +728,7 @@
f_sleep(1.0);
vc_conn := f_start_handler(refers(f_TC_attach_umts_aka_gsm_sres), 
testcasename(), g_gb, 1003);
vc_conn.done;
+   f_cleanup();
 }

 /* MS never responds to ID REQ, expect ATTACH REJECT */
@@ -742,6 +755,7 @@
f_init();
   

Change in ...libosmocore[master]: fix: vty crash by logging to killed telnet session

2019-08-27 Thread pespin
pespin has posted comments on this change. ( 
https://gerrit.osmocom.org/c/libosmocore/+/15265 )

Change subject: fix: vty crash by logging to killed telnet session
..


Patch Set 2:

I'm sorry but I don't agree here. I don't think adding lots of checks against 
null pointers all around the code to make sure we don't crash on situation that 
shouldn't happen is good practice. It makes code harder to follow and make 
people infer bad assumptions, and masks bugs.
I'm not making a huge thing of it, that's why I think these checks shouldn't be 
there.

If someone else agrees to merge this one go on, but I don't like it. I expect 
the correct fix for this issue (that is, as you said, removing the conn from 
the target list before printing in telnet_close_client()).


--
To view, visit https://gerrit.osmocom.org/c/libosmocore/+/15265
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: Idca3f54dc986abf6784790c12e69e02bdf77cb41
Gerrit-Change-Number: 15265
Gerrit-PatchSet: 2
Gerrit-Owner: neels 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: neels 
Gerrit-CC: pespin 
Gerrit-Comment-Date: Tue, 27 Aug 2019 16:24:52 +
Gerrit-HasComments: No
Gerrit-Has-Labels: No
Gerrit-MessageType: comment


Change in ...osmo-trx[master]: Transceiver: Enable EDGE detection only on PDCH timeslots

2019-08-27 Thread pespin
pespin has posted comments on this change. ( 
https://gerrit.osmocom.org/c/osmo-trx/+/15291 )

Change subject: Transceiver: Enable EDGE detection only on PDCH timeslots
..


Patch Set 1:

> Patch Set 1:
>
> > It was then broken before too [...]
>
> Why do you think so?

Well, if SETSLOT is allegedly not send on dynamic PDCH timestlos, then it was 
broken too in osmo-bts regardless of this patch (or maybe it worked due to this 
bug in osmo-trx making it work), but in any case it's an issue of osmo-bts.


--
To view, visit https://gerrit.osmocom.org/c/osmo-trx/+/15291
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-trx
Gerrit-Branch: master
Gerrit-Change-Id: Id16248a1c03f9bc9f323c707857cdf3bf34c4e3e
Gerrit-Change-Number: 15291
Gerrit-PatchSet: 1
Gerrit-Owner: pespin 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge 
Gerrit-Reviewer: pespin 
Gerrit-CC: fixeria 
Gerrit-Comment-Date: Tue, 27 Aug 2019 16:09:44 +
Gerrit-HasComments: No
Gerrit-Has-Labels: No
Gerrit-MessageType: comment


Change in ...libosmocore[master]: fix: vty crash by logging to killed telnet session

2019-08-27 Thread neels
Hello Jenkins Builder,

I'd like you to reexamine a change. Please visit

https://gerrit.osmocom.org/c/libosmocore/+/15265

to look at the new patch set (#2).

Change subject: fix: vty crash by logging to killed telnet session
..

fix: vty crash by logging to killed telnet session

When a telnet session dies (e.g. killall telnet) and also has logging enabled,
the closing of the telnet session logs to the killed telnet session and
segfaults: the vty->obuf is already NULL.

In vty_out(), guard against this situation by not composing an output if
vty->obuf is NULL.

Also guard all buffer_*() functions against a NULL buffer argument, which
should catch all other hypothetical code paths trying to add to a closed
vty->obuf.

Related: OS#4164
Change-Id: Idca3f54dc986abf6784790c12e69e02bdf77cb41
---
M src/vty/buffer.c
M src/vty/vty.c
2 files changed, 35 insertions(+), 3 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/65/15265/2
--
To view, visit https://gerrit.osmocom.org/c/libosmocore/+/15265
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: Idca3f54dc986abf6784790c12e69e02bdf77cb41
Gerrit-Change-Number: 15265
Gerrit-PatchSet: 2
Gerrit-Owner: neels 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: neels 
Gerrit-CC: pespin 
Gerrit-MessageType: newpatchset


Change in ...libosmocore[master]: fix: vty crash by logging to killed telnet session

2019-08-27 Thread neels
neels has posted comments on this change. ( 
https://gerrit.osmocom.org/c/libosmocore/+/15265 )

Change subject: fix: vty crash by logging to killed telnet session
..


Patch Set 1:

(4 comments)

https://gerrit.osmocom.org/#/c/15265/1//COMMIT_MSG
Commit Message:

https://gerrit.osmocom.org/#/c/15265/1//COMMIT_MSG@11
PS1, Line 11: segfaults: the vty->obuf is already NULL.
> Why do we try to send a message to a killed session first of all? That seems 
> to be the route of the  […]
I want to make sure that we cannot ever crash by writing to a NULL ofd. 
Whatever the reasons for the NULL ofd, and whatever the reasons for wanting to 
log to it.

Fixing the higher level fail would be: close down the logging target before 
taking down the ofd. I care about that only secondarily. This is only one cause 
for logging to NULL that we found now.

Fair enough, if we ensure closed telnets always close down log targets safely 
the issue would not exist, but I am not willing to verify that now. That is why 
I want these NULL checks at the buffer API level. It makes all other calling 
code bugs non-fatal in a trivial way, without the need to fully audit the 
ancient vty code.

Can we please get over this and not make a huge thing of it?


https://gerrit.osmocom.org/#/c/15265/1//COMMIT_MSG@16
PS1, Line 16: Also guard all buffer_*() functions against a NULL buffer 
argument, which
> this looks like a hack to fix other parts of the code which may be wrong, and 
> looks like it should b […]
If the calling code paths are not trivially clear, it is good practise to guard 
against NULL pointers. Rather drop a log line than crashing the entire program.


https://gerrit.osmocom.org/#/c/15265/1//COMMIT_MSG@20
PS1, Line 20: Related: OS#4164
> This ticket doesn't look related to me.
this one is correct, the one in the comment has a typo


https://gerrit.osmocom.org/#/c/15265/1/src/vty/vty.c
File src/vty/vty.c:

https://gerrit.osmocom.org/#/c/15265/1/src/vty/vty.c@266
PS1, Line 266:   * of this same (killed) telnet session. See 
OS#4146. */
> OS#4146 (https://osmocom. […]
aha, the commit log has the correct one: #4164. Here there is a number swap. thx



--
To view, visit https://gerrit.osmocom.org/c/libosmocore/+/15265
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: Idca3f54dc986abf6784790c12e69e02bdf77cb41
Gerrit-Change-Number: 15265
Gerrit-PatchSet: 1
Gerrit-Owner: neels 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: neels 
Gerrit-CC: pespin 
Gerrit-Comment-Date: Tue, 27 Aug 2019 15:40:57 +
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: pespin 
Gerrit-MessageType: comment


Change in ...osmo-trx[master]: Transceiver: Enable EDGE detection only on PDCH timeslots

2019-08-27 Thread fixeria
fixeria has posted comments on this change. ( 
https://gerrit.osmocom.org/c/osmo-trx/+/15291 )

Change subject: Transceiver: Enable EDGE detection only on PDCH timeslots
..


Patch Set 1:

> It was then broken before too [...]

Why do you think so?


--
To view, visit https://gerrit.osmocom.org/c/osmo-trx/+/15291
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-trx
Gerrit-Branch: master
Gerrit-Change-Id: Id16248a1c03f9bc9f323c707857cdf3bf34c4e3e
Gerrit-Change-Number: 15291
Gerrit-PatchSet: 1
Gerrit-Owner: pespin 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge 
Gerrit-Reviewer: pespin 
Gerrit-CC: fixeria 
Gerrit-Comment-Date: Tue, 27 Aug 2019 14:08:11 +
Gerrit-HasComments: No
Gerrit-Has-Labels: No
Gerrit-MessageType: comment


Change in ...osmo-trx[master]: Transceiver: Enable EDGE detection only on PDCH timeslots

2019-08-27 Thread pespin
pespin has posted comments on this change. ( 
https://gerrit.osmocom.org/c/osmo-trx/+/15291 )

Change subject: Transceiver: Enable EDGE detection only on PDCH timeslots
..


Patch Set 1:

> Patch Set 1:
>
> Oh no! This one should have been marked as WIP!
> I guess EDGE is now broken on dynamic time-slots.

It was then broken before too (broken in osmo-bts). I already opened a ticket 
to check and fix it in osmo-bts if needed:
https://osmocom.org/issues/4175


--
To view, visit https://gerrit.osmocom.org/c/osmo-trx/+/15291
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-trx
Gerrit-Branch: master
Gerrit-Change-Id: Id16248a1c03f9bc9f323c707857cdf3bf34c4e3e
Gerrit-Change-Number: 15291
Gerrit-PatchSet: 1
Gerrit-Owner: pespin 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge 
Gerrit-Reviewer: pespin 
Gerrit-CC: fixeria 
Gerrit-Comment-Date: Tue, 27 Aug 2019 13:51:11 +
Gerrit-HasComments: No
Gerrit-Has-Labels: No
Gerrit-MessageType: comment


Change in ...osmo-trx[master]: Transceiver: Enable EDGE detection only on PDCH timeslots

2019-08-27 Thread fixeria
fixeria has posted comments on this change. ( 
https://gerrit.osmocom.org/c/osmo-trx/+/15291 )

Change subject: Transceiver: Enable EDGE detection only on PDCH timeslots
..


Patch Set 1:

Oh no! This one should have been marked as WIP!
I guess EDGE is now broken on dynamic time-slots.


--
To view, visit https://gerrit.osmocom.org/c/osmo-trx/+/15291
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-trx
Gerrit-Branch: master
Gerrit-Change-Id: Id16248a1c03f9bc9f323c707857cdf3bf34c4e3e
Gerrit-Change-Number: 15291
Gerrit-PatchSet: 1
Gerrit-Owner: pespin 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge 
Gerrit-Reviewer: pespin 
Gerrit-CC: fixeria 
Gerrit-Comment-Date: Tue, 27 Aug 2019 13:48:21 +
Gerrit-HasComments: No
Gerrit-Has-Labels: No
Gerrit-MessageType: comment


Change in ...osmo-ttcn3-hacks[master]: ggsn: Introduce test TC_pdp_act_restart_ctr_echo

2019-08-27 Thread pespin
pespin has submitted this change and it was merged. ( 
https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/15282 )

Change subject: ggsn: Introduce test TC_pdp_act_restart_ctr_echo
..

ggsn: Introduce test TC_pdp_act_restart_ctr_echo

VTY functionalities to enable and disable echo requests in osmo-ggsn are
added too as part of the test.

Depends: osmo-ggsn.git Id2c84165dc59dff495106758146a701ca488834f
Related: OS#4165
Change-Id: Ia37e48e7ff9ad063f9eabf447f8a6a0a3fc380d9
---
M ggsn_tests/GGSN_Tests.ttcn
M ggsn_tests/expected-results.xml
2 files changed, 86 insertions(+), 5 deletions(-)

Approvals:
  Jenkins Builder: Verified
  laforge: Looks good to me, approved



diff --git a/ggsn_tests/GGSN_Tests.ttcn b/ggsn_tests/GGSN_Tests.ttcn
index ae92626..e294fb7 100644
--- a/ggsn_tests/GGSN_Tests.ttcn
+++ b/ggsn_tests/GGSN_Tests.ttcn
@@ -64,6 +64,13 @@
 * The tests expect to be able to send ping packets between any 
two simulated MS within the same
 * address range. This requires IP forwarding to be enabled on 
the corresponding tun interfaces.
 */
+
+   /*
+* Whether ggsn supports "(no) echo-interval" VTY command
+* (osmo-ggsn.git Id2c84165dc59dff495106758146a701ca488834f).
+* This option can be dropped after osmo-ggsn release > 1.4.0 
exists.
+*/
+   boolean m_ggsn_supports_echo_interval := true;
}

type set PdpContext {
@@ -107,6 +114,7 @@

port TELNETasp_PT GGSNVTY;
var boolean use_gtpu_txseq := false;
+   var boolean g_use_echo := false;
}

private function f_init_vty() runs on GT_CT {
@@ -159,6 +167,17 @@
return true;
}

+   private function f_vty_enable_echo_interval(boolean enable) runs on 
GT_CT {
+   f_vty_enter_config(GGSNVTY);
+   f_vty_transceive(GGSNVTY, "ggsn ggsn0");
+   if (enable) {
+   f_vty_transceive(GGSNVTY, "echo-interval 5");
+   } else {
+   f_vty_transceive(GGSNVTY, "no echo-interval");
+   }
+   f_vty_transceive(GGSNVTY, "end");
+   }
+
function f_init() runs on GT_CT {
if (g_initialized == true) {
return;
@@ -184,20 +203,22 @@

f_init_vty();
f_vty_set_gpdu_txseq(use_gtpu_txseq);
+   if (m_ggsn_supports_echo_interval) {
+   f_vty_enable_echo_interval(g_use_echo);
+   }
}

/* Altstep implementing responses to any incoming echo requests */
altstep pingpong() runs on GT_CT {
var Gtp1cUnitdata ud;
var Gtp1uUnitdata udu;
-   [] GTPC.receive(tr_GTPC_PING(?)) -> value ud {
+   [g_use_echo] GTPC.receive(tr_GTPC_PING(?)) -> value ud {
var uint16_t seq := 
oct2int(ud.gtpc.opt_part.sequenceNumber);
-   GTPC.send(ts_GTPC_PONG(ud.peer, seq, '00'O));
+   GTPC.send(ts_GTPC_PONG(ud.peer, seq, g_restart_ctr));
repeat;
};
-   [] GTPU.receive(tr_GTPU_PING(?)) -> value udu {
-   var uint16_t seq := 
oct2int(udu.gtpu.opt_part.sequenceNumber);
-   GTPU.send(ts_GTPU_PONG(udu.peer, seq, '00'O));
+   [not g_use_echo] GTPC.receive(tr_GTPC_PING(?)) {
+   setverdict(fail, "GTP Echo Req rceived but not enabled 
in VTY");
};
[] T_default.timeout { setverdict(fail); };
}
@@ -307,6 +328,35 @@
T_default.stop;
}

+   function f_pdp_ctx_exp_del_req(PdpContext ctx, template (omit) OCT1 
expect_cause := omit, boolean expect_teardown := false) runs on GT_CT {
+   var Gtp1cUnitdata ud;
+   var default d;
+
+   T_default.start;
+   d := activate(pingpong());
+   alt {
+   [] GTPC.receive(tr_GTPC_MsgType(g_peer_c, 
deletePDPContextRequest, ctx.teic)) -> value ud {
+   if (istemplatekind(expect_cause, "omit") and 
not ispresent(ud.gtpc.gtpc_pdu.deletePDPContextRequest.cause.causevalue)) {
+   setverdict(pass);
+   } else if (not istemplatekind(expect_cause, 
"omit") and
+  
ispresent(ud.gtpc.gtpc_pdu.deletePDPContextRequest.cause.causevalue) and
+  
ud.gtpc.gtpc_pdu.deletePDPContextRequest.cause.causevalue == 
valueof(expect_cause)) {
+   setverdict(pass);
+   } else {
+   setverdict(fail);
+ 

Change in ...osmo-ttcn3-hacks[master]: sgsn: Add test to verify duplicate DeactPDPCtx crashing osmo-sgsn

2019-08-27 Thread pespin
pespin has submitted this change and it was merged. ( 
https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/15225 )

Change subject: sgsn: Add test to verify duplicate DeactPDPCtx crashing 
osmo-sgsn
..

sgsn: Add test to verify duplicate DeactPDPCtx crashing osmo-sgsn

osmo-sgsn sends 2 DeletePdpCtxReq on gtp, Confirmation received on first
one frees cbp associatd to pdp and the second one accesses the already
freed cbp.

Related: OS#3956
Change-Id: Ie1cc9fdf91b18b0b7fb3d5fb33b6dcf6f46a393f
---
M sgsn/SGSN_Tests.ttcn
M sgsn/expected-results.xml
2 files changed, 52 insertions(+), 0 deletions(-)

Approvals:
  Jenkins Builder: Verified
  laforge: Looks good to me, approved



diff --git a/sgsn/SGSN_Tests.ttcn b/sgsn/SGSN_Tests.ttcn
index a7cc57f..b146046 100644
--- a/sgsn/SGSN_Tests.ttcn
+++ b/sgsn/SGSN_Tests.ttcn
@@ -1470,6 +1470,56 @@
vc_conn.done;
 }

+/* Test MS sending a duplicate Deact PDP Ctx (OS#3956). */
+private function f_TC_attach_pdp_act_deact_dup(charstring id) runs on 
BSSGP_ConnHdlr {
+   var PdpActPars apars := valueof(t_PdpActPars(mp_ggsn_ip));
+   var Gtp1cUnitdata g_ud;
+   var integer i;
+   var OCT1 cause_regular_deact := '24'O;
+
+   /* first perform regular attach + PDP context act */
+   f_TC_attach(id);
+   f_pdp_ctx_act(apars);
+
+   f_send_l3_gmm_llc(ts_SM_DEACT_PDP_REQ_MO(apars.tid, 
cause_regular_deact, false, omit), 0);
+   f_send_l3_gmm_llc(ts_SM_DEACT_PDP_REQ_MO(apars.tid, 
cause_regular_deact, false, omit), 0);
+
+   for (i := 0; i < 2; i := i+1) {
+   GTP.receive(tr_GTPC_MsgType(?, deletePDPContextRequest, 
apars.ggsn_tei_c)) -> value g_ud {
+   var integer seq_nr := 
oct2int(g_ud.gtpc.opt_part.sequenceNumber);
+   log("Received deletePDPContextResponse " & int2str(i) & 
", seq_nr=" & int2str(seq_nr));
+   GTP.send(ts_GTPC_DeletePdpResp(g_ud.peer, seq_nr, 
apars.sgsn_tei_c, '7F'O));
+   }
+   }
+
+   alt {
+   [] BSSGP[0].receive(tr_SM_DEACT_PDP_ACCEPT_MT(apars.tid)) {
+   setverdict(pass);
+   }
+   [] as_xid(apars, 0);
+   }
+
+   /* Make sure second DeactPdpAccept is sent: */
+   timer T := 2.0;
+   T.start;
+   alt {
+   [] BSSGP[0].receive(tr_SM_DEACT_PDP_ACCEPT_MT(apars.tid)) {
+   setverdict(fail, "Second SM_DEACT_PDP_ACCEPT_MT received");
+   }
+   [] T.timeout {
+   setverdict(pass);
+   }
+   }
+
+   setverdict(pass);
+}
+testcase TC_attach_pdp_act_deact_dup() runs on test_CT {
+   var BSSGP_ConnHdlr vc_conn;
+   f_init();
+   vc_conn := f_start_handler(refers(f_TC_attach_pdp_act_deact_dup), 
testcasename(), g_gb, 46);
+   vc_conn.done;
+}
+
 /* ATTACH + ATTACH (2nd) */
 private function f_TC_attach_forget_tlli_attach(charstring id) runs on 
BSSGP_ConnHdlr {
g_pars.t_guard  := 5.0;
@@ -2545,6 +2595,7 @@
execute( TC_attach_pdp_act_ggsn_reject() );
execute( TC_attach_pdp_act_user_deact_mo() );
execute( TC_attach_pdp_act_user_deact_mt() );
+   execute( TC_attach_pdp_act_deact_dup() );
execute( TC_attach_second_attempt() );
execute( TC_attach_restart_ctr_echo() );
execute( TC_attach_restart_ctr_create() );
diff --git a/sgsn/expected-results.xml b/sgsn/expected-results.xml
index 0b477d1..d9c3706 100644
--- a/sgsn/expected-results.xml
+++ b/sgsn/expected-results.xml
@@ -47,6 +47,7 @@
   
   
   
+  
   
 Tguard timeout
   SGSN_Tests.ttcn:MASKED SGSN_Tests control part

--
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/15225
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Change-Id: Ie1cc9fdf91b18b0b7fb3d5fb33b6dcf6f46a393f
Gerrit-Change-Number: 15225
Gerrit-PatchSet: 6
Gerrit-Owner: pespin 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: keith 
Gerrit-Reviewer: laforge 
Gerrit-Reviewer: pespin 
Gerrit-MessageType: merged


Change in ...osmo-ttcn3-hacks[master]: ggsn: Introduce test TC_pdp_act2_recovery

2019-08-27 Thread pespin
pespin has submitted this change and it was merged. ( 
https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/15283 )

Change subject: ggsn: Introduce test TC_pdp_act2_recovery
..

ggsn: Introduce test TC_pdp_act2_recovery

Some code is moved out of f_pdp_ctx_act() into f_handle_create_req() in
order to re-use it in the test.

Related: OS#4165
Change-Id: I48c1bc9287ce8b820e5ea672dffbc5a8503f16d7
---
M ggsn_tests/GGSN_Tests.ttcn
M ggsn_tests/expected-results.xml
2 files changed, 111 insertions(+), 42 deletions(-)

Approvals:
  Jenkins Builder: Verified
  laforge: Looks good to me, approved



diff --git a/ggsn_tests/GGSN_Tests.ttcn b/ggsn_tests/GGSN_Tests.ttcn
index e294fb7..4a53fa1 100644
--- a/ggsn_tests/GGSN_Tests.ttcn
+++ b/ggsn_tests/GGSN_Tests.ttcn
@@ -267,6 +267,51 @@
}
}

+   function f_handle_create_req(inout PdpContext ctx, in Gtp1cUnitdata ud, 
in OCT1 exp_cause := '80'O) runs on GT_CT {
+   var CreatePDPContextResponse cpr := 
ud.gtpc.gtpc_pdu.createPDPContextResponse;
+   if (exp_cause == '80'O and exp_cause == cpr.cause.causevalue) {
+   /*  Check if EUA type corresponds to requested type */
+   if (match(ctx.eua, t_EuaIPv4(?)) and
+   not match(cpr.endUserAddress, tr_EuaIPv4(?))){
+   setverdict(fail);
+   }
+   if (match(ctx.eua, t_EuaIPv6(?)) and
+   not match(cpr.endUserAddress, tr_EuaIPv6(?))) {
+   setverdict(fail);
+   }
+   if (match(ctx.eua, t_EuaIPv4v6(?, ?)) and
+   not match(cpr.endUserAddress, tr_EuaIPv4v6(?, ?))) {
+   setverdict(fail);
+   }
+   /* Check if PCO response corresponds to request */
+   if (ispresent(ctx.pco_req)) {
+   if (match(ctx.pco_req, ts_PCO_IPv4_DNS_CONT) and
+   not match(cpr.protConfigOptions, 
tr_PCO_IPv4_DNS_CONT_resp(?))) {
+   log("IPv4 DNS Container requested, but 
missing");
+   setverdict(fail);
+   }
+   if (match(ctx.pco_req, ts_PCO_IPv6_DNS) and
+   not match(cpr.protConfigOptions, 
tr_PCO_IPv6_DNS_resp(?))) {
+   log("IPv6 DNS Container requested, but 
missing");
+   setverdict(fail);
+   }
+   }
+   ctx.teid_remote := cpr.teidDataI.teidDataI;
+   ctx.teic_remote := 
cpr.teidControlPlane.teidControlPlane;
+   ctx.eua := cpr.endUserAddress;
+   ctx.pco_neg := cpr.protConfigOptions;
+   setverdict(pass);
+   } else if (exp_cause != '80'O and exp_cause == 
cpr.cause.causevalue) {
+   if (ispresent(cpr.endUserAddress)) {
+   log("EUA received on createPDPContextResponse 
cause=" & oct2str(cpr.cause.causevalue));
+   setverdict(fail);
+   }
+   setverdict(pass);
+   } else {
+   setverdict(fail);
+   }
+   }
+
/* send a PDP context activation */
function f_pdp_ctx_act(inout PdpContext ctx, OCT1 exp_cause := '80'O) 
runs on GT_CT {
var Gtp1cUnitdata ud;
@@ -280,48 +325,7 @@
d := activate(pingpong());
alt {
[] GTPC.receive(tr_GTPC_MsgType(g_peer_c, 
createPDPContextResponse, ctx.teic)) -> value ud {
-   var CreatePDPContextResponse cpr := 
ud.gtpc.gtpc_pdu.createPDPContextResponse;
-   if (exp_cause == '80'O and exp_cause == 
cpr.cause.causevalue) {
-   /*  Check if EUA type corresponds to 
requested type */
-   if (match(ctx.eua, t_EuaIPv4(?)) and
-   not match(cpr.endUserAddress, 
tr_EuaIPv4(?))){
-   setverdict(fail);
-   }
-   if (match(ctx.eua, t_EuaIPv6(?)) and
-   not match(cpr.endUserAddress, 
tr_EuaIPv6(?))) {
-   setverdict(fail);
-   }
-   if (match(ctx.eua, t_EuaIPv4v6(?, ?)) 
and
-   not match(cpr.endUserAddress, 
tr_EuaIPv4v6(?, ?))) {

Change in ...osmo-ttcn3-hacks[master]: sgsn: Add test to verify duplicate DeactPDPCtx crashing osmo-sgsn

2019-08-27 Thread pespin
pespin has posted comments on this change. ( 
https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/15225 )

Change subject: sgsn: Add test to verify duplicate DeactPDPCtx crashing 
osmo-sgsn
..


Patch Set 6:

This change is ready for review.


--
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/15225
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Change-Id: Ie1cc9fdf91b18b0b7fb3d5fb33b6dcf6f46a393f
Gerrit-Change-Number: 15225
Gerrit-PatchSet: 6
Gerrit-Owner: pespin 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: keith 
Gerrit-Reviewer: laforge 
Gerrit-Reviewer: pespin 
Gerrit-Comment-Date: Tue, 27 Aug 2019 13:05:30 +
Gerrit-HasComments: No
Gerrit-Has-Labels: No
Gerrit-MessageType: comment


Change in ...osmo-ggsn[master]: libgtp: Remove packets in tx queue belonging pdp being freed

2019-08-27 Thread laforge
laforge has submitted this change and it was merged. ( 
https://gerrit.osmocom.org/c/osmo-ggsn/+/15228 )

Change subject: libgtp: Remove packets in tx queue belonging pdp being freed
..

libgtp: Remove packets in tx queue belonging pdp being freed

Doing so should avoid the crash seen in OS#3956, where a message is
received in osmo-sgsn gtp iface after having received a DeleteCtxAccept
message where pdp and associated cbp is freed. As a result, when new
confirmation arrives, it can still be matched against an old request and
be sent to upper layers providing an already freed cbp.

With this patch, since all queued messages belonging to that pdp are
dropped, confirmation won't find a match and be discarded in libgtp.

In order to be able to drop all req messages belonging to a pdp, a new list
is added to pdp_t and qmsg_t are added to that list when inserted into the 
per-gsn
req transmit queue. This way upon pdp free time it's simply a
matter of iterating over that list to remove all messages.

There's no need to do same for resp queue, and it'd be actually
counter-productive, because it wouldn't be possible to detect and
discard duplicates anymore after pdp ctx has been freed.

Related: OS#3956
Change-Id: Id86d0b241454d3ad49c64c28087fd2710fa2d17a
---
M TODO-RELEASE
M gtp/gtp.c
M gtp/pdp.c
M gtp/pdp.h
M gtp/queue.c
M gtp/queue.h
6 files changed, 28 insertions(+), 1 deletion(-)

Approvals:
  Jenkins Builder: Verified
  laforge: Looks good to me, approved



diff --git a/TODO-RELEASE b/TODO-RELEASE
index d0852fc..73e3189 100644
--- a/TODO-RELEASE
+++ b/TODO-RELEASE
@@ -7,3 +7,5 @@
 # If any interfaces have been added since the last public release: c:r:a + 1.
 # If any interfaces have been removed or changed since the last public 
release: c:r:0.
 #library   whatdescription / commit summary line
+libgtp queue.h struct qmsg_t got a new field: entry
+libgtp pdp.h   struct pdp_t got a new field: qmsg_list_req
diff --git a/gtp/gtp.c b/gtp/gtp.c
index 94c3245..799f8a7 100644
--- a/gtp/gtp.c
+++ b/gtp/gtp.c
@@ -513,6 +513,8 @@
qmsg->cbp = cbp;
qmsg->type = ntoh8(packet->gtp0.h.type);
qmsg->fd = fd;
+   if (pdp) /* echo requests are not pdp-bound */
+   llist_add(>entry, >qmsg_list_req);
}
gsn->seq_next++;/* Count up this time */
return 0;
@@ -697,6 +699,9 @@
qmsg->cbp = NULL;
qmsg->type = 0;
qmsg->fd = fd;
+   /* No need to add to pdp list here, because even on pdp ctx free
+  we want to leave messages in queue_resp until timeout to
+  detect duplicates */
}
return 0;
 }
diff --git a/gtp/pdp.c b/gtp/pdp.c
index d745916..eaef545 100644
--- a/gtp/pdp.c
+++ b/gtp/pdp.c
@@ -31,6 +31,7 @@
 #include "pdp.h"
 #include "gtp.h"
 #include "lookupa.h"
+#include "queue.h"

 /* ***
  * Functions related to PDP storage
@@ -156,7 +157,7 @@
}
/* Default: Generate G-PDU sequence numbers on Tx */
(*pdp)->tx_gpdu_seq = true;
-
+   INIT_LLIST_HEAD(&(*pdp)->qmsg_list_req);
return 0;
}
}
@@ -165,7 +166,17 @@

 int pdp_freepdp(struct pdp_t *pdp)
 {
+   struct qmsg_t *qmsg, *qmsg2;
struct pdp_t *pdpa = pdp->gsn->pdpa;
+   int rc;
+
+   /* Remove all enqueued messages belonging to this pdp from req tx 
transmit
+  queue. queue_freemsg will call llist_del(). */
+   llist_for_each_entry_safe(qmsg, qmsg2, >qmsg_list_req, entry) {
+   if ((rc = queue_freemsg(pdp->gsn->queue_req, qmsg)))
+   LOGP(DLGTP, LOGL_ERROR,
+"Failed freeing qmsg from qmsg_list_req during 
pdp_freepdp()! %d\n", rc);
+   }

pdp_tiddel(pdp);

diff --git a/gtp/pdp.h b/gtp/pdp.h
index d64d394..fdfa824 100644
--- a/gtp/pdp.h
+++ b/gtp/pdp.h
@@ -17,6 +17,7 @@
 #include 

 #include 
+#include 

 struct gsn_t;

@@ -241,6 +242,8 @@
struct gsn_t *gsn; /* Back pointer to GSN where this pdp ctx belongs to 
*/

bool tx_gpdu_seq;   /* Transmit (true) or suppress G-PDU 
sequence numbers */
+
+   struct llist_head qmsg_list_req; /* list of req qmsg_t in retrans queue 
belonging this pdp ctx */
 };

 /* functions related to pdp_t management */
diff --git a/gtp/queue.c b/gtp/queue.c
index ce4713e..4c25913 100644
--- a/gtp/queue.c
+++ b/gtp/queue.c
@@ -172,6 +172,7 @@
} else {
*qmsg = >qmsga[queue->next];
queue_seqset(queue, *qmsg, peer, seq);
+   INIT_LLIST_HEAD(&(*qmsg)->entry);
(*qmsg)->state = 1; /* Space taken */
(*qmsg)->this = queue->next;
  

Change in ...osmo-ggsn[master]: libgtp: announce pdp ctx deletion upon CreatePdpCtx being rejected

2019-08-27 Thread laforge
laforge has submitted this change and it was merged. ( 
https://gerrit.osmocom.org/c/osmo-ggsn/+/15259 )

Change subject: libgtp: announce pdp ctx deletion upon CreatePdpCtx being 
rejected
..

libgtp: announce pdp ctx deletion upon CreatePdpCtx being rejected

The libgtp application  may have already allocated related resources
associated to the pdp context, so we need to signal its deletion in
order to let the application free the resources.

This should fix the duplication of pdp contexts seen in osmo-ggsn when
"show pdp-context" related VTY commands are used.
It was spotted due to some MS requesting a v4v6 context on a
v4-only APN, where first v4 address was allocated, and then upon v6
allocation create_context_ind() called
gtp_create_context_resp(GTPCAUSE_MISSING_APN) but the first address was
not freed. Upon receiving the callback, osmo-ggsn should now free the
related resources.

Related: OS#4154
Change-Id: I6c6215a4ce478afabc78ffaf5ffb0cf829e41226
---
M ggsn/ggsn.c
M gtp/gtp.c
2 files changed, 3 insertions(+), 4 deletions(-)

Approvals:
  Jenkins Builder: Verified
  osmith: Looks good to me, approved
  laforge: Looks good to me, but someone else must approve



diff --git a/ggsn/ggsn.c b/ggsn/ggsn.c
index 95371a2..d71855d 100644
--- a/ggsn/ggsn.c
+++ b/ggsn/ggsn.c
@@ -386,7 +386,7 @@
LOGPPDP(LOGL_ERROR, pdp, "Cannot find/free IP Pool 
member\n");
}

-   if (apn->cfg.gtpu_mode == APN_GTPU_MODE_KERNEL_GTP) {
+   if (apn && apn->cfg.gtpu_mode == APN_GTPU_MODE_KERNEL_GTP) {
if (gtp_kernel_tunnel_del(pdp, apn->tun.cfg.dev_name)) {
LOGPPDP(LOGL_ERROR, pdp, "Cannot delete tunnel from 
kernel:%s\n",
strerror(errno));
diff --git a/gtp/gtp.c b/gtp/gtp.c
index 799f8a7..f0318f7 100644
--- a/gtp/gtp.c
+++ b/gtp/gtp.c
@@ -1301,9 +1301,8 @@
/* Now send off a reply to the peer */
gtp_create_pdp_resp(gsn, pdp->version, pdp, cause);

-   if (cause != GTPCAUSE_ACC_REQ) {
-   pdp_freepdp(pdp);
-   }
+   if (cause != GTPCAUSE_ACC_REQ)
+   gtp_freepdp(gsn, pdp);

return 0;
 }

--
To view, visit https://gerrit.osmocom.org/c/osmo-ggsn/+/15259
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-ggsn
Gerrit-Branch: master
Gerrit-Change-Id: I6c6215a4ce478afabc78ffaf5ffb0cf829e41226
Gerrit-Change-Number: 15259
Gerrit-PatchSet: 2
Gerrit-Owner: pespin 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: keith 
Gerrit-Reviewer: laforge 
Gerrit-Reviewer: lynxis lazus 
Gerrit-Reviewer: osmith 
Gerrit-Reviewer: pespin 
Gerrit-MessageType: merged


Change in ...osmo-ggsn[master]: libgtp: Remove packets in tx queue belonging pdp being freed

2019-08-27 Thread laforge
laforge has posted comments on this change. ( 
https://gerrit.osmocom.org/c/osmo-ggsn/+/15228 )

Change subject: libgtp: Remove packets in tx queue belonging pdp being freed
..


Patch Set 5: Code-Review+2


--
To view, visit https://gerrit.osmocom.org/c/osmo-ggsn/+/15228
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-ggsn
Gerrit-Branch: master
Gerrit-Change-Id: Id86d0b241454d3ad49c64c28087fd2710fa2d17a
Gerrit-Change-Number: 15228
Gerrit-PatchSet: 5
Gerrit-Owner: pespin 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: keith 
Gerrit-Reviewer: laforge 
Gerrit-Reviewer: lynxis lazus 
Gerrit-Reviewer: osmith 
Gerrit-Reviewer: pespin 
Gerrit-Comment-Date: Tue, 27 Aug 2019 12:11:19 +
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment


Change in ...osmo-trx[master]: Transceiver: exit process when BTS drops connection

2019-08-27 Thread laforge
laforge has posted comments on this change. ( 
https://gerrit.osmocom.org/c/osmo-trx/+/15289 )

Change subject: Transceiver: exit process when BTS drops connection
..


Patch Set 3: Code-Review+2


--
To view, visit https://gerrit.osmocom.org/c/osmo-trx/+/15289
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-trx
Gerrit-Branch: master
Gerrit-Change-Id: I2ccbe3c17b39fb792ea7810f840235c348054d66
Gerrit-Change-Number: 15289
Gerrit-PatchSet: 3
Gerrit-Owner: pespin 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria 
Gerrit-Reviewer: laforge 
Gerrit-Reviewer: pespin 
Gerrit-Comment-Date: Tue, 27 Aug 2019 12:10:57 +
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment


Change in ...osmo-bsc[master]: lchan_select.c: tune log level in lchan_select_by_type()

2019-08-27 Thread laforge
laforge has submitted this change and it was merged. ( 
https://gerrit.osmocom.org/c/osmo-bsc/+/15276 )

Change subject: lchan_select.c: tune log level in lchan_select_by_type()
..

lchan_select.c: tune log level in lchan_select_by_type()

If lchan_select_by_type() fails to find a suitable logical channel,
it would print a message using LOGL_ERROR. This can happen if all
logical channels of the requested type are busy, thus it is not a
error. Let's use LOGL_NOTICE for that.

Change-Id: I9b45852116253e5237b779a91bed8b800758360e
---
M src/osmo-bsc/lchan_select.c
1 file changed, 1 insertion(+), 1 deletion(-)

Approvals:
  Jenkins Builder: Verified
  laforge: Looks good to me, approved
  pespin: Looks good to me, but someone else must approve



diff --git a/src/osmo-bsc/lchan_select.c b/src/osmo-bsc/lchan_select.c
index 6df3b4a..d63db22 100644
--- a/src/osmo-bsc/lchan_select.c
+++ b/src/osmo-bsc/lchan_select.c
@@ -234,7 +234,7 @@
lchan->type = type;
LOG_LCHAN(lchan, LOGL_INFO, "Selected\n");
} else
-   LOG_BTS(bts, DRLL, LOGL_ERROR, "Failed to select %s channel\n",
+   LOG_BTS(bts, DRLL, LOGL_NOTICE, "Failed to select %s channel\n",
gsm_lchant_name(type));
 
return lchan;

--
To view, visit https://gerrit.osmocom.org/c/osmo-bsc/+/15276
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-bsc
Gerrit-Branch: master
Gerrit-Change-Id: I9b45852116253e5237b779a91bed8b800758360e
Gerrit-Change-Number: 15276
Gerrit-PatchSet: 2
Gerrit-Owner: fixeria 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge 
Gerrit-Reviewer: pespin 
Gerrit-MessageType: merged


Change in ...osmo-msc[master]: smpp_openbsc.c: check acl before deref it

2019-08-27 Thread laforge
laforge has submitted this change and it was merged. ( 
https://gerrit.osmocom.org/c/osmo-msc/+/15285 )

Change subject: smpp_openbsc.c: check acl before deref it
..

smpp_openbsc.c: check acl before deref it

All other calls check acl before deref because in a setup
with no access policy, there won't be any acl structure

Change-Id: Ibe0256535b40351594d79baa05a0147a9f89dc26
---
M src/libmsc/smpp_openbsc.c
1 file changed, 1 insertion(+), 1 deletion(-)

Approvals:
  Jenkins Builder: Verified
  fixeria: Looks good to me, but someone else must approve
  pespin: Looks good to me, approved



diff --git a/src/libmsc/smpp_openbsc.c b/src/libmsc/smpp_openbsc.c
index bbfc500..e4c3891 100644
--- a/src/libmsc/smpp_openbsc.c
+++ b/src/libmsc/smpp_openbsc.c
@@ -326,7 +326,7 @@
"ESME is not (yet) bound, skipping alert\n");
continue;
}
-   if (!esme->acl->alert_notifications) {
+   if (esme->acl && !esme->acl->alert_notifications) {
LOGP(DSMPP, LOGL_DEBUG,
"[%s] is not set to receive Alert 
Notifications\n",
esme->system_id);

--
To view, visit https://gerrit.osmocom.org/c/osmo-msc/+/15285
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-msc
Gerrit-Branch: master
Gerrit-Change-Id: Ibe0256535b40351594d79baa05a0147a9f89dc26
Gerrit-Change-Number: 15285
Gerrit-PatchSet: 1
Gerrit-Owner: lynxis lazus 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria 
Gerrit-Reviewer: laforge 
Gerrit-Reviewer: pespin 
Gerrit-MessageType: merged


Change in ...osmo-trx[master]: lms: Log available antennas if requested antenna fails

2019-08-27 Thread laforge
laforge has submitted this change and it was merged. ( 
https://gerrit.osmocom.org/c/osmo-trx/+/15292 )

Change subject: lms: Log available antennas if requested antenna fails
..

lms: Log available antennas if requested antenna fails

Related: OS#3343
Change-Id: Icd328e85b0a75ef67f371a7ed72638053b1854f9
---
M Transceiver52M/device/lms/LMSDevice.cpp
M Transceiver52M/device/lms/LMSDevice.h
2 files changed, 23 insertions(+), 2 deletions(-)

Approvals:
  fixeria: Looks good to me, but someone else must approve
  laforge: Looks good to me, approved
  Jenkins Builder: Verified



diff --git a/Transceiver52M/device/lms/LMSDevice.cpp 
b/Transceiver52M/device/lms/LMSDevice.cpp
index f55b555..b7cb31d 100644
--- a/Transceiver52M/device/lms/LMSDevice.cpp
+++ b/Transceiver52M/device/lms/LMSDevice.cpp
@@ -431,6 +431,20 @@
return dB;
 }

+void LMSDevice::log_ant_list(bool dir_tx, size_t chan, std::ostringstream& os)
+{
+   lms_name_t name_list[MAX_ANTENNA_LIST_SIZE]; /* large enough list for 
antenna names. */
+   int num_names;
+   int i;
+
+   num_names = LMS_GetAntennaList(m_lms_dev, dir_tx, chan, name_list);
+   for (i = 0; i < num_names; i++) {
+   if (i)
+   os << ", ";
+   os << "'" << name_list[i] << "'";
+   }
+}
+
 int LMSDevice::get_ant_idx(const std::string & name, bool dir_tx, size_t chan)
 {
lms_name_t name_list[MAX_ANTENNA_LIST_SIZE]; /* large enough list for 
antenna names. */
@@ -484,7 +498,10 @@

idx = get_ant_idx(ant, LMS_CH_RX, chan);
if (idx < 0) {
-   LOGCHAN(chan, DDEV, ERROR) << "Invalid Rx Antenna";
+   std::ostringstream os;
+   LOGCHAN(chan, DDEV, ERROR) << "Invalid Rx Antenna: " << ant;
+   log_ant_list(LMS_CH_RX, chan, os);
+   LOGCHAN(chan, DDEV, NOTICE) << "Available Rx Antennas: " << os;
return false;
}

@@ -530,7 +547,10 @@

idx = get_ant_idx(ant, LMS_CH_TX, chan);
if (idx < 0) {
-   LOGCHAN(chan, DDEV, ERROR) << "Invalid Rx Antenna";
+   std::ostringstream os;
+   LOGCHAN(chan, DDEV, ERROR) << "Invalid Tx Antenna: " << ant;
+   log_ant_list(LMS_CH_TX, chan, os);
+   LOGCHAN(chan, DDEV, NOTICE) << "Available Tx Antennas: " << os;
return false;
}

diff --git a/Transceiver52M/device/lms/LMSDevice.h 
b/Transceiver52M/device/lms/LMSDevice.h
index 47bac94..ab45b08 100644
--- a/Transceiver52M/device/lms/LMSDevice.h
+++ b/Transceiver52M/device/lms/LMSDevice.h
@@ -63,6 +63,7 @@

bool do_calib(size_t chan);
bool do_filters(size_t chan);
+   void log_ant_list(bool dir_tx, size_t chan, std::ostringstream& os);
int get_ant_idx(const std::string & name, bool dir_tx, size_t chan);
bool flush_recv(size_t num_pkts);
void update_stream_stats_rx(size_t chan, bool *overrun);

--
To view, visit https://gerrit.osmocom.org/c/osmo-trx/+/15292
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-trx
Gerrit-Branch: master
Gerrit-Change-Id: Icd328e85b0a75ef67f371a7ed72638053b1854f9
Gerrit-Change-Number: 15292
Gerrit-PatchSet: 2
Gerrit-Owner: pespin 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria 
Gerrit-Reviewer: laforge 
Gerrit-MessageType: merged


Change in ...osmo-trx[master]: Transceiver: exit process when BTS drops connection

2019-08-27 Thread laforge
laforge has submitted this change and it was merged. ( 
https://gerrit.osmocom.org/c/osmo-trx/+/15289 )

Change subject: Transceiver: exit process when BTS drops connection
..

Transceiver: exit process when BTS drops connection

We don't want to keep osmo-trx running in a started state once the BTS
controlling it becomes unavailable. If a socket towards the BTS fails,
it means the BTS is gone and the best thing to do is to stop the process
(alternatively we could go back to stopped state instead, and wait for
BTS to re-connect, fur so far this action is good enough).

Related: OS#4170
Change-Id: I2ccbe3c17b39fb792ea7810f840235c348054d66
---
M Transceiver52M/Transceiver.cpp
M Transceiver52M/Transceiver.h
2 files changed, 54 insertions(+), 31 deletions(-)

Approvals:
  Jenkins Builder: Verified
  laforge: Looks good to me, approved



diff --git a/Transceiver52M/Transceiver.cpp b/Transceiver52M/Transceiver.cpp
index 9a1c446..23aabdd 100644
--- a/Transceiver52M/Transceiver.cpp
+++ b/Transceiver52M/Transceiver.cpp
@@ -750,7 +750,7 @@
   return true;
 }

-void Transceiver::driveControl(size_t chan)
+bool Transceiver::driveControl(size_t chan)
 {
   char buffer[MAX_PACKET_LENGTH + 1];
   char response[MAX_PACKET_LENGTH + 1];
@@ -761,7 +761,7 @@
   msgLen = read(mCtrlSockets[chan], buffer, MAX_PACKET_LENGTH);
   if (msgLen <= 0) {
 LOGCHAN(chan, DTRXCTRL, WARNING) << "mCtrlSockets read(" << 
mCtrlSockets[chan] << ") failed: " << msgLen;
-return;
+return false;
   }

   /* Zero-terminate received string */
@@ -770,7 +770,7 @@
   /* Verify a command signature */
   if (strncmp(buffer, "CMD ", 4)) {
 LOGC(DTRXCTRL, WARNING) << "bogus message on control interface";
-return;
+return false;
   }

   /* Set command pointer */
@@ -889,7 +889,7 @@
 if ((timeslot < 0) || (timeslot > 7)) {
   LOGC(DTRXCTRL, WARNING) << "bogus message on control interface";
   sprintf(response,"RSP SETSLOT 1 %d %d",timeslot,corrCode);
-  return;
+  return true;
 }
 mStates[chan].chanType[timeslot] = (ChannelCombination) corrCode;
 setModulus(timeslot, chan);
@@ -922,8 +922,11 @@

   LOGCHAN(chan, DTRXCTRL, INFO) << "response is '" << response << "'";
   msgLen = write(mCtrlSockets[chan], response, strlen(response) + 1);
-  if (msgLen <= 0)
+  if (msgLen <= 0) {
 LOGCHAN(chan, DTRXCTRL, WARNING) << "mCtrlSockets write(" << 
mCtrlSockets[chan] << ") failed: " << msgLen;
+return false;
+  }
+  return true;
 }

 bool Transceiver::driveTxPriorityQueue(size_t chan)
@@ -990,18 +993,21 @@
   return true;
 }

-void Transceiver::driveReceiveRadio()
+bool Transceiver::driveReceiveRadio()
 {
   int rc = mRadioInterface->driveReceiveRadio();
   if (rc == 0) {
 usleep(10);
-  } else if (rc < 0) {
-LOG(FATAL) << "radio Interface receive failed, requesting stop.";
-osmo_signal_dispatch(SS_MAIN, S_MAIN_STOP_REQUIRED, NULL);
-  } else if (mForceClockInterface || mTransmitDeadlineClock > 
mLastClockUpdateTime + GSM::Time(216,0)) {
-mForceClockInterface = false;
-writeClockInterface();
+return true;
   }
+  if (rc < 0)
+return false;
+
+  if (mForceClockInterface || mTransmitDeadlineClock > mLastClockUpdateTime + 
GSM::Time(216,0)) {
+mForceClockInterface = false;
+return writeClockInterface();
+  }
+  return true;
 }

 void Transceiver::logRxBurst(size_t chan, const struct trx_ul_burst_ind *bi)
@@ -1026,22 +1032,21 @@
 << " bits: "   << os;
 }

-void Transceiver::driveReceiveFIFO(size_t chan)
+bool Transceiver::driveReceiveFIFO(size_t chan)
 {
   struct trx_ul_burst_ind bi;

   if (!pullRadioVector(chan, ))
-return;
+return false;
+
   if (!bi.idle)
-   logRxBurst(chan, );
+logRxBurst(chan, );

   switch (mVersionTRXD[chan]) {
 case 0:
-  trxd_send_burst_ind_v0(chan, mDataSockets[chan], );
-  break;
+  return trxd_send_burst_ind_v0(chan, mDataSockets[chan], );
 case 1:
-  trxd_send_burst_ind_v1(chan, mDataSockets[chan], );
-  break;
+  return trxd_send_burst_ind_v1(chan, mDataSockets[chan], );
 default:
   OSMO_ASSERT(false);
   }
@@ -1102,7 +1107,7 @@



-void Transceiver::writeClockInterface()
+bool Transceiver::writeClockInterface()
 {
   int msgLen;
   char command[50];
@@ -1112,11 +1117,13 @@
   LOG(INFO) << "ClockInterface: sending " << command;

   msgLen = write(mClockSocket, command, strlen(command) + 1);
-  if (msgLen <= 0)
-LOG(WARNING) << "mClockSocket write(" << mClockSocket << ") failed: " << 
msgLen;
+  if (msgLen <= 0) {
+LOG(ERROR) << "mClockSocket write(" << mClockSocket << ") failed: " << 
msgLen;
+return false;
+  }

   mLastClockUpdateTime = mTransmitDeadlineClock;
-
+  return true;
 }

 void *RxUpperLoopAdapter(TrxChanThParams *params)
@@ -1131,7 +1138,11 @@
   set_selfthread_name(thread_name);

   while (1) {
-trx->driveReceiveFIFO(num);
+if (!trx->driveReceiveFIFO(num)) {
+  

Change in ...osmo-trx[master]: device: Use LOGCHAN in set_antennas()

2019-08-27 Thread laforge
laforge has submitted this change and it was merged. ( 
https://gerrit.osmocom.org/c/osmo-trx/+/15293 )

Change subject: device: Use LOGCHAN in set_antennas()
..

device: Use LOGCHAN in set_antennas()

Change-Id: I3099498e3a3f26b53d55a96a36cc056f7b25b27a
---
M Transceiver52M/device/common/radioDevice.h
1 file changed, 4 insertions(+), 4 deletions(-)

Approvals:
  fixeria: Looks good to me, but someone else must approve
  laforge: Looks good to me, approved
  Jenkins Builder: Verified



diff --git a/Transceiver52M/device/common/radioDevice.h 
b/Transceiver52M/device/common/radioDevice.h
index e637611..b4928f2 100644
--- a/Transceiver52M/device/common/radioDevice.h
+++ b/Transceiver52M/device/common/radioDevice.h
@@ -187,9 +187,9 @@
for (i = 0; i < tx_paths.size(); i++) {
if (tx_paths[i] == "")
continue;
-   LOG(DEBUG) << "Configuring channel " << i << " with antenna " 
<< tx_paths[i];
+   LOGCHAN(i, DDEV, DEBUG) << "Configuring Tx antenna " << 
tx_paths[i];
if (!setTxAntenna(tx_paths[i], i)) {
-   LOG(ALERT) << "Failed configuring channel " << i << " 
with antenna " << tx_paths[i];
+   LOGCHAN(i, DDEV, ALERT) << "Failed configuring Tx 
antenna " << tx_paths[i];
return false;
}
}
@@ -197,9 +197,9 @@
for (i = 0; i < rx_paths.size(); i++) {
if (rx_paths[i] == "")
continue;
-   LOG(DEBUG) << "Configuring channel " << i << " with antenna " 
<< rx_paths[i];
+   LOGCHAN(i, DDEV, DEBUG) << "Configuring Rx antenna " << 
rx_paths[i];
if (!setRxAntenna(rx_paths[i], i)) {
-   LOG(ALERT) << "Failed configuring channel " << i << " 
with antenna " << rx_paths[i];
+   LOGCHAN(i, DDEV, ALERT) << "Failed configuring Rx 
antenna " << rx_paths[i];
return false;
}
}

--
To view, visit https://gerrit.osmocom.org/c/osmo-trx/+/15293
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-trx
Gerrit-Branch: master
Gerrit-Change-Id: I3099498e3a3f26b53d55a96a36cc056f7b25b27a
Gerrit-Change-Number: 15293
Gerrit-PatchSet: 2
Gerrit-Owner: pespin 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria 
Gerrit-Reviewer: laforge 
Gerrit-MessageType: merged


Change in ...osmo-trx[master]: Transceiver: Enable EDGE detection only on PDCH timeslots

2019-08-27 Thread laforge
laforge has submitted this change and it was merged. ( 
https://gerrit.osmocom.org/c/osmo-trx/+/15291 )

Change subject: Transceiver: Enable EDGE detection only on PDCH timeslots
..

Transceiver: Enable EDGE detection only on PDCH timeslots

Related: OS#3664
Change-Id: Id16248a1c03f9bc9f323c707857cdf3bf34c4e3e
---
M Transceiver52M/Transceiver.cpp
1 file changed, 2 insertions(+), 6 deletions(-)

Approvals:
  Jenkins Builder: Verified
  laforge: Looks good to me, approved



diff --git a/Transceiver52M/Transceiver.cpp b/Transceiver52M/Transceiver.cpp
index 23aabdd..590101c 100644
--- a/Transceiver52M/Transceiver.cpp
+++ b/Transceiver52M/Transceiver.cpp
@@ -558,8 +558,8 @@
   return mExtRACH ? EXT_RACH : RACH;
 else if ((mod52 == 25) || (mod52 == 51))
   return IDLE;
-else
-  return TSC;
+else /* Enable 8-PSK burst detection if EDGE is enabled */
+  return mEdge ? EDGE : TSC;
 break;
   }
   case LOOPBACK:
@@ -610,10 +610,6 @@
   burstTime = radio_burst->getTime();
   CorrType type = expectedCorrType(burstTime, chan);

-  /* Enable 8-PSK burst detection if EDGE is enabled */
-  if (mEdge && (type == TSC))
-type = EDGE;
-
   /* Debug: dump bursts to disk */
   /* bits 0-7  - chan 0 timeslots
* bits 8-15 - chan 1 timeslots */

--
To view, visit https://gerrit.osmocom.org/c/osmo-trx/+/15291
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-trx
Gerrit-Branch: master
Gerrit-Change-Id: Id16248a1c03f9bc9f323c707857cdf3bf34c4e3e
Gerrit-Change-Number: 15291
Gerrit-PatchSet: 1
Gerrit-Owner: pespin 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge 
Gerrit-Reviewer: pespin 
Gerrit-CC: fixeria 
Gerrit-MessageType: merged


Change in ...osmo-bsc[master]: abis_nm.c: use LOGP() macro instead of LOGPC()

2019-08-27 Thread laforge
laforge has posted comments on this change. ( 
https://gerrit.osmocom.org/c/osmo-bsc/+/15277 )

Change subject: abis_nm.c: use LOGP() macro instead of LOGPC()
..


Patch Set 1:

(1 comment)

https://gerrit.osmocom.org/#/c/15277/1/src/osmo-bsc/abis_nm.c
File src/osmo-bsc/abis_nm.c:

https://gerrit.osmocom.org/#/c/15277/1/src/osmo-bsc/abis_nm.c@344
PS1, Line 344:  LOGP(DNM, LOGL_NOTICE, "BTS %u reported 
connected PCU version %s\n", bts->nr, text);
> This is an idea for a separate change. Unfortunately there is no such macro. 
> And... […]
LOGPFOH exists, probably only in osmo-bts.  I agree it's sufficient to print 
the BTS number here.



--
To view, visit https://gerrit.osmocom.org/c/osmo-bsc/+/15277
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-bsc
Gerrit-Branch: master
Gerrit-Change-Id: I868633ad3e50f2cb3ebfb2c566d16c4710f17563
Gerrit-Change-Number: 15277
Gerrit-PatchSet: 1
Gerrit-Owner: fixeria 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria 
Gerrit-Reviewer: laforge 
Gerrit-Reviewer: pespin 
Gerrit-Comment-Date: Tue, 27 Aug 2019 12:10:40 +
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: fixeria 
Comment-In-Reply-To: pespin 
Gerrit-MessageType: comment


Change in ...osmo-bsc[master]: abis_nm.c: use LOGP() macro instead of LOGPC()

2019-08-27 Thread laforge
laforge has submitted this change and it was merged. ( 
https://gerrit.osmocom.org/c/osmo-bsc/+/15277 )

Change subject: abis_nm.c: use LOGP() macro instead of LOGPC()
..

abis_nm.c: use LOGP() macro instead of LOGPC()

The LOGPC() is usually used for continuation when printing complex
logging messages (e.g. where using format string is not enough).
In this case, nothing is being printed before calling LOGPC(), so
the logging messages appear without the meta info (time-stamp,
level, category, etc.), for example:

  BTS 0 reported connected PCU version 0.7.0.1-2585-dirty

Change-Id: I868633ad3e50f2cb3ebfb2c566d16c4710f17563
---
M src/osmo-bsc/abis_nm.c
1 file changed, 3 insertions(+), 3 deletions(-)

Approvals:
  pespin: Looks good to me, approved
  laforge: Looks good to me, approved
  Jenkins Builder: Verified



diff --git a/src/osmo-bsc/abis_nm.c b/src/osmo-bsc/abis_nm.c
index 7d059b5..48e9183 100644
--- a/src/osmo-bsc/abis_nm.c
+++ b/src/osmo-bsc/abis_nm.c
@@ -311,7 +311,7 @@
enum abis_nm_pcause_type pcause = p_val[0];
enum abis_mm_event_causes cause = osmo_load16be(p_val + 1);

-   LOGPC(DNM, LOGL_ERROR, "BTS %u: Failure Event Report: ", bts->nr);
+   LOGP(DNM, LOGL_ERROR, "BTS %u: Failure Event Report: ", bts->nr);
if (type)
LOGPC(DNM, LOGL_ERROR, "Type=%s, ", type);
if (severity)
@@ -341,10 +341,10 @@
switch (cause) {
case OSMO_EVT_PCU_VERS:
if (text) {
-   LOGPC(DNM, LOGL_NOTICE, "BTS %u reported connected PCU 
version %s\n", bts->nr, text);
+   LOGP(DNM, LOGL_NOTICE, "BTS %u reported connected PCU 
version %s\n", bts->nr, text);
osmo_strlcpy(bts->pcu_version, text, 
sizeof(bts->pcu_version));
} else {
-   LOGPC(DNM, LOGL_ERROR, "BTS %u reported PCU 
disconnection.\n", bts->nr);
+   LOGP(DNM, LOGL_ERROR, "BTS %u reported PCU 
disconnection.\n", bts->nr);
bts->pcu_version[0] = '\0';
}
break;

--
To view, visit https://gerrit.osmocom.org/c/osmo-bsc/+/15277
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-bsc
Gerrit-Branch: master
Gerrit-Change-Id: I868633ad3e50f2cb3ebfb2c566d16c4710f17563
Gerrit-Change-Number: 15277
Gerrit-PatchSet: 2
Gerrit-Owner: fixeria 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria 
Gerrit-Reviewer: laforge 
Gerrit-Reviewer: pespin 
Gerrit-MessageType: merged


Change in ...osmo-bsc[master]: abis_nm.c: use LOGP() macro instead of LOGPC()

2019-08-27 Thread laforge
laforge has posted comments on this change. ( 
https://gerrit.osmocom.org/c/osmo-bsc/+/15277 )

Change subject: abis_nm.c: use LOGP() macro instead of LOGPC()
..


Patch Set 2: Code-Review+2


--
To view, visit https://gerrit.osmocom.org/c/osmo-bsc/+/15277
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-bsc
Gerrit-Branch: master
Gerrit-Change-Id: I868633ad3e50f2cb3ebfb2c566d16c4710f17563
Gerrit-Change-Number: 15277
Gerrit-PatchSet: 2
Gerrit-Owner: fixeria 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria 
Gerrit-Reviewer: laforge 
Gerrit-Reviewer: pespin 
Gerrit-Comment-Date: Tue, 27 Aug 2019 12:10:07 +
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment


Change in ...osmocom-bb[master]: fw: Add support for Huawei GTM900-B modules

2019-08-27 Thread laforge
laforge has submitted this change and it was merged. ( 
https://gerrit.osmocom.org/c/osmocom-bb/+/15152 )

Change subject: fw: Add support for Huawei GTM900-B modules
..

fw: Add support for Huawei GTM900-B modules

Both MG01GSMT and MG01GSMT hardware variants are
supported and automatically detected based on the
flash manufacturer.

Change-Id: I3a770ea93fc72c4e9b63078e253602f204b5be23
---
M src/target/firmware/Makefile
A src/target/firmware/board/gtm900b/init.c
A src/target/firmware/board/gtm900b/keymap.h
A src/target/firmware/board/gtm900b/rf_power.c
A src/target/firmware/board/gtm900b/rffe_gtm900b.c
5 files changed, 464 insertions(+), 1 deletion(-)

Approvals:
  Jenkins Builder: Verified
  laforge: Looks good to me, approved



diff --git a/src/target/firmware/Makefile b/src/target/firmware/Makefile
index 2f44a20..f7235ac 100644
--- a/src/target/firmware/Makefile
+++ b/src/target/firmware/Makefile
@@ -24,7 +24,7 @@
 #

 # List of all supported boards (meant to be overridden on command line)
-BOARDS?=compal_e88 compal_e86 compal_e99 se_j100 gta0x fcdev3b pirelli_dpl10
+BOARDS?=compal_e88 compal_e86 compal_e99 se_j100 gta0x gtm900b fcdev3b 
pirelli_dpl10

 # Framebuffer support, board specific drivers
 FB_OBJS=fb/framebuffer.o fb/font.o fb/helvR08.o fb/helvB14.o fb/c64.o \
@@ -46,6 +46,12 @@
battery/dummy.o $(FB_dummy_OBJS)
 BOARD_gta0x_ENVIRONMENTS=highram

+# Huawei GTM900-B
+BOARD_gtm900b_OBJS=$(calypso_COMMON_OBJS) board/gtm900b/init.o \
+   board/gtm900b/rffe_gtm900b.o board/gtm900b/rf_power.o \
+   battery/dummy.o $(FB_dummy_OBJS)
+BOARD_gtm900b_ENVIRONMENTS=highram
+
 # FreeCalypso FCDEV3B
 BOARD_fcdev3b_OBJS=$(calypso_COMMON_OBJS) board/fcdev3b/init.o \
board/gta0x/rffe_gta0x_triband.o board/gta0x/rf_power.o \
diff --git a/src/target/firmware/board/gtm900b/init.c 
b/src/target/firmware/board/gtm900b/init.c
new file mode 100644
index 000..38ede10
--- /dev/null
+++ b/src/target/firmware/board/gtm900b/init.c
@@ -0,0 +1,140 @@
+/* Initialization for the Huawei GTM900-B modem */
+
+/* (C) 2010 by Harald Welte 
+ * (C) 2010-19 by Steve Markgraf 
+ *
+ * All Rights Reserved
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ */
+
+#include 
+#include 
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+
+#include 
+#include 
+#include "keymap.h"
+
+#define ARMIO_LATCH_OUT 0xfffe4802
+#define IO_CNTL_REG0xfffe4804
+#define ASIC_CONF_REG  0xfffef008
+#define IO_CONF_REG0xfffef00a
+#define LPG_LCR_REG0xfffe7800
+#define LPG_PM_REG 0xfffe7801
+
+static void board_io_init(void)
+{
+   uint16_t reg;
+
+   reg = readw(ASIC_CONF_REG);
+   /* Set LPG pin mux for power LED */
+   reg |= (1 << 6);
+   /* TWL3025: Set SPI+RIF RX clock to rising edge */
+   reg |= (1 << 13) | (1 << 14);
+   writew(reg, ASIC_CONF_REG);
+
+   /*
+* Most Calypso peripheral interface signals are unconnected
+* on this modem.  We configure them to be GPIOs in IO_CONF_REG,
+* then configure them to be outputs in IO_CNTL_REG, then set
+* the outputs to 0 in ARMIO_LATCH_OUT.
+*/
+   writew(0x03F5, IO_CONF_REG);
+   writew(0xC000, IO_CNTL_REG);
+   writew(0x, ARMIO_LATCH_OUT);
+
+   /* Set LPG output permanently on (power LED) */
+   writew(1, LPG_PM_REG);
+   writew((1 << 7), LPG_LCR_REG);
+}
+
+void board_init(int with_irq)
+{
+   /* Configure the memory interface */
+   calypso_mem_cfg(CALYPSO_nCS0, 3, CALYPSO_MEM_16bit, 1);
+   calypso_mem_cfg(CALYPSO_nCS1, 3, CALYPSO_MEM_16bit, 1);
+   calypso_mem_cfg(CALYPSO_nCS2, 5, CALYPSO_MEM_16bit, 1);
+   calypso_mem_cfg(CALYPSO_nCS3, 5, CALYPSO_MEM_16bit, 1);
+   calypso_mem_cfg(CALYPSO_CS4, 0, CALYPSO_MEM_8bit, 1);
+   calypso_mem_cfg(CALYPSO_nCS6, 0, CALYPSO_MEM_32bit, 1);
+   calypso_mem_cfg(CALYPSO_nCS7, 0, CALYPSO_MEM_32bit, 0);
+
+   /* Set VTCXO_DIV2 = 1, configure PLL for 104 MHz and give ARM half of 
that */
+   calypso_clock_set(2, CALYPSO_PLL13_104_MHZ, ARM_MCLK_DIV_2);
+
+   /* Configure the RHEA bridge with some sane 

Change in ...osmo-bsc[master]: lchan_select.c: tune log level in lchan_select_by_type()

2019-08-27 Thread laforge
laforge has posted comments on this change. ( 
https://gerrit.osmocom.org/c/osmo-bsc/+/15276 )

Change subject: lchan_select.c: tune log level in lchan_select_by_type()
..


Patch Set 2: Code-Review+2


--
To view, visit https://gerrit.osmocom.org/c/osmo-bsc/+/15276
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-bsc
Gerrit-Branch: master
Gerrit-Change-Id: I9b45852116253e5237b779a91bed8b800758360e
Gerrit-Change-Number: 15276
Gerrit-PatchSet: 2
Gerrit-Owner: fixeria 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge 
Gerrit-Reviewer: pespin 
Gerrit-Comment-Date: Tue, 27 Aug 2019 12:08:43 +
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment


Change in ...osmocom-bb[master]: fw/flash: Read extended ID, expose API

2019-08-27 Thread laforge
laforge has posted comments on this change. ( 
https://gerrit.osmocom.org/c/osmocom-bb/+/15151 )

Change subject: fw/flash: Read extended ID, expose API
..


Patch Set 1: Code-Review+2


--
To view, visit https://gerrit.osmocom.org/c/osmocom-bb/+/15151
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmocom-bb
Gerrit-Branch: master
Gerrit-Change-Id: I3bcd71c84c8931bcd574953063737b51a41738a3
Gerrit-Change-Number: 15151
Gerrit-PatchSet: 1
Gerrit-Owner: steve-m 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge 
Gerrit-Comment-Date: Tue, 27 Aug 2019 12:08:02 +
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment


Change in ...osmocom-bb[master]: fw/abb/twl3025: Add function to query PWON state

2019-08-27 Thread laforge
laforge has submitted this change and it was merged. ( 
https://gerrit.osmocom.org/c/osmocom-bb/+/15149 )

Change subject: fw/abb/twl3025: Add function to query PWON state
..

fw/abb/twl3025: Add function to query PWON state

This allows us to detect power button presses on the Pirelli
DP-L10 and the Huawei GTM900-B module. Polling will only be
activated once the power button has been pressed and we received
the interrupt. The goal is to reduce the required amount of
TWL3025 register accesses to a minimum.

Change-Id: I31be61c8089173aed616abd1ede6c4cf5c9b6770
---
M src/target/firmware/abb/twl3025.c
M src/target/firmware/include/abb/twl3025.h
2 files changed, 30 insertions(+), 0 deletions(-)

Approvals:
  Jenkins Builder: Verified
  laforge: Looks good to me, approved



diff --git a/src/target/firmware/abb/twl3025.c 
b/src/target/firmware/abb/twl3025.c
index e4fcf4f..ad2b01f 100644
--- a/src/target/firmware/abb/twl3025.c
+++ b/src/target/firmware/abb/twl3025.c
@@ -60,8 +60,15 @@
ABB_RAMP_VAL( 0,  0),
 };

+typedef enum pwon_state {
+   PWON_IDLE,
+   PWON_DETECTED,
+   PWON_REPORTED,
+} pwon_state_t;
+
 struct twl3025 {
uint8_t page;
+   pwon_state_t pwon;
 };
 static struct twl3025 twl3025_state;

@@ -106,6 +113,8 @@
case IRQ_EXTERNAL: // charger in/out, pwrbtn, adc done
src = twl3025_reg_read(ITSTATREG);
 // printd("itstatreg 0x%02x\n", src);
+   if ((src & 0x04) && twl3025_state.pwon == PWON_IDLE)
+   twl3025_state.pwon = PWON_DETECTED;
if (src & 0x08)
handle_charger();
if (src & 0x20)
@@ -127,6 +136,7 @@
twl3025_clk13m(1);
twl3025_reg_write(AFCCTLADD, 0x01); /* AFCCK(1:0) must not be zero! 
*/
twl3025_unit_enable(TWL3025_UNIT_AFC, 1);
+   twl3025_state.pwon = PWON_IDLE;

irq_register_handler(IRQ_EXTERNAL, _irq);
irq_config(IRQ_EXTERNAL, 0, 0, 0);
@@ -185,6 +195,24 @@
delay_ms(1);
 }

+int twl3025_get_pwon(void)
+{
+   switch (twl3025_state.pwon) {
+   case PWON_DETECTED:
+   twl3025_state.pwon = PWON_REPORTED;
+   break;
+   case PWON_REPORTED:
+   if (twl3025_reg_read(VRPCSTS) & 0x10)
+   twl3025_state.pwon = PWON_IDLE;
+   break;
+   case PWON_IDLE:
+   default:
+   break;
+   }
+
+   return (twl3025_state.pwon != PWON_IDLE);
+}
+
 void twl3025_power_off(void)
 {
unsigned long flags;
diff --git a/src/target/firmware/include/abb/twl3025.h 
b/src/target/firmware/include/abb/twl3025.h
index 3640644..938a425 100755
--- a/src/target/firmware/include/abb/twl3025.h
+++ b/src/target/firmware/include/abb/twl3025.h
@@ -144,6 +144,8 @@
 void twl3025_reg_write(uint8_t reg, uint16_t data);
 uint16_t twl3025_reg_read(uint8_t reg);

+int twl3025_get_pwon(void);
+
 void twl3025_power_off(void);

 void twl3025_clk13m(int enable);

--
To view, visit https://gerrit.osmocom.org/c/osmocom-bb/+/15149
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmocom-bb
Gerrit-Branch: master
Gerrit-Change-Id: I31be61c8089173aed616abd1ede6c4cf5c9b6770
Gerrit-Change-Number: 15149
Gerrit-PatchSet: 1
Gerrit-Owner: steve-m 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge 
Gerrit-MessageType: merged


Change in ...osmocom-bb[master]: fw/flash: Read extended ID, expose API

2019-08-27 Thread laforge
laforge has submitted this change and it was merged. ( 
https://gerrit.osmocom.org/c/osmocom-bb/+/15151 )

Change subject: fw/flash: Read extended ID, expose API
..

fw/flash: Read extended ID, expose API

We now unlock the flash before reading the
extended ID (required for Spansion and Samsung
flash chips). These commands will be ignored
by Intel/ST flash chips, and this change has been
verified with all flash chips we support.

Furthermore, expose the API for reading the flash ID.

Change-Id: I3bcd71c84c8931bcd574953063737b51a41738a3
---
M src/target/firmware/flash/cfi_flash.c
M src/target/firmware/include/flash/cfi_flash.h
2 files changed, 36 insertions(+), 14 deletions(-)

Approvals:
  Jenkins Builder: Verified
  laforge: Looks good to me, approved



diff --git a/src/target/firmware/flash/cfi_flash.c 
b/src/target/firmware/flash/cfi_flash.c
index 974165d..2f8cde0 100644
--- a/src/target/firmware/flash/cfi_flash.c
+++ b/src/target/firmware/flash/cfi_flash.c
@@ -69,12 +69,6 @@
struct cfi_region erase_regions[CFI_FLASH_MAX_ERASE_REGIONS];
 } __attribute__ ((packed));

-/* manufacturer ids */
-enum cfi_manuf {
-   CFI_MANUF_ST= 0x0020,
-   CFI_MANUF_INTEL = 0x0089,
-};
-
 /* algorithm ids */
 enum cfi_algo {
CFI_ALGO_INTEL_3 = 0x03
@@ -83,6 +77,7 @@
 /* various command bytes */
 enum cfi_flash_cmd {
CFI_CMD_RESET = 0xff,
+   CFI_CMD_RESET_TO_READ_MODE = 0xF0,
CFI_CMD_READ_ID = 0x90,
CFI_CMD_CFI = 0x98,
CFI_CMD_READ_STATUS = 0x70,
@@ -91,6 +86,8 @@
CFI_CMD_BLOCK_ERASE = 0x20,
CFI_CMD_ERASE_CONFIRM = 0xD0,
CFI_CMD_PROTECT = 0x60,
+   CFI_CMD_UNLOCK1 = 0xAA,
+   CFI_CMD_UNLOCK2 = 0x55,
 };

 /* protection commands */
@@ -104,6 +101,8 @@
 enum flash_offset {
CFI_OFFSET_MANUFACTURER_ID = 0x00,
CFI_OFFSET_DEVICE_ID = 0x01,
+   CFI_OFFSET_EXT_DEVICE_ID1 = 0x0E,
+   CFI_OFFSET_EXT_DEVICE_ID2 = 0x0F,
CFI_OFFSET_INTEL_PROTECTION = 0x81,
CFI_OFFSET_CFI_RESP = 0x10
 };
@@ -125,6 +124,9 @@
CFI_STATUS_RESERVED = 0x01
 };

+#define CFI_CMD_ADDR1  0xAAA
+#define CFI_CMD_ADDR2  0x555
+
 __ramtext
 static inline void flash_write_cmd(const void *base_addr, uint16_t cmd)
 {
@@ -379,17 +381,27 @@
return res;
 }

-/* Internal: retrieve manufacturer and device id from id space */
+/* retrieve manufacturer and extended device id from id space */
 __ramtext
-static int get_id(void *base_addr,
+int flash_get_id(void *base_addr,
  uint16_t * manufacturer_id, uint16_t * device_id)
 {
-   flash_write_cmd(base_addr, CFI_CMD_READ_ID);
+   flash_write_cmd(base_addr, CFI_CMD_RESET_TO_READ_MODE);

-   *manufacturer_id = flash_read16(base_addr, CFI_OFFSET_MANUFACTURER_ID);
-   *device_id = flash_read16(base_addr, CFI_OFFSET_DEVICE_ID);
+   flash_write_cmd(base_addr + CFI_CMD_ADDR1, CFI_CMD_UNLOCK1);
+   flash_write_cmd(base_addr + CFI_CMD_ADDR2, CFI_CMD_UNLOCK2);
+   flash_write_cmd(base_addr + CFI_CMD_ADDR1, CFI_CMD_READ_ID);

-   flash_write_cmd(base_addr, CFI_CMD_RESET);
+   if (manufacturer_id)
+   *manufacturer_id = flash_read16(base_addr, 
CFI_OFFSET_MANUFACTURER_ID);
+
+   if (device_id) {
+   device_id[0] = flash_read16(base_addr, CFI_OFFSET_DEVICE_ID);
+   device_id[1] = flash_read16(base_addr, 
CFI_OFFSET_EXT_DEVICE_ID1);
+   device_id[2] = flash_read16(base_addr, 
CFI_OFFSET_EXT_DEVICE_ID2);
+   }
+
+   flash_write_cmd(base_addr, CFI_CMD_RESET_TO_READ_MODE);

return 0;
 }
@@ -524,12 +536,12 @@
 {
int res;
unsigned u;
-   uint16_t m_id, d_id;
+   uint16_t m_id, d_id[3];
uint32_t base;
struct cfi_query qry;

/* retrieve and check manufacturer and device id */
-   res = get_id(base_addr, _id, _id);
+   res = flash_get_id(base_addr, _id, d_id);
if (res) {
return res;
}
diff --git a/src/target/firmware/include/flash/cfi_flash.h 
b/src/target/firmware/include/flash/cfi_flash.h
index 9d8b33a..8589fb6 100644
--- a/src/target/firmware/include/flash/cfi_flash.h
+++ b/src/target/firmware/include/flash/cfi_flash.h
@@ -26,6 +26,14 @@
FLASH_LOCKED_DOWN
 } flash_lock_t;

+/* manufacturer ids */
+enum cfi_manuf {
+   CFI_MANUF_ST   = 0x0020,
+   CFI_MANUF_INTEL= 0x0089,
+   CFI_MANUF_SPANSION = 0x0001,
+   CFI_MANUF_SAMSUNG  = 0x00EC,
+};
+
 int flash_init(flash_t *flash, void *base_addr);

 flash_lock_t flash_block_getlock(flash_t *flash, uint32_t block_offset);
@@ -38,4 +46,6 @@

 int flash_program(flash_t *flash, uint32_t dst_offset, void *src, uint32_t 
nbytes);

+int flash_get_id(void *base_addr, uint16_t * manufacturer_id, uint16_t * 
device_id);
+
 #endif

--
To view, visit https://gerrit.osmocom.org/c/osmocom-bb/+/15151
To unsubscribe, or for help 

Change in ...osmocom-bb[master]: fw/keypad: Poll Iota powerbutton if required

2019-08-27 Thread laforge
laforge has submitted this change and it was merged. ( 
https://gerrit.osmocom.org/c/osmocom-bb/+/15150 )

Change subject: fw/keypad: Poll Iota powerbutton if required
..

fw/keypad: Poll Iota powerbutton if required

This commit adds polling of the TWL3025 PWON
signal. If the powerbutton is pressed on targets
that use it (Pirelli DP-L10, Huawei GTM900-B),
a normal keypad scanning cycle is started in order
to preserve the timing, required for the 500ms
power off press duration for example.

Change-Id: I904baf40d621bd680b602b88d12ff462b3c17596
---
M src/target/firmware/board/compal/keymap.h
M src/target/firmware/board/pirelli_dpl10/keymap.h
M src/target/firmware/calypso/keypad.c
M src/target/firmware/include/keypad.h
4 files changed, 27 insertions(+), 8 deletions(-)

Approvals:
  Jenkins Builder: Verified
  laforge: Looks good to me, approved



diff --git a/src/target/firmware/board/compal/keymap.h 
b/src/target/firmware/board/compal/keymap.h
index ce8f9c2..fe0e303 100644
--- a/src/target/firmware/board/compal/keymap.h
+++ b/src/target/firmware/board/compal/keymap.h
@@ -23,5 +23,6 @@
[KEY_OK]= 0,
[KEY_POWER] = 24,
[KEY_MINUS] = 30,   /* not existent */
-   [KEY_PLUS]  = 31,   /* not existent */
+   [KEY_PLUS]  = 30,   /* not existent */
+   [KEY_CAMERA]= 30,   /* not existent */
 };
diff --git a/src/target/firmware/board/pirelli_dpl10/keymap.h 
b/src/target/firmware/board/pirelli_dpl10/keymap.h
index b85621b..b06f17d 100644
--- a/src/target/firmware/board/pirelli_dpl10/keymap.h
+++ b/src/target/firmware/board/pirelli_dpl10/keymap.h
@@ -21,8 +21,9 @@
[KEY_LEFT]  = 5,
[KEY_RIGHT] = 10,
[KEY_OK]= 11,
-/* power button is not connected, we use the camera button instead */
-   [KEY_POWER] = 23,
+/* power button is not connected to keypad scan matrix but to TWL3025 */
+   [KEY_POWER] = 31,
[KEY_MINUS] = 22,
[KEY_PLUS]  = 21,
+   [KEY_CAMERA]= 23,
 };
diff --git a/src/target/firmware/calypso/keypad.c 
b/src/target/firmware/calypso/keypad.c
index 937f8bd..c3c1810 100644
--- a/src/target/firmware/calypso/keypad.c
+++ b/src/target/firmware/calypso/keypad.c
@@ -1,7 +1,7 @@
 /* Driver for the keypad attached to the TI Calypso */

 /* (C) 2010 by roh 
- * (C) 2013 by Steve Markgraf 
+ * (C) 2013-19 by Steve Markgraf 
  *
  * All Rights Reserved
  *
@@ -119,6 +119,15 @@
static uint16_t reg;
static uint16_t col;
static uint32_t buttons = 0, debounce1 = 0, debounce2 = 0;
+   uint8_t use_iota_pwrbtn = (btn_map[KEY_POWER] == 31);
+   uint32_t pwr_mask = (1 << btn_map[KEY_POWER]);
+
+   /* only read Iota powerbutton if it was not yet pressed */
+   if (use_iota_pwrbtn && !(buttons & pwr_mask) && twl3025_get_pwon()) {
+   buttons |= pwr_mask;
+   if (!polling)
+   polling = 1;
+   }

if (with_interrupts && !polling)
return;
@@ -154,7 +163,6 @@

col++;
if (col > 5) {
-   uint32_t pwr_mask = (1 << btn_map[KEY_POWER]);
col = 0;
/* if power button, ignore other states */
if (buttons & pwr_mask)
@@ -162,6 +170,16 @@
else if (lastbuttons & pwr_mask)
buttons = lastbuttons & ~pwr_mask;
dispatch_buttons(buttons);
+
+   /* check if powerbutton connected to Iota was released */
+   if (use_iota_pwrbtn && (buttons & pwr_mask) && 
!twl3025_get_pwon()) {
+   buttons &= ~pwr_mask;
+
+   /* dispatch buttons again so we do not loose
+* very short powerbutton presses */
+   dispatch_buttons(buttons);
+   }
+
if (buttons == 0) {
writew(0x0, KBC_REG);
polling = 3;
@@ -172,5 +190,4 @@
writew(0xff, KBC_REG);
else
writew(0x1f & ~(0x1 << col ), KBC_REG);
-
 }
diff --git a/src/target/firmware/include/keypad.h 
b/src/target/firmware/include/keypad.h
index 9e9acfe..2ad9889 100644
--- a/src/target/firmware/include/keypad.h
+++ b/src/target/firmware/include/keypad.h
@@ -25,11 +25,11 @@
KEY_POWER,  //red on-hook
KEY_MINUS,
KEY_PLUS,
+   KEY_CAMERA,
+   BUTTON_CNT,
KEY_INV = 0xFF
 };

-#define BUTTON_CNT 23
-
 enum key_states {
PRESSED,
RELEASED,

--
To view, visit https://gerrit.osmocom.org/c/osmocom-bb/+/15150
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmocom-bb
Gerrit-Branch: master
Gerrit-Change-Id: I904baf40d621bd680b602b88d12ff462b3c17596
Gerrit-Change-Number: 15150
Gerrit-PatchSet: 1
Gerrit-Owner: steve-m 
Gerrit-Reviewer: Jenkins Builder

Change in ...osmocom-bb[master]: fw/keypad: Poll Iota powerbutton if required

2019-08-27 Thread laforge
laforge has posted comments on this change. ( 
https://gerrit.osmocom.org/c/osmocom-bb/+/15150 )

Change subject: fw/keypad: Poll Iota powerbutton if required
..


Patch Set 1: Code-Review+2


--
To view, visit https://gerrit.osmocom.org/c/osmocom-bb/+/15150
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmocom-bb
Gerrit-Branch: master
Gerrit-Change-Id: I904baf40d621bd680b602b88d12ff462b3c17596
Gerrit-Change-Number: 15150
Gerrit-PatchSet: 1
Gerrit-Owner: steve-m 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge 
Gerrit-Comment-Date: Tue, 27 Aug 2019 12:08:00 +
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment


Change in ...osmocom-bb[master]: fw: Add support for Huawei GTM900-B modules

2019-08-27 Thread laforge
laforge has posted comments on this change. ( 
https://gerrit.osmocom.org/c/osmocom-bb/+/15152 )

Change subject: fw: Add support for Huawei GTM900-B modules
..


Patch Set 1: Code-Review+2


--
To view, visit https://gerrit.osmocom.org/c/osmocom-bb/+/15152
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmocom-bb
Gerrit-Branch: master
Gerrit-Change-Id: I3a770ea93fc72c4e9b63078e253602f204b5be23
Gerrit-Change-Number: 15152
Gerrit-PatchSet: 1
Gerrit-Owner: steve-m 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge 
Gerrit-Comment-Date: Tue, 27 Aug 2019 12:08:04 +
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment


Change in ...libosmocore[master]: context: Add support for [per-thread] global talloc contexts

2019-08-27 Thread laforge
laforge has submitted this change and it was merged. ( 
https://gerrit.osmocom.org/c/libosmocore/+/13312 )

Change subject: context: Add support for [per-thread] global talloc contexts
..

context: Add support for [per-thread] global talloc contexts

Rather than having applications maintain their own talloc cotexts,
let's offer some root talloc contexts in libosmocore.  Let's also
make them per thread right from the beginning.  This will help
some multi-threaded applications to use talloc in a thread-safe
way.

Change-Id: Iae39cd57274bf6753ecaf186f229e582b42662e3
---
M include/osmocom/core/select.h
M include/osmocom/core/talloc.h
M src/Makefile.am
A src/context.c
M src/select.c
M tests/Makefile.am
A tests/context/context_test.c
A tests/context/context_test.ok
M tests/testsuite.at
9 files changed, 213 insertions(+), 9 deletions(-)

Approvals:
  Jenkins Builder: Verified
  laforge: Looks good to me, approved



diff --git a/include/osmocom/core/select.h b/include/osmocom/core/select.h
index e4787b0..a200b6f 100644
--- a/include/osmocom/core/select.h
+++ b/include/osmocom/core/select.h
@@ -51,6 +51,7 @@
 void osmo_fd_unregister(struct osmo_fd *fd);
 void osmo_fd_close(struct osmo_fd *fd);
 int osmo_select_main(int polling);
+int osmo_select_main_ctx(int polling);

 struct osmo_fd *osmo_fd_get_by_fd(int fd);

diff --git a/include/osmocom/core/talloc.h b/include/osmocom/core/talloc.h
index 191a463..c68a56c 100644
--- a/include/osmocom/core/talloc.h
+++ b/include/osmocom/core/talloc.h
@@ -1,5 +1,27 @@
-/*! \file talloc.h
- * Convenience wrapper.  libosmocore used to ship its own internal copy of
- * talloc, before libtalloc became a standard component on most systems */
+/*! \file talloc.h */
 #pragma once
 #include 
+
+/*! per-thread talloc contexts.  This works around the problem that talloc is 
not
+ * thread-safe. However, one can simply have a different set of talloc 
contexts for each
+ * thread, and ensure that allocations made on one thread are always only 
free'd on that
+ * very same thread.
+ * WARNING: Users must make sure they free() on the same thread as they 
allocate!! */
+struct osmo_talloc_contexts {
+   /*! global per-thread talloc context. */
+   void *global;
+   /*! volatile select-dispatch context.  This context is completely 
free'd and
+* re-created every time the main select loop in osmo_select_main() 
returns from
+* select(2) and calls per-fd callback functions.  This allows users of 
this
+* facility to allocate temporary objects like string buffers, message 
buffers
+* and the like which are automatically free'd when going into the next 
select()
+* system call */
+   void *select;
+};
+
+extern __thread struct osmo_talloc_contexts *osmo_ctx;
+
+/* short-hand #defines for the osmo talloc contexts (OTC) that can be used to 
pass
+ * to the various _c functions like msgb_alloc_c() */
+#define OTC_GLOBAL (osmo_ctx->global)
+#define OTC_SELECT (osmo_ctx->select)
diff --git a/src/Makefile.am b/src/Makefile.am
index f937810..245eb6d 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -13,7 +13,7 @@
 lib_LTLIBRARIES = libosmocore.la

 libosmocore_la_LIBADD = $(BACKTRACE_LIB) $(TALLOC_LIBS) $(LIBRARY_RT)
-libosmocore_la_SOURCES = timer.c timer_gettimeofday.c timer_clockgettime.c \
+libosmocore_la_SOURCES = context.c timer.c timer_gettimeofday.c 
timer_clockgettime.c \
 select.c signal.c msgb.c bits.c \
 bitvec.c bitcomp.c counter.c fsm.c \
 write_queue.c utils.c socket.c \
diff --git a/src/context.c b/src/context.c
new file mode 100644
index 000..bad012b
--- /dev/null
+++ b/src/context.c
@@ -0,0 +1,52 @@
+/*! \file context.c
+ * talloc context handling.
+ *
+ * (C) 2019 by Harald Welte 
+ * All Rights Reserverd.
+ *
+ * SPDX-License-Identifier: GPL-2.0+
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ *  MA  02110-1301, USA.
+ */
+#include 
+#include 
+#include 
+#include 
+
+__thread struct osmo_talloc_contexts *osmo_ctx;
+
+int osmo_ctx_init(const char *id)
+{
+   osmo_ctx = talloc_named(NULL, sizeof(*osmo_ctx), "global-%s", id);
+   if (!osmo_ctx)
+   return -ENOMEM;
+   memset(osmo_ctx, 0, 

Change in ...libosmocore[master]: context: Add support for [per-thread] global talloc contexts

2019-08-27 Thread laforge
laforge has posted comments on this change. ( 
https://gerrit.osmocom.org/c/libosmocore/+/13312 )

Change subject: context: Add support for [per-thread] global talloc contexts
..


Patch Set 19: Code-Review+2


--
To view, visit https://gerrit.osmocom.org/c/libosmocore/+/13312
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: Iae39cd57274bf6753ecaf186f229e582b42662e3
Gerrit-Change-Number: 13312
Gerrit-PatchSet: 19
Gerrit-Owner: laforge 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria 
Gerrit-Reviewer: laforge 
Gerrit-Reviewer: pespin 
Gerrit-CC: Max 
Gerrit-Comment-Date: Tue, 27 Aug 2019 12:01:33 +
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment


Change in ...libosmocore[master]: context: Add support for [per-thread] global talloc contexts

2019-08-27 Thread laforge
Hello pespin, fixeria, Jenkins Builder,

I'd like you to reexamine a change. Please visit

https://gerrit.osmocom.org/c/libosmocore/+/13312

to look at the new patch set (#19).

Change subject: context: Add support for [per-thread] global talloc contexts
..

context: Add support for [per-thread] global talloc contexts

Rather than having applications maintain their own talloc cotexts,
let's offer some root talloc contexts in libosmocore.  Let's also
make them per thread right from the beginning.  This will help
some multi-threaded applications to use talloc in a thread-safe
way.

Change-Id: Iae39cd57274bf6753ecaf186f229e582b42662e3
---
M include/osmocom/core/select.h
M include/osmocom/core/talloc.h
M src/Makefile.am
A src/context.c
M src/select.c
M tests/Makefile.am
A tests/context/context_test.c
A tests/context/context_test.ok
M tests/testsuite.at
9 files changed, 213 insertions(+), 9 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/12/13312/19
--
To view, visit https://gerrit.osmocom.org/c/libosmocore/+/13312
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: Iae39cd57274bf6753ecaf186f229e582b42662e3
Gerrit-Change-Number: 13312
Gerrit-PatchSet: 19
Gerrit-Owner: laforge 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria 
Gerrit-Reviewer: laforge 
Gerrit-Reviewer: pespin 
Gerrit-CC: Max 
Gerrit-MessageType: newpatchset


Change in ...libosmocore[master]: context: Add support for [per-thread] global talloc contexts

2019-08-27 Thread laforge
Hello pespin, fixeria, Jenkins Builder,

I'd like you to reexamine a change. Please visit

https://gerrit.osmocom.org/c/libosmocore/+/13312

to look at the new patch set (#18).

Change subject: context: Add support for [per-thread] global talloc contexts
..

context: Add support for [per-thread] global talloc contexts

Rather than having applications maintain their own talloc cotexts,
let's offer some root talloc contexts in libosmocore.  Let's also
make them per thread right from the beginning.  This will help
some multi-threaded applications to use talloc in a thread-safe
way.

Change-Id: Iae39cd57274bf6753ecaf186f229e582b42662e3
---
M include/osmocom/core/select.h
M include/osmocom/core/talloc.h
M src/Makefile.am
A src/context.c
M src/select.c
M tests/Makefile.am
A tests/context/context_test.c
A tests/context/context_test.ok
M tests/testsuite.at
9 files changed, 214 insertions(+), 9 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/12/13312/18
--
To view, visit https://gerrit.osmocom.org/c/libosmocore/+/13312
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: Iae39cd57274bf6753ecaf186f229e582b42662e3
Gerrit-Change-Number: 13312
Gerrit-PatchSet: 18
Gerrit-Owner: laforge 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria 
Gerrit-Reviewer: laforge 
Gerrit-Reviewer: pespin 
Gerrit-CC: Max 
Gerrit-MessageType: newpatchset


Change in ...osmo-trx[master]: Transceiver: exit process when BTS drops connection

2019-08-27 Thread laforge
laforge has posted comments on this change. ( 
https://gerrit.osmocom.org/c/osmo-trx/+/15289 )

Change subject: Transceiver: exit process when BTS drops connection
..


Patch Set 3: Code-Review+1


--
To view, visit https://gerrit.osmocom.org/c/osmo-trx/+/15289
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-trx
Gerrit-Branch: master
Gerrit-Change-Id: I2ccbe3c17b39fb792ea7810f840235c348054d66
Gerrit-Change-Number: 15289
Gerrit-PatchSet: 3
Gerrit-Owner: pespin 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria 
Gerrit-Reviewer: laforge 
Gerrit-Reviewer: pespin 
Gerrit-Comment-Date: Tue, 27 Aug 2019 11:34:08 +
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment


Change in ...osmo-pcu[master]: osmobts_sock.cpp: do not print the same debug message twice

2019-08-27 Thread laforge
laforge has submitted this change and it was merged. ( 
https://gerrit.osmocom.org/c/osmo-pcu/+/15294 )

Change subject: osmobts_sock.cpp: do not print the same debug message twice
..

osmobts_sock.cpp: do not print the same debug message twice

The following message is printed by the pcu_tx_txt_ind():

  DL1IF INFO pcu_l1_if.cpp:113 Sending XXX TXT as PCU_VERSION to BTS

There is no need to print it twice:

  DL1IF INFO osmobts_sock.cpp:74 Sending version XXX to BTS.
  DL1IF INFO pcu_l1_if.cpp:113 Sending XXX TXT as PCU_VERSION to BTS

Change-Id: Ic2793f20cf9df2fa08c45070a8f81ef1c08b925a
---
M src/osmobts_sock.cpp
1 file changed, 0 insertions(+), 2 deletions(-)

Approvals:
  pespin: Looks good to me, approved
  Jenkins Builder: Verified



diff --git a/src/osmobts_sock.cpp b/src/osmobts_sock.cpp
index 4321696..20fb174 100644
--- a/src/osmobts_sock.cpp
+++ b/src/osmobts_sock.cpp
@@ -71,7 +71,6 @@
if (bts->active)
return;

-   LOGP(DL1IF, LOGL_INFO, "Sending version %s to BTS.\n", PACKAGE_VERSION);
pcu_tx_txt_ind(PCU_VERSION, "%s", PACKAGE_VERSION);
osmo_timer_schedule(>timer, 5, 0);
 }
@@ -250,7 +249,6 @@

pcu_sock_state = state;

-   LOGP(DL1IF, LOGL_INFO, "Sending version %s to BTS.\n", PACKAGE_VERSION);
pcu_tx_txt_ind(PCU_VERSION, "%s", PACKAGE_VERSION);

/* Schedule a timer so we keep trying until the BTS becomes active. */

--
To view, visit https://gerrit.osmocom.org/c/osmo-pcu/+/15294
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-pcu
Gerrit-Branch: master
Gerrit-Change-Id: Ic2793f20cf9df2fa08c45070a8f81ef1c08b925a
Gerrit-Change-Number: 15294
Gerrit-PatchSet: 1
Gerrit-Owner: fixeria 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge 
Gerrit-Reviewer: pespin 
Gerrit-MessageType: merged


Change in ...osmo-pcu[master]: osmobts_sock.cpp: pcu_sock_read(): further simplify the code

2019-08-27 Thread laforge
laforge has submitted this change and it was merged. ( 
https://gerrit.osmocom.org/c/osmo-pcu/+/15280 )

Change subject: osmobts_sock.cpp: pcu_sock_read(): further simplify the code
..

osmobts_sock.cpp: pcu_sock_read(): further simplify the code

Change-Id: Ie7c0ca8baf0ae5beadda60bda0bc76a44664d439
---
M src/osmobts_sock.cpp
1 file changed, 6 insertions(+), 14 deletions(-)

Approvals:
  pespin: Looks good to me, approved
  Jenkins Builder: Verified



diff --git a/src/osmobts_sock.cpp b/src/osmobts_sock.cpp
index a3e9d63..4321696 100644
--- a/src/osmobts_sock.cpp
+++ b/src/osmobts_sock.cpp
@@ -143,22 +143,14 @@
int rc;

rc = recv(bfd->fd, _prim, sizeof(pcu_prim), 0);
-   if (rc == 0)
-   goto close;
-
-   if (rc < 0) {
-   if (errno == EAGAIN)
-   return 0;
-   goto close;
+   if (rc < 0 && errno == EAGAIN)
+   return 0; /* Try again later */
+   if (rc <= 0) {
+   pcu_sock_close(state, 1);
+   return -EIO;
}

-   rc = pcu_rx(pcu_prim.msg_type, _prim);
-
-   return rc;
-
-close:
-   pcu_sock_close(state, 1);
-   return -1;
+   return pcu_rx(pcu_prim.msg_type, _prim);
 }

 static int pcu_sock_write(struct osmo_fd *bfd)

--
To view, visit https://gerrit.osmocom.org/c/osmo-pcu/+/15280
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-pcu
Gerrit-Branch: master
Gerrit-Change-Id: Ie7c0ca8baf0ae5beadda60bda0bc76a44664d439
Gerrit-Change-Number: 15280
Gerrit-PatchSet: 2
Gerrit-Owner: fixeria 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge 
Gerrit-Reviewer: pespin 
Gerrit-MessageType: merged


Change in ...osmo-pcu[master]: osmobts_sock.cpp: do not print the same debug message twice

2019-08-27 Thread pespin
pespin has posted comments on this change. ( 
https://gerrit.osmocom.org/c/osmo-pcu/+/15294 )

Change subject: osmobts_sock.cpp: do not print the same debug message twice
..


Patch Set 1: Code-Review+2


--
To view, visit https://gerrit.osmocom.org/c/osmo-pcu/+/15294
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-pcu
Gerrit-Branch: master
Gerrit-Change-Id: Ic2793f20cf9df2fa08c45070a8f81ef1c08b925a
Gerrit-Change-Number: 15294
Gerrit-PatchSet: 1
Gerrit-Owner: fixeria 
Gerrit-Reviewer: pespin 
Gerrit-Comment-Date: Tue, 27 Aug 2019 09:17:01 +
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment


Change in ...osmo-pcu[master]: osmobts_sock.cpp: pcu_sock_read(): further simplify the code

2019-08-27 Thread pespin
pespin has posted comments on this change. ( 
https://gerrit.osmocom.org/c/osmo-pcu/+/15280 )

Change subject: osmobts_sock.cpp: pcu_sock_read(): further simplify the code
..


Patch Set 2: Code-Review+2


--
To view, visit https://gerrit.osmocom.org/c/osmo-pcu/+/15280
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-pcu
Gerrit-Branch: master
Gerrit-Change-Id: Ie7c0ca8baf0ae5beadda60bda0bc76a44664d439
Gerrit-Change-Number: 15280
Gerrit-PatchSet: 2
Gerrit-Owner: fixeria 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: pespin 
Gerrit-Comment-Date: Tue, 27 Aug 2019 09:16:10 +
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment


Change in ...osmo-pcu[master]: WIP: gprs_bssgp_destroy(): fix NULL-pointer dereference

2019-08-27 Thread pespin
pespin has posted comments on this change. ( 
https://gerrit.osmocom.org/c/osmo-pcu/+/15281 )

Change subject: WIP: gprs_bssgp_destroy(): fix NULL-pointer dereference
..


Patch Set 2:

(1 comment)

https://gerrit.osmocom.org/#/c/15281/2//COMMIT_MSG
Commit Message:

https://gerrit.osmocom.org/#/c/15281/2//COMMIT_MSG@7
PS2, Line 7: WIP: gprs_bssgp_destroy(): fix NULL-pointer dereference
You probably want to get rid of the WIP here.



--
To view, visit https://gerrit.osmocom.org/c/osmo-pcu/+/15281
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-pcu
Gerrit-Branch: master
Gerrit-Change-Id: I42cb911a679b9198fd06e74b42f1e2cb28323de9
Gerrit-Change-Number: 15281
Gerrit-PatchSet: 2
Gerrit-Owner: fixeria 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: pespin 
Gerrit-Comment-Date: Tue, 27 Aug 2019 09:15:06 +
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Gerrit-MessageType: comment


Change in ...osmo-pcu[master]: osmobts_sock.cpp: do not print the same debug message twice

2019-08-27 Thread fixeria
fixeria has uploaded this change for review. ( 
https://gerrit.osmocom.org/c/osmo-pcu/+/15294


Change subject: osmobts_sock.cpp: do not print the same debug message twice
..

osmobts_sock.cpp: do not print the same debug message twice

The following message is printed by the pcu_tx_txt_ind():

  DL1IF INFO pcu_l1_if.cpp:113 Sending XXX TXT as PCU_VERSION to BTS

There is no need to print it twice:

  DL1IF INFO osmobts_sock.cpp:74 Sending version XXX to BTS.
  DL1IF INFO pcu_l1_if.cpp:113 Sending XXX TXT as PCU_VERSION to BTS

Change-Id: Ic2793f20cf9df2fa08c45070a8f81ef1c08b925a
---
M src/osmobts_sock.cpp
1 file changed, 0 insertions(+), 2 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-pcu refs/changes/94/15294/1

diff --git a/src/osmobts_sock.cpp b/src/osmobts_sock.cpp
index 4321696..20fb174 100644
--- a/src/osmobts_sock.cpp
+++ b/src/osmobts_sock.cpp
@@ -71,7 +71,6 @@
if (bts->active)
return;

-   LOGP(DL1IF, LOGL_INFO, "Sending version %s to BTS.\n", PACKAGE_VERSION);
pcu_tx_txt_ind(PCU_VERSION, "%s", PACKAGE_VERSION);
osmo_timer_schedule(>timer, 5, 0);
 }
@@ -250,7 +249,6 @@

pcu_sock_state = state;

-   LOGP(DL1IF, LOGL_INFO, "Sending version %s to BTS.\n", PACKAGE_VERSION);
pcu_tx_txt_ind(PCU_VERSION, "%s", PACKAGE_VERSION);

/* Schedule a timer so we keep trying until the BTS becomes active. */

--
To view, visit https://gerrit.osmocom.org/c/osmo-pcu/+/15294
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-pcu
Gerrit-Branch: master
Gerrit-Change-Id: Ic2793f20cf9df2fa08c45070a8f81ef1c08b925a
Gerrit-Change-Number: 15294
Gerrit-PatchSet: 1
Gerrit-Owner: fixeria 
Gerrit-MessageType: newchange


Change in ...osmo-pcu[master]: WIP: gprs_bssgp_destroy(): fix NULL-pointer dereference

2019-08-27 Thread fixeria
Hello pespin, Jenkins Builder,

I'd like you to reexamine a change. Please visit

https://gerrit.osmocom.org/c/osmo-pcu/+/15281

to look at the new patch set (#2).

Change subject: WIP: gprs_bssgp_destroy(): fix NULL-pointer dereference
..

WIP: gprs_bssgp_destroy(): fix NULL-pointer dereference

The 'gprs_bssgp_pcu' may not be initialized in some cases, e.g.
when OsmoPCU is terminated before connecting to the SGSN.

Change-Id: I42cb911a679b9198fd06e74b42f1e2cb28323de9
---
M src/gprs_bssgp_pcu.cpp
1 file changed, 5 insertions(+), 6 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-pcu refs/changes/81/15281/2
--
To view, visit https://gerrit.osmocom.org/c/osmo-pcu/+/15281
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-pcu
Gerrit-Branch: master
Gerrit-Change-Id: I42cb911a679b9198fd06e74b42f1e2cb28323de9
Gerrit-Change-Number: 15281
Gerrit-PatchSet: 2
Gerrit-Owner: fixeria 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: pespin 
Gerrit-MessageType: newpatchset


Change in ...osmo-pcu[master]: osmobts_sock.cpp: pcu_sock_read(): further simplify the code

2019-08-27 Thread fixeria
Hello Jenkins Builder,

I'd like you to reexamine a change. Please visit

https://gerrit.osmocom.org/c/osmo-pcu/+/15280

to look at the new patch set (#2).

Change subject: osmobts_sock.cpp: pcu_sock_read(): further simplify the code
..

osmobts_sock.cpp: pcu_sock_read(): further simplify the code

Change-Id: Ie7c0ca8baf0ae5beadda60bda0bc76a44664d439
---
M src/osmobts_sock.cpp
1 file changed, 6 insertions(+), 14 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-pcu refs/changes/80/15280/2
--
To view, visit https://gerrit.osmocom.org/c/osmo-pcu/+/15280
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-pcu
Gerrit-Branch: master
Gerrit-Change-Id: Ie7c0ca8baf0ae5beadda60bda0bc76a44664d439
Gerrit-Change-Number: 15280
Gerrit-PatchSet: 2
Gerrit-Owner: fixeria 
Gerrit-Reviewer: Jenkins Builder
Gerrit-CC: pespin 
Gerrit-MessageType: newpatchset