Change in libosmo-sccp[master]: add osmo_xua_msg_tall_ctx_init()

2018-07-11 Thread Neels Hofmeyr
Neels Hofmeyr has posted comments on this change. ( 
https://gerrit.osmocom.org/9953 )

Change subject: add osmo_xua_msg_tall_ctx_init()
..


Patch Set 2:

I need this for https://gerrit.osmocom.org/9955


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

Gerrit-Project: libosmo-sccp
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I618878680a096a7f7fc2d83098590f2e4cb08870
Gerrit-Change-Number: 9953
Gerrit-PatchSet: 2
Gerrit-Owner: Neels Hofmeyr 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Neels Hofmeyr 
Gerrit-Reviewer: Pau Espin Pedrol 
Gerrit-Comment-Date: Thu, 12 Jul 2018 03:35:55 +
Gerrit-HasComments: No
Gerrit-HasLabels: No


Change in libosmocore[master]: vty: fix use-after-free and memleaks in is_cmd_ambiguous()

2018-07-11 Thread Neels Hofmeyr
Neels Hofmeyr has posted comments on this change. ( 
https://gerrit.osmocom.org/9939 )

Change subject: vty: fix use-after-free and memleaks in is_cmd_ambiguous()
..


Patch Set 2:

looking at my earlier comment it sounds like a pretty bad rant, was meant more 
friendly, sorry about that...

I need this (or a similar fix) to make https://gerrit.osmocom.org/9666 pass.


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

Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: Ia71ba742108b5ff020997bfb612ad5eb30d04fcd
Gerrit-Change-Number: 9939
Gerrit-PatchSet: 2
Gerrit-Owner: Neels Hofmeyr 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Neels Hofmeyr 
Gerrit-Reviewer: Pau Espin Pedrol 
Gerrit-CC: Vadim Yanitskiy 
Gerrit-Comment-Date: Thu, 12 Jul 2018 03:34:32 +
Gerrit-HasComments: No
Gerrit-HasLabels: No


Change in libosmo-sccp[master]: add osmo_xua_msg_tall_ctx_init()

2018-07-11 Thread Neels Hofmeyr
Neels Hofmeyr has posted comments on this change. ( 
https://gerrit.osmocom.org/9953 )

Change subject: add osmo_xua_msg_tall_ctx_init()
..


Patch Set 2:

ok, thought it was only libosmocore...


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

Gerrit-Project: libosmo-sccp
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I618878680a096a7f7fc2d83098590f2e4cb08870
Gerrit-Change-Number: 9953
Gerrit-PatchSet: 2
Gerrit-Owner: Neels Hofmeyr 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Neels Hofmeyr 
Gerrit-Reviewer: Pau Espin Pedrol 
Gerrit-Comment-Date: Thu, 12 Jul 2018 03:28:42 +
Gerrit-HasComments: No
Gerrit-HasLabels: No


Change in libosmo-sccp[master]: add osmo_xua_msg_tall_ctx_init()

2018-07-11 Thread Neels Hofmeyr
Hello Pau Espin Pedrol, Harald Welte, Jenkins Builder,

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

https://gerrit.osmocom.org/9953

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

Change subject: add osmo_xua_msg_tall_ctx_init()
..

add osmo_xua_msg_tall_ctx_init()

So far the tall_xua ctx used to allocate from in xua_msg_alloc() was never
initialized, actually hiding memory leaks from the talloc report.
Add this API to allow branching the xua_msg ctx off a sane root ctx.

Explicitly initialize tall_xua to NULL, so that, if xua_msg_ctx_init() isn't
called, tall_xua is still guaranteed to not be a random pointer.

osmo-bsc will use this function to hook the tall_xua ctx to osmo-bsc's own root
ctx.

Change-Id: I618878680a096a7f7fc2d83098590f2e4cb08870
---
M include/osmocom/sigtran/xua_msg.h
M src/xua_msg.c
2 files changed, 9 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.osmocom.org:29418/libosmo-sccp refs/changes/53/9953/2
--
To view, visit https://gerrit.osmocom.org/9953
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: libosmo-sccp
Gerrit-Branch: master
Gerrit-MessageType: newpatchset
Gerrit-Change-Id: I618878680a096a7f7fc2d83098590f2e4cb08870
Gerrit-Change-Number: 9953
Gerrit-PatchSet: 2
Gerrit-Owner: Neels Hofmeyr 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Pau Espin Pedrol 


Change in libosmo-sccp[master]: fix memleaks in mtp_user_prim_cb()

2018-07-11 Thread Neels Hofmeyr
Hello Harald Welte, Jenkins Builder,

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

https://gerrit.osmocom.org/9957

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

Change subject: fix memleaks in mtp_user_prim_cb()
..

fix memleaks in mtp_user_prim_cb()

After dispatching to scrc_rx_mtp_xfer_ind_xua(), free the xua_msg.

Do not free the xua_msg in any of the code paths triggered within
scrc_rx_mtp_xfer_ind_xua(), i.e. remove xua_msg_free() from:
sccp_scoc_rx_from_scrc()
 +->sccp_scoc_rx_unass_local_ref()
 +->tx_coerr_from_xua()
 +->tx_relco_from_xua()

Before this, some code paths would free the xua_msg, while most code paths
would not, causing mem leaks.

Change-Id: I72b3c6a6f57ba32d9ba191af33b4b236492174e0
---
M src/sccp_scoc.c
M src/sccp_user.c
2 files changed, 1 insertion(+), 2 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/libosmo-sccp refs/changes/57/9957/2
--
To view, visit https://gerrit.osmocom.org/9957
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: libosmo-sccp
Gerrit-Branch: master
Gerrit-MessageType: newpatchset
Gerrit-Change-Id: I72b3c6a6f57ba32d9ba191af33b4b236492174e0
Gerrit-Change-Number: 9957
Gerrit-PatchSet: 2
Gerrit-Owner: Neels Hofmeyr 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Neels Hofmeyr 


Change in libosmo-sccp[master]: cosmetic: sccp2sua.c: log the IEI for parsed SCCP addr

2018-07-11 Thread Neels Hofmeyr
Neels Hofmeyr has submitted this change and it was merged. ( 
https://gerrit.osmocom.org/9952 )

Change subject: cosmetic: sccp2sua.c: log the IEI for parsed SCCP addr
..

cosmetic: sccp2sua.c: log the IEI for parsed SCCP addr

Before this, the log looked like it parsed the same address twice with
differing results:

  DLSUA DEBUG sccp2sua.c:333 Parsed Addr: RI=2,PC=1196,SSN=254
  DLSUA DEBUG sccp2sua.c:333 Parsed Addr: RI=2,PC=100,SSN=254

Adding the IEI clarifies this:

  DLSUA DEBUG sccp2sua.c:333 IEI 259: Parsed Addr: RI=2,PC=1196,SSN=254
  DLSUA DEBUG sccp2sua.c:333 IEI 258: Parsed Addr: RI=2,PC=100,SSN=254

(I'd have liked to print the IEI name from sua_iei_names, but I frankly can't
figure out how to reach that value_string array "hidden" behind a xua_msg_class
struct, and neither can I find any other code doing so.)

Change-Id: I64adb31129684b2eb66fff581040017ce2f6d163
---
M src/sccp2sua.c
1 file changed, 1 insertion(+), 1 deletion(-)

Approvals:
  Jenkins Builder: Verified
  Pau Espin Pedrol: Looks good to me, but someone else must approve
  Harald Welte: Looks good to me, approved



diff --git a/src/sccp2sua.c b/src/sccp2sua.c
index afc38c7..2f5b687 100644
--- a/src/sccp2sua.c
+++ b/src/sccp2sua.c
@@ -330,7 +330,7 @@
if (rc < 0)
return rc;

-   LOGP(DLSUA, LOGL_DEBUG, "Parsed Addr: %s\n", osmo_sccp_addr_dump());
+   LOGP(DLSUA, LOGL_DEBUG, "IEI %u: Parsed Addr: %s\n", iei, 
osmo_sccp_addr_dump());

/* Then re-encode it as SUA address */
return xua_msg_add_sccp_addr(xua, iei, );

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

Gerrit-Project: libosmo-sccp
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: I64adb31129684b2eb66fff581040017ce2f6d163
Gerrit-Change-Number: 9952
Gerrit-PatchSet: 1
Gerrit-Owner: Neels Hofmeyr 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Neels Hofmeyr 
Gerrit-Reviewer: Pau Espin Pedrol 


Change in libosmo-sccp[master]: fix memleak in ipa_rx_msg_sccp

2018-07-11 Thread Neels Hofmeyr
Neels Hofmeyr has submitted this change and it was merged. ( 
https://gerrit.osmocom.org/9951 )

Change subject: fix memleak in ipa_rx_msg_sccp
..

fix memleak in ipa_rx_msg_sccp

After m3ua_xfer_from_data() has copied the msgb data, we need to free the msgb.

Change-Id: I2263751c0aa3ae32455847c7622af8be0a1e7802
---
M src/ipa.c
1 file changed, 1 insertion(+), 0 deletions(-)

Approvals:
  Jenkins Builder: Verified
  Pau Espin Pedrol: Looks good to me, but someone else must approve
  Harald Welte: Looks good to me, approved



diff --git a/src/ipa.c b/src/ipa.c
index 0e6f683..e15b1d8 100644
--- a/src/ipa.c
+++ b/src/ipa.c
@@ -258,6 +258,7 @@
data_hdr.dpc = osmo_htonl(dpc);
/* Create M3UA message in XUA structure */
xua = m3ua_xfer_from_data(_hdr, msgb_l2(msg), msgb_l2len(msg));
+   msgb_free(msg);
/* Update xua->mtp with values from data_hdr */
m3ua_dh_to_xfer_param(>mtp, _hdr);


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

Gerrit-Project: libosmo-sccp
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: I2263751c0aa3ae32455847c7622af8be0a1e7802
Gerrit-Change-Number: 9951
Gerrit-PatchSet: 1
Gerrit-Owner: Neels Hofmeyr 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Neels Hofmeyr 
Gerrit-Reviewer: Pau Espin Pedrol 


Change in libosmo-sccp[master]: comment: explain xua_msg free in m3ua_rx_xfer()

2018-07-11 Thread Neels Hofmeyr
Hello Pau Espin Pedrol, Jenkins Builder,

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

https://gerrit.osmocom.org/9958

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

Change subject: comment: explain xua_msg free in m3ua_rx_xfer()
..

comment: explain xua_msg free in m3ua_rx_xfer()

Change-Id: I6211c8809eefeb94289c4c497553561b043ee619
---
M src/m3ua.c
1 file changed, 1 insertion(+), 0 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/libosmo-sccp refs/changes/58/9958/3
--
To view, visit https://gerrit.osmocom.org/9958
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: libosmo-sccp
Gerrit-Branch: master
Gerrit-MessageType: newpatchset
Gerrit-Change-Id: I6211c8809eefeb94289c4c497553561b043ee619
Gerrit-Change-Number: 9958
Gerrit-PatchSet: 3
Gerrit-Owner: Neels Hofmeyr 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Neels Hofmeyr 
Gerrit-Reviewer: Pau Espin Pedrol 


Change in libosmo-sccp[master]: fix two memleaks in ipa_rx_msg_sccp()

2018-07-11 Thread Neels Hofmeyr
Hello Pau Espin Pedrol, Harald Welte, Jenkins Builder,

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

https://gerrit.osmocom.org/9956

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

Change subject: fix two memleaks in ipa_rx_msg_sccp()
..

fix two memleaks in ipa_rx_msg_sccp()

1: Do not call xua_msg_alloc() which is later bluntly overwritten by
m3ua_xfer_from_data().

2: After dispatching to m3ua_hmdc_rx_from_l2(), call xua_msg_free().

Related: OS#3393
Change-Id: I0918f9bbc15b036619f1c25a133b69819b2a30fa
---
M src/ipa.c
1 file changed, 5 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/libosmo-sccp refs/changes/56/9956/2
--
To view, visit https://gerrit.osmocom.org/9956
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: libosmo-sccp
Gerrit-Branch: master
Gerrit-MessageType: newpatchset
Gerrit-Change-Id: I0918f9bbc15b036619f1c25a133b69819b2a30fa
Gerrit-Change-Number: 9956
Gerrit-PatchSet: 2
Gerrit-Owner: Neels Hofmeyr 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Neels Hofmeyr 
Gerrit-Reviewer: Pau Espin Pedrol 


Change in osmo-ttcn3-hacks[master]: log / comment tweaks

2018-07-11 Thread Neels Hofmeyr
Neels Hofmeyr has posted comments on this change. ( 
https://gerrit.osmocom.org/9627 )

Change subject: log / comment tweaks
..


Patch Set 3:

(exuse the double pasting typo)


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

Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I93c2914e766e200d89308cc81dd803e939b9b28c
Gerrit-Change-Number: 9627
Gerrit-PatchSet: 3
Gerrit-Owner: Neels Hofmeyr 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Neels Hofmeyr 
Gerrit-CC: Harald Welte 
Gerrit-Comment-Date: Thu, 12 Jul 2018 02:02:08 +
Gerrit-HasComments: No
Gerrit-HasLabels: No


Change in osmo-ttcn3-hacks[master]: log / comment tweaks

2018-07-11 Thread Neels Hofmeyr
Neels Hofmeyr has posted comments on this change. ( 
https://gerrit.osmocom.org/9627 )

Change subject: log / comment tweaks
..


Patch Set 3:

ok, so the package summary shows

"RSL ip.access CRCX ACK"

but in the packet details I only see the bytes, no RTP port information:

"
RSLRSL  
 ip.access CRCX ACK

Frame 4107: 84 bytes on wire (672 bits), 84 bytes captured (672 bits) on 
interface 0
Ethernet II, Src: Technolo_08:02:bc (00:d0:cc:08:02:bc), Dst: WistronI_52:68:b5 
(3c:97:0e:52:68:b5)
Internet Protocol Version 4, Src: 192.168.0.125, Dst: 192.168.0.6
Transmission Control Protocol, Src Port: 60192, Dst Port: 3003, Seq: 1086, Ack: 
387, Len: 18
IPA protocol ip.access, type: RSL
Radio Signalling Link (RSL)
Data (15 bytes)

  7e 71 01 0a f8 00 00 f5 c0 a8 00 7d f3 bf 69  ~q.}..i
Data: 7e71010af8f5c0a8007df3bf69
[Length: 15]
"

To see what port number was communicated I had to rely on logging.  
ip.access CRCX ACK

Frame 4107: 84 bytes on wire (672 bits), 84 bytes captured (672 bits) on 
interface 0
Ethernet II, Src: Technolo_08:02:bc (00:d0:cc:08:02:bc), Dst: WistronI_52:68:b5 
(3c:97:0e:52:68:b5)
Internet Protocol Version 4, Src: 192.168.0.125, Dst: 192.168.0.6
Transmission Control Protocol, Src Port: 60192, Dst Port: 3003, Seq: 1086, Ack: 
387, Len: 18
IPA protocol ip.access, type: RSL
Radio Signalling Link (RSL)
Data (15 bytes)

  7e 71 01 0a f8 00 00 f5 c0 a8 00 7d f3 bf 69  ~q.}..i
Data: 7e71010af8f5c0a8007df3bf69
[Length: 15]


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

Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I93c2914e766e200d89308cc81dd803e939b9b28c
Gerrit-Change-Number: 9627
Gerrit-PatchSet: 3
Gerrit-Owner: Neels Hofmeyr 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Neels Hofmeyr 
Gerrit-CC: Harald Welte 
Gerrit-Comment-Date: Thu, 12 Jul 2018 02:01:25 +
Gerrit-HasComments: No
Gerrit-HasLabels: No


Jenkins build is back to normal : master-osmo-sgsn » --enable-iu,a2=default,a3=default,osmocom-master-debian9 #4160

2018-07-11 Thread jenkins
See 




Build failed in Jenkins: master-osmo-sgsn » --enable-iu,a2=default,a3=default,osmocom-master-debian9 #4159

2018-07-11 Thread jenkins
See 


--
[...truncated 992.49 KB...]
   void (*free)(type *);   \
^
/build/deps/install/stow/osmo-iuh/include/osmocom/ranap/RANAP_PLMNs-in-shared-network.h:27:2:
 note: in expansion of macro 'A_SEQUENCE_OF'
  A_SEQUENCE_OF(struct MemberM {
  ^
  CC   gprs_sgsn.o
/build/deps/install/stow/osmo-iuh/include/osmocom/ranap/RANAP_RABDataVolumeReport.h:27:23:
 warning: 'struct MemberN' declared inside parameter list
  A_SEQUENCE_OF(struct MemberN {
   ^
/build/deps/install/stow/libasn1c/include/asn1c/asn_SET_OF.h:17:16: note: in 
definition of macro 'A_SET_OF'
   void (*free)(type *);   \
^
/build/deps/install/stow/osmo-iuh/include/osmocom/ranap/RANAP_RABDataVolumeReport.h:27:2:
 note: in expansion of macro 'A_SEQUENCE_OF'
  A_SEQUENCE_OF(struct MemberN {
  ^
/build/deps/install/stow/osmo-iuh/include/osmocom/ranap/RANAP_RABParametersList.h:29:23:
 warning: 'struct MemberB' declared inside parameter list
  A_SEQUENCE_OF(struct MemberB {
   ^
/build/deps/install/stow/libasn1c/include/asn1c/asn_SET_OF.h:17:16: note: in 
definition of macro 'A_SET_OF'
   void (*free)(type *);   \
^
/build/deps/install/stow/osmo-iuh/include/osmocom/ranap/RANAP_RABParametersList.h:29:2:
 note: in expansion of macro 'A_SEQUENCE_OF'
  A_SEQUENCE_OF(struct MemberB {
  ^
/build/deps/install/stow/osmo-iuh/include/osmocom/ranap/RANAP_UnsuccessfulLinking-IEs.h:27:23:
 warning: 'struct MemberD' declared inside parameter list
  A_SEQUENCE_OF(struct MemberD {
   ^
/build/deps/install/stow/libasn1c/include/asn1c/asn_SET_OF.h:17:16: note: in 
definition of macro 'A_SET_OF'
   void (*free)(type *);   \
^
/build/deps/install/stow/osmo-iuh/include/osmocom/ranap/RANAP_UnsuccessfulLinking-IEs.h:27:2:
 note: in expansion of macro 'A_SEQUENCE_OF'
  A_SEQUENCE_OF(struct MemberD {
  ^
In file included from 
/build/deps/install/stow/osmo-iuh/include/osmocom/ranap/ranap_common.h:592:0,
 from 
/build/deps/install/stow/osmo-iuh/include/osmocom/ranap/ranap_ies_defs.h:7,
 from gprs_gmm.c:50:
/build/deps/install/stow/osmo-iuh/include/osmocom/ranap/ranap_ies_defs.h:126:0: 
warning: "ENHANCEDRELOCATIONCOMPLETEREQUESTIES_RANAP_EXTENDEDRNC_ID_PRESENT" 
redefined
 #define ENHANCEDRELOCATIONCOMPLETEREQUESTIES_RANAP_EXTENDEDRNC_ID_PRESENT  
 (1 << 1)
 ^
/build/deps/install/stow/osmo-iuh/include/osmocom/ranap/ranap_ies_defs.h:125:0: 
note: this is the location of the previous definition
 #define ENHANCEDRELOCATIONCOMPLETEREQUESTIES_RANAP_EXTENDEDRNC_ID_PRESENT  
 (1 << 0)
 ^
/build/deps/install/stow/osmo-iuh/include/osmocom/ranap/ranap_ies_defs.h:436:0: 
warning: 
"RANAP_ENHANCEDRELOCATIONINFORMATIONREQUESTIES_RANAP_IUSIGNALLINGCONNECTIONIDENTIFIER_PRESENT"
 redefined
 #define 
RANAP_ENHANCEDRELOCATIONINFORMATIONREQUESTIES_RANAP_IUSIGNALLINGCONNECTIONIDENTIFIER_PRESENT
 (1 << 2)
 ^
/build/deps/install/stow/osmo-iuh/include/osmocom/ranap/ranap_ies_defs.h:434:0: 
note: this is the location of the previous definition
 #define 
RANAP_ENHANCEDRELOCATIONINFORMATIONREQUESTIES_RANAP_IUSIGNALLINGCONNECTIONIDENTIFIER_PRESENT
 (1 << 0)
 ^
/build/deps/install/stow/osmo-iuh/include/osmocom/ranap/ranap_ies_defs.h:437:0: 
warning: 
"RANAP_ENHANCEDRELOCATIONINFORMATIONREQUESTIES_RANAP_GLOBALCN_ID_PRESENT" 
redefined
 #define 
RANAP_ENHANCEDRELOCATIONINFORMATIONREQUESTIES_RANAP_GLOBALCN_ID_PRESENT 
 (1 << 3)
 ^
/build/deps/install/stow/osmo-iuh/include/osmocom/ranap/ranap_ies_defs.h:435:0: 
note: this is the location of the previous definition
 #define 
RANAP_ENHANCEDRELOCATIONINFORMATIONREQUESTIES_RANAP_GLOBALCN_ID_PRESENT 
 (1 << 1)
 ^
  CC   gprs_sndcp.o
gprs_gmm.c: In function 'gsm0408_gprs_rcvmsg_iu':
gprs_gmm.c:2823:9: note: #pragma message: set drop_cipherable arg for 
gsm0408_rcv_gmm() from IuPS?
 #pragma message "set drop_cipherable arg for gsm0408_rcv_gmm() from IuPS?"
 ^
  CC   gprs_sndcp_comp.o
  CC   gprs_sndcp_dcomp.o
  CC   gprs_sndcp_pcomp.o
  CC   gprs_sndcp_vty.o
  CC   gprs_sndcp_xid.o
  CC   sgsn_main.o
  CC   sgsn_vty.o
  CC   sgsn_libgtp.o
In file included from 
/build/deps/install/stow/libosmocore/include/osmocom/core/talloc.h:5:0,
 from sgsn_main.c:37:
/usr/include/talloc.h:1313:1: internal compiler error: Segmentation fault
 void *talloc_realloc_fn(const void *context, void *ptr, size_t size);
 ^
Please submit a full bug report,
with preprocessed source if appropriate.
See  for instructions.
In file included from 
/build/deps/install/stow/libasn1c/include/asn1c/asn_SEQUENCE_OF.h:8:0,
 from 

Jenkins build is back to normal : master-osmo-mgw » --enable-mgcp-transcoding,a2=default,a3=default,osmocom-master-debian9 #1108

2018-07-11 Thread jenkins
See 




Change in pysim[master]: cards: add update method for EF:PLMNsel to Card class

2018-07-11 Thread dexter
dexter has uploaded this change for review. ( https://gerrit.osmocom.org/9970


Change subject: cards: add update method for EF:PLMNsel to Card class
..

cards: add update method for EF:PLMNsel to Card class

The Card class offers update methods for various EF, but for
PLMNsel there is no update method available yet. Lets add one.

Change-Id: I832f7bef70c92dc101b94ad871b6cafaa626e134
Related: SYS#4245
---
M pySim/cards.py
1 file changed, 6 insertions(+), 0 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/pysim refs/changes/70/9970/1

diff --git a/pySim/cards.py b/pySim/cards.py
index 0c9c2b8..3577d8d 100644
--- a/pySim/cards.py
+++ b/pySim/cards.py
@@ -83,6 +83,12 @@
data, sw = self._scc.update_binary(EF['HPLMNwAcT'], content + 
'ff' * (size/5-1))
return sw

+def update_plmnsel(self, mcc, mnc):
+   data = self._scc.read_binary(EF['PLMNsel'], length=None, 
offset=0)
+size = len(data[0])/2
+   hplmn = enc_plmn(mcc, mnc)
+   self._scc.update_binary(EF['PLMNsel'], hplmn + 'ff' * (size-3))
+
def update_smsp(self, smsp):
data, sw = self._scc.update_record(EF['SMSP'], 1, rpad(smsp, 
84))
return sw

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

Gerrit-Project: pysim
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: I832f7bef70c92dc101b94ad871b6cafaa626e134
Gerrit-Change-Number: 9970
Gerrit-PatchSet: 1
Gerrit-Owner: dexter 


Change in pysim[master]: pySim-read: read contents of PLMN related files.

2018-07-11 Thread dexter
dexter has uploaded a new patch set (#2). ( https://gerrit.osmocom.org/9969 )

Change subject: pySim-read: read contents of PLMN related files.
..

pySim-read: read contents of PLMN related files.

The files EF.PLMNsel, EF.PLMNwAcT, EF.OPLMNwAcT, EF.HPLMNAcT are not
yet printed by pysim-read. Lets add support for those files.

Change-Id: Ice802033adfa6fc1bccc76da47495eb29c3aef6c
Related: SYS#4245
---
M pySim-read.py
1 file changed, 40 insertions(+), 8 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/pysim refs/changes/69/9969/2
--
To view, visit https://gerrit.osmocom.org/9969
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: pysim
Gerrit-Branch: master
Gerrit-MessageType: newpatchset
Gerrit-Change-Id: Ice802033adfa6fc1bccc76da47495eb29c3aef6c
Gerrit-Change-Number: 9969
Gerrit-PatchSet: 2
Gerrit-Owner: dexter 


Change in osmocom-bb[master]: Move from libc random() to osmo_get_rand_id

2018-07-11 Thread Holger Freyther
Holger Freyther has submitted this change and it was merged. ( 
https://gerrit.osmocom.org/9914 )

Change subject: Move from libc random() to osmo_get_rand_id
..

Move from libc random() to osmo_get_rand_id

When starting multiple mobile in the same second, the libc random number
generator will be seeded to exactly the same value.

The random bits inside the RACH request(s) will be exactly the same
across multiple mobile and when the channel fails they all pick the same
randomized back-off timing.

Use stronger random numbers and replace all calls to random(2) with
osmo_get_rand_id. Add a fallback to try random().

Change-Id: Ie0cc64663cd4b90c027b79545dc5d3ac9d87b9dd
---
M src/host/layer23/src/mobile/gsm322.c
M src/host/layer23/src/mobile/gsm48_mm.c
M src/host/layer23/src/mobile/gsm48_rr.c
M src/host/layer23/src/mobile/settings.c
4 files changed, 18 insertions(+), 5 deletions(-)

Approvals:
  Holger Freyther: Looks good to me, approved
  Vadim Yanitskiy: Looks good to me, but someone else must approve
  Jenkins Builder: Verified



diff --git a/src/host/layer23/src/mobile/gsm322.c 
b/src/host/layer23/src/mobile/gsm322.c
index c3485b6..ce25cd5 100644
--- a/src/host/layer23/src/mobile/gsm322.c
+++ b/src/host/layer23/src/mobile/gsm322.c
@@ -959,7 +959,9 @@
entries++;
}
while(entries) {
-   move = random() % entries;
+   if (osmo_get_rand_id((uint8_t *) , sizeof(move)) != 0)
+   move = random();
+   move = move % entries;
i = 0;
llist_for_each_entry(temp, _list, entry) {
if (rxlev2dbm(temp->rxlev) > -85) {
diff --git a/src/host/layer23/src/mobile/gsm48_mm.c 
b/src/host/layer23/src/mobile/gsm48_mm.c
index a7af1f5..a36e7e8 100644
--- a/src/host/layer23/src/mobile/gsm48_mm.c
+++ b/src/host/layer23/src/mobile/gsm48_mm.c
@@ -30,6 +30,7 @@
 #include 
 #include 
 #include 
+#include 

 #include 
 #include 
@@ -2099,7 +2100,9 @@
mm->t3212.timeout.tv_sec = current_time.tv_sec
+ (t % s->t3212);
} else {
-   uint32_t rand = random();
+   uint32_t rand;
+   if (osmo_get_rand_id((uint8_t *) , sizeof(rand)) 
!= 0)
+   rand = random();

LOGP(DMM, LOGL_INFO, "New T3212 while timer is not "
"running (value %d)\n", s->t3212);
diff --git a/src/host/layer23/src/mobile/gsm48_rr.c 
b/src/host/layer23/src/mobile/gsm48_rr.c
index dd3fe93..db2cb5e 100644
--- a/src/host/layer23/src/mobile/gsm48_rr.c
+++ b/src/host/layer23/src/mobile/gsm48_rr.c
@@ -71,6 +71,7 @@
 #include 
 #include 
 #include 
+#include 

 #include 
 #include 
@@ -1628,7 +1629,8 @@
}
}

-   chan_req = random();
+   if (osmo_get_rand_id((uint8_t *) _req, sizeof(chan_req)) != 0)
+   chan_req = random();
chan_req &= rr->chan_req_mask;
chan_req |= rr->chan_req_val;

diff --git a/src/host/layer23/src/mobile/settings.c 
b/src/host/layer23/src/mobile/settings.c
index 7370b0a..80b0b48 100644
--- a/src/host/layer23/src/mobile/settings.c
+++ b/src/host/layer23/src/mobile/settings.c
@@ -23,6 +23,7 @@
 #include 
 #include 
 #include 
+#include 

 #include 
 #include 
@@ -178,14 +179,19 @@
 {
int digits = set->imei_random;
char rand[16];
+   long rand_num;

if (digits <= 0)
return 0;
if (digits > 15)
digits = 15;

-   sprintf(rand, "%08ld", random() % 1);
-   sprintf(rand + 8, "%07ld", random() % 1000);
+   if (osmo_get_rand_id((uint8_t *) _num, sizeof(rand_num)) != 0)
+   rand_num = random();
+   sprintf(rand, "%08ld", rand_num % 1);
+   if (osmo_get_rand_id((uint8_t *) _num, sizeof(rand_num)) != 0)
+   rand_num = random();
+   sprintf(rand + 8, "%07ld", rand_num % 1000);

strcpy(set->imei + 15 - digits, rand + 15 - digits);
strncpy(set->imeisv, set->imei, 15);

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

Gerrit-Project: osmocom-bb
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: Ie0cc64663cd4b90c027b79545dc5d3ac9d87b9dd
Gerrit-Change-Number: 9914
Gerrit-PatchSet: 3
Gerrit-Owner: Holger Freyther 
Gerrit-Reviewer: Holger Freyther 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Vadim Yanitskiy 


Change in osmocom-bb[master]: Move from libc random() to osmo_get_rand_id

2018-07-11 Thread Holger Freyther
Holger Freyther has posted comments on this change. ( 
https://gerrit.osmocom.org/9914 )

Change subject: Move from libc random() to osmo_get_rand_id
..


Patch Set 2: Code-Review+2


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

Gerrit-Project: osmocom-bb
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: Ie0cc64663cd4b90c027b79545dc5d3ac9d87b9dd
Gerrit-Change-Number: 9914
Gerrit-PatchSet: 2
Gerrit-Owner: Holger Freyther 
Gerrit-Reviewer: Holger Freyther 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Vadim Yanitskiy 
Gerrit-Comment-Date: Wed, 11 Jul 2018 21:13:07 +
Gerrit-HasComments: No
Gerrit-HasLabels: Yes


Change in pysim[master]: pySim-read: Print exception when reading of EF.MSISDN fails

2018-07-11 Thread dexter
dexter has uploaded this change for review. ( https://gerrit.osmocom.org/9968


Change subject: pySim-read: Print exception when reading of EF.MSISDN fails
..

pySim-read: Print exception when reading of EF.MSISDN fails

At the moment the exception is catched, but there is only a vague
error message printed. However, the exception string usually tells
us the status word, so it is very valuable to see it. Lets make
sure that the exception string is printed here.

Change-Id: Icb30470b1c0eee6a15fc028da820e92bf9ded27a
---
M pySim-read.py
1 file changed, 2 insertions(+), 2 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/pysim refs/changes/68/9968/1

diff --git a/pySim-read.py b/pySim-read.py
index 5ca39ee..561a498 100755
--- a/pySim-read.py
+++ b/pySim-read.py
@@ -134,8 +134,8 @@
print("MSISDN: Not available")
else:
print("MSISDN: Can't read, response code = %s" % (sw,))
-   except:
-   print "MSISDN: Can't read. Probably not existing file"
+   except Exception as e:
+   print "HPLMNAcT: Can't read file -- " + str(e)

# Done for this card and maybe for everything ?
print "Done !\n"

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

Gerrit-Project: pysim
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: Icb30470b1c0eee6a15fc028da820e92bf9ded27a
Gerrit-Change-Number: 9968
Gerrit-PatchSet: 1
Gerrit-Owner: dexter 


Change in pysim[master]: pySim-read: read contents of PLMN related files.

2018-07-11 Thread dexter
dexter has uploaded this change for review. ( https://gerrit.osmocom.org/9969


Change subject: pySim-read: read contents of PLMN related files.
..

pySim-read: read contents of PLMN related files.

The files EF.PLMNsel, EF.PLMNwAcT, EF.OPLMNwAcT, EF.HPLMNAcT are not
yet printed by pysim-read. Lets add support for those files.

Change-Id: Ice802033adfa6fc1bccc76da47495eb29c3aef6c
Related: SYS#4245
---
M pySim-read.py
1 file changed, 39 insertions(+), 8 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/pysim refs/changes/69/9969/1

diff --git a/pySim-read.py b/pySim-read.py
index 561a498..247a4b4 100755
--- a/pySim-read.py
+++ b/pySim-read.py
@@ -107,14 +107,45 @@
else:
print("SMSP: Can't read, response code = %s" % (sw,))

-   # EF.HPLMN
-#  (res, sw) = scc.read_binary(['3f00', '7f20', '6f30'])
-#  if sw == '9000':
-#  print("HPLMN: %s" % (res))
-#  print("HPLMN: %s" % (dec_hplmn(res),))
-#  else:
-#  print("HPLMN: Can't read, response code = %s" % (sw,))
-   # FIXME
+   # EF.PLMNsel
+   try:
+   (res, sw) = scc.read_binary(EF['PLMNsel'])
+   if sw == '9000':
+   print("PLMNsel: %s" % (res))
+   else:
+   print("PLMNsel: Can't read, response code = %s" % (sw,))
+   except Exception as e:
+   print "HPLMNAcT: Can't read file -- " + str(e)
+
+   # EF.PLMNwAcT
+try:
+   (res, sw) = scc.read_binary(EF['PLMNwAcT'])
+   if sw == '9000':
+   print("PLMNwAcT: %s" % (res))
+   else:
+   print("PLMNwAcT: Can't read, response code = %s" % 
(sw,))
+   except Exception as e:
+   print "HPLMNAcT: Can't read file -- " + str(e)
+
+   # EF.OPLMNwAcT
+try:
+   (res, sw) = scc.read_binary(EF['OPLMNwAcT'])
+   if sw == '9000':
+   print("OPLMNwAcT: %s" % (res))
+   else:
+   print("OPLMNwAcT: Can't read, response code = %s" % 
(sw,))
+   except Exception as e:
+   print "HPLMNAcT: Can't read file -- " + str(e)
+
+   # EF.HPLMNAcT
+try:
+   (res, sw) = scc.read_binary(EF['HPLMNAcT'])
+   if sw == '9000':
+   print("HPLMNAcT: %s" % (res))
+   else:
+   print("HPLMNAcT: Can't read, response code = %s" % 
(sw,))
+   except Exception as e:
+   print "HPLMNAcT: Can't read file -- " + str(e)

# EF.ACC
(res, sw) = scc.read_binary(['3f00', '7f20', '6f78'])

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

Gerrit-Project: pysim
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ice802033adfa6fc1bccc76da47495eb29c3aef6c
Gerrit-Change-Number: 9969
Gerrit-PatchSet: 1
Gerrit-Owner: dexter 


Change in pysim[master]: cosmetic: fix excess space in log output (typo)

2018-07-11 Thread dexter
dexter has uploaded this change for review. ( https://gerrit.osmocom.org/9967


Change subject: cosmetic: fix excess space in log output (typo)
..

cosmetic: fix excess space in log output (typo)

There shouldn't be a space between the end of a sentence and a
punctuation mark.

Change-Id: I33f9b8c803ccd185ffa370d235363423d82ba9c7
---
M pySim/transport/__init__.py
1 file changed, 1 insertion(+), 1 deletion(-)



  git pull ssh://gerrit.osmocom.org:29418/pysim refs/changes/67/9967/1

diff --git a/pySim/transport/__init__.py b/pySim/transport/__init__.py
index 9cd23d0..4b932cd 100644
--- a/pySim/transport/__init__.py
+++ b/pySim/transport/__init__.py
@@ -101,5 +101,5 @@
sw_masked = sw_masked + rv[1][i].lower()

if sw.lower() != sw_masked:
-   raise RuntimeError("SW match failed ! Expected %s and 
got %s." % (sw.lower(), rv[1]))
+   raise RuntimeError("SW match failed! Expected %s and 
got %s." % (sw.lower(), rv[1]))
return rv

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

Gerrit-Project: pysim
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: I33f9b8c803ccd185ffa370d235363423d82ba9c7
Gerrit-Change-Number: 9967
Gerrit-PatchSet: 1
Gerrit-Owner: dexter 


Change in python/osmo-python-tests[master]: Introduce script ctrl2cgi.py

2018-07-11 Thread Pau Espin Pedrol
Hello Harald Welte, Jenkins Builder,

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

https://gerrit.osmocom.org/9963

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

Change subject: Introduce script ctrl2cgi.py
..

Introduce script ctrl2cgi.py

This scripts implements a similar proxy to the one already available in
soapy.py, but aiming at converting CTRl into a regular HTTP POST Request
to be handled by a CGI script in the HTTP server.

Furthermore, it includes several improvements over the soapy.py script,
such as using a token to authenticate users and capability to read some
parameters from a cfg file.

Change-Id: I7a83ecb379835e295c8cb4c27c39883783746544
---
M README
A scripts/ctrl2cgi.py
M setup.py
3 files changed, 249 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/python/osmo-python-tests 
refs/changes/63/9963/2
--
To view, visit https://gerrit.osmocom.org/9963
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: python/osmo-python-tests
Gerrit-Branch: master
Gerrit-MessageType: newpatchset
Gerrit-Change-Id: I7a83ecb379835e295c8cb4c27c39883783746544
Gerrit-Change-Number: 9963
Gerrit-PatchSet: 2
Gerrit-Owner: Pau Espin Pedrol 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder


Change in osmo-pcu[master]: tbf: Replace '.' in counter names with ':'

2018-07-11 Thread Pau Espin Pedrol
Pau Espin Pedrol has submitted this change and it was merged. ( 
https://gerrit.osmocom.org/9942 )

Change subject: tbf: Replace '.' in counter names with ':'
..

tbf: Replace '.' in counter names with ':'

The '.' is illegal character in counter names, as they are exported
via CTRL interface, where '.' has a special meaning that cannot be
used by strings comprising the variable name.

Change-Id: Ieb7496e1a30ab4f2bfe36c7b664dcdc034010a15
---
M src/tbf.cpp
1 file changed, 32 insertions(+), 32 deletions(-)

Approvals:
  Jenkins Builder: Verified
  Harald Welte: Looks good to me, approved



diff --git a/src/tbf.cpp b/src/tbf.cpp
index 4b89a43..6792d08 100644
--- a/src/tbf.cpp
+++ b/src/tbf.cpp
@@ -100,49 +100,49 @@
 };

 static const struct rate_ctr_desc tbf_ctr_description[] = {
-{ "rlc.nacked", "RLC Nacked " },
+{ "rlc:nacked", "RLC Nacked " },
 };

 static const struct rate_ctr_desc tbf_dl_gprs_ctr_description[] = {
-{ "gprs.downlink.cs1",  "CS1" },
-{ "gprs.downlink.cs2",  "CS2" },
-{ "gprs.downlink.cs3",  "CS3" },
-{ "gprs.downlink.cs4",  "CS4" },
+{ "gprs:downlink:cs1",  "CS1" },
+{ "gprs:downlink:cs2",  "CS2" },
+{ "gprs:downlink:cs3",  "CS3" },
+{ "gprs:downlink:cs4",  "CS4" },
 };

 static const struct rate_ctr_desc tbf_dl_egprs_ctr_description[] = {
-{ "egprs.downlink.mcs1","MCS1" },
-{ "egprs.downlink.mcs2","MCS2" },
-{ "egprs.downlink.mcs3","MCS3" },
-{ "egprs.downlink.mcs4","MCS4" },
-{ "egprs.downlink.mcs5","MCS5" },
-{ "egprs.downlink.mcs6","MCS6" },
-{ "egprs.downlink.mcs7","MCS7" },
-{ "egprs.downlink.mcs8","MCS8" },
-{ "egprs.downlink.mcs9","MCS9" },
+{ "egprs:downlink:mcs1","MCS1" },
+{ "egprs:downlink:mcs2","MCS2" },
+{ "egprs:downlink:mcs3","MCS3" },
+{ "egprs:downlink:mcs4","MCS4" },
+{ "egprs:downlink:mcs5","MCS5" },
+{ "egprs:downlink:mcs6","MCS6" },
+{ "egprs:downlink:mcs7","MCS7" },
+{ "egprs:downlink:mcs8","MCS8" },
+{ "egprs:downlink:mcs9","MCS9" },
 };

 static const struct rate_ctr_desc tbf_ul_gprs_ctr_description[] = {
-{ "gprs.uplink.cs1",  "CS1" },
-{ "gprs.uplink.cs2",  "CS2" },
-{ "gprs.uplink.cs3",  "CS3" },
-{ "gprs.uplink.cs4",  "CS4" },
+{ "gprs:uplink:cs1",  "CS1" },
+{ "gprs:uplink:cs2",  "CS2" },
+{ "gprs:uplink:cs3",  "CS3" },
+{ "gprs:uplink:cs4",  "CS4" },
 };

 static const struct rate_ctr_desc tbf_ul_egprs_ctr_description[] = {
-{ "egprs.uplink.mcs1","MCS1" },
-{ "egprs.uplink.mcs2","MCS2" },
-{ "egprs.uplink.mcs3","MCS3" },
-{ "egprs.uplink.mcs4","MCS4" },
-{ "egprs.uplink.mcs5","MCS5" },
-{ "egprs.uplink.mcs6","MCS6" },
-{ "egprs.uplink.mcs7","MCS7" },
-{ "egprs.uplink.mcs8","MCS8" },
-{ "egprs.uplink.mcs9","MCS9" },
+{ "egprs:uplink:mcs1","MCS1" },
+{ "egprs:uplink:mcs2","MCS2" },
+{ "egprs:uplink:mcs3","MCS3" },
+{ "egprs:uplink:mcs4","MCS4" },
+{ "egprs:uplink:mcs5","MCS5" },
+{ "egprs:uplink:mcs6","MCS6" },
+{ "egprs:uplink:mcs7","MCS7" },
+{ "egprs:uplink:mcs8","MCS8" },
+{ "egprs:uplink:mcs9","MCS9" },
 };

 static const struct rate_ctr_group_desc tbf_ctrg_desc = {
-"pcu.tbf",
+"pcu:tbf",
 "TBF Statistics",
 OSMO_STATS_CLASS_SUBSCRIBER,
 ARRAY_SIZE(tbf_ctr_description),
@@ -150,7 +150,7 @@
 };

 static const struct rate_ctr_group_desc tbf_dl_gprs_ctrg_desc = {
-"tbf.gprs",
+"tbf:gprs",
 "Data Blocks",
 OSMO_STATS_CLASS_SUBSCRIBER,
 ARRAY_SIZE(tbf_dl_gprs_ctr_description),
@@ -158,7 +158,7 @@
 };

 static const struct 

Change in osmo-pcu[master]: tbf: Use incrementing id for rate_ctr_group_alloc

2018-07-11 Thread Pau Espin Pedrol
Pau Espin Pedrol has submitted this change and it was merged. ( 
https://gerrit.osmocom.org/9943 )

Change subject: tbf: Use incrementing id for rate_ctr_group_alloc
..

tbf: Use incrementing id for rate_ctr_group_alloc

Wrap-around of var handling next id will luckly happen
long after initially assigned TBFs are already released.

Change-Id: I90ef64133986c556c1a529f5b966e847e6cabbad
---
M src/tbf.cpp
1 file changed, 18 insertions(+), 8 deletions(-)

Approvals:
  Jenkins Builder: Verified
  Harald Welte: Looks good to me, approved



diff --git a/src/tbf.cpp b/src/tbf.cpp
index 76137df..4b89a43 100644
--- a/src/tbf.cpp
+++ b/src/tbf.cpp
@@ -51,6 +51,8 @@

 extern void *tall_pcu_ctx;

+static unsigned int next_tbf_ctr_group_id = 0; /* Incrementing group id */
+
 static void tbf_timer_cb(void *_tbf);

 const struct value_string gprs_rlcmac_tbf_poll_state_names[] = {
@@ -922,7 +924,7 @@
"Allocated: trx = %d, ul_slots = %02x, dl_slots = %02x\n",
tbf->trx->trx_no, tbf->ul_slots(), tbf->dl_slots());

-   tbf->m_ctrs = rate_ctr_group_alloc(tbf, _ctrg_desc, 0);
+   tbf->m_ctrs = rate_ctr_group_alloc(tbf, _ctrg_desc, 
next_tbf_ctr_group_id++);
if (!tbf->m_ctrs) {
LOGPTBF(tbf, LOGL_ERROR, "Couldn't allocate TBF counters\n");
return -1;
@@ -1005,8 +1007,10 @@
return NULL;
}

-   tbf->m_ul_egprs_ctrs = rate_ctr_group_alloc(tbf, 
_ul_egprs_ctrg_desc, 0);
-   tbf->m_ul_gprs_ctrs = rate_ctr_group_alloc(tbf, _ul_gprs_ctrg_desc, 
0);
+   tbf->m_ul_egprs_ctrs = rate_ctr_group_alloc(tbf,
+   _ul_egprs_ctrg_desc, 
tbf->m_ctrs->idx);
+   tbf->m_ul_gprs_ctrs = rate_ctr_group_alloc(tbf,
+   _ul_gprs_ctrg_desc, 
tbf->m_ctrs->idx);
if (!tbf->m_ul_egprs_ctrs || !tbf->m_ul_gprs_ctrs) {
LOGPTBF(tbf, LOGL_ERROR, "Couldn't allocate TBF UL counters\n");
talloc_free(tbf);
@@ -1094,14 +1098,18 @@

if (tbf->is_egprs_enabled()) {
tbf->set_window_size();
-   tbf->m_dl_egprs_ctrs = rate_ctr_group_alloc(tbf, 
_dl_egprs_ctrg_desc, 0);
+   tbf->m_dl_egprs_ctrs = rate_ctr_group_alloc(tbf,
+   _dl_egprs_ctrg_desc,
+   tbf->m_ctrs->idx);
if (!tbf->m_dl_egprs_ctrs) {
LOGPTBF(tbf, LOGL_ERROR, "Couldn't allocate EGPRS DL 
counters\n");
talloc_free(tbf);
return NULL;
}
} else {
-   tbf->m_dl_gprs_ctrs = rate_ctr_group_alloc(tbf, 
_dl_gprs_ctrg_desc, 0);
+   tbf->m_dl_gprs_ctrs = rate_ctr_group_alloc(tbf,
+   _dl_gprs_ctrg_desc,
+   tbf->m_ctrs->idx);
if (!tbf->m_dl_gprs_ctrs) {
LOGPTBF(tbf, LOGL_ERROR, "Couldn't allocate GPRS DL 
counters\n");
talloc_free(tbf);
@@ -1569,11 +1577,13 @@
TBF_SET_ASS_STATE_UL(ul_tbf, GPRS_RLCMAC_UL_ASS_SEND_ASS_REJ);
ul_tbf->control_ts = ts;
ul_tbf->trx = trx;
-   ul_tbf->m_ctrs = rate_ctr_group_alloc(ul_tbf, _ctrg_desc, 0);
+   ul_tbf->m_ctrs = rate_ctr_group_alloc(ul_tbf, _ctrg_desc, 
next_tbf_ctr_group_id++);
ul_tbf->m_ul_egprs_ctrs = rate_ctr_group_alloc(ul_tbf,
-   _ul_egprs_ctrg_desc, 0);
+  _ul_egprs_ctrg_desc,
+  ul_tbf->m_ctrs->idx);
ul_tbf->m_ul_gprs_ctrs = rate_ctr_group_alloc(ul_tbf,
-   _ul_gprs_ctrg_desc, 0);
+ _ul_gprs_ctrg_desc,
+ ul_tbf->m_ctrs->idx);
if (!ul_tbf->m_ctrs || !ul_tbf->m_ul_egprs_ctrs || 
!ul_tbf->m_ul_gprs_ctrs) {
LOGPTBF(ul_tbf, LOGL_ERROR, "Cound not allocate TBF UL rate 
counters\n");
talloc_free(ul_tbf);

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

Gerrit-Project: osmo-pcu
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: I90ef64133986c556c1a529f5b966e847e6cabbad
Gerrit-Change-Number: 9943
Gerrit-PatchSet: 2
Gerrit-Owner: Pau Espin Pedrol 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Pau Espin Pedrol 


Change in simtrace2[master]: sniff: add checksum verification for ATR and PPS

2018-07-11 Thread Kévin Redon
Hello Harald Welte, Jenkins Builder,

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

https://gerrit.osmocom.org/9966

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

Change subject: sniff: add checksum verification for ATR and PPS
..

sniff: add checksum verification for ATR and PPS

a checksum error is only signaled in the USB message with the
corresponding flag.

Change-Id: I277868267c3199eea216ab47bdd09fb2fb944b06
---
M firmware/libcommon/include/simtrace_prot.h
M firmware/libcommon/source/sniffer.c
M host/simtrace2-sniff.c
3 files changed, 28 insertions(+), 3 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/simtrace2 refs/changes/66/9966/6
--
To view, visit https://gerrit.osmocom.org/9966
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: simtrace2
Gerrit-Branch: master
Gerrit-MessageType: newpatchset
Gerrit-Change-Id: I277868267c3199eea216ab47bdd09fb2fb944b06
Gerrit-Change-Number: 9966
Gerrit-PatchSet: 6
Gerrit-Owner: Kévin Redon 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder


Change in simtrace2[master]: make adc2uv common

2018-07-11 Thread Harald Welte
Harald Welte has submitted this change and it was merged. ( 
https://gerrit.osmocom.org/9964 )

Change subject: make adc2uv common
..

make adc2uv common

when building the trace app for the simtrace board gcc was outputing
the following error:
libboard/common/source/boardver_adc.c:20:17: warning: 'adc2uv' defined but not 
used [-Wunused-function]
 static uint32_t adc2uv(uint16_t adc)

adc2uv is used by qmod, and defined in two places:
in boardver_adc.c and mode_cardemu.c.

this change will have adc2uv only defined in boardver_adc.c and make
available in the header to be used by mode_cardemu.c.

Change-Id: I8a772638fa8dd02d8bc8b7631de5af5a22647c55
---
M firmware/libboard/common/include/boardver_adc.h
M firmware/libboard/common/source/boardver_adc.c
M firmware/libcommon/source/mode_cardemu.c
3 files changed, 3 insertions(+), 9 deletions(-)

Approvals:
  Jenkins Builder: Verified
  Harald Welte: Looks good to me, approved



diff --git a/firmware/libboard/common/include/boardver_adc.h 
b/firmware/libboard/common/include/boardver_adc.h
index 9b01d0a..956c302 100644
--- a/firmware/libboard/common/include/boardver_adc.h
+++ b/firmware/libboard/common/include/boardver_adc.h
@@ -15,3 +15,4 @@
 #pragma once

 int get_board_version_adc(void);
+uint32_t adc2uv(uint16_t adc);
diff --git a/firmware/libboard/common/source/boardver_adc.c 
b/firmware/libboard/common/source/boardver_adc.c
index f204aa1..51db929 100644
--- a/firmware/libboard/common/source/boardver_adc.c
+++ b/firmware/libboard/common/source/boardver_adc.c
@@ -15,9 +15,8 @@
 #include "board.h"
 #include "boardver_adc.h"

-/* FIXME: share this with mode_cardemu.c */
 #define UV_PER_LSB ((3300 * 1000) / 4096)
-static uint32_t adc2uv(uint16_t adc)
+uint32_t adc2uv(uint16_t adc)
 {
uint32_t uv = (uint32_t) adc * UV_PER_LSB;
return uv;
diff --git a/firmware/libcommon/source/mode_cardemu.c 
b/firmware/libcommon/source/mode_cardemu.c
index c7362cf..b1d9c7a 100644
--- a/firmware/libcommon/source/mode_cardemu.c
+++ b/firmware/libcommon/source/mode_cardemu.c
@@ -17,6 +17,7 @@
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307, USA
  */
 #include "board.h"
+#include "boardver_adc.h"
 #include "simtrace.h"
 #include "ringbuffer.h"
 #include "card_emu.h"
@@ -296,7 +297,6 @@
return 0;
 }

-#define UV_PER_LSB ((3300 * 1000) / 4096)
 #define VCC_UV_THRESH_1V8  150
 #define VCC_UV_THRESH_3V   280

@@ -316,12 +316,6 @@
ci->vcc_uv_last = ci->vcc_uv;
 }

-static uint32_t adc2uv(uint16_t adc)
-{
-   uint32_t uv = (uint32_t) adc * UV_PER_LSB;
-   return uv;
-}
-
 void ADC_IrqHandler(void)
 {
 #ifdef CARDEMU_SECOND_UART

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

Gerrit-Project: simtrace2
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: I8a772638fa8dd02d8bc8b7631de5af5a22647c55
Gerrit-Change-Number: 9964
Gerrit-PatchSet: 5
Gerrit-Owner: Kévin Redon 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder


Change in simtrace2[master]: host sniff: add functions to print flags

2018-07-11 Thread Harald Welte
Harald Welte has submitted this change and it was merged. ( 
https://gerrit.osmocom.org/9946 )

Change subject: host sniff: add functions to print flags
..

host sniff: add functions to print flags

Change-Id: If3c0a4790662bcc64db5ff03adcc033836e16ad0
---
M host/simtrace2-sniff.c
1 file changed, 61 insertions(+), 29 deletions(-)

Approvals:
  Jenkins Builder: Verified
  Harald Welte: Looks good to me, approved



diff --git a/host/simtrace2-sniff.c b/host/simtrace2-sniff.c
index d5fe48a..efb986f 100644
--- a/host/simtrace2-sniff.c
+++ b/host/simtrace2-sniff.c
@@ -94,6 +94,61 @@
return 0;
 }

+const struct value_string change_flags[] = {
+   {
+   .value = SNIFF_CHANGE_FLAG_CARD_INSERT,
+   .str = "card inserted",
+   },
+   {
+   .value = SNIFF_CHANGE_FLAG_CARD_EJECT,
+   .str = "card ejected",
+   },
+   {
+   .value = SNIFF_CHANGE_FLAG_RESET_HOLD,
+   .str = "reset hold",
+   },
+   {
+   .value = SNIFF_CHANGE_FLAG_RESET_RELEASE,
+   .str = "reset release",
+   },
+   {
+   .value = SNIFF_CHANGE_FLAG_TIMEOUT_WT,
+   .str = "data transfer timeout",
+   },
+   {
+   .value = 0,
+   .str = NULL,
+   },
+};
+
+const struct value_string data_flags[] = {
+   {
+   .value = SNIFF_DATA_FLAG_ERROR_INCOMPLETE,
+   .str = "incomplete",
+   },
+   {
+   .value = SNIFF_DATA_FLAG_ERROR_MALFORMED,
+   .str = "malformed",
+   },
+   {
+   .value = 0,
+   .str = NULL,
+   },
+};
+
+static void print_flags(const struct value_string* flag_meanings, uint32_t 
nb_flags, uint32_t flags) {
+   uint32_t i;
+   for (i = 0; i < nb_flags; i++) {
+   if (flags & flag_meanings[i].value) {
+   printf(flag_meanings[i].str);
+   flags &= ~flag_meanings[i].value;
+   if (flags) {
+   printf(", ");
+   }
+   }
+   }
+}
+
 static int process_change(const uint8_t *buf, int len)
 {
/* check if there is enough data for the structure */
@@ -103,22 +158,12 @@
struct sniff_change *change = (struct sniff_change *)buf;

printf("Card state change: ");
-   if (change->flags_CHANGE_FLAG_CARD_INSERT) {
-   printf("card inserted ");
+   if (change->flags) {
+   print_flags(change_flags, ARRAY_SIZE(change_flags), 
change->flags);
+   printf("\n");
+   } else {
+   printf("no changes\n");
}
-   if (change->flags_CHANGE_FLAG_CARD_EJECT) {
-   printf("card ejected ");
-   }
-   if (change->flags_CHANGE_FLAG_RESET_HOLD) {
-   printf("reset hold ");
-   }
-   if (change->flags_CHANGE_FLAG_RESET_RELEASE) {
-   printf("reset release ");
-   }
-   if (change->flags_CHANGE_FLAG_TIMEOUT_WT) {
-   printf("data transfer timeout ");
-   }
-   printf("\n");

return 0;
 }
@@ -176,20 +221,7 @@
}
if (data->flags) {
printf(" (");
-   if (data->flags & SNIFF_DATA_FLAG_ERROR_INCOMPLETE) {
-   printf("incomplete");
-   data->flags &= ~SNIFF_DATA_FLAG_ERROR_INCOMPLETE;
-   if (data->flags) {
-   printf(", ");
-   }
-   }
-   if (data->flags & SNIFF_DATA_FLAG_ERROR_MALFORMED) {
-   printf("malformed");
-   data->flags &= ~SNIFF_DATA_FLAG_ERROR_MALFORMED;
-   if (data->flags) {
-   printf(", ");
-   }
-   }
+   print_flags(data_flags, ARRAY_SIZE(data_flags), data->flags);
printf(")");
}
printf(": ");

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

Gerrit-Project: simtrace2
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: If3c0a4790662bcc64db5ff03adcc033836e16ad0
Gerrit-Change-Number: 9946
Gerrit-PatchSet: 6
Gerrit-Owner: Kévin Redon 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Kévin Redon 


Change in simtrace2[master]: host sniff: add functions to print flags

2018-07-11 Thread Harald Welte
Harald Welte has posted comments on this change. ( 
https://gerrit.osmocom.org/9946 )

Change subject: host sniff: add functions to print flags
..


Patch Set 6: Code-Review+2


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

Gerrit-Project: simtrace2
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: If3c0a4790662bcc64db5ff03adcc033836e16ad0
Gerrit-Change-Number: 9946
Gerrit-PatchSet: 6
Gerrit-Owner: Kévin Redon 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Kévin Redon 
Gerrit-Comment-Date: Wed, 11 Jul 2018 20:32:38 +
Gerrit-HasComments: No
Gerrit-HasLabels: Yes


Change in simtrace2[master]: fix 'ISO_S_IN_ATR not handled' gcc warning

2018-07-11 Thread Harald Welte
Harald Welte has submitted this change and it was merged. ( 
https://gerrit.osmocom.org/9965 )

Change subject: fix 'ISO_S_IN_ATR not handled' gcc warning
..

fix 'ISO_S_IN_ATR not handled' gcc warning

when building the cardem application GCC would output the following warning:
libcommon/source/card_emu.c: In function 'card_emu_process_rx_byte':
libcommon/source/card_emu.c:764:2: warning: enumeration value 'ISO_S_IN_ATR' 
not handled in switch [-Wswitch]
  switch (ch->state) {
  ^~

in card emulation the reader should not send data while the card is
sending its ATR.
this is true for other states already handled (RESET, ...). in
these cases an error message is output.
this behaviour is now the default case as data from the reader is
only expected in 3 cases: ISO_S_WAIT_TPDU, ISO_S_IN_TPDU, and
ISO_S_IN_PTS.

Change-Id: Ifbc8dbe1c9f176343304f211c7e6068fb977961e
---
M firmware/libcommon/source/card_emu.c
1 file changed, 4 insertions(+), 8 deletions(-)

Approvals:
  Jenkins Builder: Verified
  Harald Welte: Looks good to me, approved



diff --git a/firmware/libcommon/source/card_emu.c 
b/firmware/libcommon/source/card_emu.c
index 9291064..94a601a 100644
--- a/firmware/libcommon/source/card_emu.c
+++ b/firmware/libcommon/source/card_emu.c
@@ -762,14 +762,6 @@
ch->stats.rx_bytes++;

switch (ch->state) {
-   case ISO_S_WAIT_POWER:
-   case ISO_S_WAIT_CLK:
-   case ISO_S_WAIT_RST:
-   case ISO_S_WAIT_ATR:
-   TRACE_ERROR("%u: Received UART char in invalid 7816 state "
-   "%u\r\n", ch->num, ch->state);
-   /* we shouldn't receive any data from the reader yet! */
-   break;
case ISO_S_WAIT_TPDU:
if (byte == 0xff) {
new_state = process_byte_pts(ch, byte);
@@ -783,6 +775,10 @@
case ISO_S_IN_PTS:
new_state = process_byte_pts(ch, byte);
goto out_silent;
+   default:
+   TRACE_ERROR("%u: Received UART char in invalid 7816 state "
+   "%u\r\n", ch->num, ch->state);
+   break;
}
 
 out_silent:

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

Gerrit-Project: simtrace2
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: Ifbc8dbe1c9f176343304f211c7e6068fb977961e
Gerrit-Change-Number: 9965
Gerrit-PatchSet: 5
Gerrit-Owner: Kévin Redon 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder


Change in simtrace2[master]: host sniff: add functions to print flags

2018-07-11 Thread Kévin Redon
Kévin Redon has posted comments on this change. ( 
https://gerrit.osmocom.org/9946 )

Change subject: host sniff: add functions to print flags
..


Patch Set 6:

thanks for pointing it out. I wasn't aware of it.
I only used struct value_string and not get_value_string() because I an not 
comparing the end values, but the individual bits (e.g. flags)


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

Gerrit-Project: simtrace2
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: If3c0a4790662bcc64db5ff03adcc033836e16ad0
Gerrit-Change-Number: 9946
Gerrit-PatchSet: 6
Gerrit-Owner: Kévin Redon 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Kévin Redon 
Gerrit-CC: Harald Welte 
Gerrit-Comment-Date: Wed, 11 Jul 2018 20:27:51 +
Gerrit-HasComments: No
Gerrit-HasLabels: No


Change in simtrace2[master]: minor: fix linker warning

2018-07-11 Thread Harald Welte
Harald Welte has submitted this change and it was merged. ( 
https://gerrit.osmocom.org/9925 )

Change subject: minor: fix linker warning
..

minor: fix linker warning

linker warning:
obj/simtrace/dfu_sniffer.o: In function `usb_send_data':
/media/data/work/simtrace2/simtrace2/firmware/libcommon/source/sniffer.c:338: 
warning: undefined reference to `putchar'

Change-Id: I934f3fcb474d4046e921511a024c3a0b8533c782
---
M firmware/libcommon/source/sniffer.c
1 file changed, 1 insertion(+), 1 deletion(-)

Approvals:
  Jenkins Builder: Verified
  Harald Welte: Looks good to me, approved



diff --git a/firmware/libcommon/source/sniffer.c 
b/firmware/libcommon/source/sniffer.c
index 9202d8e..be57d54 100644
--- a/firmware/libcommon/source/sniffer.c
+++ b/firmware/libcommon/source/sniffer.c
@@ -335,7 +335,7 @@
printf(", ");
}
}
-   printf(")");
+   putchar(')');
}
printf(": ");
uint16_t i;

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

Gerrit-Project: simtrace2
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: I934f3fcb474d4046e921511a024c3a0b8533c782
Gerrit-Change-Number: 9925
Gerrit-PatchSet: 6
Gerrit-Owner: Kévin Redon 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder


Change in simtrace2[master]: sniffer: move reset handling from ISR to main loop

2018-07-11 Thread Harald Welte
Harald Welte has submitted this change and it was merged. ( 
https://gerrit.osmocom.org/9922 )

Change subject: sniffer: move reset handling from ISR to main loop
..

sniffer: move reset handling from ISR to main loop

Change-Id: Ia88fb4baf49017524bb201123da3511e5342ba48
---
M firmware/libcommon/source/sniffer.c
1 file changed, 16 insertions(+), 8 deletions(-)

Approvals:
  Jenkins Builder: Verified
  Harald Welte: Looks good to me, approved



diff --git a/firmware/libcommon/source/sniffer.c 
b/firmware/libcommon/source/sniffer.c
index 07bc82d..8262bec 100644
--- a/firmware/libcommon/source/sniffer.c
+++ b/firmware/libcommon/source/sniffer.c
@@ -267,11 +267,9 @@
case ISO7816_S_RESET:
update_fidi(_usart, 0x11); /* reset baud rate to default 
Di/Fi values */
update_wt(10, 1); /* reset WT time-out */
-   change_flags |= SNIFF_CHANGE_FLAG_RESET_HOLD; /* set flag and 
let main loop send it */
break;
case ISO7816_S_WAIT_ATR:
rbuf_reset(_buffer); /* reset buffer for new 
communication */
-   change_flags |= SNIFF_CHANGE_FLAG_RESET_RELEASE; /* set flag 
and let main loop send it */
break;
case ISO7816_S_IN_ATR:
atr_i = 0;
@@ -817,13 +815,9 @@
}
/* Update the ISO state according to the reset change */
if (PIO_Get(_rst)) {
-   if (ISO7816_S_WAIT_ATR != iso_state) {
-   change_state(ISO7816_S_WAIT_ATR);
-   }
+   change_flags |= SNIFF_CHANGE_FLAG_RESET_HOLD; /* set flag and 
let main loop send it */
} else {
-   if (ISO7816_S_RESET != iso_state) {
-   change_state(ISO7816_S_RESET);
-   }
+   change_flags |= SNIFF_CHANGE_FLAG_RESET_RELEASE; /* set flag 
and let main loop send it */
}
 }

@@ -949,6 +943,10 @@
process_any_usb_commands(queue);
*/

+   /* WARNING: the signal data and flags are not synchronized. We have to 
hope 
+* the processing is fast enough to not land in the wrong state while 
data
+* is remaining
+*/
/* Handle sniffed data */
if (!rbuf_is_empty(_buffer)) { /* use if instead of while to let 
the main loop restart the watchdog */
uint8_t byte = rbuf_read(_buffer);
@@ -993,6 +991,16 @@

/* Handle flags */
if (change_flags) { /* WARNING this is not synced with the data buffer 
handling */
+   if (change_flags & SNIFF_CHANGE_FLAG_RESET_HOLD) {
+   if (ISO7816_S_WAIT_ATR != iso_state) {
+   change_state(ISO7816_S_WAIT_ATR);
+   }
+   }
+   if (change_flags & SNIFF_CHANGE_FLAG_RESET_RELEASE) {
+   if (ISO7816_S_RESET != iso_state) {
+   change_state(ISO7816_S_RESET);
+   }
+   }
if (change_flags & SNIFF_CHANGE_FLAG_TIMEOUT_WT) {
/* Use timeout to detect interrupted data transmission 
*/
switch (iso_state) {

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

Gerrit-Project: simtrace2
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: Ia88fb4baf49017524bb201123da3511e5342ba48
Gerrit-Change-Number: 9922
Gerrit-PatchSet: 6
Gerrit-Owner: Kévin Redon 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder


Change in simtrace2[master]: sniffer: move data print before USB send

2018-07-11 Thread Harald Welte
Harald Welte has submitted this change and it was merged. ( 
https://gerrit.osmocom.org/9921 )

Change subject: sniffer: move data print before USB send
..

sniffer: move data print before USB send

when the host software does not retrieve the USB messages the memory
is filled and no new USB messages can be allocated, preventing the
following code to print the message

Change-Id: Ie8946894a84cb853b4f7abb1ca6f32111425
---
M firmware/libcommon/source/sniffer.c
1 file changed, 13 insertions(+), 12 deletions(-)

Approvals:
  Jenkins Builder: Verified
  Harald Welte: Looks good to me, approved



diff --git a/firmware/libcommon/source/sniffer.c 
b/firmware/libcommon/source/sniffer.c
index 4ec56d9..07bc82d 100644
--- a/firmware/libcommon/source/sniffer.c
+++ b/firmware/libcommon/source/sniffer.c
@@ -306,18 +306,6 @@
/* Show activity on LED */
led_blink(LED_GREEN, BLINK_2O_F);

-   /* Send data over USB */
-   struct msgb *usb_msg = usb_msg_alloc_hdr(SIMTRACE_USB_EP_CARD_DATAIN, 
SIMTRACE_MSGC_SNIFF, type);
-   if (!usb_msg) {
-   return;
-   }
-   struct sniff_data *usb_sniff_data = (struct sniff_data *) 
msgb_put(usb_msg, sizeof(*usb_sniff_data));
-   usb_sniff_data->flags = flags;
-   usb_sniff_data->length = length;
-   uint8_t *sniff_data = msgb_put(usb_msg, usb_sniff_data->length);
-   memcpy(sniff_data, data, length);
-   usb_msg_upd_len_and_submit(usb_msg);
-
/* Print message */
switch (type) {
case SIMTRACE_MSGT_SNIFF_ATR:
@@ -357,6 +345,19 @@
printf("%02x ", data[i]);
}
printf("\n\r");
+
+   /* Send data over USB */
+   struct msgb *usb_msg = usb_msg_alloc_hdr(SIMTRACE_USB_EP_CARD_DATAIN, 
SIMTRACE_MSGC_SNIFF, type);
+   if (!usb_msg) {
+   return;
+   }
+   struct sniff_data *usb_sniff_data = (struct sniff_data *) 
msgb_put(usb_msg, sizeof(*usb_sniff_data));
+   usb_sniff_data->flags = flags;
+   usb_sniff_data->length = length;
+   uint8_t *sniff_data = msgb_put(usb_msg, usb_sniff_data->length);
+   memcpy(sniff_data, data, length);
+   usb_msg_upd_len_and_submit(usb_msg);
+
 }

 /*! Send current ATR over USB

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

Gerrit-Project: simtrace2
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: Ie8946894a84cb853b4f7abb1ca6f32111425
Gerrit-Change-Number: 9921
Gerrit-PatchSet: 6
Gerrit-Owner: Kévin Redon 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder


Change in simtrace2[master]: host sniff: add functions to print flags

2018-07-11 Thread Kévin Redon
Hello Jenkins Builder,

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

https://gerrit.osmocom.org/9946

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

Change subject: host sniff: add functions to print flags
..

host sniff: add functions to print flags

Change-Id: If3c0a4790662bcc64db5ff03adcc033836e16ad0
---
M host/simtrace2-sniff.c
1 file changed, 61 insertions(+), 29 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/simtrace2 refs/changes/46/9946/6
--
To view, visit https://gerrit.osmocom.org/9946
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: simtrace2
Gerrit-Branch: master
Gerrit-MessageType: newpatchset
Gerrit-Change-Id: If3c0a4790662bcc64db5ff03adcc033836e16ad0
Gerrit-Change-Number: 9946
Gerrit-PatchSet: 6
Gerrit-Owner: Kévin Redon 
Gerrit-Reviewer: Jenkins Builder
Gerrit-CC: Harald Welte 


Change in simtrace2[master]: LED: add need pattern

2018-07-11 Thread Harald Welte
Harald Welte has submitted this change and it was merged. ( 
https://gerrit.osmocom.org/9923 )

Change subject: LED: add need pattern
..

LED: add need pattern

new LED pattern: off for 200 ms and then on

Change-Id: Id2c40dc20d75ed6f38b735164ad1eb2860dc480c
---
M firmware/libboard/common/include/led.h
M firmware/libboard/common/source/led.c
2 files changed, 13 insertions(+), 0 deletions(-)

Approvals:
  Jenkins Builder: Verified
  Harald Welte: Looks good to me, approved



diff --git a/firmware/libboard/common/include/led.h 
b/firmware/libboard/common/include/led.h
index 0c851f0..339702d 100644
--- a/firmware/libboard/common/include/led.h
+++ b/firmware/libboard/common/include/led.h
@@ -31,6 +31,7 @@
BLINK_200O_F= 7,
BLINK_600O_F= 8,
BLINK_CUSTOM= 9,
+   BLINK_2F_O,
_NUM_LED_BLINK
 };

diff --git a/firmware/libboard/common/source/led.c 
b/firmware/libboard/common/source/led.c
index e3293b6..6772007 100644
--- a/firmware/libboard/common/source/led.c
+++ b/firmware/libboard/common/source/led.c
@@ -73,16 +73,23 @@
 static const struct blink_state bs_3on_1off_3on_1off_3on_30off[] = {
{ 300, 1 }, { 100, 0 }, { 300, 1 }, { 100, 0 }, { 300, 1 }, { 3000, 0 }
 };
+
 static const struct blink_state bs_2on_off[] = {
{ 200, 1 }, { 0, 0 },
 };
+
 static const struct blink_state bs_200on_off[] = {
{ 2, 1 }, { 0, 0 },
 };
+
 static const struct blink_state bs_600on_off[] = {
{ 6, 1 }, { 0, 0 },
 };

+static const struct blink_state bs_2off_on[] = {
+   { 200, 0 }, { 0, 1 },
+};
+

 /* a blink pattern is an array of blink_states */
 struct blink_pattern {
@@ -128,6 +135,11 @@
.states = bs_600on_off,
.size = ARRAY_SIZE(bs_600on_off),
},
+   [BLINK_2F_O] = {
+   .states = bs_2off_on,
+   .size = ARRAY_SIZE(bs_2off_on),
+   },
+
 };

 struct led_state {

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

Gerrit-Project: simtrace2
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: Id2c40dc20d75ed6f38b735164ad1eb2860dc480c
Gerrit-Change-Number: 9923
Gerrit-PatchSet: 6
Gerrit-Owner: Kévin Redon 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder


Change in simtrace2[master]: DFU: use central DFU override check

2018-07-11 Thread Harald Welte
Harald Welte has submitted this change and it was merged. ( 
https://gerrit.osmocom.org/9913 )

Change subject: DFU: use central DFU override check
..

DFU: use central DFU override check

TRACE_INFO will also provide the DFU start reason, but TRACE_INFO
(TRACE_LEVEL >= 4) should only be used for debugging.
WARNING: With TRACE_LEVEL >= 4 the DFU binary is over the maximum of
16 kiB allocated for the DFU bootloader.
Thus make combined will not boot the main application because its
start if after the expecte 16 kiB address; and flashing using DFU
will overwrite the DFU bootloader itself.

Change-Id: I82323e0f76c03f67df7dc8f2b6783166cc25f3aa
---
M firmware/apps/dfu/main.c
M firmware/libboard/common/source/board_cstartup_gnu.c
2 files changed, 51 insertions(+), 28 deletions(-)

Approvals:
  Jenkins Builder: Verified
  Harald Welte: Looks good to me, approved



diff --git a/firmware/apps/dfu/main.c b/firmware/apps/dfu/main.c
index 26cbb8c..467b7dd 100644
--- a/firmware/apps/dfu/main.c
+++ b/firmware/apps/dfu/main.c
@@ -159,22 +159,30 @@
 int USBDFU_OverrideEnterDFU(void)
 {
uint32_t *app_part = (uint32_t *)FLASH_ADDR(0);
+   /* at the first call we are before the text segment has been relocated,
+* so g_dfu is not initialized yet */
+   g_dfu = &_g_dfu;
+   if (USB_DFU_MAGIC == g_dfu->magic) {
+   return 1;
+   }

/* If the loopback jumper is set, we enter DFU mode */
-   if (board_override_enter_dfu())
-   return 1;
+   if (board_override_enter_dfu()) {
+   return 2;
+   }

/* if the first word of the application partition doesn't look
 * like a stack pointer (i.e. point to RAM), enter DFU mode */
-   if ((app_part[0] < IRAM_ADDR) ||
-   ((uint8_t *)app_part[0] > IRAM_END))
-   return 1;
+   if ((app_part[0] < IRAM_ADDR) || ((uint8_t *)app_part[0] > IRAM_END)) {
+   return 3;
+   }

/* if the second word of the application partition doesn't look
 * like a function from flash (reset vector), enter DFU mode */
if (((uint32_t *)app_part[1] < app_part) ||
-   ((uint8_t *)app_part[1] > IFLASH_END))
-   return 1;
+   ((uint8_t *)app_part[1] > IFLASH_END)) {
+   return 4;
+   }

return 0;
 }
@@ -218,7 +226,7 @@

EEFC_ReadUniqueID(g_unique_id);

-printf("\n\r\n\r"
+   printf("\n\r\n\r"

"=\n\r"
"DFU bootloader %s for board %s (C) 2010-2017 by Harald 
Welte\n\r"

"=\n\r",
@@ -230,6 +238,35 @@
   g_unique_id[2], g_unique_id[3]);
TRACE_INFO("Reset Cause: 0x%x\n\r", reset_cause);

+#if (TRACE_LEVEL >= TRACE_LEVEL_INFO)
+   /* Find out why we are in the DFU bootloader, and not the main 
application */
+   TRACE_INFO("DFU bootloader start reason: ");
+   switch (USBDFU_OverrideEnterDFU()) {
+   case 0:
+   /* 0 normally means that there is no override, but we are in 
the bootloader,
+* thus the first check in board_cstartup_gnu did return 
something else than 0.
+* this can only be g_dfu->magic which is erased when the 
segment are
+* relocated, which happens in board_cstartup_gnu just after 
USBDFU_OverrideEnterDFU.
+* no static variable can be used to store this case since this 
will also be overwritten
+*/
+   case 1:
+   TRACE_INFO_WP("DFU switch requested by main application\n\r");
+   break;
+   case 2:
+   TRACE_INFO_WP("bootloader forced (button pressed or jumper 
set)\n\r");
+   break;
+   case 3:
+   TRACE_INFO_WP("stack pointer (first application word) does no 
point in RAM\n\r");
+   break;
+   case 4: // the is no reason
+   TRACE_INFO_WP("reset vector (second application word) does no 
point in flash\n\r");
+   break;
+   default:
+   TRACE_INFO_WP("unknown\n\r");
+   break;
+   }
+#endif
+
/* clear g_dfu on power-up reset */
if (reset_cause == 0)
memset(g_dfu, 0, sizeof(*g_dfu));
diff --git a/firmware/libboard/common/source/board_cstartup_gnu.c 
b/firmware/libboard/common/source/board_cstartup_gnu.c
index 42231fb..bfe59ad 100644
--- a/firmware/libboard/common/source/board_cstartup_gnu.c
+++ b/firmware/libboard/common/source/board_cstartup_gnu.c
@@ -159,26 +159,12 @@
 
 
 #if defined(BOARD_USB_DFU) && defined(APPLICATION_dfu)
-/* we are before the text segment has been relocated, so g_dfu is
- * not initialized yet */
-g_dfu = &_g_dfu;
-if ((g_dfu->magic != USB_DFU_MAGIC) && 

Change in simtrace2[master]: set linux end of line

2018-07-11 Thread Harald Welte
Harald Welte has submitted this change and it was merged. ( 
https://gerrit.osmocom.org/9917 )

Change subject: set linux end of line
..

set linux end of line

Change-Id: I5200f0d6f39b0641cac26a4109a3cd33e8474b9b
---
M firmware/atmel_softpack_libraries/libchip_sam3s/include/efc.h
M firmware/atmel_softpack_libraries/libchip_sam3s/include/flashd.h
M firmware/atmel_softpack_libraries/libchip_sam3s/source/USBD_HAL.c
M firmware/atmel_softpack_libraries/libchip_sam3s/source/efc.c
M firmware/atmel_softpack_libraries/libchip_sam3s/source/exceptions.c
M firmware/atmel_softpack_libraries/libchip_sam3s/source/flashd.c
M firmware/atmel_softpack_libraries/libchip_sam3s/source/pio.c
M firmware/atmel_softpack_libraries/libchip_sam3s/source/pio_it.c
M firmware/atmel_softpack_libraries/libchip_sam3s/source/pmc.c
M firmware/atmel_softpack_libraries/libchip_sam3s/source/spi.c
M firmware/atmel_softpack_libraries/libchip_sam3s/source/tc.c
M firmware/atmel_softpack_libraries/libchip_sam3s/source/usart.c
M firmware/atmel_softpack_libraries/libchip_sam3s/source/wdt.c
M firmware/libboard/common/source/board_cstartup_gnu.c
M firmware/libboard/common/source/board_lowlevel.c
M firmware/libboard/common/source/uart_console.c
16 files changed, 6,071 insertions(+), 6,071 deletions(-)

Approvals:
  Jenkins Builder: Verified
  Harald Welte: Looks good to me, approved




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

Gerrit-Project: simtrace2
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: I5200f0d6f39b0641cac26a4109a3cd33e8474b9b
Gerrit-Change-Number: 9917
Gerrit-PatchSet: 5
Gerrit-Owner: Kévin Redon 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder


Change in simtrace2[master]: host sniff: process remaining usb messages in buffer

2018-07-11 Thread Harald Welte
Harald Welte has submitted this change and it was merged. ( 
https://gerrit.osmocom.org/9945 )

Change subject: host sniff: process remaining usb messages in buffer
..

host sniff: process remaining usb messages in buffer

Change-Id: I1746c0187b2e5dbef44b4b336fee3bd9ded15079
---
M host/simtrace2-sniff.c
1 file changed, 6 insertions(+), 3 deletions(-)

Approvals:
  Jenkins Builder: Verified
  Harald Welte: Looks good to me, approved



diff --git a/host/simtrace2-sniff.c b/host/simtrace2-sniff.c
index eb547b0..d5fe48a 100644
--- a/host/simtrace2-sniff.c
+++ b/host/simtrace2-sniff.c
@@ -276,12 +276,15 @@
if (xfer_len > 0) {
//printf("URB: %s\n", osmo_hexdump([buf_i], 
xfer_len));
buf_i += xfer_len;
-   if (buf_i>=sizeof(buf)) {
+   if (buf_i >= sizeof(buf)) {
perror("preventing USB buffer overflow");
return;
}
-   int processed = process_usb_msg(buf, buf_i);
-   if (processed > 0 && processed <= buf_i) {
+   int processed;
+   while ((processed = process_usb_msg(buf, buf_i)) > 0) {
+   if (processed > buf_i) {
+   break;
+   }
for (i = processed; i < buf_i; i++) {
buf[i-processed] = buf[i];
}

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

Gerrit-Project: simtrace2
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: I1746c0187b2e5dbef44b4b336fee3bd9ded15079
Gerrit-Change-Number: 9945
Gerrit-PatchSet: 5
Gerrit-Owner: Kévin Redon 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder


Change in simtrace2[master]: USB: add flags for sniff data and centralise transfer

2018-07-11 Thread Harald Welte
Harald Welte has submitted this change and it was merged. ( 
https://gerrit.osmocom.org/9920 )

Change subject: USB: add flags for sniff data and centralise transfer
..

USB: add flags for sniff data and centralise transfer

Also fix issue in usb_msg_alloc_hdr and add cosmetic spaces around
operations.

Change-Id: I768a0ad639aa5e648a630af72d01f7b68082b6b6
---
M firmware/libcommon/include/simtrace_prot.h
M firmware/libcommon/source/sniffer.c
M host/simtrace2-sniff.c
3 files changed, 140 insertions(+), 142 deletions(-)

Approvals:
  Jenkins Builder: Verified
  Harald Welte: Looks good to me, approved



diff --git a/firmware/libcommon/include/simtrace_prot.h 
b/firmware/libcommon/include/simtrace_prot.h
index 1e9d72f..f1f736b 100644
--- a/firmware/libcommon/include/simtrace_prot.h
+++ b/firmware/libcommon/include/simtrace_prot.h
@@ -294,6 +294,9 @@
 #define SNIFF_CHANGE_FLAG_RESET_HOLD (1<<2)
 #define SNIFF_CHANGE_FLAG_RESET_RELEASE (1<<3)
 #define SNIFF_CHANGE_FLAG_TIMEOUT_WT (1<<4)
+/* SIMTRACE_MSGT_SNIFF_ATR, SIMTRACE_MSGT_SNIFF_PPS, SIMTRACE_MSGT_SNIFF_TPDU 
flags */
+#define SNIFF_DATA_FLAG_ERROR_INCOMPLETE (1<<5)
+#define SNIFF_DATA_FLAG_ERROR_MALFORMED (1<<6)

 /* SIMTRACE_MSGT_SNIFF_CHANGE */
 struct sniff_change {
@@ -309,8 +312,8 @@

 /* SIMTRACE_MSGT_SNIFF_ATR, SIMTRACE_MSGT_SNIFF_PPS, SIMTRACE_MSGT_SNIFF_TPDU 
*/
 struct sniff_data {
-   /* if the data is complete (an error might have occurred during 
transmission */
-   bool complete;
+   /* data flags */
+   uint32_t flags;
/* data length */
uint16_t length;
/* data */
diff --git a/firmware/libcommon/source/sniffer.c 
b/firmware/libcommon/source/sniffer.c
index 81a6712..4ec56d9 100644
--- a/firmware/libcommon/source/sniffer.c
+++ b/firmware/libcommon/source/sniffer.c
@@ -234,8 +234,8 @@
usb_msg->l1h = msgb_put(usb_msg, sizeof(*usb_msg_header));
usb_msg_header = (struct simtrace_msg_hdr *) usb_msg->l1h;
memset(usb_msg_header, 0, sizeof(*usb_msg_header));
-   usb_msg_header->msg_class = SIMTRACE_MSGC_SNIFF;
-   usb_msg_header->msg_type = SIMTRACE_MSGT_SNIFF_CHANGE;
+   usb_msg_header->msg_class = msg_class;
+   usb_msg_header->msg_type = msg_type;
usb_msg->l2h = usb_msg->l1h + sizeof(*usb_msg_header);

return usb_msg;
@@ -296,11 +296,74 @@
//TRACE_INFO("Changed to ISO 7816-3 state %u\n\r", iso_state); /* don't 
print since this is function is also called by ISRs */
 }

+static void usb_send_data(enum simtrace_msg_type_sniff type, const uint8_t* 
data, uint16_t length, uint32_t flags)
+{
+   /* Sanity check */
+   if (type != SIMTRACE_MSGT_SNIFF_ATR && type != SIMTRACE_MSGT_SNIFF_PPS 
&& type != SIMTRACE_MSGT_SNIFF_TPDU) {
+   return;
+   }
+
+   /* Show activity on LED */
+   led_blink(LED_GREEN, BLINK_2O_F);
+
+   /* Send data over USB */
+   struct msgb *usb_msg = usb_msg_alloc_hdr(SIMTRACE_USB_EP_CARD_DATAIN, 
SIMTRACE_MSGC_SNIFF, type);
+   if (!usb_msg) {
+   return;
+   }
+   struct sniff_data *usb_sniff_data = (struct sniff_data *) 
msgb_put(usb_msg, sizeof(*usb_sniff_data));
+   usb_sniff_data->flags = flags;
+   usb_sniff_data->length = length;
+   uint8_t *sniff_data = msgb_put(usb_msg, usb_sniff_data->length);
+   memcpy(sniff_data, data, length);
+   usb_msg_upd_len_and_submit(usb_msg);
+
+   /* Print message */
+   switch (type) {
+   case SIMTRACE_MSGT_SNIFF_ATR:
+   printf("ATR");
+   break;
+   case SIMTRACE_MSGT_SNIFF_PPS:
+   printf("PPS");
+   break;
+   case SIMTRACE_MSGT_SNIFF_TPDU:
+   printf("TPDU");
+   break;
+   default:
+   printf("???");
+   break;
+   }
+   if (flags) {
+   printf(" (");
+   if (flags & SNIFF_DATA_FLAG_ERROR_INCOMPLETE) {
+   printf("incomplete");
+   flags &= ~SNIFF_DATA_FLAG_ERROR_INCOMPLETE;
+   if (flags) {
+   printf(", ");
+   }
+   }
+   if (flags & SNIFF_DATA_FLAG_ERROR_MALFORMED) {
+   printf("malformed");
+   flags &= ~SNIFF_DATA_FLAG_ERROR_MALFORMED;
+   if (flags) {
+   printf(", ");
+   }
+   }
+   printf(")");
+   }
+   printf(": ");
+   uint16_t i;
+   for (i = 0; i < length; i++) {
+   printf("%02x ", data[i]);
+   }
+   printf("\n\r");
+}
+
 /*! Send current ATR over USB
- *  @param[in] complete if the ATR is complete
+ *  @param[in] flags SNIFF_DATA_FLAG_ data flags
  *  @note Also print the ATR to debug console
  */
-static void usb_send_atr(bool complete)
+static void 

Change in simtrace2[master]: sniffer: set LED pattern

2018-07-11 Thread Harald Welte
Harald Welte has submitted this change and it was merged. ( 
https://gerrit.osmocom.org/9924 )

Change subject: sniffer: set LED pattern
..

sniffer: set LED pattern

The red and green LEDs are now used as follows:
- red on = power (firmware is running)
- red blink = error detected (e.g. during ISO-7816 parsing)
- green on = running (sniffer mode is running)
- green blink = activity (e.g. USB message sent)

Change-Id: Ib1b6ff87fb92d6ed3ecae4bc89386206aaab508e
---
M firmware/apps/trace/main.c
M firmware/libcommon/source/sniffer.c
2 files changed, 8 insertions(+), 3 deletions(-)

Approvals:
  Jenkins Builder: Verified
  Harald Welte: Looks good to me, approved



diff --git a/firmware/apps/trace/main.c b/firmware/apps/trace/main.c
index 6b6d70b..f7eb15d 100644
--- a/firmware/apps/trace/main.c
+++ b/firmware/apps/trace/main.c
@@ -142,10 +142,15 @@
enum confNum last_simtrace_config = simtrace_config;
unsigned int i = 0;

-   /* Configure LED output (red = on, green = activity */
+   /* Configure LED output
+* red on = power
+* red blink = error
+* green on = running
+* green blink = activity
+*/
led_init();
led_blink(LED_RED, BLINK_ALWAYS_ON);
-   led_blink(LED_GREEN, BLINK_ALWAYS_OFF);
+   led_blink(LED_GREEN, BLINK_ALWAYS_ON);

/* Enable watchdog for 2000 ms, with no window */
WDT_Enable(WDT, WDT_MR_WDRSTEN | WDT_MR_WDDBGHLT | WDT_MR_WDIDLEHLT |
diff --git a/firmware/libcommon/source/sniffer.c 
b/firmware/libcommon/source/sniffer.c
index 8262bec..9202d8e 100644
--- a/firmware/libcommon/source/sniffer.c
+++ b/firmware/libcommon/source/sniffer.c
@@ -302,7 +302,7 @@
}

/* Show activity on LED */
-   led_blink(LED_GREEN, BLINK_2O_F);
+   led_blink(LED_GREEN, BLINK_2F_O);

/* Print message */
switch (type) {

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

Gerrit-Project: simtrace2
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: Ib1b6ff87fb92d6ed3ecae4bc89386206aaab508e
Gerrit-Change-Number: 9924
Gerrit-PatchSet: 6
Gerrit-Owner: Kévin Redon 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder


Change in simtrace2[master]: cosmetic: put spaces around operations

2018-07-11 Thread Harald Welte
Harald Welte has submitted this change and it was merged. ( 
https://gerrit.osmocom.org/9919 )

Change subject: cosmetic: put spaces around operations
..

cosmetic: put spaces around operations

Change-Id: If5ba5f8d16680e8403944274336ea595017063db
---
M firmware/libcommon/source/sniffer.c
1 file changed, 72 insertions(+), 72 deletions(-)

Approvals:
  Jenkins Builder: Verified
  Harald Welte: Looks good to me, approved



diff --git a/firmware/libcommon/source/sniffer.c 
b/firmware/libcommon/source/sniffer.c
index 5ab60bb..81a6712 100644
--- a/firmware/libcommon/source/sniffer.c
+++ b/firmware/libcommon/source/sniffer.c
@@ -208,10 +208,10 @@
static uint8_t wt_wi = 10; /* Waiting time Integer (WI), used to 
calculate the Waiting Time (WT) */
static uint8_t wt_d = 1; /* baud rate adjustment integer (the actual 
value, not the table index) */

-   if (0!=wi) {
+   if (0 != wi) {
wt_wi = wi;
}
-   if (0!=d) {
+   if (0 != d) {
wt_d = d;
}
wt = wt_wi*960UL*wt_d;
@@ -257,7 +257,7 @@
 static void change_state(enum iso7816_3_sniff_state iso_state_new)
 {
/* sanity check */
-   if (iso_state_new==iso_state) {
+   if (iso_state_new == iso_state) {
TRACE_WARNING("Already in ISO 7816 state %u\n\r", iso_state);
return;
}
@@ -303,11 +303,11 @@
 static void usb_send_atr(bool complete)
 {
/* Check state */
-   if (ISO7816_S_IN_ATR!=iso_state) {
+   if (ISO7816_S_IN_ATR != iso_state) {
TRACE_WARNING("Can't print ATR in ISO 7816-3 state %u\n\r", 
iso_state);
return;
}
-   if (atr_i>=ARRAY_SIZE(atr)) {
+   if (atr_i >= ARRAY_SIZE(atr)) {
TRACE_ERROR("ATR buffer overflow\n\r");
return;
}
@@ -346,11 +346,11 @@
static uint8_t i = 0; /* interface byte subgroup number */

/* sanity check */
-   if (ISO7816_S_IN_ATR!=iso_state) {
+   if (ISO7816_S_IN_ATR != iso_state) {
TRACE_ERROR("Processing ATR data in wrong ISO 7816-3 state 
%u\n\r", iso_state);
return;
}
-   if (atr_i>=ARRAY_SIZE(atr)) {
+   if (atr_i >= ARRAY_SIZE(atr)) {
TRACE_ERROR("ATR data overflow\n\r");
return;
}
@@ -377,37 +377,37 @@
break;
case ATR_S_WAIT_T0: /* see ISO/IEC 7816-3:2006 section 8.2.2 */
case ATR_S_WAIT_TD: /* see ISO/IEC 7816-3:2006 section 8.2.3 */
-   if (ATR_S_WAIT_T0==atr_state) {
-   atr_hist_len = (byte&0x0f); /* save the number of 
historical bytes */
-   } else if (ATR_S_WAIT_TD==atr_state) {
-   t_protocol_support |= (1<<(byte&0x0f)); /* remember 
supported protocol to know if TCK will be present */
+   if (ATR_S_WAIT_T0 == atr_state) {
+   atr_hist_len = (byte & 0x0f); /* save the number of 
historical bytes */
+   } else if (ATR_S_WAIT_TD == atr_state) {
+   t_protocol_support |= (1<<(byte & 0x0f)); /* remember 
supported protocol to know if TCK will be present */
}
-   y = (byte&0xf0); /* remember upcoming interface bytes */
+   y = (byte & 0xf0); /* remember upcoming interface bytes */
i++; /* next interface byte sub-group is coming */
-   if (y&0x10) {
+   if (y & 0x10) {
atr_state = ATR_S_WAIT_TA; /* wait for interface byte 
TA */
break;
}
case ATR_S_WAIT_TA: /* see ISO/IEC 7816-3:2006 section 8.2.3 */
-   if (y&0x20) {
+   if (y & 0x20) {
atr_state = ATR_S_WAIT_TB; /* wait for interface byte 
TB */
break;
}
case ATR_S_WAIT_TB: /* see ISO/IEC 7816-3:2006 section 8.2.3 */
-   if (y&0x40) {
+   if (y & 0x40) {
atr_state = ATR_S_WAIT_TC; /* wait for interface byte 
TC */
break;
}
case ATR_S_WAIT_TC: /* see ISO/IEC 7816-3:2006 section 8.2.3 */
/* retrieve WI encoded in TC2*/
if (ATR_S_WAIT_TC==atr_state && 2==i) {
-   if (0==byte) {
+   if (0 == byte) {
update_wt(10, 0);
} else {
update_wt(byte, 0);
}
}
-   if (y&0x80) {
+   if (y & 0x80) {
atr_state = ATR_S_WAIT_TD; /* wait for interface byte 
TD */
break;
} else if (atr_hist_len) {
@@ -418,8 +418,8 @@
if (atr_hist_len) {
atr_hist_len--;

Change in simtrace2[master]: sniffer: also send malformed message over USB

2018-07-11 Thread Harald Welte
Harald Welte has submitted this change and it was merged. ( 
https://gerrit.osmocom.org/9926 )

Change subject: sniffer: also send malformed message over USB
..

sniffer: also send malformed message over USB

Change-Id: I124c8db1d2f836e185630bbe8b5e52eb085d702a
---
M firmware/libcommon/source/sniffer.c
1 file changed, 15 insertions(+), 1 deletion(-)

Approvals:
  Jenkins Builder: Verified
  Harald Welte: Looks good to me, approved



diff --git a/firmware/libcommon/source/sniffer.c 
b/firmware/libcommon/source/sniffer.c
index be57d54..1c691af 100644
--- a/firmware/libcommon/source/sniffer.c
+++ b/firmware/libcommon/source/sniffer.c
@@ -412,8 +412,11 @@
atr_state = ATR_S_WAIT_T0; /* wait for format byte */
break;
default:
-   atr_i--; /* revert last byte */
TRACE_WARNING("Invalid TS received\n\r");
+   led_blink(LED_RED, BLINK_2F_O); /* indicate error to 
user */
+   usb_send_atr(SNIFF_DATA_FLAG_ERROR_MALFORMED); /* send 
ATR to host software using USB */
+   change_state(ISO7816_S_WAIT_ATR); /* reset state */
+   break;
}
i = 0; /* first interface byte sub-group is coming (T0 is kind 
of TD0) */
break;
@@ -559,6 +562,8 @@
pps_state = PPS_S_WAIT_PPS0; /* go to next state */
} else {
TRACE_INFO("Invalid PPSS received\n\r");
+   led_blink(LED_RED, BLINK_2F_O); /* indicate error to 
user */
+   usb_send_pps(SNIFF_DATA_FLAG_ERROR_MALFORMED); /* send 
ATR to host software using USB */
change_state(ISO7816_S_WAIT_TPDU); /* go back to TPDU 
state */
}
break;
@@ -670,6 +675,8 @@
case TPDU_S_CLA:
if (0xff == byte) {
TRACE_WARNING("0xff is not a valid class byte\n\r");
+   led_blink(LED_RED, BLINK_2F_O); /* indicate error to 
user */
+   usb_send_tpdu(SNIFF_DATA_FLAG_ERROR_MALFORMED); /* send 
ATR to host software using USB */
change_state(ISO7816_S_WAIT_TPDU); /* go back to TPDU 
state */
return;
}
@@ -680,6 +687,8 @@
case TPDU_S_INS:
if ((0x60 == (byte & 0xf0)) || (0x90 == (byte & 0xf0))) {
TRACE_WARNING("invalid CLA 0x%02x\n\r", byte);
+   led_blink(LED_RED, BLINK_2F_O); /* indicate error to 
user */
+   usb_send_tpdu(SNIFF_DATA_FLAG_ERROR_MALFORMED); /* send 
ATR to host software using USB */
change_state(ISO7816_S_WAIT_TPDU); /* go back to TPDU 
state */
return;
}
@@ -718,6 +727,8 @@
tpdu_state = TPDU_S_SW2;
} else {
TRACE_WARNING("invalid SW1 0x%02x\n\r", byte);
+   led_blink(LED_RED, BLINK_2F_O); /* indicate error to 
user */
+   usb_send_tpdu(SNIFF_DATA_FLAG_ERROR_MALFORMED); /* send 
ATR to host software using USB */
change_state(ISO7816_S_WAIT_TPDU); /* go back to TPDU 
state */
return;
}
@@ -1005,15 +1016,18 @@
/* Use timeout to detect interrupted data transmission 
*/
switch (iso_state) {
case ISO7816_S_IN_ATR:
+   led_blink(LED_RED, BLINK_2F_O); /* indicate 
error to user */
usb_send_atr(SNIFF_DATA_FLAG_ERROR_INCOMPLETE); 
/* send incomplete ATR to host software using USB */
change_state(ISO7816_S_WAIT_ATR);
break;
case ISO7816_S_IN_TPDU:
+   led_blink(LED_RED, BLINK_2F_O); /* indicate 
error to user */

usb_send_tpdu(SNIFF_DATA_FLAG_ERROR_INCOMPLETE); /* send incomplete PPS to host 
software using USB */
change_state(ISO7816_S_WAIT_TPDU);
break;
case ISO7816_S_IN_PPS_REQ:
case ISO7816_S_IN_PPS_RSP:
+   led_blink(LED_RED, BLINK_2F_O); /* indicate 
error to user */
usb_send_pps(SNIFF_DATA_FLAG_ERROR_INCOMPLETE); 
/* send incomplete TPDU to host software using USB */
change_state(ISO7816_S_WAIT_TPDU);
break;

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

Gerrit-Project: simtrace2

Change in simtrace2[master]: sniffer: only allocate USB message if queue is not too long

2018-07-11 Thread Harald Welte
Harald Welte has submitted this change and it was merged. ( 
https://gerrit.osmocom.org/9927 )

Change subject: sniffer: only allocate USB message if queue is not too long
..

sniffer: only allocate USB message if queue is not too long

When the host does not retrieved the USB messages, they keep getting
queue in the firmware, filling the RAM, and preventing further memory
to be allocated.

Change-Id: I0e447acdf757dcb5dc5c4d8b84a4235866914cad
---
M firmware/libcommon/source/sniffer.c
1 file changed, 8 insertions(+), 0 deletions(-)

Approvals:
  Jenkins Builder: Verified
  Harald Welte: Looks good to me, approved



diff --git a/firmware/libcommon/source/sniffer.c 
b/firmware/libcommon/source/sniffer.c
index 1c691af..0ca71a5 100644
--- a/firmware/libcommon/source/sniffer.c
+++ b/firmware/libcommon/source/sniffer.c
@@ -226,6 +226,14 @@
  */
 static struct msgb *usb_msg_alloc_hdr(uint8_t ep, uint8_t msg_class, uint8_t 
msg_type)
 {
+   /* Only allocate message if not too many are already in the queue */
+   struct llist_head *head = usb_get_queue(SIMTRACE_USB_EP_CARD_DATAIN);
+   if (!head) {
+   return NULL;
+   }
+   if (llist_count(head) > 5) {
+   return NULL;
+   }
struct msgb *usb_msg = usb_buf_alloc(SIMTRACE_USB_EP_CARD_DATAIN);
if (!usb_msg) {
return NULL;

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

Gerrit-Project: simtrace2
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: I0e447acdf757dcb5dc5c4d8b84a4235866914cad
Gerrit-Change-Number: 9927
Gerrit-PatchSet: 6
Gerrit-Owner: Kévin Redon 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder


Change in simtrace2[master]: sniffer: fix inverted reset meaning

2018-07-11 Thread Harald Welte
Harald Welte has submitted this change and it was merged. ( 
https://gerrit.osmocom.org/9944 )

Change subject: sniffer: fix inverted reset meaning
..

sniffer: fix inverted reset meaning

Change-Id: I860e2e29c059e1e0ec126695bb68d489891a17da
---
M firmware/libcommon/source/sniffer.c
1 file changed, 7 insertions(+), 7 deletions(-)

Approvals:
  Jenkins Builder: Verified
  Harald Welte: Looks good to me, approved



diff --git a/firmware/libcommon/source/sniffer.c 
b/firmware/libcommon/source/sniffer.c
index 0ca71a5..c58b047 100644
--- a/firmware/libcommon/source/sniffer.c
+++ b/firmware/libcommon/source/sniffer.c
@@ -832,11 +832,11 @@
TRACE_ERROR("Pin other than reset caused a interrupt\n\r");
return;
}
-   /* Update the ISO state according to the reset change */
+   /* Update the ISO state according to the reset change (reset is active 
low) */
if (PIO_Get(_rst)) {
-   change_flags |= SNIFF_CHANGE_FLAG_RESET_HOLD; /* set flag and 
let main loop send it */
-   } else {
change_flags |= SNIFF_CHANGE_FLAG_RESET_RELEASE; /* set flag 
and let main loop send it */
+   } else {
+   change_flags |= SNIFF_CHANGE_FLAG_RESET_HOLD; /* set flag and 
let main loop send it */
}
 }

@@ -1011,13 +1011,13 @@
/* Handle flags */
if (change_flags) { /* WARNING this is not synced with the data buffer 
handling */
if (change_flags & SNIFF_CHANGE_FLAG_RESET_HOLD) {
-   if (ISO7816_S_WAIT_ATR != iso_state) {
-   change_state(ISO7816_S_WAIT_ATR);
+   if (ISO7816_S_RESET != iso_state) {
+   change_state(ISO7816_S_RESET);
}
}
if (change_flags & SNIFF_CHANGE_FLAG_RESET_RELEASE) {
-   if (ISO7816_S_RESET != iso_state) {
-   change_state(ISO7816_S_RESET);
+   if (ISO7816_S_WAIT_ATR != iso_state) {
+   change_state(ISO7816_S_WAIT_ATR);
}
}
if (change_flags & SNIFF_CHANGE_FLAG_TIMEOUT_WT) {

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

Gerrit-Project: simtrace2
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: I860e2e29c059e1e0ec126695bb68d489891a17da
Gerrit-Change-Number: 9944
Gerrit-PatchSet: 5
Gerrit-Owner: Kévin Redon 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder


Change in simtrace2[master]: host: set license to GPLv2+

2018-07-11 Thread Harald Welte
Harald Welte has submitted this change and it was merged. ( 
https://gerrit.osmocom.org/9915 )

Change subject: host: set license to GPLv2+
..

host: set license to GPLv2+

Change-Id: I0948d74874af1d3a0f1b4cbcb4a838e4ecd9fe3f
---
M host/apdu_dispatch.c
M host/apdu_dispatch.h
M host/libusb_util.c
M host/libusb_util.h
M host/simtrace2-discovery.c
M host/simtrace2-discovery.h
M host/simtrace2-remsim.c
M host/simtrace2-sniff.c
M host/simtrace2_usb.c
M host/usb2udp.c
10 files changed, 153 insertions(+), 40 deletions(-)

Approvals:
  Jenkins Builder: Verified
  Harald Welte: Looks good to me, approved



diff --git a/host/apdu_dispatch.c b/host/apdu_dispatch.c
index 6bdba9f..7c7ed01 100644
--- a/host/apdu_dispatch.c
+++ b/host/apdu_dispatch.c
@@ -2,20 +2,20 @@
  *
  * (C) 2016 by Harald Welte 
  *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License version 2
- *  as published by the Free Software Foundation
+ * 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.
+ * 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., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ * 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 
diff --git a/host/apdu_dispatch.h b/host/apdu_dispatch.h
index c76c8ec..2c99858 100644
--- a/host/apdu_dispatch.h
+++ b/host/apdu_dispatch.h
@@ -1,3 +1,21 @@
+/* apdu_dispatch - State machine to determine Rx/Tx phases of APDU
+ *
+ * (C) 2016 by Harald Welte 
+ *
+ * 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.
+ */
 #pragma once

 #include 
diff --git a/host/libusb_util.c b/host/libusb_util.c
index 5ee685e..8565372 100644
--- a/host/libusb_util.c
+++ b/host/libusb_util.c
@@ -1,3 +1,21 @@
+/* libisb utilities
+ *
+ * (C) 2010-2016 by Harald Welte 
+ *
+ * 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 
diff --git a/host/libusb_util.h b/host/libusb_util.h
index 5bbe3cb..2b2d92e 100644
--- a/host/libusb_util.h
+++ b/host/libusb_util.h
@@ -1,3 +1,21 @@
+/* libisb utilities
+ *
+ * (C) 2010-2016 by Harald Welte 
+ *
+ * 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
+ * 

Change in simtrace2[master]: host: set license to GPLv2+

2018-07-11 Thread Harald Welte
Harald Welte has posted comments on this change. ( 
https://gerrit.osmocom.org/9915 )

Change subject: host: set license to GPLv2+
..


Patch Set 5: Code-Review+2


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

Gerrit-Project: simtrace2
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I0948d74874af1d3a0f1b4cbcb4a838e4ecd9fe3f
Gerrit-Change-Number: 9915
Gerrit-PatchSet: 5
Gerrit-Owner: Kévin Redon 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Kévin Redon 
Gerrit-Comment-Date: Wed, 11 Jul 2018 20:24:42 +
Gerrit-HasComments: No
Gerrit-HasLabels: Yes


Change in osmo-sgsn[master]: osmo-sgsn: ping GGSN periodically and check for restart counter

2018-07-11 Thread Pau Espin Pedrol
Pau Espin Pedrol has posted comments on this change. ( 
https://gerrit.osmocom.org/9934 )

Change subject: osmo-sgsn: ping GGSN periodically and check for restart counter
..


Set Ready For Review


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

Gerrit-Project: osmo-sgsn
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I9d714726785407859f26bbef052cd0efc28e8dae
Gerrit-Change-Number: 9934
Gerrit-PatchSet: 2
Gerrit-Owner: Pau Espin Pedrol 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Comment-Date: Wed, 11 Jul 2018 20:23:45 +
Gerrit-HasComments: No
Gerrit-HasLabels: No


Change in osmo-ttcn3-hacks[master]: lib: GTP_Emulation: Allow receiving packets with TEID 0

2018-07-11 Thread Pau Espin Pedrol
Pau Espin Pedrol has submitted this change and it was merged. ( 
https://gerrit.osmocom.org/9949 )

Change subject: lib: GTP_Emulation: Allow receiving packets with TEID 0
..

lib: GTP_Emulation: Allow receiving packets with TEID 0

Some GTP messages like Echo Request, Echo Reply and Ind Error don't use
the TEID value. According to 3GPP TS 29.060 sec 9.3.1 in those cases the TEID is
set to 0:

"""
- TEID: Contains the Tunnel Endpoint Identifier for the tunnel to which this 
T-PDU belongs. The TEID shall be
used by the receiving entity to find the PDP context, except for the following 
cases:
- The Echo Request/Response and Supported Extension Headers notification 
messages, where the Tunnel
Endpoint Identifier shall be set to all zeroes.
- The Error Indication message where the Tunnel Endpoint Identifier shall be 
set to all zeros.
"""

Change-Id: Ic702b78028e850ed961ef805f35e10a42da34e56
---
M library/GTP_Emulation.ttcn
1 file changed, 11 insertions(+), 2 deletions(-)

Approvals:
  Harald Welte: Looks good to me, approved
  Jenkins Builder: Verified



diff --git a/library/GTP_Emulation.ttcn b/library/GTP_Emulation.ttcn
index 534fdef..615309a 100644
--- a/library/GTP_Emulation.ttcn
+++ b/library/GTP_Emulation.ttcn
@@ -185,10 +185,19 @@
var template hexstring imsi_t := 
f_gtpc_extract_imsi(g1c_ud.gtpc);
if (isvalue(imsi_t)) {
vc_conn := f_comp_by_imsi(valueof(imsi_t));
-   } else {
+   CLIENT.send(g1c_ud) to vc_conn;
+   } else if(g1c_ud.gtpc.teid != int2oct(0, 4)) {
vc_conn := f_comp_by_teid(g1c_ud.gtpc.teid);
+   CLIENT.send(g1c_ud) to vc_conn;
+   } else {
+   /* Send to all clients */
+   var integer i;
+   for (i := 0; i < sizeof(TidTable); i := i+1) {
+   if (isbound(TidTable[i].teid) and 
TidTable[i].teid == teid) {
+   CLIENT.send(g1c_ud) to 
TidTable[i].vc_conn;
+   }
+   }
}
-   CLIENT.send(g1c_ud) to vc_conn;
}
[] GTPU.receive(Gtp1uUnitdata:?) -> value g1u_ud {
vc_conn := f_comp_by_teid(g1u_ud.gtpu.teid);

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

Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: Ic702b78028e850ed961ef805f35e10a42da34e56
Gerrit-Change-Number: 9949
Gerrit-PatchSet: 2
Gerrit-Owner: Pau Espin Pedrol 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Pau Espin Pedrol 


Change in osmo-pcu[master]: tbf: Replace '.' in counter names with ':'

2018-07-11 Thread Pau Espin Pedrol
Pau Espin Pedrol has posted comments on this change. ( 
https://gerrit.osmocom.org/9942 )

Change subject: tbf: Replace '.' in counter names with ':'
..


Patch Set 1: Verified+1


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

Gerrit-Project: osmo-pcu
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: Ieb7496e1a30ab4f2bfe36c7b664dcdc034010a15
Gerrit-Change-Number: 9942
Gerrit-PatchSet: 1
Gerrit-Owner: Pau Espin Pedrol 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Pau Espin Pedrol 
Gerrit-Comment-Date: Wed, 11 Jul 2018 20:17:25 +
Gerrit-HasComments: No
Gerrit-HasLabels: Yes


Change in pysim[master]: tests: add test program to verify pysim-prog.py (and pysim-read.py)

2018-07-11 Thread Harald Welte
Harald Welte has posted comments on this change. ( 
https://gerrit.osmocom.org/9947 )

Change subject: tests: add test program to verify pysim-prog.py (and 
pysim-read.py)
..


Patch Set 1:

(1 comment)

fine except the whitespace issues

https://gerrit.osmocom.org/#/c/9947/1/tests/pysim-test.sh
File tests/pysim-test.sh:

https://gerrit.osmocom.org/#/c/9947/1/tests/pysim-test.sh@93
PS1, Line 93:   echo "8<"
let's fix all those whitespace issues that are highlightedhere (7 issues, if I 
counted correctly)



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

Gerrit-Project: pysim
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I8c6f95998272333bc757b34e3ab6be004e8cd674
Gerrit-Change-Number: 9947
Gerrit-PatchSet: 1
Gerrit-Owner: dexter 
Gerrit-CC: Harald Welte 
Gerrit-Comment-Date: Wed, 11 Jul 2018 20:12:25 +
Gerrit-HasComments: Yes
Gerrit-HasLabels: No


Change in osmo-pcu[master]: tbf: Replace '.' in counter names with ':'

2018-07-11 Thread Harald Welte
Harald Welte has posted comments on this change. ( 
https://gerrit.osmocom.org/9942 )

Change subject: tbf: Replace '.' in counter names with ':'
..


Patch Set 1: Code-Review+2


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

Gerrit-Project: osmo-pcu
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: Ieb7496e1a30ab4f2bfe36c7b664dcdc034010a15
Gerrit-Change-Number: 9942
Gerrit-PatchSet: 1
Gerrit-Owner: Pau Espin Pedrol 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Pau Espin Pedrol 
Gerrit-Comment-Date: Wed, 11 Jul 2018 20:10:47 +
Gerrit-HasComments: No
Gerrit-HasLabels: Yes


Change in osmo-pcu[master]: tbf: Use incrementing id for rate_ctr_group_alloc

2018-07-11 Thread Harald Welte
Harald Welte has posted comments on this change. ( 
https://gerrit.osmocom.org/9943 )

Change subject: tbf: Use incrementing id for rate_ctr_group_alloc
..


Patch Set 1: Code-Review+2


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

Gerrit-Project: osmo-pcu
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I90ef64133986c556c1a529f5b966e847e6cabbad
Gerrit-Change-Number: 9943
Gerrit-PatchSet: 1
Gerrit-Owner: Pau Espin Pedrol 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Comment-Date: Wed, 11 Jul 2018 20:10:29 +
Gerrit-HasComments: No
Gerrit-HasLabels: Yes


Change in osmo-sgsn[master]: examples: Enable by default echo req towards active GGSNs

2018-07-11 Thread Harald Welte
Harald Welte has posted comments on this change. ( 
https://gerrit.osmocom.org/9936 )

Change subject: examples: Enable by default echo req towards active GGSNs
..


Patch Set 2: Code-Review+2


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

Gerrit-Project: osmo-sgsn
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: Ia1898d172482bf6a25d829f8fc9a47824f49456f
Gerrit-Change-Number: 9936
Gerrit-PatchSet: 2
Gerrit-Owner: Pau Espin Pedrol 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Comment-Date: Wed, 11 Jul 2018 20:09:36 +
Gerrit-HasComments: No
Gerrit-HasLabels: Yes


Change in osmo-sgsn[master]: vty: Add cmd to disable echo loop explictly

2018-07-11 Thread Harald Welte
Harald Welte has posted comments on this change. ( 
https://gerrit.osmocom.org/9948 )

Change subject: vty: Add cmd to disable echo loop explictly
..


Patch Set 1: Code-Review+2


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

Gerrit-Project: osmo-sgsn
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I0598427257533ce8ae9e9afa787293d7c98fed15
Gerrit-Change-Number: 9948
Gerrit-PatchSet: 1
Gerrit-Owner: Pau Espin Pedrol 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Comment-Date: Wed, 11 Jul 2018 20:09:49 +
Gerrit-HasComments: No
Gerrit-HasLabels: Yes


Change in osmo-ttcn3-hacks[master]: lib: GTP_Emulation: Allow receiving packets with TEID 0

2018-07-11 Thread Harald Welte
Harald Welte has posted comments on this change. ( 
https://gerrit.osmocom.org/9949 )

Change subject: lib: GTP_Emulation: Allow receiving packets with TEID 0
..


Patch Set 1: Code-Review+2


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

Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: Ic702b78028e850ed961ef805f35e10a42da34e56
Gerrit-Change-Number: 9949
Gerrit-PatchSet: 1
Gerrit-Owner: Pau Espin Pedrol 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Comment-Date: Wed, 11 Jul 2018 20:08:58 +
Gerrit-HasComments: No
Gerrit-HasLabels: Yes


Change in python/osmo-python-tests[master]: Move twisted_ipa.py to osmopy lib

2018-07-11 Thread Pau Espin Pedrol
Pau Espin Pedrol has submitted this change and it was merged. ( 
https://gerrit.osmocom.org/9960 )

Change subject: Move twisted_ipa.py to osmopy lib
..

Move twisted_ipa.py to osmopy lib

twisted_ipa is a module expected to be used by other python scripts, so
move it to osmopy dir to be installed as a lib (in python path) so it
can be later used.

twisted_ipa has some features to use it standalone for testing purposes.
This feature can still be used from new installation path.

Change-Id: I33a0c4263297abd9e111bf43e6e9967c06474318
---
M osmopy/__init__.py
R osmopy/twisted_ipa.py
M scripts/soap.py
M setup.py
4 files changed, 2 insertions(+), 3 deletions(-)

Approvals:
  Jenkins Builder: Verified
  Harald Welte: Looks good to me, approved



diff --git a/osmopy/__init__.py b/osmopy/__init__.py
index 4e818ed..2195498 100644
--- a/osmopy/__init__.py
+++ b/osmopy/__init__.py
@@ -1,4 +1,4 @@
 #!/usr/bin/env python
 __version__ = '0.0.9'

-__all__ = ['obscvty', 'osmoutil', 'osmo_ipa', 'osmo_interact']
+__all__ = ['obscvty', 'osmoutil', 'osmo_ipa', 'osmo_interact', 'twisted_ipa']
diff --git a/scripts/twisted_ipa.py b/osmopy/twisted_ipa.py
similarity index 100%
rename from scripts/twisted_ipa.py
rename to osmopy/twisted_ipa.py
diff --git a/scripts/soap.py b/scripts/soap.py
index f1da8f2..dc06e1e 100755
--- a/scripts/soap.py
+++ b/scripts/soap.py
@@ -25,7 +25,7 @@
 __version__ = "0.7.1" # bump this on every non-trivial change

 from twisted.internet import defer, reactor
-from twisted_ipa import CTRL, IPAFactory, __version__ as twisted_ipa_version
+from osmopy.twisted_ipa import CTRL, IPAFactory, __version__ as 
twisted_ipa_version
 from osmopy.osmo_ipa import Ctrl
 from treq import post, collect
 from suds.client import Client
diff --git a/setup.py b/setup.py
index a8fd6e9..1d785e7 100755
--- a/setup.py
+++ b/setup.py
@@ -30,7 +30,6 @@
 "scripts/osmo_ctrl.py",
 "scripts/osmo_rate_ctr2csv.py",
 "scripts/soap.py",
-"scripts/twisted_ipa.py",
 "scripts/osmo_interact_vty.py",
 "scripts/osmo_interact_ctrl.py",
 "scripts/osmo_verify_transcript_vty.py",

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

Gerrit-Project: python/osmo-python-tests
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: I33a0c4263297abd9e111bf43e6e9967c06474318
Gerrit-Change-Number: 9960
Gerrit-PatchSet: 1
Gerrit-Owner: Pau Espin Pedrol 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Pau Espin Pedrol 


Change in libosmocore[master]: gsm0808: Add value_string for encryption algorithms

2018-07-11 Thread Harald Welte
Harald Welte has posted comments on this change. ( 
https://gerrit.osmocom.org/9901 )

Change subject: gsm0808: Add value_string for encryption algorithms
..


Patch Set 1: Code-Review+2


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

Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: Iadf6460c438d02c53c2eaa9e42d51844ad28859a
Gerrit-Change-Number: 9901
Gerrit-PatchSet: 1
Gerrit-Owner: Pau Espin Pedrol 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Comment-Date: Wed, 11 Jul 2018 20:06:57 +
Gerrit-HasComments: No
Gerrit-HasLabels: Yes


Change in libosmo-sccp[master]: fix memleaks in mtp_user_prim_cb()

2018-07-11 Thread Harald Welte
Harald Welte has posted comments on this change. ( 
https://gerrit.osmocom.org/9957 )

Change subject: fix memleaks in mtp_user_prim_cb()
..


Patch Set 1: Code-Review+1

looks fine to me, but should be thoroughly tested


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

Gerrit-Project: libosmo-sccp
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I72b3c6a6f57ba32d9ba191af33b4b236492174e0
Gerrit-Change-Number: 9957
Gerrit-PatchSet: 1
Gerrit-Owner: Neels Hofmeyr 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Neels Hofmeyr 
Gerrit-Comment-Date: Wed, 11 Jul 2018 20:05:37 +
Gerrit-HasComments: No
Gerrit-HasLabels: Yes


Change in simtrace2[master]: host: set license to GPLv2+

2018-07-11 Thread Kévin Redon
Kévin Redon has posted comments on this change. ( 
https://gerrit.osmocom.org/9915 )

Change subject: host: set license to GPLv2+
..


Patch Set 5:

argh, wrong copy paste. now fixed


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

Gerrit-Project: simtrace2
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I0948d74874af1d3a0f1b4cbcb4a838e4ecd9fe3f
Gerrit-Change-Number: 9915
Gerrit-PatchSet: 5
Gerrit-Owner: Kévin Redon 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Kévin Redon 
Gerrit-Comment-Date: Wed, 11 Jul 2018 20:04:39 +
Gerrit-HasComments: No
Gerrit-HasLabels: No


Change in libosmo-sccp[master]: fix two memleaks in ipa_rx_msg_sccp()

2018-07-11 Thread Harald Welte
Harald Welte has posted comments on this change. ( 
https://gerrit.osmocom.org/9956 )

Change subject: fix two memleaks in ipa_rx_msg_sccp()
..


Patch Set 1: Code-Review+2


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

Gerrit-Project: libosmo-sccp
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I0918f9bbc15b036619f1c25a133b69819b2a30fa
Gerrit-Change-Number: 9956
Gerrit-PatchSet: 1
Gerrit-Owner: Neels Hofmeyr 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Neels Hofmeyr 
Gerrit-Reviewer: Pau Espin Pedrol 
Gerrit-Comment-Date: Wed, 11 Jul 2018 20:04:10 +
Gerrit-HasComments: No
Gerrit-HasLabels: Yes


Change in libosmo-sccp[master]: add osmo_xua_msg_tall_ctx_init()

2018-07-11 Thread Harald Welte
Harald Welte has posted comments on this change. ( 
https://gerrit.osmocom.org/9953 )

Change subject: add osmo_xua_msg_tall_ctx_init()
..


Patch Set 1: Code-Review-1

(1 comment)

let's please remove the misleading part from the commitlog message. thanks!

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

https://gerrit.osmocom.org/#/c/9953/1//COMMIT_MSG@16
PS1, Line 16: The convention should actually be that only libosmocore exposes 
API with the
: osmo_ prefix, but libosmo-sigtran explicitly exposes only symbols 
starting with
: osmo_, forcing me to use this prefix.
this is not correct.  All libosmo* may expose API with osmo_ prefix.



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

Gerrit-Project: libosmo-sccp
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I618878680a096a7f7fc2d83098590f2e4cb08870
Gerrit-Change-Number: 9953
Gerrit-PatchSet: 1
Gerrit-Owner: Neels Hofmeyr 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Pau Espin Pedrol 
Gerrit-Comment-Date: Wed, 11 Jul 2018 20:03:21 +
Gerrit-HasComments: Yes
Gerrit-HasLabels: Yes


Change in libosmo-sccp[master]: cosmetic: sccp2sua.c: log the IEI for parsed SCCP addr

2018-07-11 Thread Harald Welte
Harald Welte has posted comments on this change. ( 
https://gerrit.osmocom.org/9952 )

Change subject: cosmetic: sccp2sua.c: log the IEI for parsed SCCP addr
..


Patch Set 1: Code-Review+2


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

Gerrit-Project: libosmo-sccp
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I64adb31129684b2eb66fff581040017ce2f6d163
Gerrit-Change-Number: 9952
Gerrit-PatchSet: 1
Gerrit-Owner: Neels Hofmeyr 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Neels Hofmeyr 
Gerrit-Reviewer: Pau Espin Pedrol 
Gerrit-Comment-Date: Wed, 11 Jul 2018 20:02:08 +
Gerrit-HasComments: No
Gerrit-HasLabels: Yes


Change in libosmo-sccp[master]: fix memleak in ipa_rx_msg_sccp

2018-07-11 Thread Harald Welte
Harald Welte has posted comments on this change. ( 
https://gerrit.osmocom.org/9951 )

Change subject: fix memleak in ipa_rx_msg_sccp
..


Patch Set 1: Code-Review+2


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

Gerrit-Project: libosmo-sccp
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I2263751c0aa3ae32455847c7622af8be0a1e7802
Gerrit-Change-Number: 9951
Gerrit-PatchSet: 1
Gerrit-Owner: Neels Hofmeyr 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Pau Espin Pedrol 
Gerrit-Comment-Date: Wed, 11 Jul 2018 20:01:44 +
Gerrit-HasComments: No
Gerrit-HasLabels: Yes


Change in osmo-ttcn3-hacks[master]: MSC_ConnectionHandler: split up as_media into separate altsteps

2018-07-11 Thread Harald Welte
Harald Welte has submitted this change and it was merged. ( 
https://gerrit.osmocom.org/9961 )

Change subject: MSC_ConnectionHandler: split up as_media into separate altsteps
..

MSC_ConnectionHandler: split up as_media into separate altsteps

as_media() tests both, IPACC/RSL media handling and MGCP media
handling. These two domains are technically quite separate, which
means we can split them up into two separate altsteps in order
to increase readability of the code.

- Split as_media() into as_Media_ipacc() and as_Media_mgw()

Change-Id: I539e8ffdb9f99d5a8e730dd918df502614b9e84d
Related: OS#3292
---
M bsc/MSC_ConnectionHandler.ttcn
1 file changed, 17 insertions(+), 7 deletions(-)

Approvals:
  Jenkins Builder: Verified
  Harald Welte: Looks good to me, approved



diff --git a/bsc/MSC_ConnectionHandler.ttcn b/bsc/MSC_ConnectionHandler.ttcn
index 1261a4d..f38a3e9 100644
--- a/bsc/MSC_ConnectionHandler.ttcn
+++ b/bsc/MSC_ConnectionHandler.ttcn
@@ -149,12 +149,10 @@
self.stop;
 }

-
-/* altstep for handling of IPA + MGCP media related commands. Can be activated 
by a given
- * test case if it expects to see media related handling (i.e. voice calls */
-altstep as_Media() runs on MSC_ConnHdlr {
+/* altstep for handling of IPACC media related commands. Activated by 
as_Media() to test
+ * RSL level media handling */
+altstep as_Media_ipacc() runs on MSC_ConnHdlr {
var RSL_Message rsl;
-   var MgcpCommand mgcp_cmd;
var RSL_IE_Body ie;
var boolean b_unused;
[not g_media.bts.ipa_crcx_seen] RSL.receive(tr_RSL_IPA_CRCX(g_chan_nr)) 
-> value rsl {
@@ -243,6 +241,14 @@
repeat;
}

+
+}
+
+/* altstep for handling of MGCP media related commands. Activated by 
as_Media() to test
+ * MGW level media handling */
+altstep as_Media_mgw() runs on MSC_ConnHdlr {
+   var MgcpCommand mgcp_cmd;
+
[] MGCP.receive(tr_CRCX) -> value mgcp_cmd {
var SDP_Message sdp;
var integer cid := f_get_free_mgcp_conn();
@@ -298,8 +304,12 @@
}
 }

-
-
+/* Altsteps for handling of media related commands. Can be activated by a given
+ * test case if it expects to see media related handling (i.e. voice calls) */
+altstep as_Media() runs on MSC_ConnHdlr {
+   [] as_Media_ipacc();
+   [] as_Media_mgw();
+}

 /* this component represents a single subscriber connection at the MSC.
  * There is a 1:1 mapping between SCCP connections and BSSAP_ConnHdlr 
components.

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

Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: I539e8ffdb9f99d5a8e730dd918df502614b9e84d
Gerrit-Change-Number: 9961
Gerrit-PatchSet: 1
Gerrit-Owner: dexter 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder


Change in osmo-ttcn3-hacks[master]: BSC_Tests: count MGCP operations in as_media

2018-07-11 Thread Harald Welte
Harald Welte has submitted this change and it was merged. ( 
https://gerrit.osmocom.org/9962 )

Change subject: BSC_Tests: count MGCP operations in as_media
..

BSC_Tests: count MGCP operations in as_media

as_media handles the MGCP interaction for most of the tests. However,
it does not make sure if transactions are missing or if too many
transactions are performed (e.g. if an SCCP-Lite tests still creates
the connections pointing to the core network, even if they must not
created by the BSC in this case). So lets make sure that the MGCP
transactions are performed as expected by counting them.

- Add counters to count CRCX and MDCX transactions
- Check those counters after call establishment and handover

Change-Id: Ib073b097a840ca3a8ee99c4ed41f59f574191d98
Related: OS#3292
---
M bsc/BSC_Tests.ttcn
M bsc/MSC_ConnectionHandler.ttcn
2 files changed, 74 insertions(+), 7 deletions(-)

Approvals:
  Jenkins Builder: Verified
  Harald Welte: Looks good to me, approved



diff --git a/bsc/BSC_Tests.ttcn b/bsc/BSC_Tests.ttcn
index 149d5b7..2897a0b 100644
--- a/bsc/BSC_Tests.ttcn
+++ b/bsc/BSC_Tests.ttcn
@@ -2122,10 +2122,19 @@
f_vty_handover(0, 0, g_chan_nr, 1);
/* temporarily suspend DChan processing on BTS1 to avoid race with 
RSLEM_register */
f_rslem_suspend(RSL1_PROC);
+
+   /* From the MGW perspective, a handover is is characterized by
+* performing one MDCX operation with the MGW. So we expect to see
+* one more MDCX during handover. */
+   g_media.mgcp_conn[0].mdcx_seen_exp := 
g_media.mgcp_conn[0].crcx_seen_exp + 1;
+
alt {
[] as_handover(hs);
-   /* FIXME: somehow determine that the hand-over has completed, by MGCP 
MDCX? */
}
+
+   /* Check the amount of MGCP transactions is still consistant with the
+* test expectation */
+   f_check_mgcp_expectations()
 }

 testcase TC_ho_int() runs on test_CT {
diff --git a/bsc/MSC_ConnectionHandler.ttcn b/bsc/MSC_ConnectionHandler.ttcn
index f38a3e9..ba4d19d 100644
--- a/bsc/MSC_ConnectionHandler.ttcn
+++ b/bsc/MSC_ConnectionHandler.ttcn
@@ -58,7 +58,10 @@

 /* State encapsulating one MGCP Connection */
 type record MgcpConnState {
-   boolean crcx_seen,
+   integer crcx_seen,  /* Counts how many CRCX operations 
happend */
+   integer mdcx_seen,  /* Counts how many MDCX operations 
happend C */
+   integer crcx_seen_exp,  /* Sets the expected number of CRCX 
operations */
+   integer mdcx_seen_exp,  /* Sets the expected number of MDCX 
operations */
MgcpConnectionId conn_id,
charstring mime_type,   /* e.g. AMR */
integer sample_rate,/* 8000 */
@@ -115,7 +118,10 @@
g_media.mgcp_conn[i].sample_rate := 8000;
g_media.mgcp_conn[i].ptime := 20;
g_media.mgcp_conn[i].rtp_pt := 
enum2int(f_get_mgcp_pt(codecType));
-   g_media.mgcp_conn[i].crcx_seen := false;
+   g_media.mgcp_conn[i].crcx_seen := 0;
+   g_media.mgcp_conn[i].mdcx_seen := 0;
+   g_media.mgcp_conn[i].crcx_seen_exp := 0;
+   g_media.mgcp_conn[i].mdcx_seen_exp := 0;
g_media.mgcp_conn[i].conn_id := f_mgcp_alloc_conn_id();
}

@@ -129,9 +135,11 @@
}
 }

+/* Helper function to get the next free MGCP connection identifier. We can
+ * recognize free connection identifiers by the fact that no CRCX happend yet 
*/
 private function f_get_free_mgcp_conn() runs on MSC_ConnHdlr return integer {
for (var integer i:= 0; i < sizeof(g_media.mgcp_conn); i := i+1) {
-   if (not g_media.mgcp_conn[i].crcx_seen) {
+   if (not g_media.mgcp_conn[i].crcx_seen >= 1) {
return i;
}
}
@@ -139,9 +147,12 @@
self.stop;
 }

+/* Helper function to pick a specific connection by its cid. Since we reach out
+ * for a connection that is in-use we also check if there was already exactly
+ * one CRCX happening on that connection. */
 private function f_get_mgcp_conn(MgcpConnectionId cid) runs on MSC_ConnHdlr 
return integer {
for (var integer i:= 0; i < sizeof(g_media.mgcp_conn); i := i+1) {
-   if (g_media.mgcp_conn[i].conn_id == cid and 
g_media.mgcp_conn[i].crcx_seen) {
+   if (g_media.mgcp_conn[i].conn_id == cid and 
g_media.mgcp_conn[i].crcx_seen == 1) {
return i;
}
}
@@ -278,7 +289,7 @@
mgcp_resp := ts_CRCX_ACK(mgcp_cmd.line.trans_id, 
mgcp_conn.conn_id, sdp);
f_mgcp_par_append(mgcp_resp.params, 
ts_MgcpParSpecEP(g_media.mgcp_ep));
MGCP.send(mgcp_resp);
-   g_media.mgcp_conn[cid].crcx_seen := true;
+   g_media.mgcp_conn[cid].crcx_seen := 
g_media.mgcp_conn[cid].crcx_seen + 1;
repeat;
 

Change in osmo-ttcn3-hacks[master]: BSC_Tests: count MGCP operations in as_media

2018-07-11 Thread Harald Welte
Harald Welte has posted comments on this change. ( 
https://gerrit.osmocom.org/9962 )

Change subject: BSC_Tests: count MGCP operations in as_media
..


Patch Set 1: Code-Review+2


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

Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: Ib073b097a840ca3a8ee99c4ed41f59f574191d98
Gerrit-Change-Number: 9962
Gerrit-PatchSet: 1
Gerrit-Owner: dexter 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Comment-Date: Wed, 11 Jul 2018 20:00:44 +
Gerrit-HasComments: No
Gerrit-HasLabels: Yes


Change in osmo-ttcn3-hacks[master]: MSC_ConnectionHandler: split up as_media into separate altsteps

2018-07-11 Thread Harald Welte
Harald Welte has posted comments on this change. ( 
https://gerrit.osmocom.org/9961 )

Change subject: MSC_ConnectionHandler: split up as_media into separate altsteps
..


Patch Set 1: Code-Review+2


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

Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I539e8ffdb9f99d5a8e730dd918df502614b9e84d
Gerrit-Change-Number: 9961
Gerrit-PatchSet: 1
Gerrit-Owner: dexter 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Comment-Date: Wed, 11 Jul 2018 20:00:06 +
Gerrit-HasComments: No
Gerrit-HasLabels: Yes


Change in osmo-ttcn3-hacks[master]: BSC_Tests_LCLS: try call legs with different codec/rate

2018-07-11 Thread Harald Welte
Harald Welte has posted comments on this change. ( 
https://gerrit.osmocom.org/9941 )

Change subject: BSC_Tests_LCLS: try call legs with different codec/rate
..


Patch Set 1: Code-Review+2


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

Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I91b132306e530ad9ca03fb4a34012381be6b0b52
Gerrit-Change-Number: 9941
Gerrit-PatchSet: 1
Gerrit-Owner: dexter 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Comment-Date: Wed, 11 Jul 2018 19:59:41 +
Gerrit-HasComments: No
Gerrit-HasLabels: Yes


Change in osmo-ttcn3-hacks[master]: BSC_Tests: Also test LCLS with halfrate codecs

2018-07-11 Thread Harald Welte
Harald Welte has posted comments on this change. ( 
https://gerrit.osmocom.org/9900 )

Change subject: BSC_Tests: Also test LCLS with halfrate codecs
..


Patch Set 2: Code-Review+2


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

Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I2421519a642bdb7453ae4a9058e177845690a489
Gerrit-Change-Number: 9900
Gerrit-PatchSet: 2
Gerrit-Owner: dexter 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Comment-Date: Wed, 11 Jul 2018 19:59:12 +
Gerrit-HasComments: No
Gerrit-HasLabels: Yes


Change in simtrace2[master]: sniff: add checksum verification for ATR and PPS

2018-07-11 Thread Harald Welte
Harald Welte has posted comments on this change. ( 
https://gerrit.osmocom.org/9966 )

Change subject: sniff: add checksum verification for ATR and PPS
..


Patch Set 3: Code-Review+2


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

Gerrit-Project: simtrace2
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I277868267c3199eea216ab47bdd09fb2fb944b06
Gerrit-Change-Number: 9966
Gerrit-PatchSet: 3
Gerrit-Owner: Kévin Redon 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Comment-Date: Wed, 11 Jul 2018 19:58:32 +
Gerrit-HasComments: No
Gerrit-HasLabels: Yes


Change in simtrace2[master]: fix 'ISO_S_IN_ATR not handled' gcc warning

2018-07-11 Thread Harald Welte
Harald Welte has posted comments on this change. ( 
https://gerrit.osmocom.org/9965 )

Change subject: fix 'ISO_S_IN_ATR not handled' gcc warning
..


Patch Set 3: Code-Review+2


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

Gerrit-Project: simtrace2
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: Ifbc8dbe1c9f176343304f211c7e6068fb977961e
Gerrit-Change-Number: 9965
Gerrit-PatchSet: 3
Gerrit-Owner: Kévin Redon 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Comment-Date: Wed, 11 Jul 2018 19:58:03 +
Gerrit-HasComments: No
Gerrit-HasLabels: Yes


Change in simtrace2[master]: host sniff: add functions to print flags

2018-07-11 Thread Harald Welte
Harald Welte has posted comments on this change. ( 
https://gerrit.osmocom.org/9946 )

Change subject: host sniff: add functions to print flags
..


Patch Set 4:

(1 comment)

https://gerrit.osmocom.org/#/c/9946/4/host/simtrace2-sniff.c
File host/simtrace2-sniff.c:

https://gerrit.osmocom.org/#/c/9946/4/host/simtrace2-sniff.c@97
PS4, Line 97: struct flag_meaning_t {
we typically use 'struct value_string' here and the corresponding 
'get_value_string() and 'get_string_value()' functions from libosmocore.  
Unless you need something those functions don't provide, please use the 
existing ones.



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

Gerrit-Project: simtrace2
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: If3c0a4790662bcc64db5ff03adcc033836e16ad0
Gerrit-Change-Number: 9946
Gerrit-PatchSet: 4
Gerrit-Owner: Kévin Redon 
Gerrit-Reviewer: Jenkins Builder
Gerrit-CC: Harald Welte 
Gerrit-Comment-Date: Wed, 11 Jul 2018 19:57:24 +
Gerrit-HasComments: Yes
Gerrit-HasLabels: No


Change in simtrace2[master]: make adc2uv common

2018-07-11 Thread Harald Welte
Harald Welte has posted comments on this change. ( 
https://gerrit.osmocom.org/9964 )

Change subject: make adc2uv common
..


Patch Set 3: Code-Review+2


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

Gerrit-Project: simtrace2
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I8a772638fa8dd02d8bc8b7631de5af5a22647c55
Gerrit-Change-Number: 9964
Gerrit-PatchSet: 3
Gerrit-Owner: Kévin Redon 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Comment-Date: Wed, 11 Jul 2018 19:57:47 +
Gerrit-HasComments: No
Gerrit-HasLabels: Yes


Change in simtrace2[master]: host sniff: process remaining usb messages in buffer

2018-07-11 Thread Harald Welte
Harald Welte has posted comments on this change. ( 
https://gerrit.osmocom.org/9945 )

Change subject: host sniff: process remaining usb messages in buffer
..


Patch Set 4: Code-Review+2


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

Gerrit-Project: simtrace2
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I1746c0187b2e5dbef44b4b336fee3bd9ded15079
Gerrit-Change-Number: 9945
Gerrit-PatchSet: 4
Gerrit-Owner: Kévin Redon 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Comment-Date: Wed, 11 Jul 2018 19:56:18 +
Gerrit-HasComments: No
Gerrit-HasLabels: Yes


Change in simtrace2[master]: sniffer: fix inverted reset meaning

2018-07-11 Thread Harald Welte
Harald Welte has posted comments on this change. ( 
https://gerrit.osmocom.org/9944 )

Change subject: sniffer: fix inverted reset meaning
..


Patch Set 4: Code-Review+2


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

Gerrit-Project: simtrace2
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I860e2e29c059e1e0ec126695bb68d489891a17da
Gerrit-Change-Number: 9944
Gerrit-PatchSet: 4
Gerrit-Owner: Kévin Redon 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Comment-Date: Wed, 11 Jul 2018 19:56:04 +
Gerrit-HasComments: No
Gerrit-HasLabels: Yes


Change in simtrace2[master]: sniffer: also send malformed message over USB

2018-07-11 Thread Harald Welte
Harald Welte has posted comments on this change. ( 
https://gerrit.osmocom.org/9926 )

Change subject: sniffer: also send malformed message over USB
..


Patch Set 5: Code-Review+2


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

Gerrit-Project: simtrace2
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I124c8db1d2f836e185630bbe8b5e52eb085d702a
Gerrit-Change-Number: 9926
Gerrit-PatchSet: 5
Gerrit-Owner: Kévin Redon 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Comment-Date: Wed, 11 Jul 2018 19:55:29 +
Gerrit-HasComments: No
Gerrit-HasLabels: Yes


Change in simtrace2[master]: sniffer: only allocate USB message if queue is not too long

2018-07-11 Thread Harald Welte
Harald Welte has posted comments on this change. ( 
https://gerrit.osmocom.org/9927 )

Change subject: sniffer: only allocate USB message if queue is not too long
..


Patch Set 5: Code-Review+2


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

Gerrit-Project: simtrace2
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I0e447acdf757dcb5dc5c4d8b84a4235866914cad
Gerrit-Change-Number: 9927
Gerrit-PatchSet: 5
Gerrit-Owner: Kévin Redon 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Comment-Date: Wed, 11 Jul 2018 19:55:44 +
Gerrit-HasComments: No
Gerrit-HasLabels: Yes


Change in simtrace2[master]: minor: fix linker warning

2018-07-11 Thread Harald Welte
Harald Welte has posted comments on this change. ( 
https://gerrit.osmocom.org/9925 )

Change subject: minor: fix linker warning
..


Patch Set 5: Code-Review+2


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

Gerrit-Project: simtrace2
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I934f3fcb474d4046e921511a024c3a0b8533c782
Gerrit-Change-Number: 9925
Gerrit-PatchSet: 5
Gerrit-Owner: Kévin Redon 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Comment-Date: Wed, 11 Jul 2018 19:55:17 +
Gerrit-HasComments: No
Gerrit-HasLabels: Yes


Change in simtrace2[master]: LED: add need pattern

2018-07-11 Thread Harald Welte
Harald Welte has posted comments on this change. ( 
https://gerrit.osmocom.org/9923 )

Change subject: LED: add need pattern
..


Patch Set 5: Code-Review+2


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

Gerrit-Project: simtrace2
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: Id2c40dc20d75ed6f38b735164ad1eb2860dc480c
Gerrit-Change-Number: 9923
Gerrit-PatchSet: 5
Gerrit-Owner: Kévin Redon 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Comment-Date: Wed, 11 Jul 2018 19:54:54 +
Gerrit-HasComments: No
Gerrit-HasLabels: Yes


Change in simtrace2[master]: sniffer: move reset handling from ISR to main loop

2018-07-11 Thread Harald Welte
Harald Welte has posted comments on this change. ( 
https://gerrit.osmocom.org/9922 )

Change subject: sniffer: move reset handling from ISR to main loop
..


Patch Set 5: Code-Review+2


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

Gerrit-Project: simtrace2
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: Ia88fb4baf49017524bb201123da3511e5342ba48
Gerrit-Change-Number: 9922
Gerrit-PatchSet: 5
Gerrit-Owner: Kévin Redon 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Comment-Date: Wed, 11 Jul 2018 19:54:39 +
Gerrit-HasComments: No
Gerrit-HasLabels: Yes


Change in simtrace2[master]: sniffer: set LED pattern

2018-07-11 Thread Harald Welte
Harald Welte has posted comments on this change. ( 
https://gerrit.osmocom.org/9924 )

Change subject: sniffer: set LED pattern
..


Patch Set 5: Code-Review+2


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

Gerrit-Project: simtrace2
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: Ib1b6ff87fb92d6ed3ecae4bc89386206aaab508e
Gerrit-Change-Number: 9924
Gerrit-PatchSet: 5
Gerrit-Owner: Kévin Redon 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Comment-Date: Wed, 11 Jul 2018 19:55:07 +
Gerrit-HasComments: No
Gerrit-HasLabels: Yes


Change in simtrace2[master]: sniffer: move data print before USB send

2018-07-11 Thread Harald Welte
Harald Welte has posted comments on this change. ( 
https://gerrit.osmocom.org/9921 )

Change subject: sniffer: move data print before USB send
..


Patch Set 5: Code-Review+2


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

Gerrit-Project: simtrace2
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: Ie8946894a84cb853b4f7abb1ca6f32111425
Gerrit-Change-Number: 9921
Gerrit-PatchSet: 5
Gerrit-Owner: Kévin Redon 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Comment-Date: Wed, 11 Jul 2018 19:54:19 +
Gerrit-HasComments: No
Gerrit-HasLabels: Yes


Change in simtrace2[master]: USB: add flags for sniff data and centralise transfer

2018-07-11 Thread Harald Welte
Harald Welte has posted comments on this change. ( 
https://gerrit.osmocom.org/9920 )

Change subject: USB: add flags for sniff data and centralise transfer
..


Patch Set 5: Code-Review+2


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

Gerrit-Project: simtrace2
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I768a0ad639aa5e648a630af72d01f7b68082b6b6
Gerrit-Change-Number: 9920
Gerrit-PatchSet: 5
Gerrit-Owner: Kévin Redon 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Comment-Date: Wed, 11 Jul 2018 19:53:44 +
Gerrit-HasComments: No
Gerrit-HasLabels: Yes


Change in simtrace2[master]: replace leading spaces with tabs

2018-07-11 Thread Harald Welte
Harald Welte has posted comments on this change. ( 
https://gerrit.osmocom.org/9918 )

Change subject: replace leading spaces with tabs
..


Patch Set 5: Code-Review+2


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

Gerrit-Project: simtrace2
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I86783eba0827b58303b10310e9f6b9625e1a27f1
Gerrit-Change-Number: 9918
Gerrit-PatchSet: 5
Gerrit-Owner: Kévin Redon 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Comment-Date: Wed, 11 Jul 2018 19:53:00 +
Gerrit-HasComments: No
Gerrit-HasLabels: Yes


Change in simtrace2[master]: cosmetic: put spaces around operations

2018-07-11 Thread Harald Welte
Harald Welte has posted comments on this change. ( 
https://gerrit.osmocom.org/9919 )

Change subject: cosmetic: put spaces around operations
..


Patch Set 5: Code-Review+2


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

Gerrit-Project: simtrace2
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: If5ba5f8d16680e8403944274336ea595017063db
Gerrit-Change-Number: 9919
Gerrit-PatchSet: 5
Gerrit-Owner: Kévin Redon 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Comment-Date: Wed, 11 Jul 2018 19:53:14 +
Gerrit-HasComments: No
Gerrit-HasLabels: Yes


Change in simtrace2[master]: firmware: set license to GPLv2+

2018-07-11 Thread Harald Welte
Harald Welte has posted comments on this change. ( 
https://gerrit.osmocom.org/9916 )

Change subject: firmware: set license to GPLv2+
..


Patch Set 4: Code-Review+2


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

Gerrit-Project: simtrace2
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: Id4c00159f984976b6d8641900fb64e36a3a30407
Gerrit-Change-Number: 9916
Gerrit-PatchSet: 4
Gerrit-Owner: Kévin Redon 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Comment-Date: Wed, 11 Jul 2018 19:52:29 +
Gerrit-HasComments: No
Gerrit-HasLabels: Yes


Change in simtrace2[master]: host: set license to GPLv2+

2018-07-11 Thread Harald Welte
Harald Welte has posted comments on this change. ( 
https://gerrit.osmocom.org/9915 )

Change subject: host: set license to GPLv2+
..


Patch Set 4: Code-Review-1

I'm sorry, but as mentioned several times, it should be "version 2 or later", 
while your patch now adds "version 2" (only)


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

Gerrit-Project: simtrace2
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I0948d74874af1d3a0f1b4cbcb4a838e4ecd9fe3f
Gerrit-Change-Number: 9915
Gerrit-PatchSet: 4
Gerrit-Owner: Kévin Redon 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Comment-Date: Wed, 11 Jul 2018 19:51:37 +
Gerrit-HasComments: No
Gerrit-HasLabels: Yes


Change in simtrace2[master]: DFU: use central DFU override check

2018-07-11 Thread Harald Welte
Harald Welte has posted comments on this change. ( 
https://gerrit.osmocom.org/9913 )

Change subject: DFU: use central DFU override check
..


Patch Set 4: Code-Review+2


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

Gerrit-Project: simtrace2
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I82323e0f76c03f67df7dc8f2b6783166cc25f3aa
Gerrit-Change-Number: 9913
Gerrit-PatchSet: 4
Gerrit-Owner: Kévin Redon 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Comment-Date: Wed, 11 Jul 2018 19:50:41 +
Gerrit-HasComments: No
Gerrit-HasLabels: Yes


Change in python/osmo-python-tests[master]: Move twisted_ipa.py to osmopy lib

2018-07-11 Thread Harald Welte
Harald Welte has posted comments on this change. ( 
https://gerrit.osmocom.org/9960 )

Change subject: Move twisted_ipa.py to osmopy lib
..


Patch Set 1: Code-Review+2


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

Gerrit-Project: python/osmo-python-tests
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I33a0c4263297abd9e111bf43e6e9967c06474318
Gerrit-Change-Number: 9960
Gerrit-PatchSet: 1
Gerrit-Owner: Pau Espin Pedrol 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Comment-Date: Wed, 11 Jul 2018 19:49:55 +
Gerrit-HasComments: No
Gerrit-HasLabels: Yes


Change in simtrace2[master]: sniffer: also send malformed message over USB

2018-07-11 Thread Kévin Redon
Hello Jenkins Builder,

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

https://gerrit.osmocom.org/9926

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

Change subject: sniffer: also send malformed message over USB
..

sniffer: also send malformed message over USB

Change-Id: I124c8db1d2f836e185630bbe8b5e52eb085d702a
---
M firmware/libcommon/source/sniffer.c
1 file changed, 15 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.osmocom.org:29418/simtrace2 refs/changes/26/9926/5
--
To view, visit https://gerrit.osmocom.org/9926
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: simtrace2
Gerrit-Branch: master
Gerrit-MessageType: newpatchset
Gerrit-Change-Id: I124c8db1d2f836e185630bbe8b5e52eb085d702a
Gerrit-Change-Number: 9926
Gerrit-PatchSet: 5
Gerrit-Owner: Kévin Redon 
Gerrit-Reviewer: Jenkins Builder


Change in simtrace2[master]: fix 'ISO_S_IN_ATR not handled' gcc warning

2018-07-11 Thread Kévin Redon
Hello Jenkins Builder,

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

https://gerrit.osmocom.org/9965

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

Change subject: fix 'ISO_S_IN_ATR not handled' gcc warning
..

fix 'ISO_S_IN_ATR not handled' gcc warning

when building the cardem application GCC would output the following warning:
libcommon/source/card_emu.c: In function 'card_emu_process_rx_byte':
libcommon/source/card_emu.c:764:2: warning: enumeration value 'ISO_S_IN_ATR' 
not handled in switch [-Wswitch]
  switch (ch->state) {
  ^~

in card emulation the reader should not send data while the card is
sending its ATR.
this is true for other states already handled (RESET, ...). in
these cases an error message is output.
this behaviour is now the default case as data from the reader is
only expected in 3 cases: ISO_S_WAIT_TPDU, ISO_S_IN_TPDU, and
ISO_S_IN_PTS.

Change-Id: Ifbc8dbe1c9f176343304f211c7e6068fb977961e
---
M firmware/libcommon/source/card_emu.c
1 file changed, 4 insertions(+), 8 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/simtrace2 refs/changes/65/9965/3
--
To view, visit https://gerrit.osmocom.org/9965
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: simtrace2
Gerrit-Branch: master
Gerrit-MessageType: newpatchset
Gerrit-Change-Id: Ifbc8dbe1c9f176343304f211c7e6068fb977961e
Gerrit-Change-Number: 9965
Gerrit-PatchSet: 3
Gerrit-Owner: Kévin Redon 
Gerrit-Reviewer: Jenkins Builder


Change in simtrace2[master]: USB: add flags for sniff data and centralise transfer

2018-07-11 Thread Kévin Redon
Hello Jenkins Builder,

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

https://gerrit.osmocom.org/9920

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

Change subject: USB: add flags for sniff data and centralise transfer
..

USB: add flags for sniff data and centralise transfer

Also fix issue in usb_msg_alloc_hdr and add cosmetic spaces around
operations.

Change-Id: I768a0ad639aa5e648a630af72d01f7b68082b6b6
---
M firmware/libcommon/include/simtrace_prot.h
M firmware/libcommon/source/sniffer.c
M host/simtrace2-sniff.c
3 files changed, 140 insertions(+), 142 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/simtrace2 refs/changes/20/9920/5
--
To view, visit https://gerrit.osmocom.org/9920
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: simtrace2
Gerrit-Branch: master
Gerrit-MessageType: newpatchset
Gerrit-Change-Id: I768a0ad639aa5e648a630af72d01f7b68082b6b6
Gerrit-Change-Number: 9920
Gerrit-PatchSet: 5
Gerrit-Owner: Kévin Redon 
Gerrit-Reviewer: Jenkins Builder


Change in simtrace2[master]: host sniff: add functions to print flags

2018-07-11 Thread Kévin Redon
Hello Jenkins Builder,

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

https://gerrit.osmocom.org/9946

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

Change subject: host sniff: add functions to print flags
..

host sniff: add functions to print flags

Change-Id: If3c0a4790662bcc64db5ff03adcc033836e16ad0
---
M host/simtrace2-sniff.c
1 file changed, 58 insertions(+), 29 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/simtrace2 refs/changes/46/9946/4
--
To view, visit https://gerrit.osmocom.org/9946
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: simtrace2
Gerrit-Branch: master
Gerrit-MessageType: newpatchset
Gerrit-Change-Id: If3c0a4790662bcc64db5ff03adcc033836e16ad0
Gerrit-Change-Number: 9946
Gerrit-PatchSet: 4
Gerrit-Owner: Kévin Redon 
Gerrit-Reviewer: Jenkins Builder


Change in simtrace2[master]: sniffer: set LED pattern

2018-07-11 Thread Kévin Redon
Hello Jenkins Builder,

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

https://gerrit.osmocom.org/9924

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

Change subject: sniffer: set LED pattern
..

sniffer: set LED pattern

The red and green LEDs are now used as follows:
- red on = power (firmware is running)
- red blink = error detected (e.g. during ISO-7816 parsing)
- green on = running (sniffer mode is running)
- green blink = activity (e.g. USB message sent)

Change-Id: Ib1b6ff87fb92d6ed3ecae4bc89386206aaab508e
---
M firmware/apps/trace/main.c
M firmware/libcommon/source/sniffer.c
2 files changed, 8 insertions(+), 3 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/simtrace2 refs/changes/24/9924/5
--
To view, visit https://gerrit.osmocom.org/9924
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: simtrace2
Gerrit-Branch: master
Gerrit-MessageType: newpatchset
Gerrit-Change-Id: Ib1b6ff87fb92d6ed3ecae4bc89386206aaab508e
Gerrit-Change-Number: 9924
Gerrit-PatchSet: 5
Gerrit-Owner: Kévin Redon 
Gerrit-Reviewer: Jenkins Builder


Change in simtrace2[master]: sniff: add checksum verification for ATR and PPS

2018-07-11 Thread Kévin Redon
Hello Jenkins Builder,

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

https://gerrit.osmocom.org/9966

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

Change subject: sniff: add checksum verification for ATR and PPS
..

sniff: add checksum verification for ATR and PPS

a checksum error is only signaled in the USB message with the
corresponding flag.

Change-Id: I277868267c3199eea216ab47bdd09fb2fb944b06
---
M firmware/libcommon/include/simtrace_prot.h
M firmware/libcommon/source/sniffer.c
M host/simtrace2-sniff.c
3 files changed, 28 insertions(+), 3 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/simtrace2 refs/changes/66/9966/3
--
To view, visit https://gerrit.osmocom.org/9966
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: simtrace2
Gerrit-Branch: master
Gerrit-MessageType: newpatchset
Gerrit-Change-Id: I277868267c3199eea216ab47bdd09fb2fb944b06
Gerrit-Change-Number: 9966
Gerrit-PatchSet: 3
Gerrit-Owner: Kévin Redon 
Gerrit-Reviewer: Jenkins Builder


Change in simtrace2[master]: LED: add need pattern

2018-07-11 Thread Kévin Redon
Hello Jenkins Builder,

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

https://gerrit.osmocom.org/9923

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

Change subject: LED: add need pattern
..

LED: add need pattern

new LED pattern: off for 200 ms and then on

Change-Id: Id2c40dc20d75ed6f38b735164ad1eb2860dc480c
---
M firmware/libboard/common/include/led.h
M firmware/libboard/common/source/led.c
2 files changed, 13 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/simtrace2 refs/changes/23/9923/5
--
To view, visit https://gerrit.osmocom.org/9923
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: simtrace2
Gerrit-Branch: master
Gerrit-MessageType: newpatchset
Gerrit-Change-Id: Id2c40dc20d75ed6f38b735164ad1eb2860dc480c
Gerrit-Change-Number: 9923
Gerrit-PatchSet: 5
Gerrit-Owner: Kévin Redon 
Gerrit-Reviewer: Jenkins Builder


Change in simtrace2[master]: make adc2uv common

2018-07-11 Thread Kévin Redon
Hello Jenkins Builder,

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

https://gerrit.osmocom.org/9964

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

Change subject: make adc2uv common
..

make adc2uv common

when building the trace app for the simtrace board gcc was outputing
the following error:
libboard/common/source/boardver_adc.c:20:17: warning: 'adc2uv' defined but not 
used [-Wunused-function]
 static uint32_t adc2uv(uint16_t adc)

adc2uv is used by qmod, and defined in two places:
in boardver_adc.c and mode_cardemu.c.

this change will have adc2uv only defined in boardver_adc.c and make
available in the header to be used by mode_cardemu.c.

Change-Id: I8a772638fa8dd02d8bc8b7631de5af5a22647c55
---
M firmware/libboard/common/include/boardver_adc.h
M firmware/libboard/common/source/boardver_adc.c
M firmware/libcommon/source/mode_cardemu.c
3 files changed, 3 insertions(+), 9 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/simtrace2 refs/changes/64/9964/3
--
To view, visit https://gerrit.osmocom.org/9964
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: simtrace2
Gerrit-Branch: master
Gerrit-MessageType: newpatchset
Gerrit-Change-Id: I8a772638fa8dd02d8bc8b7631de5af5a22647c55
Gerrit-Change-Number: 9964
Gerrit-PatchSet: 3
Gerrit-Owner: Kévin Redon 
Gerrit-Reviewer: Jenkins Builder


Change in simtrace2[master]: sniffer: only allocate USB message if queue is not too long

2018-07-11 Thread Kévin Redon
Hello Jenkins Builder,

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

https://gerrit.osmocom.org/9927

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

Change subject: sniffer: only allocate USB message if queue is not too long
..

sniffer: only allocate USB message if queue is not too long

When the host does not retrieved the USB messages, they keep getting
queue in the firmware, filling the RAM, and preventing further memory
to be allocated.

Change-Id: I0e447acdf757dcb5dc5c4d8b84a4235866914cad
---
M firmware/libcommon/source/sniffer.c
1 file changed, 8 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/simtrace2 refs/changes/27/9927/5
--
To view, visit https://gerrit.osmocom.org/9927
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: simtrace2
Gerrit-Branch: master
Gerrit-MessageType: newpatchset
Gerrit-Change-Id: I0e447acdf757dcb5dc5c4d8b84a4235866914cad
Gerrit-Change-Number: 9927
Gerrit-PatchSet: 5
Gerrit-Owner: Kévin Redon 
Gerrit-Reviewer: Jenkins Builder


Change in simtrace2[master]: DFU: use central DFU override check

2018-07-11 Thread Kévin Redon
Hello Jenkins Builder,

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

https://gerrit.osmocom.org/9913

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

Change subject: DFU: use central DFU override check
..

DFU: use central DFU override check

TRACE_INFO will also provide the DFU start reason, but TRACE_INFO
(TRACE_LEVEL >= 4) should only be used for debugging.
WARNING: With TRACE_LEVEL >= 4 the DFU binary is over the maximum of
16 kiB allocated for the DFU bootloader.
Thus make combined will not boot the main application because its
start if after the expecte 16 kiB address; and flashing using DFU
will overwrite the DFU bootloader itself.

Change-Id: I82323e0f76c03f67df7dc8f2b6783166cc25f3aa
---
M firmware/apps/dfu/main.c
M firmware/libboard/common/source/board_cstartup_gnu.c
2 files changed, 51 insertions(+), 28 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/simtrace2 refs/changes/13/9913/4
--
To view, visit https://gerrit.osmocom.org/9913
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: simtrace2
Gerrit-Branch: master
Gerrit-MessageType: newpatchset
Gerrit-Change-Id: I82323e0f76c03f67df7dc8f2b6783166cc25f3aa
Gerrit-Change-Number: 9913
Gerrit-PatchSet: 4
Gerrit-Owner: Kévin Redon 
Gerrit-Reviewer: Jenkins Builder


Change in simtrace2[master]: minor: fix linker warning

2018-07-11 Thread Kévin Redon
Hello Jenkins Builder,

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

https://gerrit.osmocom.org/9925

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

Change subject: minor: fix linker warning
..

minor: fix linker warning

linker warning:
obj/simtrace/dfu_sniffer.o: In function `usb_send_data':
/media/data/work/simtrace2/simtrace2/firmware/libcommon/source/sniffer.c:338: 
warning: undefined reference to `putchar'

Change-Id: I934f3fcb474d4046e921511a024c3a0b8533c782
---
M firmware/libcommon/source/sniffer.c
1 file changed, 1 insertion(+), 1 deletion(-)


  git pull ssh://gerrit.osmocom.org:29418/simtrace2 refs/changes/25/9925/5
--
To view, visit https://gerrit.osmocom.org/9925
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: simtrace2
Gerrit-Branch: master
Gerrit-MessageType: newpatchset
Gerrit-Change-Id: I934f3fcb474d4046e921511a024c3a0b8533c782
Gerrit-Change-Number: 9925
Gerrit-PatchSet: 5
Gerrit-Owner: Kévin Redon 
Gerrit-Reviewer: Jenkins Builder


  1   2   >