From mike.mcternan at wavemobile.com Tue Sep 1 11:11:41 2015 From: mike.mcternan at wavemobile.com (Mike McTernan (wavemobile)) Date: Tue, 1 Sep 2015 11:11:41 +0000 Subject: [PATCH] openbsc: unhardwire MGCP endpoint id In-Reply-To: <7FE87464-FBBA-43A3-A485-3C2A120EBE8F@freyther.de> References: <7FE87464-FBBA-43A3-A485-3C2A120EBE8F@freyther.de> Message-ID: > great, do you have time to prepare a revised patch? Of course, my pleasure. Please see the attached. Mike -------------- next part -------------- A non-text attachment was scrubbed... Name: mgcp-endpoint-id-v2.patch Type: application/octet-stream Size: 1143 bytes Desc: mgcp-endpoint-id-v2.patch URL: From laforge at gnumonks.org Sat Sep 5 21:32:35 2015 From: laforge at gnumonks.org (Harald Welte) Date: Sat, 5 Sep 2015 23:32:35 +0200 Subject: Osmocom Berlin User Group revival? Message-ID: <20150905213235.GB3853@nataraja> Dear all, After two years of intermission, I'm currently pondering to revive the Osmocom Berlin User Group and would like to understand a) who would be interested in attending? b) which day(s) of the week would be preferred / not preferred? Instad of "just" hanging out, chatting about Osmocom related topics etc. I am interested in having actual topics for each of the meetings. There is no need for a formal presentation or anything like that, but at least let's try to stay focussed on the topic for the first hour or so, and then conclude with a more general chat towards the end. Some of the topics that I would like to start with ASAP: * sharing of knowledge regarding 3G and 4G protocol stacks (I'm looking a lot at this recently, and it is a good time to talk about what I've learned) * completing the work towards splitting osmo-nitb into osmo-bsc and osmo-mss - as a first stept towards adding RANAP/Iu to osmo-mss * attempting to decode/analyze BVG bus/tram radio (TETRAPOL) using tetrapol-kit from http://brmlab.cz/git/tetrapol-kit.git * are berlin S-Bahn trains actually still broadcasting their GPS position in MPT1327? * moving ahead with AT91SAM3S based SIMtrace2 with MITM support Let me know who is interested in joining. In terms of venue I would suggest to again use the CCCB, unless somebody objects. We could of course also ask our friends at IN-Berlin or C-Base. In terms of schedule, I would actually want to go for bi-weekly again. Happy hacking, Harald -- - Harald Welte http://laforge.gnumonks.org/ ============================================================================ "Privacy in residential applications is a desirable marketing option." (ETSI EN 300 175-7 Ch. A6) From laforge at gnumonks.org Sun Sep 6 13:09:09 2015 From: laforge at gnumonks.org (Harald Welte) Date: Sun, 6 Sep 2015 15:09:09 +0200 Subject: L1SAP and TRX rebase, the last one (TM) Message-ID: <20150906130909.GF3853@nataraja> Dear all, after my futile attempt in September last year to finally merge l1sap (see the 201409-l1sap branch), I'm making one final attempt. The following branches have been created + pushed: * 201509-l1sap: The core l1sap change that I intend to merge This is most of the heavy lifting by introducing L1SAP between the sysmobts l1 and the common code. Hasn't been modified much. * 201509-trx-rebase: osmo-bts-trx support that I intend to merge This is what I can merge without too much review, as it does not touch the common code, except some minor l1sap fixes, and * the AMR multirate change, requiring a matching patch on openbsc.git * bts_model_abis_close() which should be fine * ability to configue multiple TRX from VTY * 201509-fairwaves-rebase Stuff I cannot merge in its current form * the abis/e1inp multi-trx and reconnect changes require in-depth review and testing. Part of it is marked as HACK even by Andreas. * a so-called 'fix for use after free' that is actually a patch that introduces another copy for every primitive and is only required for the loopback mode * copying gsm_data_common.[ch] into the repo for debian packaging [let's not discuss further work on this before l1sap and trx-rebase are merged] I recommend everyone with a stake in this to review or test the code in 201509-l1sap and 201509-trx-rebase now. My schedule is to merge at some point next week, unless someone raises some serious objections. What needs to be done after the merge is to unify the src/common/power_control.c code from Holger originating in master with src/common/loops.c from Andreas originating from the osmo-trx branch. There is no doubt that the power control and timing advance loops should be part of common, as this is required in virtually any BTS hardware. However, we can safely merge/unify this after the merging of the above branches. Regards, Harald -- - Harald Welte http://laforge.gnumonks.org/ ============================================================================ "Privacy in residential applications is a desirable marketing option." (ETSI EN 300 175-7 Ch. A6) From alexander.chemeris at gmail.com Mon Sep 7 06:08:47 2015 From: alexander.chemeris at gmail.com (Alexander Chemeris) Date: Mon, 7 Sep 2015 01:08:47 -0500 Subject: L1SAP and TRX rebase, the last one (TM) In-Reply-To: <20150906130909.GF3853@nataraja> References: <20150906130909.GF3853@nataraja> Message-ID: Hi Harald, On Sun, Sep 6, 2015 at 8:09 AM, Harald Welte wrote: > after my futile attempt in September last year to finally merge l1sap > (see the 201409-l1sap branch), I'm making one final attempt. That's incredible. Thank you for making this final step. > * a so-called 'fix for use after free' that is actually a patch that > introduces another copy for every primitive and is only required for > the loopback mode I'd appreciate recommendations on how to do this differently. IIRC the code frees messages after the function and the queue was pointing to a freed message. this led to undefined behavior. There is a companion patch to this to manually activate/deactivate a channel. I'd appreciate recommendations on how to properly implement it as well. Loopback and channel activation functions are very helpful for the L0/L1 development. > I recommend everyone with a stake in this to review or test the code > in 201509-l1sap and 201509-trx-rebase now. My schedule is to merge at > some point next week, unless someone raises some serious objections. We're little busy this week, so assume we're ok by default. If we find time for testing and find something - we'll let you know. Worst case we'll fix TRX support after it's merged. Could you share what kind of testing has been performed, so we can shape our expectations? > What needs to be done after the merge is to unify the > src/common/power_control.c code from Holger originating in master with > src/common/loops.c from Andreas originating from the osmo-trx branch. > > There is no doubt that the power control and timing advance loops should > be part of common, as this is required in virtually any BTS hardware. Indeed. I can promise to look into this, but it'll be a long time before I can do that. If there is any interest in doing this before then - don't hold your breath. > However, we can safely merge/unify this after the merging of the above > branches. Totally agree. -- Regards, Alexander Chemeris. CEO, Fairwaves, Inc. https://fairwaves.co From holger at freyther.de Mon Sep 7 07:24:41 2015 From: holger at freyther.de (Holger Freyther) Date: Mon, 7 Sep 2015 09:24:41 +0200 Subject: L1SAP and TRX rebase, the last one (TM) In-Reply-To: <20150906130909.GF3853@nataraja> References: <20150906130909.GF3853@nataraja> Message-ID: > On 06 Sep 2015, at 15:09, Harald Welte wrote: > > Dear all, > > > * 201509-trx-rebase: osmo-bts-trx support that I intend to merge > This is what I can merge without too much review, as it does not touch > the common code, except some minor l1sap fixes, and > * the AMR multirate change, requiring a matching patch on openbsc.git > What needs to be done after the merge is to unify the > src/common/power_control.c code from Holger originating in master with > src/common/loops.c from Andreas originating from the osmo-trx branch. I think the AMR part could be generalized as well? I am currently adding the configuration for MR to OpenBSC. I wonder if there is value in being able to separate the thresholds for the BTS and the MS? From sipos.csaba at kvk.uni-obuda.hu Mon Sep 7 20:37:47 2015 From: sipos.csaba at kvk.uni-obuda.hu (Sipos Csaba) Date: Mon, 7 Sep 2015 22:37:47 +0200 (CEST) Subject: L1SAP and TRX rebase, the last one (TM) In-Reply-To: <20150906130909.GF3853@nataraja> References: <20150906130909.GF3853@nataraja> Message-ID: <2056147707.4252644.1441658267203.JavaMail.zimbra@kvk.uni-obuda.hu> Dear Harald, Your work is much apreciated, there are a lot of important features in these branches not yet merged to the master. I will test it on a B200 with a strong focus on PS domain (probably next week because I am quite busy at the moment). The new Wiki article about how to operate the B200/B210 with the Osmocom projects is also in the pipe :-) Regards, Csaba ----- Eredeti ?zenet ----- Felad?: "Harald Welte" C?mzett: openbsc at lists.osmocom.org Elk?ld?tt ?zenetek: Vas?rnap, 2015. Szeptember 6. 15:09:09 T?rgy: L1SAP and TRX rebase, the last one (TM) Dear all, after my futile attempt in September last year to finally merge l1sap (see the 201409-l1sap branch), I'm making one final attempt. The following branches have been created + pushed: * 201509-l1sap: The core l1sap change that I intend to merge This is most of the heavy lifting by introducing L1SAP between the sysmobts l1 and the common code. Hasn't been modified much. * 201509-trx-rebase: osmo-bts-trx support that I intend to merge This is what I can merge without too much review, as it does not touch the common code, except some minor l1sap fixes, and * the AMR multirate change, requiring a matching patch on openbsc.git * bts_model_abis_close() which should be fine * ability to configue multiple TRX from VTY * 201509-fairwaves-rebase Stuff I cannot merge in its current form * the abis/e1inp multi-trx and reconnect changes require in-depth review and testing. Part of it is marked as HACK even by Andreas. * a so-called 'fix for use after free' that is actually a patch that introduces another copy for every primitive and is only required for the loopback mode * copying gsm_data_common.[ch] into the repo for debian packaging [let's not discuss further work on this before l1sap and trx-rebase are merged] I recommend everyone with a stake in this to review or test the code in 201509-l1sap and 201509-trx-rebase now. My schedule is to merge at some point next week, unless someone raises some serious objections. What needs to be done after the merge is to unify the src/common/power_control.c code from Holger originating in master with src/common/loops.c from Andreas originating from the osmo-trx branch. There is no doubt that the power control and timing advance loops should be part of common, as this is required in virtually any BTS hardware. However, we can safely merge/unify this after the merging of the above branches. Regards, Harald -- - Harald Welte http://laforge.gnumonks.org/ ============================================================================ "Privacy in residential applications is a desirable marketing option." (ETSI EN 300 175-7 Ch. A6) From alexander.chemeris at gmail.com Tue Sep 8 04:07:18 2015 From: alexander.chemeris at gmail.com (Alexander Chemeris) Date: Mon, 7 Sep 2015 23:07:18 -0500 Subject: L1SAP and TRX rebase, the last one (TM) In-Reply-To: References: <20150906130909.GF3853@nataraja> Message-ID: On Mon, Sep 7, 2015 at 2:24 AM, Holger Freyther wrote: >> On 06 Sep 2015, at 15:09, Harald Welte wrote: >> * 201509-trx-rebase: osmo-bts-trx support that I intend to merge >> This is what I can merge without too much review, as it does not touch >> the common code, except some minor l1sap fixes, and >> * the AMR multirate change, requiring a matching patch on openbsc.git > >> What needs to be done after the merge is to unify the >> src/common/power_control.c code from Holger originating in master with >> src/common/loops.c from Andreas originating from the osmo-trx branch. > > I think the AMR part could be generalized as well? Sounds like a good idea. > I am currently adding > the configuration for MR to OpenBSC. I wonder if there is value in being > able to separate the thresholds for the BTS and the MS? I don't have much experience with AMR, but having more flexibility looks like a better way than less flexibility. -- Regards, Alexander Chemeris. CEO, Fairwaves, Inc. https://fairwaves.co From laforge at gnumonks.org Tue Sep 8 14:13:08 2015 From: laforge at gnumonks.org (Harald Welte) Date: Tue, 8 Sep 2015 16:13:08 +0200 Subject: L1SAP and TRX rebase, the last one (TM) In-Reply-To: References: <20150906130909.GF3853@nataraja> Message-ID: <20150908141308.GP5987@nataraja> Hi Alexander, On Mon, Sep 07, 2015 at 01:08:47AM -0500, Alexander Chemeris wrote: > > * a so-called 'fix for use after free' that is actually a patch that > > introduces another copy for every primitive and is only required for > > the loopback mode > > I'd appreciate recommendations on how to do this differently. IIRC the > code frees messages after the function and the queue was pointing to a > freed message. this led to undefined behavior. > > There is a companion patch to this to manually activate/deactivate a > channel. I'd appreciate recommendations on how to properly implement > it as well. Loopback and channel activation functions are very helpful > for the L0/L1 development. I don't really have a good response for this, other than to keep it out of master (or maybe even a compile time option). 99.9% of all installations will not have any benefit from the extra memcpy(), so I don't want to make it the standard behavior. > We're little busy this week, so assume we're ok by default. If we find > time for testing and find something - we'll let you know. Worst case > we'll fix TRX support after it's merged. agreed. > Could you share what kind of testing has been performed, so we can > shape our expectations? Not much, to be honest. We will test for osmo-bts-sysmo during this week. However, no testing will be done by me regarding the osmo-trx related code. Regards, Harald -- - Harald Welte http://laforge.gnumonks.org/ ============================================================================ "Privacy in residential applications is a desirable marketing option." (ETSI EN 300 175-7 Ch. A6) From laforge at gnumonks.org Wed Sep 9 20:26:46 2015 From: laforge at gnumonks.org (Harald Welte) Date: Wed, 9 Sep 2015 22:26:46 +0200 Subject: Osmocom Berlin User Group revival? In-Reply-To: <20150905213235.GB3853@nataraja> References: <20150905213235.GB3853@nataraja> Message-ID: <20150909202646.GR5987@nataraja> Dear all, today the CCC Berlin has given us permission to use their premises for on the evening of the first and third wednesday of each month. This means that the Osmocom User Group Berlin will be meeting on the followign dates. October 7, 2015 October 21, 2015 November 4, 2015 November 18, 2015 December 2, 2015 December 16, 2015 We'll again meet from 8pm onwards, like back in 2012. I will be shortly sending an official announcement including the topic for the first meeting. Looking forward to meeting some of the old regulars and of course new people with interest in mobile communications protocols, SDR, ... -- - Harald Welte http://laforge.gnumonks.org/ ============================================================================ "Privacy in residential applications is a desirable marketing option." (ETSI EN 300 175-7 Ch. A6) From alexander.chemeris at gmail.com Sat Sep 12 04:19:34 2015 From: alexander.chemeris at gmail.com (Alexander Chemeris) Date: Sat, 12 Sep 2015 00:19:34 -0400 Subject: L1SAP and TRX rebase, the last one (TM) In-Reply-To: <20150908141308.GP5987@nataraja> References: <20150906130909.GF3853@nataraja> <20150908141308.GP5987@nataraja> Message-ID: HI Harald, On Tue, Sep 8, 2015 at 10:13 AM, Harald Welte wrote: > On Mon, Sep 07, 2015 at 01:08:47AM -0500, Alexander Chemeris wrote: >> > * a so-called 'fix for use after free' that is actually a patch that >> > introduces another copy for every primitive and is only required for >> > the loopback mode >> >> I'd appreciate recommendations on how to do this differently. IIRC the >> code frees messages after the function and the queue was pointing to a >> freed message. this led to undefined behavior. >> >> There is a companion patch to this to manually activate/deactivate a >> channel. I'd appreciate recommendations on how to properly implement >> it as well. Loopback and channel activation functions are very helpful >> for the L0/L1 development. > > I don't really have a good response for this, other than to keep it out > of master (or maybe even a compile time option). 99.9% of all > installations will not have any benefit from the extra memcpy(), so I > don't want to make it the standard behavior. I took a look into this patch today. So, first of all - as I expected, it changes behavior only for channels marked as loopback. I.e. it has no effect on production systems. But nevertheless, I found a cleaner solution and checked it in as two first commits at the 201509-fairwaves-rebase branch. If we return "1" from the function, the message is not being freed and we don't need to create a copy of it. I think it worth merging, as it doesn't degrade anything and is a clean fix. >> Could you share what kind of testing has been performed, so we can >> shape our expectations? > > Not much, to be honest. We will test for osmo-bts-sysmo during this > week. However, no testing will be done by me regarding the osmo-trx > related code. Ok, noted. I tried to run the code today, but was not able to get osmo-bts to start at all. It stop with an error: <0011> e1_input.c:326 No such E1 driver 'ipa Have you seen this? I guess this comes from the common part of the code, but I don't have much experience with this part of the code, unfortunately. -- Regards, Alexander Chemeris. CEO, Fairwaves, Inc. https://fairwaves.co From alexander.chemeris at gmail.com Sat Sep 12 04:23:38 2015 From: alexander.chemeris at gmail.com (Alexander Chemeris) Date: Sat, 12 Sep 2015 00:23:38 -0400 Subject: [PATCH] msc: Add channel information to the meas_feed, bump version to v1 In-Reply-To: <20150826114033.GV1065@nataraja> References: <20150826114033.GV1065@nataraja> Message-ID: Hi Holger, On Wed, Aug 26, 2015 at 7:40 AM, Harald Welte wrote: > On Sat, Aug 22, 2015 at 11:35:05AM +0200, Holger Freyther wrote: >> patch looks good. As the original meas_viz has been created by Harald I >> will wait a week before merging it. > > Thanks (but then with that rule you might have to wait on a lot of > patches, I suppose). Merging it is fine with me! Could we get this merged? -- Regards, Alexander Chemeris. CEO, Fairwaves, Inc. https://fairwaves.co From laforge at gnumonks.org Sat Sep 12 08:47:13 2015 From: laforge at gnumonks.org (Harald Welte) Date: Sat, 12 Sep 2015 10:47:13 +0200 Subject: L1SAP and TRX rebase, the last one (TM) In-Reply-To: References: <20150906130909.GF3853@nataraja> <20150908141308.GP5987@nataraja> Message-ID: <20150912084713.GH28511@nataraja> Hi Alexander, On Sat, Sep 12, 2015 at 12:19:34AM -0400, Alexander Chemeris wrote: > I tried to run the code today, but was not able to get osmo-bts to > start at all. It stop with an error: > <0011> e1_input.c:326 No such E1 driver 'ipa > Have you seen this? I guess this comes from the common part of the > code, but I don't have much experience with this part of the code, > unfortunately. I have seen this and remember fixing it. I will double-check that this fix is in the repo, maybe I forgot to push or didn't push to the right branch. Sorry for that. -- - Harald Welte http://laforge.gnumonks.org/ ============================================================================ "Privacy in residential applications is a desirable marketing option." (ETSI EN 300 175-7 Ch. A6) From laforge at gnumonks.org Sat Sep 12 09:01:42 2015 From: laforge at gnumonks.org (Harald Welte) Date: Sat, 12 Sep 2015 11:01:42 +0200 Subject: L1SAP and TRX rebase, the last one (TM) In-Reply-To: References: <20150906130909.GF3853@nataraja> <20150908141308.GP5987@nataraja> Message-ID: <20150912090142.GI28511@nataraja> Hi Alexander, On Sat, Sep 12, 2015 at 12:19:34AM -0400, Alexander Chemeris wrote: > I tried to run the code today, but was not able to get osmo-bts to > start at all. It stop with an error: > <0011> e1_input.c:326 No such E1 driver 'ipa > Have you seen this? I guess this comes from the common part of the > code, but I don't have much experience with this part of the code, > unfortunately. Please check commit '2e9854e368d72f7481e14ec712de0baede685efd' which should resolve this. Looking forward to your further test results. -- - Harald Welte http://laforge.gnumonks.org/ ============================================================================ "Privacy in residential applications is a desirable marketing option." (ETSI EN 300 175-7 Ch. A6) From alexander.chemeris at gmail.com Sat Sep 12 15:12:29 2015 From: alexander.chemeris at gmail.com (Alexander Chemeris) Date: Sat, 12 Sep 2015 11:12:29 -0400 Subject: L1SAP and TRX rebase, the last one (TM) In-Reply-To: <20150912090142.GI28511@nataraja> References: <20150906130909.GF3853@nataraja> <20150908141308.GP5987@nataraja> <20150912090142.GI28511@nataraja> Message-ID: On Sat, Sep 12, 2015 at 5:01 AM, Harald Welte wrote: > Hi Alexander, > > On Sat, Sep 12, 2015 at 12:19:34AM -0400, Alexander Chemeris wrote: > >> I tried to run the code today, but was not able to get osmo-bts to >> start at all. It stop with an error: >> <0011> e1_input.c:326 No such E1 driver 'ipa >> Have you seen this? I guess this comes from the common part of the >> code, but I don't have much experience with this part of the code, >> unfortunately. > > Please check commit '2e9854e368d72f7481e14ec712de0baede685efd' which > should resolve this. Looking forward to your further test results. Thanks a lot! Now it starts, but crashes while reading a config file: #0 cfg_trx_rxgain (self=, vty=, argc=, argv=) at trx_vty.c:232 (gdb) bt #0 cfg_trx_rxgain (self=, vty=, argc=, argv=) at trx_vty.c:232 #1 0x00007f797e2951c7 in cmd_execute_command_strict (vline=vline at entry=0x17ded20, vty=vty at entry=0x17de940, cmd=cmd at entry=0x0) at command.c:2211 #2 0x00007f797e295246 in config_from_file (vty=vty at entry=0x17de940, fp=fp at entry=0x17de6b0) at command.c:2234 #3 0x00007f797e2980b4 in vty_read_file (priv=0x0, confp=0x17de6b0) at vty.c:1458 #4 vty_read_config_file (file_name=0x1763680 "/etc/osmocom/osmo-bts.cfg", priv=priv at entry=0x0) at vty.c:1775 #5 0x00000000004041c6 in main (argc=5, argv=0x7ffd931ee858) at main.c:333 DEFUN(cfg_trx_rxgain, cfg_trx_rxgain_cmd, "rxgain <0-50>", "Set the receiver gain in dB\n" "Gain in dB\n") { struct gsm_bts_trx *trx = vty->index; struct trx_l1h *l1h = trx_l1h_hdl(trx); l1h->config.rxgain = atoi(argv[0]); l1h->config.rxgain_valid = 1; ^^^^^^^^^^^^^^^^^^^^^^ I'll look into this later if you don't happen to know the reason for this already. -- Regards, Alexander Chemeris. CEO, Fairwaves, Inc. https://fairwaves.co From sipos.csaba at kvk.uni-obuda.hu Sat Sep 12 16:19:05 2015 From: sipos.csaba at kvk.uni-obuda.hu (Sipos Csaba) Date: Sat, 12 Sep 2015 18:19:05 +0200 (CEST) Subject: DAHDi support broken (with DAHDI 2.7.0 onwards) In-Reply-To: <227848651.14782013.1442074002485.JavaMail.zimbra@kvk.uni-obuda.hu> Message-ID: <1718679701.14782406.1442074745121.JavaMail.zimbra@kvk.uni-obuda.hu> Dear Harald, This is probably no the best moment, but as the original implementer of DAHDI support in OpenBSC, maybe you can fix this. It seems that DAHDI 2.7.0 breaks the compatibility with OpenBSC. I think the only thing they changed is the way you need to refer to the E1 device in /dev and because of that, OpenBSC will not going to find the DAHDI device and give an error in that regard. The last time I checked (around version 2.9) this was the only problem, otherwise OpenBSC compiles fine with DAHDI. Anyway, the use of DAHDI 2.6.3 (the latest which works with OpenBSC) forces us to use very old kernels (and OSes), and I am quite sure we are not the only ones still using OpenBSC with E1. :-) I hope you will have some time and take a quick look into this. If you dont have any E1 based hardware anymore, I am more than happy to help you and test the fix on our (Nokia InSite, MetroSite, Ultrasite based) system. Thank you! Regards, Csaba From sipos.csaba at kvk.uni-obuda.hu Sat Sep 12 16:46:51 2015 From: sipos.csaba at kvk.uni-obuda.hu (Sipos Csaba) Date: Sat, 12 Sep 2015 18:46:51 +0200 (CEST) Subject: DAHDi support broken (with DAHDI 2.7.0 onwards) In-Reply-To: <1718679701.14782406.1442074745121.JavaMail.zimbra@kvk.uni-obuda.hu> References: <1718679701.14782406.1442074745121.JavaMail.zimbra@kvk.uni-obuda.hu> Message-ID: <662388329.14783705.1442076411356.JavaMail.zimbra@kvk.uni-obuda.hu> Hang on for a second. Just compiled DAHDi 2.10.2 and it seems they fixed the /dev path issue and now the old addressing structure is "emualted" with symbolic links. Will test this on Monday, until then please consider my email obsolete. Anyway, this was sure a problem with version 2.7 and 2.8 for quite long period of time. Regards, Csaba ----- Eredeti ?zenet ----- Felad?: "Sipos Csaba" C?mzett: "Harald Welte" M?solatot kap: "OpenBSC Mailing List" Elk?ld?tt ?zenetek: Szombat, 2015. Szeptember 12. 18:19:05 T?rgy: DAHDi support broken (with DAHDI 2.7.0 onwards) Dear Harald, This is probably no the best moment, but as the original implementer of DAHDI support in OpenBSC, maybe you can fix this. It seems that DAHDI 2.7.0 breaks the compatibility with OpenBSC. I think the only thing they changed is the way you need to refer to the E1 device in /dev and because of that, OpenBSC will not going to find the DAHDI device and give an error in that regard. The last time I checked (around version 2.9) this was the only problem, otherwise OpenBSC compiles fine with DAHDI. Anyway, the use of DAHDI 2.6.3 (the latest which works with OpenBSC) forces us to use very old kernels (and OSes), and I am quite sure we are not the only ones still using OpenBSC with E1. :-) I hope you will have some time and take a quick look into this. If you dont have any E1 based hardware anymore, I am more than happy to help you and test the fix on our (Nokia InSite, MetroSite, Ultrasite based) system. Thank you! Regards, Csaba From alexander.chemeris at gmail.com Sat Sep 12 23:57:29 2015 From: alexander.chemeris at gmail.com (Alexander Chemeris) Date: Sat, 12 Sep 2015 19:57:29 -0400 Subject: L1SAP and TRX rebase, the last one (TM) In-Reply-To: References: <20150906130909.GF3853@nataraja> <20150908141308.GP5987@nataraja> <20150912090142.GI28511@nataraja> Message-ID: On Sat, Sep 12, 2015 at 11:12 AM, Alexander Chemeris wrote: > On Sat, Sep 12, 2015 at 5:01 AM, Harald Welte wrote: >> On Sat, Sep 12, 2015 at 12:19:34AM -0400, Alexander Chemeris wrote: >> >>> I tried to run the code today, but was not able to get osmo-bts to >>> start at all. It stop with an error: >>> <0011> e1_input.c:326 No such E1 driver 'ipa >>> Have you seen this? I guess this comes from the common part of the >>> code, but I don't have much experience with this part of the code, >>> unfortunately. >> >> Please check commit '2e9854e368d72f7481e14ec712de0baede685efd' which >> should resolve this. Looking forward to your further test results. > > Thanks a lot! Now it starts, but crashes while reading a config file: Please disregard this. I did a clean rebuild and it starts normally now. I don't have an UmTRX with me to test if it actually works, we'll get back to this in a couple days. -- Regards, Alexander Chemeris. CEO, Fairwaves, Inc. https://fairwaves.co From alexander.chemeris at gmail.com Sun Sep 13 00:46:38 2015 From: alexander.chemeris at gmail.com (Alexander Chemeris) Date: Sat, 12 Sep 2015 20:46:38 -0400 Subject: [PATCH 1/3] mncc: Implement helper functions to convert MNCC cause to a string. Message-ID: This is the first patch of the series. The first two patches are improvements of the log output and are independent of the 3rd patch in terms of code - proposed logging improvements just make it easier to debug issues with MNCC cause codes. The code is also a part of the achemeris/mncc_cause_fixes_master branch. -- Regards, Alexander Chemeris. CEO, Fairwaves, Inc. https://fairwaves.co -------------- next part -------------- A non-text attachment was scrubbed... Name: 0001-mncc-Implement-helper-functions-to-convert-MNCC-caus.patch Type: text/x-patch Size: 4990 bytes Desc: not available URL: From alexander.chemeris at gmail.com Sun Sep 13 00:47:15 2015 From: alexander.chemeris at gmail.com (Alexander Chemeris) Date: Sat, 12 Sep 2015 20:47:15 -0400 Subject: [PATCH 2/3] mncc: Log CC cause when sending a primitive to MNCC. Message-ID: The code is also a part of the achemeris/mncc_cause_fixes_master branch. -- Regards, Alexander Chemeris. CEO, Fairwaves, Inc. https://fairwaves.co -------------- next part -------------- A non-text attachment was scrubbed... Name: 0002-mncc-Log-CC-cause-when-sending-a-primitive-to-MNCC.patch Type: text/x-patch Size: 1966 bytes Desc: not available URL: From alexander.chemeris at gmail.com Sun Sep 13 00:48:28 2015 From: alexander.chemeris at gmail.com (Alexander Chemeris) Date: Sat, 12 Sep 2015 20:48:28 -0400 Subject: [PATCH 3/3] mncc: Send "Dest OOO" cause in case of a link radio failure. Message-ID: Previously we were sending a generic "Resource unavailable" cause code making it impossible to distinguish real error cases from a regular radio link failure. This was the reason for many "unknown" call errors we've seen at Rhizomatica installations. Now they are properly classified as non-erroneous call failures. The code is also a part of the achemeris/mncc_cause_fixes_master branch. -- Regards, Alexander Chemeris. CEO, Fairwaves, Inc. https://fairwaves.co -------------- next part -------------- A non-text attachment was scrubbed... Name: 0003-mncc-Send-Dest-OOO-cause-in-case-of-a-link-radio-fai.patch Type: text/x-patch Size: 4457 bytes Desc: not available URL: From alexander.chemeris at gmail.com Sun Sep 13 15:24:51 2015 From: alexander.chemeris at gmail.com (Alexander Chemeris) Date: Sun, 13 Sep 2015 11:24:51 -0400 Subject: [PATCH 3/3] mncc: Send "Dest OOO" cause in case of a link radio failure. In-Reply-To: References: Message-ID: Btw, I'm not sure 27 DESTINATION_OUT_OF_ORDER is the best cause in this case. Two other options I see suitable are 102 RECOVERY_ON_TIMER_EXPIRE and 604 MEDIA_TIMEOUT. Does anyone know is there an official mapping between Q.850 codes and various GSM cause codes? Another useful change here would be to propagate information about which timer expired. That would help to gather information about issues with the network. On Sat, Sep 12, 2015 at 8:48 PM, Alexander Chemeris wrote: > Previously we were sending a generic "Resource unavailable" cause code making > it impossible to distinguish real error cases from a regular radio link failure. > This was the reason for many "unknown" call errors we've seen at Rhizomatica > installations. Now they are properly classified as non-erroneous call failures. > > The code is also a part of the achemeris/mncc_cause_fixes_master branch. > > -- > Regards, > Alexander Chemeris. > CEO, Fairwaves, Inc. > https://fairwaves.co > > -- Regards, Alexander Chemeris. CEO, Fairwaves, Inc. https://fairwaves.co From alexander.chemeris at gmail.com Mon Sep 14 00:06:36 2015 From: alexander.chemeris at gmail.com (Alexander Chemeris) Date: Sun, 13 Sep 2015 20:06:36 -0400 Subject: L1SAP and TRX rebase, the last one (TM) In-Reply-To: References: <20150906130909.GF3853@nataraja> <20150908141308.GP5987@nataraja> <20150912090142.GI28511@nataraja> Message-ID: On Sat, Sep 12, 2015 at 7:57 PM, Alexander Chemeris wrote: > On Sat, Sep 12, 2015 at 11:12 AM, Alexander Chemeris > wrote: >> On Sat, Sep 12, 2015 at 5:01 AM, Harald Welte wrote: >>> On Sat, Sep 12, 2015 at 12:19:34AM -0400, Alexander Chemeris wrote: >>> >>>> I tried to run the code today, but was not able to get osmo-bts to >>>> start at all. It stop with an error: >>>> <0011> e1_input.c:326 No such E1 driver 'ipa >>>> Have you seen this? I guess this comes from the common part of the >>>> code, but I don't have much experience with this part of the code, >>>> unfortunately. >>> >>> Please check commit '2e9854e368d72f7481e14ec712de0baede685efd' which >>> should resolve this. Looking forward to your further test results. >> >> Thanks a lot! Now it starts, but crashes while reading a config file: > > Please disregard this. I did a clean rebuild and it starts normally now. > > I don't have an UmTRX with me to test if it actually works, we'll get > back to this in a couple days. I did some quick tests with UmSITE today and calls, SMS and USSD seem to work in basic scenarios. Deeper testing TBD. -- Regards, Alexander Chemeris. CEO, Fairwaves, Inc. https://fairwaves.co From holger at freyther.de Mon Sep 14 08:07:02 2015 From: holger at freyther.de (Holger Freyther) Date: Mon, 14 Sep 2015 10:07:02 +0200 Subject: [PATCH] msc: Add channel information to the meas_feed, bump version to v1 In-Reply-To: References: <20150826114033.GV1065@nataraja> Message-ID: > On 12 Sep 2015, at 06:23, Alexander Chemeris wrote: > > Hi Holger, > > > Could we get this merged? sure. The patch doesn?t show up on patchwork though. I am not sure why, maybe because it has been sent as attachment? Could you try to use git send-email for the next set of patches? holger From ciaby at autistici.org Mon Sep 14 13:36:05 2015 From: ciaby at autistici.org (Ciaby) Date: Mon, 14 Sep 2015 15:36:05 +0200 Subject: [PATCH] Add SMPP support in the debian build, include libsmpp34-dev as a dependency. In-Reply-To: <55DC4691.5020301@autistici.org> References: <55DC4691.5020301@autistici.org> Message-ID: <55F6CD45.5090507@autistici.org> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA512 On 08/25/2015 12:42 PM, Ciaby wrote: > This is the last out-of-tree patch that we're still using to > package OpenBSC in Rhizomatica. Adding SMPP support in the Debian > packages shouldn't be an issue, right? Any feedback on this one? :) Cheers Ciaby -----BEGIN PGP SIGNATURE----- iQIcBAEBCgAGBQJV9s06AAoJEPU83OtbD4fQkncP/jhgWwuSGTsB08QTAvIbCIM8 Wm/cfffK2HIqF4h0EPwMo5rdOdBTOi1n3pKAabg1BteMHSNYFrKV5YHmSLQ2gmYL J8wGJUsvsu2Bly+4qa4CMbZ8OXA8sVi6AFXcDiqIVi0Tnu4JiOVydbLCG1hBeEGh XYNAHCJtcTP+hOvqrb+o3Vb2ZixS6mA/T7vTWnzAxQW2cSrQY2LfqVZPQOVi9/j/ VMmi6PzPDO1/REZnwg2KX6rJOWR+MrL1VVRthv0Se/o/EV0aIXkqpd6iqttJ+KLJ oEQA8VYyPPunj+7zT0C56FAg8n8TMNNdJkAtgvXh+XVQgii0vYDlMx6W8FD/7OvI 23GBYf5jrMBrnRStP7ZRORBzDyDecoSmBXcW2McEv1QM3/GFTaDK1AQWtYksNr4/ VujTEI2Kgwd/M/jPzilGa53mTxVR/P+c5F0RfDbW0pL7OlncbiMZtncGsIz9e9Co QQ44xkt7IIlZO8EIBirU0HsJ5Wa12u6m+EIcfxJnyaookL3z0ROIwVk5pOXVj5xz Mo2s9Xj3cDBFN4R2IyY+FMJTuhkyifOIB08nXyeROav4N2+0dB815EA3Ad5tcX3C 8+U1BbE1KyNbwfrqBGPkfJG8SAgdg6Ysmk/PTY74i+sCbHolSaFmv8R3Xujy7pBU ittc/RBbxOYQPFB6gjDO =ZT7d -----END PGP SIGNATURE----- From sipos.csaba at kvk.uni-obuda.hu Mon Sep 14 15:20:34 2015 From: sipos.csaba at kvk.uni-obuda.hu (Sipos Csaba) Date: Mon, 14 Sep 2015 17:20:34 +0200 (CEST) Subject: DAHDi support broken (with DAHDI 2.7.0 onwards) In-Reply-To: <662388329.14783705.1442076411356.JavaMail.zimbra@kvk.uni-obuda.hu> References: <1718679701.14782406.1442074745121.JavaMail.zimbra@kvk.uni-obuda.hu> <662388329.14783705.1442076411356.JavaMail.zimbra@kvk.uni-obuda.hu> Message-ID: <2098607880.15081222.1442244034014.JavaMail.zimbra@kvk.uni-obuda.hu> Dear Harald, It seems DAHDI ver. 2.10.2 works with OpenBSC without modification on kernel 3.5. Tomorrow will recompile and test on kernel 3.16 and hopefully 3.19 Regards, Csaba ----- Eredeti ?zenet ----- Felad?: "Sipos Csaba" C?mzett: "Harald Welte" M?solatot kap: "OpenBSC Mailing List" Elk?ld?tt ?zenetek: Szombat, 2015. Szeptember 12. 18:46:51 T?rgy: Re: DAHDi support broken (with DAHDI 2.7.0 onwards) Hang on for a second. Just compiled DAHDi 2.10.2 and it seems they fixed the /dev path issue and now the old addressing structure is "emualted" with symbolic links. Will test this on Monday, until then please consider my email obsolete. Anyway, this was sure a problem with version 2.7 and 2.8 for quite long period of time. Regards, Csaba ----- Eredeti ?zenet ----- Felad?: "Sipos Csaba" C?mzett: "Harald Welte" M?solatot kap: "OpenBSC Mailing List" Elk?ld?tt ?zenetek: Szombat, 2015. Szeptember 12. 18:19:05 T?rgy: DAHDi support broken (with DAHDI 2.7.0 onwards) Dear Harald, This is probably no the best moment, but as the original implementer of DAHDI support in OpenBSC, maybe you can fix this. It seems that DAHDI 2.7.0 breaks the compatibility with OpenBSC. I think the only thing they changed is the way you need to refer to the E1 device in /dev and because of that, OpenBSC will not going to find the DAHDI device and give an error in that regard. The last time I checked (around version 2.9) this was the only problem, otherwise OpenBSC compiles fine with DAHDI. Anyway, the use of DAHDI 2.6.3 (the latest which works with OpenBSC) forces us to use very old kernels (and OSes), and I am quite sure we are not the only ones still using OpenBSC with E1. :-) I hope you will have some time and take a quick look into this. If you dont have any E1 based hardware anymore, I am more than happy to help you and test the fix on our (Nokia InSite, MetroSite, Ultrasite based) system. Thank you! Regards, Csaba From holger at freyther.de Mon Sep 14 20:54:19 2015 From: holger at freyther.de (Holger Freyther) Date: Mon, 14 Sep 2015 22:54:19 +0200 Subject: [PATCH] Add SMPP support in the debian build, include libsmpp34-dev as a dependency. In-Reply-To: <55F6CD45.5090507@autistici.org> References: <55DC4691.5020301@autistici.org> <55F6CD45.5090507@autistici.org> Message-ID: <3A0A1926-101E-4563-8DEF-D54541378A16@freyther.de> > On 14 Sep 2015, at 15:36, Ciaby wrote: > > Signed PGP part > On 08/25/2015 12:42 PM, Ciaby wrote: > > This is the last out-of-tree patch that we're still using to > > package OpenBSC in Rhizomatica. Adding SMPP support in the Debian > > packages shouldn't be an issue, right? > Any feedback on this one? :) had been silently applied? From nhofmeyr at sysmocom.de Tue Sep 15 11:15:28 2015 From: nhofmeyr at sysmocom.de (Neels Hofmeyr) Date: Tue, 15 Sep 2015 13:15:28 +0200 Subject: minor patches Message-ID: <20150915111528.GA16233@dub5> Hello OpenBSC, see attached patches: one added configure script requirement and two entirely cosmetic tweaks. ~Neels -------------- next part -------------- A non-text attachment was scrubbed... Name: 0001-openbsc-configure.ac-check-for-pcap-pcap.h.patch Type: text/x-diff Size: 920 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: 0002-Remove-empty-README.patch Type: text/x-diff Size: 459 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: 0003-osmo-nitb-obsess-about-help-formatting.patch Type: text/x-diff Size: 2802 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 819 bytes Desc: Digital signature URL: From holger at freyther.de Tue Sep 15 17:38:08 2015 From: holger at freyther.de (Holger Freyther) Date: Tue, 15 Sep 2015 19:38:08 +0200 Subject: minor patches In-Reply-To: <20150915111528.GA16233@dub5> References: <20150915111528.GA16233@dub5> Message-ID: > On 15 Sep 2015, at 13:15, Neels Hofmeyr wrote: > > Hello OpenBSC, > > see attached patches: one added configure script requirement and two > entirely cosmetic tweaks. Welcome! Thank you for the initial patches. Please try to set-up git send-email so that our patchwork will track all of your patches! holger From sipos.csaba at kvk.uni-obuda.hu Tue Sep 15 19:32:47 2015 From: sipos.csaba at kvk.uni-obuda.hu (Sipos Csaba) Date: Tue, 15 Sep 2015 21:32:47 +0200 (CEST) Subject: DAHDi support broken (with DAHDI 2.7.0 onwards) In-Reply-To: <2098607880.15081222.1442244034014.JavaMail.zimbra@kvk.uni-obuda.hu> References: <1718679701.14782406.1442074745121.JavaMail.zimbra@kvk.uni-obuda.hu> <662388329.14783705.1442076411356.JavaMail.zimbra@kvk.uni-obuda.hu> <2098607880.15081222.1442244034014.JavaMail.zimbra@kvk.uni-obuda.hu> Message-ID: <2137405291.194316.1442345567281.JavaMail.zimbra@kvk.uni-obuda.hu> Dear Harald, Just to close this: OpenBSC latest compiles and runs fine with DAHDI 2.10.2 (latest) and kernel 3.19.0-28-generic (64bit) on Ubuntu 14.04.03 LTS. Regards, Csaba ----- Eredeti ?zenet ----- Felad?: "Sipos Csaba" C?mzett: "Harald Welte" M?solatot kap: "OpenBSC Mailing List" Elk?ld?tt ?zenetek: H?tf?, 2015. Szeptember 14. 17:20:34 T?rgy: Re: DAHDi support broken (with DAHDI 2.7.0 onwards) Dear Harald, It seems DAHDI ver. 2.10.2 works with OpenBSC without modification on kernel 3.5. Tomorrow will recompile and test on kernel 3.16 and hopefully 3.19 Regards, Csaba ----- Eredeti ?zenet ----- Felad?: "Sipos Csaba" C?mzett: "Harald Welte" M?solatot kap: "OpenBSC Mailing List" Elk?ld?tt ?zenetek: Szombat, 2015. Szeptember 12. 18:46:51 T?rgy: Re: DAHDi support broken (with DAHDI 2.7.0 onwards) Hang on for a second. Just compiled DAHDi 2.10.2 and it seems they fixed the /dev path issue and now the old addressing structure is "emualted" with symbolic links. Will test this on Monday, until then please consider my email obsolete. Anyway, this was sure a problem with version 2.7 and 2.8 for quite long period of time. Regards, Csaba ----- Eredeti ?zenet ----- Felad?: "Sipos Csaba" C?mzett: "Harald Welte" M?solatot kap: "OpenBSC Mailing List" Elk?ld?tt ?zenetek: Szombat, 2015. Szeptember 12. 18:19:05 T?rgy: DAHDi support broken (with DAHDI 2.7.0 onwards) Dear Harald, This is probably no the best moment, but as the original implementer of DAHDI support in OpenBSC, maybe you can fix this. It seems that DAHDI 2.7.0 breaks the compatibility with OpenBSC. I think the only thing they changed is the way you need to refer to the E1 device in /dev and because of that, OpenBSC will not going to find the DAHDI device and give an error in that regard. The last time I checked (around version 2.9) this was the only problem, otherwise OpenBSC compiles fine with DAHDI. Anyway, the use of DAHDI 2.6.3 (the latest which works with OpenBSC) forces us to use very old kernels (and OSes), and I am quite sure we are not the only ones still using OpenBSC with E1. :-) I hope you will have some time and take a quick look into this. If you dont have any E1 based hardware anymore, I am more than happy to help you and test the fix on our (Nokia InSite, MetroSite, Ultrasite based) system. Thank you! Regards, Csaba From jengelh at inai.de Wed Sep 16 12:32:31 2015 From: jengelh at inai.de (Jan Engelhardt) Date: Wed, 16 Sep 2015 14:32:31 +0200 Subject: [PATCH] build: have a disable-static build succeed Message-ID: <1442406751-29670-1-git-send-email-jengelh@inai.de> When using configure --disable-static, no libosmogsm.a will be created, and the tests fail to link because symbols like _a5_3 and _a5_4 are not exported through the only remaining libosmogsm.so. A method to overcome this is an intermediate private non-distributed library, examples of which are present in e.g. libabc, kmod and systemd. With this, disable-static can now be the default and practical compile time be halved. --- * This is for libosmocore. * configure.ac | 2 +- src/gsm/Makefile.am | 8 ++++++-- tests/Makefile.am | 6 ++---- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/configure.ac b/configure.ac index c492277..9a744b1 100644 --- a/configure.ac +++ b/configure.ac @@ -13,7 +13,7 @@ AC_PROG_MAKE_SET AC_PROG_MKDIR_P AC_PROG_CC AC_PROG_INSTALL -LT_INIT([pic-only]) +LT_INIT([pic-only disable-static]) AC_CONFIG_MACRO_DIR([m4]) diff --git a/src/gsm/Makefile.am b/src/gsm/Makefile.am index d8aff4a..1878050 100644 --- a/src/gsm/Makefile.am +++ b/src/gsm/Makefile.am @@ -10,9 +10,10 @@ noinst_HEADERS = milenage/aes.h milenage/aes_i.h milenage/aes_wrap.h \ milenage/common.h milenage/crypto.h milenage/includes.h \ milenage/milenage.h +noinst_LTLIBRARIES = libgsmint.la lib_LTLIBRARIES = libosmogsm.la -libosmogsm_la_SOURCES = a5.c rxlev_stat.c tlv_parser.c comp128.c comp128v23.c \ +libgsmint_la_SOURCES = a5.c rxlev_stat.c tlv_parser.c comp128.c comp128v23.c \ gsm_utils.c rsl.c gsm48.c gsm48_ie.c gsm0808.c sysinfo.c \ gprs_cipher_core.c gsm0480.c abis_nm.c gsm0502.c \ gsm0411_utils.c gsm0411_smc.c gsm0411_smr.c \ @@ -21,8 +22,11 @@ libosmogsm_la_SOURCES = a5.c rxlev_stat.c tlv_parser.c comp128.c comp128v23.c \ auth_milenage.c milenage/aes-encblock.c \ milenage/aes-internal.c milenage/aes-internal-enc.c \ milenage/milenage.c gan.c ipa.c gsm0341.c apn.c +libgsmint_la_LDFLAGS = -no-undefined +libgsmint_la_LIBADD = ../libosmocore.la +libosmogsm_la_SOURCES = libosmogsm_la_LDFLAGS = $(LTLDFLAGS_OSMOGSM) -version-info $(LIBVERSION) -no-undefined -libosmogsm_la_LIBADD = $(top_builddir)/src/libosmocore.la +libosmogsm_la_LIBADD = libgsmint.la EXTRA_DIST = libosmogsm.map diff --git a/tests/Makefile.am b/tests/Makefile.am index 8e31f66..cf0977d 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -19,12 +19,10 @@ utils_utils_test_SOURCES = utils/utils_test.c utils_utils_test_LDADD = $(top_builddir)/src/libosmocore.la $(top_builddir)/src/gsm/libosmogsm.la a5_a5_test_SOURCES = a5/a5_test.c -a5_a5_test_LDADD = $(top_builddir)/src/libosmocore.la $(top_builddir)/src/gsm/libosmogsm.la -a5_a5_test_LDFLAGS = -static +a5_a5_test_LDADD = $(top_builddir)/src/libosmocore.la $(top_builddir)/src/gsm/libgsmint.la kasumi_kasumi_test_SOURCES = kasumi/kasumi_test.c -kasumi_kasumi_test_LDADD = $(top_builddir)/src/libosmocore.la $(top_builddir)/src/gsm/libosmogsm.la -kasumi_kasumi_test_LDFLAGS = -static +kasumi_kasumi_test_LDADD = $(top_builddir)/src/libosmocore.la $(top_builddir)/src/gsm/libgsmint.la comp128_comp128_test_SOURCES = comp128/comp128_test.c comp128_comp128_test_LDADD = $(top_builddir)/src/libosmocore.la $(top_builddir)/src/gsm/libosmogsm.la -- 2.4.3 From holger at freyther.de Wed Sep 16 16:11:35 2015 From: holger at freyther.de (Holger Freyther) Date: Wed, 16 Sep 2015 18:11:35 +0200 Subject: [PATCH] build: have a disable-static build succeed In-Reply-To: <1442406751-29670-1-git-send-email-jengelh@inai.de> References: <1442406751-29670-1-git-send-email-jengelh@inai.de> Message-ID: <7239E2C8-94E0-4D88-B251-5C856BF5AEA8@freyther.de> > On 16 Sep 2015, at 14:32, Jan Engelhardt wrote: > > When using configure --disable-static, no libosmogsm.a will be > created, and the tests fail to link because symbols like _a5_3 and > _a5_4 are not exported through the only remaining libosmogsm.so. > > A method to overcome this is an intermediate private non-distributed > library, examples of which are present in e.g. libabc, kmod and > systemd. > > With this, disable-static can now be the default and practical compile > time be halved. thanks. What is the likelihood of ?disable-static build to fail? Does it make sense to add a jenkins config/matrix for this? From jengelh at inai.de Wed Sep 16 16:48:02 2015 From: jengelh at inai.de (Jan Engelhardt) Date: Wed, 16 Sep 2015 18:48:02 +0200 (CEST) Subject: [PATCH] build: have a disable-static build succeed In-Reply-To: <7239E2C8-94E0-4D88-B251-5C856BF5AEA8@freyther.de> References: <1442406751-29670-1-git-send-email-jengelh@inai.de> <7239E2C8-94E0-4D88-B251-5C856BF5AEA8@freyther.de> Message-ID: On Wednesday 2015-09-16 18:11, Holger Freyther wrote: >> On 16 Sep 2015, at 14:32, Jan Engelhardt wrote: >> >> When using configure --disable-static, no libosmogsm.a will be >> created, and the tests fail to link because symbols like _a5_3 and >> _a5_4 are not exported through the only remaining libosmogsm.so. >> >> A method to overcome this is an intermediate private non-distributed >> library, examples of which are present in e.g. libabc, kmod and >> systemd. >> >> With this, disable-static can now be the default and practical compile >> time be halved. > >thanks. What is the likelihood of ?disable-static build to fail? No different from before. >Does it make sense to add a jenkins config/matrix for this? An extra one no; just modify the existing job and let it use `./configure --enable-static` which will build all variants. From sipos.csaba at kvk.uni-obuda.hu Sat Sep 19 14:05:33 2015 From: sipos.csaba at kvk.uni-obuda.hu (Sipos Csaba) Date: Sat, 19 Sep 2015 16:05:33 +0200 (CEST) Subject: Half sided calls In-Reply-To: <1551443047.771707.1442671100204.JavaMail.zimbra@kvk.uni-obuda.hu> Message-ID: <661549695.771938.1442671533772.JavaMail.zimbra@kvk.uni-obuda.hu> Dear List, I am in the process of creating the Wiki page for Ettus B200/B210 with OpenBSC, GPRS and Asterisk. I am quite close, both data and calls are working, but the voice calls are half sided. The downlink direction works, but the uplink does not. I tried without Asterisk and LCR (between two phones) and still the calls are half sided. In the mean time I got these messages in the Osmo-BTS log: <0006> scheduler.c:276 PH-DATA.req: chan_nr=0x0a link_id=0x00 fn=1284768 ts=2 tr x=0 <0006> scheduler.c:1036 TCH/F has not been served !! No prim for trx=0 ts=1 at f n=1284764 to transmit. <0006> scheduler.c:1036 TCH/F has not been served !! No prim for trx=0 ts=2 at f n=1284764 to transmit. <0006> scheduler.c:379 TCH RTS.ind: chan=TCH/F chan_nr=0x09 fn=1284772 ts=1 trx= 0 <0006> scheduler.c:276 PH-DATA.req: chan_nr=0x09 link_id=0x00 fn=1284772 ts=1 tr x=0 <0006> scheduler.c:379 TCH RTS.ind: chan=TCH/F chan_nr=0x0a fn=1284772 ts=2 trx= 0 <0006> scheduler.c:276 PH-DATA.req: chan_nr=0x0a link_id=0x00 fn=1284772 ts=2 tr x=0 <0006> scheduler.c:1036 TCH/F has not been served !! No prim for trx=0 ts=1 at f n=1284768 to transmit. <0006> scheduler.c:1036 TCH/F has not been served !! No prim for trx=0 ts=2 at f n=1284768 to transmit. SMS and GPRS seems to be fine. If someone have any idea, I would love to hear it. :-) Thanks! Csaba From alexander.chemeris at gmail.com Sat Sep 19 18:09:54 2015 From: alexander.chemeris at gmail.com (Alexander Chemeris) Date: Sat, 19 Sep 2015 21:09:54 +0300 Subject: Half sided calls In-Reply-To: <661549695.771938.1442671533772.JavaMail.zimbra@kvk.uni-obuda.hu> References: <1551443047.771707.1442671100204.JavaMail.zimbra@kvk.uni-obuda.hu> <661549695.771938.1442671533772.JavaMail.zimbra@kvk.uni-obuda.hu> Message-ID: Hi Sipos, On Sat, Sep 19, 2015 at 5:05 PM, Sipos Csaba wrote: > I am in the process of creating the Wiki page for Ettus B200/B210 with OpenBSC, GPRS and Asterisk. Any reason it's specific to B2x0? Configuration should be 99% common for all SDR devices and I think it makes more sense to have a single page for that, like the old network_from_scratch. > I am quite close, both data and calls are working, but the voice calls are half sided. The downlink direction works, but the uplink does not. > > I tried without Asterisk and LCR (between two phones) and still the calls are half sided. > > In the mean time I got these messages in the Osmo-BTS log: > > <0006> scheduler.c:276 PH-DATA.req: chan_nr=0x0a link_id=0x00 fn=1284768 ts=2 tr x=0 > <0006> scheduler.c:1036 TCH/F has not been served !! No prim for trx=0 ts=1 at f n=1284764 to transmit. > <0006> scheduler.c:1036 TCH/F has not been served !! No prim for trx=0 ts=2 at f n=1284764 to transmit. Log message suggests that downlink doesn't receive a frame from RTP side and thus transmits a filler frame. So it seems like your downlink doesn't work rather than uplink. It's not clear what do you mean that a call is half sided? According to the logs, downlink frames are not served at both timeslots, so you should not hear anything on both sides of the call. I'd suggest checking that your uplink works, e.g. by looking at osmo-trx logs. If you have the latest one, it should output a warning if Rx side is saturated, which is the most possible reason for the issue. Another possible issue is codec. I have tested only with GSM-FR so far. If you enable more debugging in osmo-bts, you should be able to see decoding result at least for gsm-fr codec. I recommend you enable at least NOTICE level for L1C and see if there are any fail messages from here: http://cgit.osmocom.org/osmo-bts/tree/src/osmo-bts-trx/gsm0503_coding.c?h=201509-fairwaves-rebase One more thing - which branch are you testing with? I've been testing 201509-fairwaves-rebase. If you're using something else - I'd be curious what happens if you try 201509-fairwaves-rebase. -- Regards, Alexander Chemeris. CEO, Fairwaves, Inc. https://fairwaves.co From sipos.csaba at kvk.uni-obuda.hu Sun Sep 20 09:10:54 2015 From: sipos.csaba at kvk.uni-obuda.hu (Sipos Csaba) Date: Sun, 20 Sep 2015 11:10:54 +0200 (CEST) Subject: Half sided calls In-Reply-To: References: <1551443047.771707.1442671100204.JavaMail.zimbra@kvk.uni-obuda.hu> <661549695.771938.1442671533772.JavaMail.zimbra@kvk.uni-obuda.hu> Message-ID: <1470902359.815607.1442740254265.JavaMail.zimbra@kvk.uni-obuda.hu> Dear Alexander, > Any reason it's specific to B2x0? Not really, now that UmTRX also uses the standard UHD branch, it should be the same. The only reason is that I have a B200 and a B210 (finally) to test, but I dont have for example a UmTRX, so I cant validate my method against that piece of hardware. > So it seems like your downlink doesn't work rather than uplink. Trust me, its the uplink which is not working. When I used LCR (through MISDN and chan_lcr) to hook OpenBSC to Asterisk, I was able to hear both the test music and a test tone, but the echo test was not working. When I left LCR and Asterisk out (just two mobiles calling each other) I was not able to hear anything. I am using normal Full Rate calls (no AMR, no EFR, no HR). Anyway is this the desired way to hook OpenBSC to Asterisk? I know LCR also have a SIP method to connect to Asterisk, but I never figured that out and have good experience with the MISDN method. > which branch are you testing with? For Osmo-BTS I used Fairwaves/master, for Osmo-TRX I used the master branch (the fiarwaves/master is still not compiling due to the compile time instruction set issue we identified a few weeks ago). I can try fairwaves/rebase for Osmo-BTS if you want. > I'd suggest checking that your uplink works I use RX gain 12, the MS TX power is limited to 20dBm and I also have a duplex filter. With this setup "show lchan" say the uplink is around -47dBm the downlink is around -67dBm. The TRX log does not indicate any saturation issue (or any other problems during the call). Will try and enable the extra logging and try to extract some meaningful information from that first, after that will try fairwaves/rebase. Thanks for your help! Regards, Csaba ----- Eredeti ?zenet ----- Felad?: "Alexander Chemeris" C?mzett: "Sipos Csaba" M?solatot kap: "OpenBSC Mailing List" Elk?ld?tt ?zenetek: Szombat, 2015. Szeptember 19. 20:09:54 T?rgy: Re: Half sided calls Hi Sipos, On Sat, Sep 19, 2015 at 5:05 PM, Sipos Csaba wrote: > I am in the process of creating the Wiki page for Ettus B200/B210 with OpenBSC, GPRS and Asterisk. Any reason it's specific to B2x0? Configuration should be 99% common for all SDR devices and I think it makes more sense to have a single page for that, like the old network_from_scratch. > I am quite close, both data and calls are working, but the voice calls are half sided. The downlink direction works, but the uplink does not. > > I tried without Asterisk and LCR (between two phones) and still the calls are half sided. > > In the mean time I got these messages in the Osmo-BTS log: > > <0006> scheduler.c:276 PH-DATA.req: chan_nr=0x0a link_id=0x00 fn=1284768 ts=2 tr x=0 > <0006> scheduler.c:1036 TCH/F has not been served !! No prim for trx=0 ts=1 at f n=1284764 to transmit. > <0006> scheduler.c:1036 TCH/F has not been served !! No prim for trx=0 ts=2 at f n=1284764 to transmit. Log message suggests that downlink doesn't receive a frame from RTP side and thus transmits a filler frame. So it seems like your downlink doesn't work rather than uplink. It's not clear what do you mean that a call is half sided? According to the logs, downlink frames are not served at both timeslots, so you should not hear anything on both sides of the call. I'd suggest checking that your uplink works, e.g. by looking at osmo-trx logs. If you have the latest one, it should output a warning if Rx side is saturated, which is the most possible reason for the issue. Another possible issue is codec. I have tested only with GSM-FR so far. If you enable more debugging in osmo-bts, you should be able to see decoding result at least for gsm-fr codec. I recommend you enable at least NOTICE level for L1C and see if there are any fail messages from here: http://cgit.osmocom.org/osmo-bts/tree/src/osmo-bts-trx/gsm0503_coding.c?h=201509-fairwaves-rebase One more thing - which branch are you testing with? I've been testing 201509-fairwaves-rebase. If you're using something else - I'd be curious what happens if you try 201509-fairwaves-rebase. -- Regards, Alexander Chemeris. CEO, Fairwaves, Inc. https://fairwaves.co From sipos.csaba at kvk.uni-obuda.hu Sun Sep 20 09:35:17 2015 From: sipos.csaba at kvk.uni-obuda.hu (Sipos Csaba) Date: Sun, 20 Sep 2015 11:35:17 +0200 (CEST) Subject: Half sided calls In-Reply-To: <1470902359.815607.1442740254265.JavaMail.zimbra@kvk.uni-obuda.hu> References: <1551443047.771707.1442671100204.JavaMail.zimbra@kvk.uni-obuda.hu> <661549695.771938.1442671533772.JavaMail.zimbra@kvk.uni-obuda.hu> <1470902359.815607.1442740254265.JavaMail.zimbra@kvk.uni-obuda.hu> Message-ID: <1909085298.817040.1442741717567.JavaMail.zimbra@kvk.uni-obuda.hu> Hi Alexander, Just attached the log with the L1C set to notice level. For this test I did not used "-m" nor "-P", just pure OpenBSC with two phones calling each other. I would highlight the following line: <0014> trau/osmo_ortp.c:132 osmo-ortp(52995): network_error >From the very beggining I get a sense that maybe the RTP is not working (I got half sided calls on SIP with asterisk previously because of RTP port issues). I am using ORTP version 0.24.2 maybe it is too new? One more thing: I am using the master branch of Libosmo-Abis. Can that be a problem? Regards, Csaba ----- Eredeti ?zenet ----- Felad?: "Sipos Csaba" C?mzett: "Alexander Chemeris" M?solatot kap: "OpenBSC Mailing List" Elk?ld?tt ?zenetek: Vas?rnap, 2015. Szeptember 20. 11:10:54 T?rgy: Re: Half sided calls Dear Alexander, > Any reason it's specific to B2x0? Not really, now that UmTRX also uses the standard UHD branch, it should be the same. The only reason is that I have a B200 and a B210 (finally) to test, but I dont have for example a UmTRX, so I cant validate my method against that piece of hardware. > So it seems like your downlink doesn't work rather than uplink. Trust me, its the uplink which is not working. When I used LCR (through MISDN and chan_lcr) to hook OpenBSC to Asterisk, I was able to hear both the test music and a test tone, but the echo test was not working. When I left LCR and Asterisk out (just two mobiles calling each other) I was not able to hear anything. I am using normal Full Rate calls (no AMR, no EFR, no HR). Anyway is this the desired way to hook OpenBSC to Asterisk? I know LCR also have a SIP method to connect to Asterisk, but I never figured that out and have good experience with the MISDN method. > which branch are you testing with? For Osmo-BTS I used Fairwaves/master, for Osmo-TRX I used the master branch (the fiarwaves/master is still not compiling due to the compile time instruction set issue we identified a few weeks ago). I can try fairwaves/rebase for Osmo-BTS if you want. > I'd suggest checking that your uplink works I use RX gain 12, the MS TX power is limited to 20dBm and I also have a duplex filter. With this setup "show lchan" say the uplink is around -47dBm the downlink is around -67dBm. The TRX log does not indicate any saturation issue (or any other problems during the call). Will try and enable the extra logging and try to extract some meaningful information from that first, after that will try fairwaves/rebase. Thanks for your help! Regards, Csaba ----- Eredeti ?zenet ----- Felad?: "Alexander Chemeris" C?mzett: "Sipos Csaba" M?solatot kap: "OpenBSC Mailing List" Elk?ld?tt ?zenetek: Szombat, 2015. Szeptember 19. 20:09:54 T?rgy: Re: Half sided calls Hi Sipos, On Sat, Sep 19, 2015 at 5:05 PM, Sipos Csaba wrote: > I am in the process of creating the Wiki page for Ettus B200/B210 with OpenBSC, GPRS and Asterisk. Any reason it's specific to B2x0? Configuration should be 99% common for all SDR devices and I think it makes more sense to have a single page for that, like the old network_from_scratch. > I am quite close, both data and calls are working, but the voice calls are half sided. The downlink direction works, but the uplink does not. > > I tried without Asterisk and LCR (between two phones) and still the calls are half sided. > > In the mean time I got these messages in the Osmo-BTS log: > > <0006> scheduler.c:276 PH-DATA.req: chan_nr=0x0a link_id=0x00 fn=1284768 ts=2 tr x=0 > <0006> scheduler.c:1036 TCH/F has not been served !! No prim for trx=0 ts=1 at f n=1284764 to transmit. > <0006> scheduler.c:1036 TCH/F has not been served !! No prim for trx=0 ts=2 at f n=1284764 to transmit. Log message suggests that downlink doesn't receive a frame from RTP side and thus transmits a filler frame. So it seems like your downlink doesn't work rather than uplink. It's not clear what do you mean that a call is half sided? According to the logs, downlink frames are not served at both timeslots, so you should not hear anything on both sides of the call. I'd suggest checking that your uplink works, e.g. by looking at osmo-trx logs. If you have the latest one, it should output a warning if Rx side is saturated, which is the most possible reason for the issue. Another possible issue is codec. I have tested only with GSM-FR so far. If you enable more debugging in osmo-bts, you should be able to see decoding result at least for gsm-fr codec. I recommend you enable at least NOTICE level for L1C and see if there are any fail messages from here: http://cgit.osmocom.org/osmo-bts/tree/src/osmo-bts-trx/gsm0503_coding.c?h=201509-fairwaves-rebase One more thing - which branch are you testing with? I've been testing 201509-fairwaves-rebase. If you're using something else - I'd be curious what happens if you try 201509-fairwaves-rebase. -- Regards, Alexander Chemeris. CEO, Fairwaves, Inc. https://fairwaves.co -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: osmo-bts-call-log-half-sided.txt URL: From sipos.csaba at kvk.uni-obuda.hu Sun Sep 20 10:31:30 2015 From: sipos.csaba at kvk.uni-obuda.hu (Sipos Csaba) Date: Sun, 20 Sep 2015 12:31:30 +0200 (CEST) Subject: Half sided calls In-Reply-To: <1909085298.817040.1442741717567.JavaMail.zimbra@kvk.uni-obuda.hu> References: <1551443047.771707.1442671100204.JavaMail.zimbra@kvk.uni-obuda.hu> <661549695.771938.1442671533772.JavaMail.zimbra@kvk.uni-obuda.hu> <1470902359.815607.1442740254265.JavaMail.zimbra@kvk.uni-obuda.hu> <1909085298.817040.1442741717567.JavaMail.zimbra@kvk.uni-obuda.hu> Message-ID: <864880037.819106.1442745090880.JavaMail.zimbra@kvk.uni-obuda.hu> Dear Alexander, Sorry for the lots of mails :-) I found the issue, but first let me go through what I did: 1. Osmo-BTS fiarwaves_rebase: I tried it. it compiles fine, but the problem is the same. 2. I tried to use fairwaves/master for Libosmo-abis, but the Fairwaves/master branch of OpenBSC is not compiling with the Fairwaves/master branch of Libosmo-abis. This is the error log: CC abis_nm.o CC abis_nm_vty.o CC abis_om2000.o CC abis_om2000_vty.o CC abis_rsl.o CC bsc_rll.o CC paging.o CC bts_ericsson_rbs2000.o CC bts_ipaccess_nanobts.o In file included from bts_ipaccess_nanobts.c:39:0: /usr/local/include/osmocom/abis/ipaccess.h:7:8: error: redefinition of ?struct ipaccess_unit? struct ipaccess_unit { ^ In file included from bts_ipaccess_nanobts.c:38:0: /usr/local/include/osmocom/gsm/ipa.h:11:8: note: originally defined here struct ipaccess_unit { ^ make[3]: *** [bts_ipaccess_nanobts.o] Error 1 make[3]: Leaving directory `/root/osmocom/openbsc/openbsc/src/libbsc' make[2]: *** [all-recursive] Error 1 make[2]: Leaving directory `/root/osmocom/openbsc/openbsc/src' make[1]: *** [all-recursive] Error 1 make[1]: Leaving directory `/root/osmocom/openbsc/openbsc' make: *** [all] Error 2 3. I tried to revert LibORTP to an older version, so I reverted from 0.24.2 to 0.22.0, recompiled everything and now the voice calls are working fine. So there is definitely a compatiblity issue with ORTP version 0.24.2 and the compile script is not taking care of that. Now I am using Libosmo-abis master, OpenBSC Fairwaves/master, Osmo-BTS fairwaves_rebase and Osmo-TRX master and everything seems to work on a B200. Regards, Csaba ----- Eredeti ?zenet ----- Felad?: "Sipos Csaba" C?mzett: "Alexander Chemeris" M?solatot kap: "OpenBSC Mailing List" Elk?ld?tt ?zenetek: Vas?rnap, 2015. Szeptember 20. 11:35:17 T?rgy: Re: Half sided calls Hi Alexander, Just attached the log with the L1C set to notice level. For this test I did not used "-m" nor "-P", just pure OpenBSC with two phones calling each other. I would highlight the following line: <0014> trau/osmo_ortp.c:132 osmo-ortp(52995): network_error >From the very beggining I get a sense that maybe the RTP is not working (I got half sided calls on SIP with asterisk previously because of RTP port issues). I am using ORTP version 0.24.2 maybe it is too new? One more thing: I am using the master branch of Libosmo-Abis. Can that be a problem? Regards, Csaba ----- Eredeti ?zenet ----- Felad?: "Sipos Csaba" C?mzett: "Alexander Chemeris" M?solatot kap: "OpenBSC Mailing List" Elk?ld?tt ?zenetek: Vas?rnap, 2015. Szeptember 20. 11:10:54 T?rgy: Re: Half sided calls Dear Alexander, > Any reason it's specific to B2x0? Not really, now that UmTRX also uses the standard UHD branch, it should be the same. The only reason is that I have a B200 and a B210 (finally) to test, but I dont have for example a UmTRX, so I cant validate my method against that piece of hardware. > So it seems like your downlink doesn't work rather than uplink. Trust me, its the uplink which is not working. When I used LCR (through MISDN and chan_lcr) to hook OpenBSC to Asterisk, I was able to hear both the test music and a test tone, but the echo test was not working. When I left LCR and Asterisk out (just two mobiles calling each other) I was not able to hear anything. I am using normal Full Rate calls (no AMR, no EFR, no HR). Anyway is this the desired way to hook OpenBSC to Asterisk? I know LCR also have a SIP method to connect to Asterisk, but I never figured that out and have good experience with the MISDN method. > which branch are you testing with? For Osmo-BTS I used Fairwaves/master, for Osmo-TRX I used the master branch (the fiarwaves/master is still not compiling due to the compile time instruction set issue we identified a few weeks ago). I can try fairwaves/rebase for Osmo-BTS if you want. > I'd suggest checking that your uplink works I use RX gain 12, the MS TX power is limited to 20dBm and I also have a duplex filter. With this setup "show lchan" say the uplink is around -47dBm the downlink is around -67dBm. The TRX log does not indicate any saturation issue (or any other problems during the call). Will try and enable the extra logging and try to extract some meaningful information from that first, after that will try fairwaves/rebase. Thanks for your help! Regards, Csaba ----- Eredeti ?zenet ----- Felad?: "Alexander Chemeris" C?mzett: "Sipos Csaba" M?solatot kap: "OpenBSC Mailing List" Elk?ld?tt ?zenetek: Szombat, 2015. Szeptember 19. 20:09:54 T?rgy: Re: Half sided calls Hi Sipos, On Sat, Sep 19, 2015 at 5:05 PM, Sipos Csaba wrote: > I am in the process of creating the Wiki page for Ettus B200/B210 with OpenBSC, GPRS and Asterisk. Any reason it's specific to B2x0? Configuration should be 99% common for all SDR devices and I think it makes more sense to have a single page for that, like the old network_from_scratch. > I am quite close, both data and calls are working, but the voice calls are half sided. The downlink direction works, but the uplink does not. > > I tried without Asterisk and LCR (between two phones) and still the calls are half sided. > > In the mean time I got these messages in the Osmo-BTS log: > > <0006> scheduler.c:276 PH-DATA.req: chan_nr=0x0a link_id=0x00 fn=1284768 ts=2 tr x=0 > <0006> scheduler.c:1036 TCH/F has not been served !! No prim for trx=0 ts=1 at f n=1284764 to transmit. > <0006> scheduler.c:1036 TCH/F has not been served !! No prim for trx=0 ts=2 at f n=1284764 to transmit. Log message suggests that downlink doesn't receive a frame from RTP side and thus transmits a filler frame. So it seems like your downlink doesn't work rather than uplink. It's not clear what do you mean that a call is half sided? According to the logs, downlink frames are not served at both timeslots, so you should not hear anything on both sides of the call. I'd suggest checking that your uplink works, e.g. by looking at osmo-trx logs. If you have the latest one, it should output a warning if Rx side is saturated, which is the most possible reason for the issue. Another possible issue is codec. I have tested only with GSM-FR so far. If you enable more debugging in osmo-bts, you should be able to see decoding result at least for gsm-fr codec. I recommend you enable at least NOTICE level for L1C and see if there are any fail messages from here: http://cgit.osmocom.org/osmo-bts/tree/src/osmo-bts-trx/gsm0503_coding.c?h=201509-fairwaves-rebase One more thing - which branch are you testing with? I've been testing 201509-fairwaves-rebase. If you're using something else - I'd be curious what happens if you try 201509-fairwaves-rebase. -- Regards, Alexander Chemeris. CEO, Fairwaves, Inc. https://fairwaves.co From laforge at gnumonks.org Sun Sep 20 15:55:27 2015 From: laforge at gnumonks.org (Harald Welte) Date: Sun, 20 Sep 2015 17:55:27 +0200 Subject: Last two Siemens BS-11 available Message-ID: <20150920155527.GI3331@nataraja> Hi all, the history of OpenBSC (and thus the Osmocom umbrella project) started with the Siemens BS-11 microBTS. I still have three of those BTS, and think that one is enough, i.e. two BS-11 are available. If you are an active contributor to OpenBSC or represent a public research organization, I will provide them free of charge, you only have to pay for shipping. For all other interested parties, I would like 200 EUR per unit (excl. shipping), which still makes it one of the cheapest options for running your own network with OpenBSC. If you're not familiar with the BS-11 and its technical data, please check http://openbsc.osmocom.org/trac/wiki/BS11 and related pages i nthe wiki. They units I have available are with 230V power supply and operate in the GSM900 band. I also have one compatible HFC-E1 PCI E1 adapter (supported by mISDN + OpenBSC) available. Please contact me privately if you are interested. Regards, Harald -- - Harald Welte http://laforge.gnumonks.org/ ============================================================================ "Privacy in residential applications is a desirable marketing option." (ETSI EN 300 175-7 Ch. A6) From laforge at gnumonks.org Sun Sep 20 16:00:08 2015 From: laforge at gnumonks.org (Harald Welte) Date: Sun, 20 Sep 2015 18:00:08 +0200 Subject: Motorola Horizon macro BTS available for free Message-ID: <20150920160008.GJ3331@nataraja> Hi all, I am getting rid of some old hardware to make space for new stuff. The most bulky item in my collection is a Motorola Horizon macro BTS. If you don't know it, check out http://openbsc.osmocom.org/trac/wiki/Motorola_Horizon_macro in the OpenBSC wiki. IMPORTANT: Due to the large deviations of Motorola from standard GSM, this BTS does not have an Abis interface and thus is not compatible with OpenBSC! Still, it contains some interesting electronics, including the 40W PAs and hybrid combiner/duplexers. The unit comes with three TRX (as on the pictures linked above), as well as my custom-made serial cable to access the console port of all three main processors, see http://openbsc.osmocom.org/trac/wiki/Motorola_Horizon_macro/MCUF_Console You can have it free of charge if you take care of shipping. Please contact me privately if you are interested. Regards, Harald -- - Harald Welte http://laforge.gnumonks.org/ ============================================================================ "Privacy in residential applications is a desirable marketing option." (ETSI EN 300 175-7 Ch. A6) From sipos.csaba at kvk.uni-obuda.hu Sun Sep 20 19:15:22 2015 From: sipos.csaba at kvk.uni-obuda.hu (Sipos Csaba) Date: Sun, 20 Sep 2015 21:15:22 +0200 (CEST) Subject: DL TBF abnormal release In-Reply-To: <854580386.845991.1442774116256.JavaMail.zimbra@kvk.uni-obuda.hu> Message-ID: <396436376.850249.1442776522065.JavaMail.zimbra@kvk.uni-obuda.hu> Dear Jacob, Finally I managed to get everything in a working order, so I can finally start testing the GPRS part of OpenBSC/Osmo-PCU with an USRP B200. I am using a Cat 12 device with a 4 PDCH configuration. In the past I wrote a little script to test the PRACH stability of OpenBTS, which sends a single ping to the gateway address, waits until the session goes into idle, and then tries again. The goal is to generate as many PRACH as possible and check if there is a response. I used this script and it turns out that around 1 out of every 20 requests the ping is not reaching the gateway, and the UE indicates an abnormal DL TBF release. I attached the UE side log, so you can take a look. During this issue there is no reasonable frequency nor timing variation indicated on the UE side. What I noticed is the very high number of RLC resent and RLC restarted. After a few minutes of pinging, this is the result from the PCU: RLC Sent : 18015 (0/s 0/m 0/h 0/d) RLC Resent : 17596 (0/s 0/m 0/h 0/d) RLC Restarted : 15669 (0/s 0/m 0/h 0/d) RLC Stalled : 0 (0/s 0/m 0/h 0/d) Please note that the ARFCN I use is completely clean, I filter the uplink with proper duplexer and the TRX is not complaining about anything. Also interesting that during constant pinging (the system does not need to do PRACH), this problem is not popping up. Will update my UHD stack from 3.8.0 to 3.9.0 just to test with the latest, but I don't think itt will change anything about this issue. And to be hones, we've seen similar PRACH related issues with OpenBTS GPRS too. If you need any more logs or you have an idea what to try, I am happy to do that. :-) Regards, Csaba -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: osmocom_gprs_dl_tbf_abnormal.txt URL: From holger at freyther.de Mon Sep 21 08:38:26 2015 From: holger at freyther.de (Holger Freyther) Date: Mon, 21 Sep 2015 10:38:26 +0200 Subject: DL TBF abnormal release In-Reply-To: <396436376.850249.1442776522065.JavaMail.zimbra@kvk.uni-obuda.hu> References: <396436376.850249.1442776522065.JavaMail.zimbra@kvk.uni-obuda.hu> Message-ID: <32324C17-87C2-4A45-8B1A-5F3445EE0C21@freyther.de> > On 20 Sep 2015, at 21:15, Sipos Csaba wrote: > > Dear Jacob, > > Finally I managed to get everything in a working order, so I can finally start testing the GPRS part of OpenBSC/Osmo-PCU with an USRP B200. > > I am using a Cat 12 device with a 4 PDCH configuration. > > > I attached the UE side log, so you can take a look. How did you get these logs? From jerlbeck at sysmocom.de Mon Sep 21 10:30:31 2015 From: jerlbeck at sysmocom.de (Jacob Erlbeck) Date: Mon, 21 Sep 2015 12:30:31 +0200 Subject: DL TBF abnormal release In-Reply-To: <396436376.850249.1442776522065.JavaMail.zimbra@kvk.uni-obuda.hu> References: <396436376.850249.1442776522065.JavaMail.zimbra@kvk.uni-obuda.hu> Message-ID: <55FFDC47.6010408@sysmocom.de> Dear Csaba, which exact PCU version (git SHA stamp) are you using? On 20.09.2015 21:15, Sipos Csaba wrote: > > In the past I wrote a little script to test the PRACH stability of OpenBTS, which sends a single ping to the gateway address, waits until the session goes into idle, and then tries again. The goal is to generate as many PRACH as possible and check if there is a response. > > I used this script and it turns out that around 1 out of every 20 requests the ping is not reaching the gateway, and the UE indicates an abnormal DL TBF release. > > I attached the UE side log, so you can take a look. The UE side log doesn't help much, as I cannot see much differences between either case (even the time deltas before each EVENT_GPRS_TBF_RELEASE are similar). It would be very helpful, if I had the logging output of the PCU, e.g. by adding the following stanza to the osmo-pcu.cfg file: ==== log file /tmp/pcu.log logging filter all 1 logging color 0 logging print extended-timestamp 1 logging level all everything logging level rlcmac debug logging level rlcmacul debug logging level rlcmacdl debug logging level l1if info logging level bssgp debug logging level rlcmacdata debug logging level rlcmacmeas debug logging level rlcmacsched debug logging level pcu debug ==== > > During this issue there is no reasonable frequency nor timing variation indicated on the UE side. > > What I noticed is the very high number of RLC resent and RLC restarted. After a few minutes of pinging, this is the result from the PCU: > > RLC Sent : 18015 (0/s 0/m 0/h 0/d) > RLC Resent : 17596 (0/s 0/m 0/h 0/d) > RLC Restarted : 15669 (0/s 0/m 0/h 0/d) > RLC Stalled : 0 (0/s 0/m 0/h 0/d) This probably results from the dl-tbf-idle-time feature. When enabled, the DL TBF is not closed after the last LLC frame. Instead the DL TBF is kept open by sending LLC dummy commands at regular intervals. Each of them creates a single RLC packet which is then resent in every free slot with a low priority until the corresponding ACK is received. Note that this rewrapping of the send buffer will not happen, when there is other data to be sent (this is meant by 'low priority'). Regards Jacob -- - Jacob Erlbeck http://www.sysmocom.de/ ======================================================================= * sysmocom - systems for mobile communications GmbH * Alt-Moabit 93 * 10559 Berlin, Germany * Sitz / Registered office: Berlin, HRB 134158 B * Geschaeftsfuehrer / Managing Directors: Holger Freyther, Harald Welte From sipos.csaba at kvk.uni-obuda.hu Mon Sep 21 19:10:16 2015 From: sipos.csaba at kvk.uni-obuda.hu (Sipos Csaba) Date: Mon, 21 Sep 2015 21:10:16 +0200 (CEST) Subject: DL TBF abnormal release In-Reply-To: <55FFDC47.6010408@sysmocom.de> References: <396436376.850249.1442776522065.JavaMail.zimbra@kvk.uni-obuda.hu> <55FFDC47.6010408@sysmocom.de> Message-ID: <736611335.1035490.1442862616875.JavaMail.zimbra@kvk.uni-obuda.hu> Dear Jacob, I am using the laster master branch of Osmo-PCU. Last commit: commit 7c8d39a67b7568cda38829c774ea541250f3142f Author: Jacob Erlbeck Date: Mon Sep 7 14:04:56 2015 +0200 poll: Count failed procedures > The UE side log doesn't help much After I gone through it the second time, thats what I tought too :-) I added the extra log options to the pcu config and now try to reproduce the error. Will try and give you as much details as possible. Regards, Csaba ----- Eredeti ?zenet ----- Felad?: "Jacob Erlbeck" C?mzett: "Sipos Csaba" M?solatot kap: "OpenBSC Mailing List" Elk?ld?tt ?zenetek: H?tf?, 2015. Szeptember 21. 12:30:31 T?rgy: Re: DL TBF abnormal release Dear Csaba, which exact PCU version (git SHA stamp) are you using? On 20.09.2015 21:15, Sipos Csaba wrote: > > In the past I wrote a little script to test the PRACH stability of OpenBTS, which sends a single ping to the gateway address, waits until the session goes into idle, and then tries again. The goal is to generate as many PRACH as possible and check if there is a response. > > I used this script and it turns out that around 1 out of every 20 requests the ping is not reaching the gateway, and the UE indicates an abnormal DL TBF release. > > I attached the UE side log, so you can take a look. The UE side log doesn't help much, as I cannot see much differences between either case (even the time deltas before each EVENT_GPRS_TBF_RELEASE are similar). It would be very helpful, if I had the logging output of the PCU, e.g. by adding the following stanza to the osmo-pcu.cfg file: ==== log file /tmp/pcu.log logging filter all 1 logging color 0 logging print extended-timestamp 1 logging level all everything logging level rlcmac debug logging level rlcmacul debug logging level rlcmacdl debug logging level l1if info logging level bssgp debug logging level rlcmacdata debug logging level rlcmacmeas debug logging level rlcmacsched debug logging level pcu debug ==== > > During this issue there is no reasonable frequency nor timing variation indicated on the UE side. > > What I noticed is the very high number of RLC resent and RLC restarted. After a few minutes of pinging, this is the result from the PCU: > > RLC Sent : 18015 (0/s 0/m 0/h 0/d) > RLC Resent : 17596 (0/s 0/m 0/h 0/d) > RLC Restarted : 15669 (0/s 0/m 0/h 0/d) > RLC Stalled : 0 (0/s 0/m 0/h 0/d) This probably results from the dl-tbf-idle-time feature. When enabled, the DL TBF is not closed after the last LLC frame. Instead the DL TBF is kept open by sending LLC dummy commands at regular intervals. Each of them creates a single RLC packet which is then resent in every free slot with a low priority until the corresponding ACK is received. Note that this rewrapping of the send buffer will not happen, when there is other data to be sent (this is meant by 'low priority'). Regards Jacob -- - Jacob Erlbeck http://www.sysmocom.de/ ======================================================================= * sysmocom - systems for mobile communications GmbH * Alt-Moabit 93 * 10559 Berlin, Germany * Sitz / Registered office: Berlin, HRB 134158 B * Geschaeftsfuehrer / Managing Directors: Holger Freyther, Harald Welte From kornschnok at gmail.com Thu Sep 3 10:09:16 2015 From: kornschnok at gmail.com (Kornschnok) Date: Thu, 03 Sep 2015 10:09:16 -0000 Subject: [Help needed] Testing OpenBSC without hardware BTS Message-ID: Hello, I just started on OpenBSC. I would really like to test it without a hardware BTS. I'm aware that there's a smalltalk "FakeBTS" program for testing it but I did not manage to run it due to a runtime problem with libgnu-smalltalk version 3.2.91 which was listed as a requirement to run FakeBTS. As lower stable version of libgnu-smalltalk wouldn't work there's nothing I could do. I include the error message below just in case. ------------------- openbts at ubuntuopenbts:~$ gst "Global garbage collection... done" "Global garbage collection... done" /usr/share/gnu-smalltalk/kernel/SysDict.st:37: Aborted /usr/share/gnu-smalltalk/kernel/SysDict.st:37: Error occurred while not in byte code interpreter!! /usr/lib/libgst.so.7 (+0x67cef) [0xb7748cef] [0xb77af400] [0xb77af424] ... Aborted -------------------- Anyway, what I want to achieve as a start is to emulate some phone calls and trace how calls are routed through the different entities. (It's for demonstration purpose and personal interest) Would that be possible with maybe some coding? I would appreciate any suggestion on how to start. Thanks in advance! Kornschnok -------------- next part -------------- An HTML attachment was scrubbed... URL: From baumi525 at googlemail.com Sun Sep 6 17:38:00 2015 From: baumi525 at googlemail.com (Tobias XY) Date: Sun, 06 Sep 2015 17:38:00 -0000 Subject: Osmocom Berlin User Group revival? In-Reply-To: <20150905213235.GB3853@nataraja> References: <20150905213235.GB3853@nataraja> Message-ID: Hello there, there is generally very interested to listen to the issues and learn. But the fact is that I 'm still not a student or a computer scientist , I nevertheless find it very interesting . I deal with it as a hobby . Now it is so that it's my first CCC event . Can I participate there as a private person ? What is the price of admission? As a rule, I would find a Saturday for an event so great. Where would the the event take place in Berlin ? Greetings, Tobias Am 05.09.2015 23:35 schrieb "Harald Welte" : > Dear all, > > After two years of intermission, I'm currently pondering to revive the > Osmocom Berlin User Group and would like to understand > > a) who would be interested in attending? > > b) which day(s) of the week would be preferred / not preferred? > > Instad of "just" hanging out, chatting about Osmocom related topics etc. > I am interested in having actual topics for each of the meetings. There > is no need for a formal presentation or anything like that, but at least > let's try to stay focussed on the topic for the first hour or so, and > then conclude with a more general chat towards the end. > > Some of the topics that I would like to start with ASAP: > > * sharing of knowledge regarding 3G and 4G protocol stacks (I'm looking > a lot at this recently, and it is a good time to talk about what I've > learned) > > * completing the work towards splitting osmo-nitb into osmo-bsc and > osmo-mss - as a first stept towards adding RANAP/Iu to osmo-mss > > * attempting to decode/analyze BVG bus/tram radio (TETRAPOL) using > tetrapol-kit from http://brmlab.cz/git/tetrapol-kit.git > > * are berlin S-Bahn trains actually still broadcasting their GPS > position in MPT1327? > > * moving ahead with AT91SAM3S based SIMtrace2 with MITM support > > Let me know who is interested in joining. > > In terms of venue I would suggest to again use the CCCB, unless somebody > objects. We could of course also ask our friends at IN-Berlin or > C-Base. > > In terms of schedule, I would actually want to go for bi-weekly again. > > Happy hacking, > Harald > -- > - Harald Welte > http://laforge.gnumonks.org/ > > ============================================================================ > "Privacy in residential applications is a desirable marketing option." > (ETSI EN 300 175-7 Ch. > A6) > -------------- next part -------------- An HTML attachment was scrubbed... URL: From radiarisainanasitraka at yahoo.fr Mon Sep 7 18:30:10 2015 From: radiarisainanasitraka at yahoo.fr (Radiarisainana Sitraka) Date: Mon, 7 Sep 2015 18:30:10 +0000 (UTC) Subject: Osmocom Berlin User Group revival? In-Reply-To: <20150905213235.GB3853@nataraja> References: <20150905213235.GB3853@nataraja> Message-ID: <2016961670.4007025.1441650610022.JavaMail.yahoo@mail.yahoo.com> Hi,My name is Sitraka ,I come from Madagascar!I? am a student intersted about mobile communication and i would like to have some information about the conference of osmocom concerning 3g and LTE . Thank's for helping, De?: Harald Welte ??: openbsc at lists.osmocom.org Cc?: baseband-devel at lists.osmocom.org; osmocom-event-orga at lists.osmocom.org; simtrace at lists.osmocom.org Envoy? le : Samedi 5 septembre 2015 23h32 Objet?: Osmocom Berlin User Group revival? Dear all, After two years of intermission, I'm currently pondering to revive the Osmocom Berlin User Group and would like to understand a) who would be interested in attending? b) which day(s) of the week would be preferred / not preferred? Instad of "just" hanging out, chatting about Osmocom related topics etc. I am interested in having actual topics for each of the meetings.? There is no need for a formal presentation or anything like that, but at least let's try to stay focussed on the topic for the first hour or so, and then conclude with a more general chat towards the end. Some of the topics that I would like to start with ASAP: * sharing of knowledge regarding 3G and 4G protocol stacks (I'm looking ? a lot at this recently, and it is a good time to talk about what I've ? learned) * completing the work towards splitting osmo-nitb into osmo-bsc and ? osmo-mss - as a first stept towards adding RANAP/Iu to osmo-mss * attempting to decode/analyze BVG bus/tram radio (TETRAPOL) using ? tetrapol-kit from http://brmlab.cz/git/tetrapol-kit.git * are berlin S-Bahn trains actually still broadcasting their GPS ? position in MPT1327? * moving ahead with AT91SAM3S based SIMtrace2 with MITM support Let me know who is interested in joining. In terms of venue I would suggest to again use the CCCB, unless somebody objects.? We could of course also ask our friends at IN-Berlin or C-Base. In terms of schedule, I would actually want to go for bi-weekly again. Happy hacking, ??? Harald -- - Harald Welte ? ? ? ? ? http://laforge.gnumonks.org/ ============================================================================ "Privacy in residential applications is a desirable marketing option." ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? (ETSI EN 300 175-7 Ch. A6) -------------- next part -------------- An HTML attachment was scrubbed... URL: From jengelh at inai.de Fri Sep 11 08:23:47 2015 From: jengelh at inai.de (Jan Engelhardt) Date: Fri, 11 Sep 2015 10:23:47 +0200 Subject: [PATCH] build: have a disable-static build succeed Message-ID: <1441959827-3614-1-git-send-email-jengelh@inai.de> When using configure --disable-static, no libosmogsm.a will be created, and the tests fail to link because symbols like _a5_3 and _a5_4 are not exported through the only remaining libosmogsm.so. A method to overcome this is an intermediate private non-distributed library, examples of which are present in e.g. libabc, kmod and systemd. With this, disable-static can now be the default and practical compile time be halved. --- This is for libosmocore.git. configure.ac | 2 +- src/gsm/Makefile.am | 8 ++++++-- tests/Makefile.am | 6 ++---- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/configure.ac b/configure.ac index c492277..9a744b1 100644 --- a/configure.ac +++ b/configure.ac @@ -13,7 +13,7 @@ AC_PROG_MAKE_SET AC_PROG_MKDIR_P AC_PROG_CC AC_PROG_INSTALL -LT_INIT([pic-only]) +LT_INIT([pic-only disable-static]) AC_CONFIG_MACRO_DIR([m4]) diff --git a/src/gsm/Makefile.am b/src/gsm/Makefile.am index d8aff4a..1878050 100644 --- a/src/gsm/Makefile.am +++ b/src/gsm/Makefile.am @@ -10,9 +10,10 @@ noinst_HEADERS = milenage/aes.h milenage/aes_i.h milenage/aes_wrap.h \ milenage/common.h milenage/crypto.h milenage/includes.h \ milenage/milenage.h +noinst_LTLIBRARIES = libgsmint.la lib_LTLIBRARIES = libosmogsm.la -libosmogsm_la_SOURCES = a5.c rxlev_stat.c tlv_parser.c comp128.c comp128v23.c \ +libgsmint_la_SOURCES = a5.c rxlev_stat.c tlv_parser.c comp128.c comp128v23.c \ gsm_utils.c rsl.c gsm48.c gsm48_ie.c gsm0808.c sysinfo.c \ gprs_cipher_core.c gsm0480.c abis_nm.c gsm0502.c \ gsm0411_utils.c gsm0411_smc.c gsm0411_smr.c \ @@ -21,8 +22,11 @@ libosmogsm_la_SOURCES = a5.c rxlev_stat.c tlv_parser.c comp128.c comp128v23.c \ auth_milenage.c milenage/aes-encblock.c \ milenage/aes-internal.c milenage/aes-internal-enc.c \ milenage/milenage.c gan.c ipa.c gsm0341.c apn.c +libgsmint_la_LDFLAGS = -no-undefined +libgsmint_la_LIBADD = ../libosmocore.la +libosmogsm_la_SOURCES = libosmogsm_la_LDFLAGS = $(LTLDFLAGS_OSMOGSM) -version-info $(LIBVERSION) -no-undefined -libosmogsm_la_LIBADD = $(top_builddir)/src/libosmocore.la +libosmogsm_la_LIBADD = libgsmint.la EXTRA_DIST = libosmogsm.map diff --git a/tests/Makefile.am b/tests/Makefile.am index 8e31f66..cf0977d 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -19,12 +19,10 @@ utils_utils_test_SOURCES = utils/utils_test.c utils_utils_test_LDADD = $(top_builddir)/src/libosmocore.la $(top_builddir)/src/gsm/libosmogsm.la a5_a5_test_SOURCES = a5/a5_test.c -a5_a5_test_LDADD = $(top_builddir)/src/libosmocore.la $(top_builddir)/src/gsm/libosmogsm.la -a5_a5_test_LDFLAGS = -static +a5_a5_test_LDADD = $(top_builddir)/src/libosmocore.la $(top_builddir)/src/gsm/libgsmint.la kasumi_kasumi_test_SOURCES = kasumi/kasumi_test.c -kasumi_kasumi_test_LDADD = $(top_builddir)/src/libosmocore.la $(top_builddir)/src/gsm/libosmogsm.la -kasumi_kasumi_test_LDFLAGS = -static +kasumi_kasumi_test_LDADD = $(top_builddir)/src/libosmocore.la $(top_builddir)/src/gsm/libgsmint.la comp128_comp128_test_SOURCES = comp128/comp128_test.c comp128_comp128_test_LDADD = $(top_builddir)/src/libosmocore.la $(top_builddir)/src/gsm/libosmogsm.la -- 2.4.3 From tomasmorvay at gmail.com Wed Sep 16 16:35:06 2015 From: tomasmorvay at gmail.com (=?UTF-8?B?VG9tw6HFoSBNb3J2YXk=?=) Date: Wed, 16 Sep 2015 18:35:06 +0200 Subject: Patch: EPC capability flag support Message-ID: Hi, as a part of our project at university, we implemented extraction of EPC Capability flag. This flag is a bit sent by mobile phone to indicate support of EPC (or LTE). This bit is extracted during processing of Attach request to log this information. An function to check the the of this flag for given sgsn context is also created to make it reusable. For the extraction of the EPC Capability field we used the location described in TS 24.008 v10.15.0 section 10.5.5.12. This can be interesting information for any developers experimenting with devices supporting 4G, so I think I would be a good idea to make it available in the original repository. The patch for this change is in the attachment. Best regards, Tomas Movay -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: openbsc_epc_capability.patch Type: application/octet-stream Size: 2590 bytes Desc: not available URL: From sipos.csaba at kvk.uni-obuda.hu Mon Sep 21 19:58:02 2015 From: sipos.csaba at kvk.uni-obuda.hu (Sipos Csaba) Date: Mon, 21 Sep 2015 21:58:02 +0200 (CEST) Subject: DL TBF abnormal release In-Reply-To: <736611335.1035490.1442862616875.JavaMail.zimbra@kvk.uni-obuda.hu> References: <396436376.850249.1442776522065.JavaMail.zimbra@kvk.uni-obuda.hu> <55FFDC47.6010408@sysmocom.de> <736611335.1035490.1442862616875.JavaMail.zimbra@kvk.uni-obuda.hu> Message-ID: <1474768283.1039632.1442865482198.JavaMail.zimbra@kvk.uni-obuda.hu> Dear Jacob, I run my PRACH test for a few minutes and the problem popped up. I am attahcing the UE and the PCU side logs. In the UE log note that the UL TBF is released almost right after the PRACH is finsihed, while the ICMP echo request is being sent (and lost). In the PCU log the interesting part is close to the bottom. One line to highlight: Software error: Pending downlink assignment. This may not happen, because the assignment message never gets transmitted. Please be sure not to free in this state. PLEASE FIX! This message is quite close to the part where the ICMP echo request got lost, but it is hard to tell because to two logs are not synchronised. Will continue testing because this error looks a littlebit different than the one I catched yesterday. Regards, Csaba ----- Eredeti ?zenet ----- Felad?: "Sipos Csaba" C?mzett: "Jacob Erlbeck" M?solatot kap: "OpenBSC Mailing List" Elk?ld?tt ?zenetek: H?tf?, 2015. Szeptember 21. 21:10:16 T?rgy: Re: DL TBF abnormal release Dear Jacob, I am using the laster master branch of Osmo-PCU. Last commit: commit 7c8d39a67b7568cda38829c774ea541250f3142f Author: Jacob Erlbeck Date: Mon Sep 7 14:04:56 2015 +0200 poll: Count failed procedures > The UE side log doesn't help much After I gone through it the second time, thats what I tought too :-) I added the extra log options to the pcu config and now try to reproduce the error. Will try and give you as much details as possible. Regards, Csaba ----- Eredeti ?zenet ----- Felad?: "Jacob Erlbeck" C?mzett: "Sipos Csaba" M?solatot kap: "OpenBSC Mailing List" Elk?ld?tt ?zenetek: H?tf?, 2015. Szeptember 21. 12:30:31 T?rgy: Re: DL TBF abnormal release Dear Csaba, which exact PCU version (git SHA stamp) are you using? On 20.09.2015 21:15, Sipos Csaba wrote: > > In the past I wrote a little script to test the PRACH stability of OpenBTS, which sends a single ping to the gateway address, waits until the session goes into idle, and then tries again. The goal is to generate as many PRACH as possible and check if there is a response. > > I used this script and it turns out that around 1 out of every 20 requests the ping is not reaching the gateway, and the UE indicates an abnormal DL TBF release. > > I attached the UE side log, so you can take a look. The UE side log doesn't help much, as I cannot see much differences between either case (even the time deltas before each EVENT_GPRS_TBF_RELEASE are similar). It would be very helpful, if I had the logging output of the PCU, e.g. by adding the following stanza to the osmo-pcu.cfg file: ==== log file /tmp/pcu.log logging filter all 1 logging color 0 logging print extended-timestamp 1 logging level all everything logging level rlcmac debug logging level rlcmacul debug logging level rlcmacdl debug logging level l1if info logging level bssgp debug logging level rlcmacdata debug logging level rlcmacmeas debug logging level rlcmacsched debug logging level pcu debug ==== > > During this issue there is no reasonable frequency nor timing variation indicated on the UE side. > > What I noticed is the very high number of RLC resent and RLC restarted. After a few minutes of pinging, this is the result from the PCU: > > RLC Sent : 18015 (0/s 0/m 0/h 0/d) > RLC Resent : 17596 (0/s 0/m 0/h 0/d) > RLC Restarted : 15669 (0/s 0/m 0/h 0/d) > RLC Stalled : 0 (0/s 0/m 0/h 0/d) This probably results from the dl-tbf-idle-time feature. When enabled, the DL TBF is not closed after the last LLC frame. Instead the DL TBF is kept open by sending LLC dummy commands at regular intervals. Each of them creates a single RLC packet which is then resent in every free slot with a low priority until the corresponding ACK is received. Note that this rewrapping of the send buffer will not happen, when there is other data to be sent (this is meant by 'low priority'). Regards Jacob -- - Jacob Erlbeck http://www.sysmocom.de/ ======================================================================= * sysmocom - systems for mobile communications GmbH * Alt-Moabit 93 * 10559 Berlin, Germany * Sitz / Registered office: Berlin, HRB 134158 B * Geschaeftsfuehrer / Managing Directors: Holger Freyther, Harald Welte -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: ul_tbf_release_after_prach.txt URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: pcu.zip Type: application/zip Size: 1159281 bytes Desc: not available URL: From laforge at gnumonks.org Tue Sep 22 14:47:32 2015 From: laforge at gnumonks.org (Harald Welte) Date: Tue, 22 Sep 2015 16:47:32 +0200 Subject: L1SAP and TRX rebase, the last one (TM) In-Reply-To: <20150906130909.GF3853@nataraja> References: <20150906130909.GF3853@nataraja> Message-ID: <20150922144732.GM31436@nataraja> Dear all, On Sun, Sep 06, 2015 at 03:09:09PM +0200, Harald Welte wrote: > after my futile attempt in September last year to finally merge l1sap > (see the 201409-l1sap branch), I'm making one final attempt. 201509-l1sap and 201509-trx-rebase have just been merged to master. Whatever fall-out there may be, we will need to fix it incrementally. Please note that you also need a current openbsc.git master to make osmo-bts master compile due to the modified AMR related structures in shared header files. Regards, Harald -- - Harald Welte http://laforge.gnumonks.org/ ============================================================================ "Privacy in residential applications is a desirable marketing option." (ETSI EN 300 175-7 Ch. A6) From alexander.chemeris at gmail.com Tue Sep 22 15:08:10 2015 From: alexander.chemeris at gmail.com (Alexander Chemeris) Date: Tue, 22 Sep 2015 18:08:10 +0300 Subject: L1SAP and TRX rebase, the last one (TM) In-Reply-To: <20150922144732.GM31436@nataraja> References: <20150906130909.GF3853@nataraja> <20150922144732.GM31436@nataraja> Message-ID: That's great. I believe incremental fixes work best. We'll do more testing and submit patches. Please excuse typos. Written with a touchscreen keyboard. -- Regards, Alexander Chemeris CEO Fairwaves, Inc. https://fairwaves.co On Sep 22, 2015 17:47, "Harald Welte" wrote: > Dear all, > > On Sun, Sep 06, 2015 at 03:09:09PM +0200, Harald Welte wrote: > > after my futile attempt in September last year to finally merge l1sap > > (see the 201409-l1sap branch), I'm making one final attempt. > > 201509-l1sap and 201509-trx-rebase have just been merged to master. > > Whatever fall-out there may be, we will need to fix it incrementally. > > Please note that you also need a current openbsc.git master to make > osmo-bts master compile due to the modified AMR related structures in > shared header files. > > Regards, > Harald > -- > - Harald Welte > http://laforge.gnumonks.org/ > > ============================================================================ > "Privacy in residential applications is a desirable marketing option." > (ETSI EN 300 175-7 Ch. > A6) > -------------- next part -------------- An HTML attachment was scrubbed... URL: From holger at freyther.de Thu Sep 24 10:29:34 2015 From: holger at freyther.de (Holger Hans Peter Freyther) Date: Thu, 24 Sep 2015 12:29:34 +0200 Subject: [PATCH 1/3] amr: Remove some code duplication in preparation Message-ID: <1443090576-63058-1-git-send-email-holger@freyther.de> From: Holger Hans Peter Freyther Merge two copies into a local static helper function. The format of the message will change and then it is easier to modify it in one place than in two. Sadly the original patch was merged before this clean-up so do the clean-up as second step. Conflicts: openbsc/src/libbsc/abis_rsl.c openbsc/src/libbsc/gsm_04_08_utils.c --- openbsc/src/libbsc/abis_rsl.c | 18 +++++++++--------- openbsc/src/libbsc/gsm_04_08_utils.c | 15 +++++++++------ 2 files changed, 18 insertions(+), 15 deletions(-) diff --git a/openbsc/src/libbsc/abis_rsl.c b/openbsc/src/libbsc/abis_rsl.c index 526b977..8e9258c 100644 --- a/openbsc/src/libbsc/abis_rsl.c +++ b/openbsc/src/libbsc/abis_rsl.c @@ -442,6 +442,13 @@ static int channel_mode_from_lchan(struct rsl_ie_chan_mode *cm, return 0; } +static void mr_config_for_bts(struct gsm_lchan *lchan, struct msgb *msg) +{ + if (lchan->tch_mode == GSM48_CMODE_SPEECH_AMR) + msgb_tlv_put(msg, RSL_IE_MR_CONFIG, lchan->mr_bts_lv[0], + lchan->mr_bts_lv + 1); +} + /* Chapter 8.4.1 */ int rsl_chan_activate_lchan(struct gsm_lchan *lchan, uint8_t act_type, uint8_t ho_ref) @@ -518,10 +525,7 @@ int rsl_chan_activate_lchan(struct gsm_lchan *lchan, uint8_t act_type, msgb_tv_put(msg, RSL_IE_BS_POWER, lchan->bs_power); msgb_tv_put(msg, RSL_IE_MS_POWER, lchan->ms_power); msgb_tv_put(msg, RSL_IE_TIMING_ADVANCE, ta); - - if (lchan->tch_mode == GSM48_CMODE_SPEECH_AMR) - msgb_tlv_put(msg, RSL_IE_MR_CONFIG, lchan->mr_bts_lv[0], - lchan->mr_bts_lv + 1); + mr_config_for_bts(lchan, msg); msg->dst = lchan->ts->trx->rsl_link; @@ -557,11 +561,7 @@ int rsl_chan_mode_modify_req(struct gsm_lchan *lchan) msgb_tlv_put(msg, RSL_IE_ENCR_INFO, rc, encr_info); } - if (lchan->tch_mode == GSM48_CMODE_SPEECH_AMR) -{ - msgb_tlv_put(msg, RSL_IE_MR_CONFIG, lchan->mr_bts_lv[0], - lchan->mr_bts_lv + 1); -} + mr_config_for_bts(lchan, msg); msg->dst = lchan->ts->trx->rsl_link; diff --git a/openbsc/src/libbsc/gsm_04_08_utils.c b/openbsc/src/libbsc/gsm_04_08_utils.c index ef82555..24a1cfd 100644 --- a/openbsc/src/libbsc/gsm_04_08_utils.c +++ b/openbsc/src/libbsc/gsm_04_08_utils.c @@ -214,6 +214,13 @@ int get_reason_by_chreq(uint8_t ra, int neci) return GSM_CHREQ_REASON_OTHER; } +static void mr_config_for_ms(struct gsm_lchan *lchan, struct msgb *msg) +{ + if (lchan->tch_mode == GSM48_CMODE_SPEECH_AMR) + msgb_tlv_put(msg, GSM48_IE_MUL_RATE_CFG, lchan->mr_ms_lv[0], + lchan->mr_ms_lv + 1); +} + /* 7.1.7 and 9.1.7: RR CHANnel RELease */ int gsm48_send_rr_release(struct gsm_lchan *lchan) { @@ -489,9 +496,7 @@ int gsm48_send_rr_ass_cmd(struct gsm_lchan *dest_lchan, struct gsm_lchan *lchan, } /* in case of multi rate we need to attach a config */ - if (lchan->tch_mode == GSM48_CMODE_SPEECH_AMR) - msgb_tlv_put(msg, GSM48_IE_MUL_RATE_CFG, lchan->mr_ms_lv[0], - lchan->mr_ms_lv + 1); + mr_config_for_ms(lchan, msg); return gsm48_sendmsg(msg); } @@ -517,9 +522,7 @@ int gsm48_tx_chan_mode_modify(struct gsm_lchan *lchan, uint8_t mode) cmm->mode = mode; /* in case of multi rate we need to attach a config */ - if (lchan->tch_mode == GSM48_CMODE_SPEECH_AMR) - msgb_tlv_put(msg, GSM48_IE_MUL_RATE_CFG, lchan->mr_ms_lv[0], - lchan->mr_ms_lv + 1); + mr_config_for_ms(lchan, msg); return gsm48_sendmsg(msg); } -- 2.3.5 From holger at freyther.de Thu Sep 24 10:29:35 2015 From: holger at freyther.de (Holger Hans Peter Freyther) Date: Thu, 24 Sep 2015 12:29:35 +0200 Subject: [PATCH 2/3] amr: Instead of putting ms/bts into the same struct.. use it twice In-Reply-To: <1443090576-63058-1-git-send-email-holger@freyther.de> References: <1443090576-63058-1-git-send-email-holger@freyther.de> Message-ID: <1443090576-63058-2-git-send-email-holger@freyther.de> From: Holger Hans Peter Freyther This way a lot of if/else can just be killed by the caller deciding which of the two instances to use. I have copied both branches to new files, replace bts for ms in one of them and ran diff on it. There is no difference. --- openbsc/include/openbsc/gsm_04_08.h | 3 ++- openbsc/include/openbsc/gsm_data_shared.h | 10 ++++---- openbsc/src/libbsc/bsc_api.c | 4 +-- openbsc/src/libbsc/bsc_vty.c | 16 ++++++------ openbsc/src/libbsc/gsm_04_08_utils.c | 42 +++++++++++-------------------- 5 files changed, 31 insertions(+), 44 deletions(-) diff --git a/openbsc/include/openbsc/gsm_04_08.h b/openbsc/include/openbsc/gsm_04_08.h index 02b2e3b..02d67f7 100644 --- a/openbsc/include/openbsc/gsm_04_08.h +++ b/openbsc/include/openbsc/gsm_04_08.h @@ -14,6 +14,7 @@ struct gsm_network; struct gsm_trans; struct gsm_subscriber_connection; struct amr_multirate_conf; +struct amr_mode; #define GSM48_ALLOC_SIZE 2048 #define GSM48_ALLOC_HEADROOM 256 @@ -90,6 +91,6 @@ void gsm48_lchan2chan_desc(struct gsm48_chan_desc *cd, void release_security_operation(struct gsm_subscriber_connection *conn); void allocate_security_operation(struct gsm_subscriber_connection *conn); -int gsm48_multirate_config(uint8_t *lv, struct amr_multirate_conf *mr, int ms); +int gsm48_multirate_config(uint8_t *lv, struct amr_multirate_conf *mr, struct amr_mode *modes); #endif diff --git a/openbsc/include/openbsc/gsm_data_shared.h b/openbsc/include/openbsc/gsm_data_shared.h index 5ff6c20..be3333c 100644 --- a/openbsc/include/openbsc/gsm_data_shared.h +++ b/openbsc/include/openbsc/gsm_data_shared.h @@ -150,14 +150,14 @@ struct bts_codec_conf { struct amr_mode { uint8_t mode; - uint8_t threshold_ms; - uint8_t hysteresis_ms; - uint8_t threshold_bts; - uint8_t hysteresis_bts; + uint8_t threshold; + uint8_t hysteresis; }; + struct amr_multirate_conf { uint8_t gsm48_ie[2]; - struct amr_mode mode[4]; + struct amr_mode ms_mode[4]; + struct amr_mode bts_mode[4]; uint8_t num_modes; }; /* /BTS ONLY */ diff --git a/openbsc/src/libbsc/bsc_api.c b/openbsc/src/libbsc/bsc_api.c index 78e7c87..e157eb9 100644 --- a/openbsc/src/libbsc/bsc_api.c +++ b/openbsc/src/libbsc/bsc_api.c @@ -178,8 +178,8 @@ static void handle_mr_config(struct gsm_subscriber_connection *conn, mr_conf->icmi = 1; mr_conf->m5_90 = 1; } - gsm48_multirate_config(lchan->mr_ms_lv, mr, 1); - gsm48_multirate_config(lchan->mr_bts_lv, mr, 0); + gsm48_multirate_config(lchan->mr_ms_lv, mr, mr->ms_mode); + gsm48_multirate_config(lchan->mr_bts_lv, mr, mr->bts_mode); } /* diff --git a/openbsc/src/libbsc/bsc_vty.c b/openbsc/src/libbsc/bsc_vty.c index 9b0f020..d940624 100644 --- a/openbsc/src/libbsc/bsc_vty.c +++ b/openbsc/src/libbsc/bsc_vty.c @@ -505,22 +505,22 @@ static void config_write_bts_amr(struct vty *vty, struct gsm_bts *bts, if (num > 1) { vty_out(vty, " %s threshold ms", prefix); for (i = 0; i < num - 1; i++) { - vty_out(vty, " %d", mr->mode[i].threshold_ms); + vty_out(vty, " %d", mr->ms_mode[i].threshold); } vty_out(vty, "%s", VTY_NEWLINE); vty_out(vty, " %s hysteresis ms", prefix); for (i = 0; i < num - 1; i++) { - vty_out(vty, " %d", mr->mode[i].hysteresis_ms); + vty_out(vty, " %d", mr->ms_mode[i].hysteresis); } vty_out(vty, "%s", VTY_NEWLINE); vty_out(vty, " %s threshold bts", prefix); for (i = 0; i < num - 1; i++) { - vty_out(vty, " %d", mr->mode[i].threshold_bts); + vty_out(vty, " %d", mr->bts_mode[i].threshold); } vty_out(vty, "%s", VTY_NEWLINE); vty_out(vty, " %s hysteresis bts", prefix); for (i = 0; i < num - 1; i++) { - vty_out(vty, " %d", mr->mode[i].hysteresis_bts); + vty_out(vty, " %d", mr->bts_mode[i].hysteresis); } vty_out(vty, "%s", VTY_NEWLINE); } @@ -2957,10 +2957,10 @@ static void get_amr_th_from_arg(struct vty *vty, int argc, const char *argv[], i if (argv[0][0]=='m') { for (i = 0; i < argc - 1; i++) - mr->mode[i].threshold_ms = atoi(argv[i + 1]); + mr->ms_mode[i].threshold = atoi(argv[i + 1]); } else { for (i = 0; i < argc - 1; i++) - mr->mode[i].threshold_bts = atoi(argv[i + 1]); + mr->bts_mode[i].threshold = atoi(argv[i + 1]); } } @@ -2972,10 +2972,10 @@ static void get_amr_hy_from_arg(struct vty *vty, int argc, const char *argv[], i if (argv[0][0]=='m') { for (i = 0; i < argc - 1; i++) - mr->mode[i].hysteresis_ms = atoi(argv[i + 1]); + mr->ms_mode[i].hysteresis = atoi(argv[i + 1]); } else { for (i = 0; i < argc - 1; i++) - mr->mode[i].hysteresis_bts = atoi(argv[i + 1]); + mr->bts_mode[i].hysteresis = atoi(argv[i + 1]); } } diff --git a/openbsc/src/libbsc/gsm_04_08_utils.c b/openbsc/src/libbsc/gsm_04_08_utils.c index 24a1cfd..4901912 100644 --- a/openbsc/src/libbsc/gsm_04_08_utils.c +++ b/openbsc/src/libbsc/gsm_04_08_utils.c @@ -364,7 +364,7 @@ void gsm48_lchan2chan_desc(struct gsm48_chan_desc *cd, } } -int gsm48_multirate_config(uint8_t *lv, struct amr_multirate_conf *mr, int ms) +int gsm48_multirate_config(uint8_t *lv, struct amr_multirate_conf *mr, struct amr_mode *modes) { int num = 0, i; @@ -387,33 +387,19 @@ int gsm48_multirate_config(uint8_t *lv, struct amr_multirate_conf *mr, int ms) memcpy(lv + 1, mr->gsm48_ie, 2); if (num == 1) return 0; - if (ms) { - lv[3] = mr->mode[0].threshold_ms & 0x3f; - lv[4] = mr->mode[0].hysteresis_ms << 4; - if (num == 2) - return 0; - lv[4] |= (mr->mode[1].threshold_ms & 0x3f) >> 2; - lv[5] = mr->mode[1].threshold_ms << 6; - lv[5] |= (mr->mode[1].hysteresis_ms & 0x0f) << 2; - if (num == 3) - return 0; - lv[5] |= (mr->mode[2].threshold_ms & 0x3f) >> 4; - lv[6] = mr->mode[2].threshold_ms << 4; - lv[6] |= mr->mode[2].hysteresis_ms & 0x0f; - } else { - lv[3] = mr->mode[0].threshold_bts & 0x3f; - lv[4] = mr->mode[0].hysteresis_bts << 4; - if (num == 2) - return 0; - lv[4] |= (mr->mode[1].threshold_bts & 0x3f) >> 2; - lv[5] = mr->mode[1].threshold_bts << 6; - lv[5] |= (mr->mode[1].hysteresis_bts & 0x0f) << 2; - if (num == 3) - return 0; - lv[5] |= (mr->mode[2].threshold_bts & 0x3f) >> 4; - lv[6] = mr->mode[2].threshold_bts << 4; - lv[6] |= mr->mode[2].hysteresis_bts & 0x0f; - } + + lv[3] = modes[0].threshold & 0x3f; + lv[4] = modes[0].hysteresis << 4; + if (num == 2) + return 0; + lv[4] |= (modes[1].threshold & 0x3f) >> 2; + lv[5] = modes[1].threshold << 6; + lv[5] |= (modes[1].hysteresis & 0x0f) << 2; + if (num == 3) + return 0; + lv[5] |= (modes[2].threshold & 0x3f) >> 4; + lv[6] = modes[2].threshold << 4; + lv[6] |= modes[2].hysteresis & 0x0f; return 0; } -- 2.3.5 From holger at freyther.de Thu Sep 24 10:29:36 2015 From: holger at freyther.de (Holger Hans Peter Freyther) Date: Thu, 24 Sep 2015 12:29:36 +0200 Subject: [PATCH 3/3] amr: Kill more duplication and let the code work one of the modes In-Reply-To: <1443090576-63058-1-git-send-email-holger@freyther.de> References: <1443090576-63058-1-git-send-email-holger@freyther.de> Message-ID: <1443090576-63058-3-git-send-email-holger@freyther.de> From: Holger Hans Peter Freyther --- openbsc/src/libbsc/bsc_vty.c | 59 +++++++++++++++++++------------------------- 1 file changed, 25 insertions(+), 34 deletions(-) diff --git a/openbsc/src/libbsc/bsc_vty.c b/openbsc/src/libbsc/bsc_vty.c index d940624..f8ef833 100644 --- a/openbsc/src/libbsc/bsc_vty.c +++ b/openbsc/src/libbsc/bsc_vty.c @@ -479,6 +479,21 @@ static void config_write_bts_model(struct vty *vty, struct gsm_bts *bts) config_write_trx_single(vty, trx); } +static void write_amr_modes(struct vty *vty, const char *prefix, + const char *name, struct amr_mode *modes, int num) +{ + int i; + + vty_out(vty, " %s threshold %s", prefix, name); + for (i = 0; i < num - 1; i++) + vty_out(vty, " %d", modes[i].threshold); + vty_out(vty, "%s", VTY_NEWLINE); + vty_out(vty, " %s hysteresis %s", prefix, name); + for (i = 0; i < num - 1; i++) + vty_out(vty, " %d", modes[i].hysteresis); + vty_out(vty, "%s", VTY_NEWLINE); +} + static void config_write_bts_amr(struct vty *vty, struct gsm_bts *bts, struct amr_multirate_conf *mr, int full) { @@ -503,26 +518,8 @@ static void config_write_bts_amr(struct vty *vty, struct gsm_bts *bts, if (num > 4) num = 4; if (num > 1) { - vty_out(vty, " %s threshold ms", prefix); - for (i = 0; i < num - 1; i++) { - vty_out(vty, " %d", mr->ms_mode[i].threshold); - } - vty_out(vty, "%s", VTY_NEWLINE); - vty_out(vty, " %s hysteresis ms", prefix); - for (i = 0; i < num - 1; i++) { - vty_out(vty, " %d", mr->ms_mode[i].hysteresis); - } - vty_out(vty, "%s", VTY_NEWLINE); - vty_out(vty, " %s threshold bts", prefix); - for (i = 0; i < num - 1; i++) { - vty_out(vty, " %d", mr->bts_mode[i].threshold); - } - vty_out(vty, "%s", VTY_NEWLINE); - vty_out(vty, " %s hysteresis bts", prefix); - for (i = 0; i < num - 1; i++) { - vty_out(vty, " %d", mr->bts_mode[i].hysteresis); - } - vty_out(vty, "%s", VTY_NEWLINE); + write_amr_modes(vty, prefix, "ms", mr->ms_mode, num); + write_amr_modes(vty, prefix, "bts", mr->bts_mode, num); } vty_out(vty, " %s start-mode ", prefix); if (mr_conf->icmi) { @@ -2953,30 +2950,24 @@ static void get_amr_th_from_arg(struct vty *vty, int argc, const char *argv[], i { struct gsm_bts *bts = vty->index; struct amr_multirate_conf *mr = (full) ? &bts->mr_full: &bts->mr_half; + struct amr_mode *modes; int i; - if (argv[0][0]=='m') { - for (i = 0; i < argc - 1; i++) - mr->ms_mode[i].threshold = atoi(argv[i + 1]); - } else { - for (i = 0; i < argc - 1; i++) - mr->bts_mode[i].threshold = atoi(argv[i + 1]); - } + modes = argv[0][0]=='m' ? mr->ms_mode : mr->bts_mode; + for (i = 0; i < argc - 1; i++) + modes[i].threshold = atoi(argv[i + 1]); } static void get_amr_hy_from_arg(struct vty *vty, int argc, const char *argv[], int full) { struct gsm_bts *bts = vty->index; struct amr_multirate_conf *mr = (full) ? &bts->mr_full: &bts->mr_half; + struct amr_mode *modes; int i; - if (argv[0][0]=='m') { - for (i = 0; i < argc - 1; i++) - mr->ms_mode[i].hysteresis = atoi(argv[i + 1]); - } else { - for (i = 0; i < argc - 1; i++) - mr->bts_mode[i].hysteresis = atoi(argv[i + 1]); - } + modes = argv[0][0]=='m' ? mr->ms_mode : mr->bts_mode; + for (i = 0; i < argc - 1; i++) + modes[i].hysteresis = atoi(argv[i + 1]); } static void get_amr_start_from_arg(struct vty *vty, const char *argv[], int full) -- 2.3.5 From nhofmeyr at sysmocom.de Thu Sep 24 11:44:06 2015 From: nhofmeyr at sysmocom.de (Neels Hofmeyr) Date: Thu, 24 Sep 2015 13:44:06 +0200 Subject: [PATCH 1/3] Add initial OAP protocol design document Message-ID: <1443095048-4593-1-git-send-email-nhofmeyr@sysmocom.de> Sponsored-by: On-Waves ehf --- openbsc/doc/osmocom-authn-protocol.txt | 191 +++++++++++++++++++++++++++++++++ 1 file changed, 191 insertions(+) create mode 100644 openbsc/doc/osmocom-authn-protocol.txt diff --git a/openbsc/doc/osmocom-authn-protocol.txt b/openbsc/doc/osmocom-authn-protocol.txt new file mode 100644 index 0000000..660fdb6 --- /dev/null +++ b/openbsc/doc/osmocom-authn-protocol.txt @@ -0,0 +1,191 @@ + + Osmocom Authentication Protocol (OAP) + +1. General + +This document describes the remote protocol that is used by the SGSN and MAP +proxy to authenticate each other. The protocol and the messages are designed +after the corresponding MAP messages (see GSM 09.02) with the following +differences: + + - The encoding uses TLV structures instead of ASN.1 encodings + - Segmentation is not used + +See the specification of the Gr interface (GSM 03.60). + +1.1. Connection + +The protocol expects that a reliable, ordered, packet boundaries preserving +connection is used (e.g. IPA over TCP). The remote peer is either a service +that understands the protocol natively or a wrapper service that maps the +messages to/from real MAP messages that can be used to directly communicate +with an HLR. + +1.2. Using IPA + +By default, the following identifiers should be used: + - IPA protocol: 0xee (OSMO) + - IPA OSMO protocol extension: 0x06 + +2. Procedures + +Ideal communication sequence: + + SGSN MAP + | | + | Register (Id) | + |----------------------------------->| + | | + | Challenge (RAND+AUTN) | + |<-----------------------------------| + | | + | Challenge Result (SRES) | + |----------------------------------->| + | | + | Register Result | + |<-----------------------------------| + +2.1. Register + +The SGSN sends a REGISTER_REQ message containing an SGSN identifier number. + +2.2. Challenge + +The OAP server (optionally) sends a CHALLENGE_REQ to the SGSN, containing +random bytes and a milenage authentication token generated from these random +bytes, using a shared secret, to authenticate itself to the OAP client (SGSN). +The server may omit this challenge entirely, based on its configuration, and +immediately reply with a Register Result response. If the SGSN cannot be +registered (e.g. id is invalid), the server sends a REGISTER_ERR response. + +2.3. Challenge Result + +When the SGSN has received a Challenge, it may verify the server's +authenticity, and reply with a CHALLENGE_RES message. This shall contain SRES +(and Kc?) authentication tokens generated by milenage from the same random +bytes received from the server and the same shared secet. If the SGSN cannot +verify the server's authenticity, it shall instead send a CHALLENGE_ERR +message. + +2.4. Register Result + +The MAP sends a REGISTER_RES message to indicate that registration has been +successful. If the MAP proxy cannot register the SGSN (e.g. invalid challenge +response), it sends a REGISTER_ERR message. + +3. Message Format + +3.1. General + +Every message is based on the following message format + + IEI Info Element Type Pres. Format Length + Message type 4.2.1 M V 1 + +The receiver shall be able to receive IEs in any order. Unknown IEs shall be +ignored. + +3.2.1. Register Request + +SGSN -> Network peer + + IEI Info Element Type Pres. Format Length + Message type 4.2.1 M V 1 + 30 SGSN Id big endian int (2 oct) M TLV 4 + +3.2.2. Register Error + +Network peer -> SGSN + + IEI Info Element Type Pres. Format Length + Message type 4.2.1 M V 1 + 02 Cause GMM cause, M TLV 3 + 04.08: 10.5.5.14 + +3.2.6. Register Result + +Network peer -> SGSN + + IEI Info Element Type Pres. Format Length + Message type 4.2.1 M V 1 + +3.2.3. Challenge + +Network peer -> SGSN + + IEI Info Element Type Pres. Format Length + Message type 4.2.1 M V 1 + 20 RAND octet string (16) M TLV 18 + 23 AUTN octet string (16) M TLV 18 + +3.2.4. Challenge Error + +SGSN -> Network peer + + IEI Info Element Type Pres. Format Length + Message type 4.2.1 M V 1 + 02 Cause GMM cause, M TLV 3 + 04.08: 10.5.5.14 + +3.2.5. Challenge Result + +SGSN -> Network peer + + IEI Info Element Type Pres. Format Length + Message type 4.2.1 M V 1 + 21 SRES octet string (4) M TLV 6 + 22 Kc octet string (8) M TLV 10 + +4. Information Elements + +4.1. General + +[...] + +4.2.1. Message Type + + +---------------------------------------------------+ + | 8 7 6 5 4 3 2 1 | + | | + | 0 0 0 0 0 1 0 0 - Register Request | + | 0 0 0 0 0 1 0 1 - Register Error | + | 0 0 0 0 0 1 1 0 - Register Result | + | | + | 0 0 0 0 1 0 0 0 - Challenge Request | + | 0 0 0 0 1 0 0 1 - Challenge Error | + | 0 0 0 0 1 0 1 0 - Challenge Result | + | | + +---------------------------------------------------+ + +4.2.2. IE Identifier (informational) + +These are the standard values for the IEI. + + +---------------------------------------------------------+ + | IEI Info Element Type | + | | + | 0x02 Cause GMM cause, 04.08: 10.5.5.14 | + | 0x20 RAND octet string | + | 0x21 SRES octet string | + | 0x22 Kc octet string | + | 0x23 AUTN octet string | + | 0x30 SGSN Id big endian int (2 octets) | + +---------------------------------------------------------+ + +4.2.3. SGSN Id + + 8 7 6 5 4 3 2 1 + +-----------------------------------------------------+ + | | SGSN Id IEI | octet 1 + +-----------------------------------------------------+ + | Length of SGSN Id IE contents (2) | octet 2 + +-----------------------------------------------------+ + | SGSN Id number, most significant byte | octet 3 + +-----------------------------------------------------+ + | SGSN Id number, least significant byte | octet 4 + +-----------------------------------------------------+ + +The SGSN Id number shall be interpreted as an unsigned 16bit integer, where 0 +indicates an invalid / unset Id. + + -- 2.1.4 From nhofmeyr at sysmocom.de Thu Sep 24 11:44:08 2015 From: nhofmeyr at sysmocom.de (Neels Hofmeyr) Date: Thu, 24 Sep 2015 13:44:08 +0200 Subject: [PATCH 3/3] Implement OAP for SGSN registration. In-Reply-To: <1443095048-4593-1-git-send-email-nhofmeyr@sysmocom.de> References: <1443095048-4593-1-git-send-email-nhofmeyr@sysmocom.de> Message-ID: <1443095048-4593-3-git-send-email-nhofmeyr@sysmocom.de> Needs a new ipaccess_proto_ext enum value IPAC_PROTO_EXT_OAP from libosmocore, added in libosmocore.git:5eeb17a0178a72d291cb99f2391d8ea7e9b65dd4. Implement the Osmocom Authentication Protocol, to allow an SGSN to register with an IPA peer. The aim is to allow multiple SGSNs talking to a single MAP proxy. Have this API separation: - ipa_client_conn provides a bare connection (unchanged). - ipa_client provides general IPA connection verification using timeouts and an IPA ping/pong. - gprs_ipa_client muxes an ipa_client to the GSUP and OAP APIs. While ipa_client_conn and ipa_client above are very general, gprs_ipa_client is a specific use "with real data". ipa_client has previously been gprs_gsup_client. Remove GSUP specifics, change naming and log output to say "IPA" instead. (A previous commit has already renamed the gprs_gsup_client files to make this commit easier to read.) Add gprs_ipa_client to soak up the GSUP specifics from ipa_client (basically just the protocol numbers). Also soak up gprs_subscr_init() and gsup_read_cb() from gprs_subscriber.c. And, of course, apply the OAP API. Add gprs_oap_messages.{h,c} and gprs_oap.{h,c} to implement the OAP protocol. Add a gprs_oap_state field to (new) gprs_gsup_client. Add a gprs_oap_config field to sgsn_config. Rename sgsn_config.gsup_server_* to ipa_server_*. Apply this in sgsn_vty.c. Change from gprs_gsup_client to the new gprs_ipa_client API in - gprs_subscriber.c - sgsn_main.c (gprs_subscr_init() has become gprs_ipa_client_init()) Move some static functions to gprs_utils.h to avoid code duplication, I hope the location is a sufficiently good choice: - constant_time_cmp() from bsc_nat.c for gprs_oap_evaluate_challenge(), now called gprs_constant_time_cmp(). - encode_big_endian() and decode_big_endian() from gprs_gsup_messages.c for gprs_oap_decode() and gprs_oap_encode(), now called gprs_encode_big_endian() and gps_decode_big_endian(). Apply the function renames in the mentioned .c files. Add OAP unit tests to sgsn_test.c: test_oap() and test_sgsn_registration(). Update sgsn_test.ok accordingly. Sponsored-by: On-Waves ehf --- openbsc/include/openbsc/Makefile.am | 8 +- openbsc/include/openbsc/gprs_ipa_client.h | 53 ++++ openbsc/include/openbsc/gprs_oap.h | 65 +++++ openbsc/include/openbsc/gprs_oap_messages.h | 70 ++++++ openbsc/include/openbsc/gprs_utils.h | 5 + openbsc/include/openbsc/ipa_client.h | 43 ++-- openbsc/include/openbsc/sgsn.h | 13 +- openbsc/src/gprs/Makefile.am | 6 +- openbsc/src/gprs/gprs_gsup_messages.c | 44 +--- openbsc/src/gprs/gprs_ipa_client.c | 159 ++++++++++++ openbsc/src/gprs/gprs_oap.c | 207 ++++++++++++++++ openbsc/src/gprs/gprs_oap_messages.c | 179 ++++++++++++++ openbsc/src/gprs/gprs_subscriber.c | 43 +--- openbsc/src/gprs/gprs_utils.c | 39 +++ openbsc/src/gprs/ipa_client.c | 233 +++++++++--------- openbsc/src/gprs/sgsn_main.c | 5 +- openbsc/src/gprs/sgsn_vty.c | 49 ++-- openbsc/src/osmo-bsc_nat/bsc_nat.c | 16 +- openbsc/tests/sgsn/Makefile.am | 6 +- openbsc/tests/sgsn/sgsn_test.c | 361 ++++++++++++++++++++++++++-- openbsc/tests/sgsn/sgsn_test.ok | 5 + 21 files changed, 1343 insertions(+), 266 deletions(-) create mode 100644 openbsc/include/openbsc/gprs_ipa_client.h create mode 100644 openbsc/include/openbsc/gprs_oap.h create mode 100644 openbsc/include/openbsc/gprs_oap_messages.h create mode 100644 openbsc/src/gprs/gprs_ipa_client.c create mode 100644 openbsc/src/gprs/gprs_oap.c create mode 100644 openbsc/src/gprs/gprs_oap_messages.c diff --git a/openbsc/include/openbsc/Makefile.am b/openbsc/include/openbsc/Makefile.am index 7bc9d95..492f6e2 100644 --- a/openbsc/include/openbsc/Makefile.am +++ b/openbsc/include/openbsc/Makefile.am @@ -15,8 +15,12 @@ noinst_HEADERS = abis_nm.h abis_rsl.h db.h gsm_04_08.h gsm_data.h \ bss.h gsm_data_shared.h ipaccess.h mncc_int.h \ arfcn_range_encode.h nat_rewrite_trie.h bsc_nat_callstats.h \ osmux.h mgcp_transcode.h gprs_utils.h \ - gprs_gb_parse.h smpp.h meas_feed.h gprs_gsup_messages.h \ - ipa_client.h bsc_msg_filter.h + gprs_gb_parse.h smpp.h meas_feed.h \ + bsc_msg_filter.h \ + ipa_client.h \ + gprs_ipa_client.h \ + gprs_gsup_messages.h gprs_oap_messages.h \ + gprs_oap.h openbsc_HEADERS = gsm_04_08.h meas_rep.h bsc_api.h openbscdir = $(includedir)/openbsc diff --git a/openbsc/include/openbsc/gprs_ipa_client.h b/openbsc/include/openbsc/gprs_ipa_client.h new file mode 100644 index 0000000..068d1a1 --- /dev/null +++ b/openbsc/include/openbsc/gprs_ipa_client.h @@ -0,0 +1,53 @@ +/* Specific IPA client for GPRS: Multiplex for GSUP and OAP */ + +/* (C) 2015 by Sysmocom s.f.m.c. GmbH + * All Rights Reserved + * + * Author: Jacob Erlbeck, Neels Hofmeyr + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation; either version 3 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 Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + * + */ +#pragma once + +#include + +#include + +#include +#include + +struct sgsn_instance; + +int gprs_ipa_client_init(struct sgsn_instance *sgsn_inst); + + +struct gprs_ipa_client { + struct ipa_client *ipac; + + // sgsn <-> map proxy registration state + struct gprs_oap_state oap; + + // TODO registration timeout? +}; + +struct gprs_ipa_client *gprs_ipa_client_create(const char *ip_addr, + unsigned int tcp_port); + +int gprs_ipa_client_send_gsup(struct gprs_ipa_client *gipac, struct msgb *msg); +int gprs_ipa_client_send_oap(struct gprs_ipa_client *gipac, struct msgb *msg); + +void gprs_ipa_client_destroy(struct gprs_ipa_client *gipac); + + diff --git a/openbsc/include/openbsc/gprs_oap.h b/openbsc/include/openbsc/gprs_oap.h new file mode 100644 index 0000000..9972a81 --- /dev/null +++ b/openbsc/include/openbsc/gprs_oap.h @@ -0,0 +1,65 @@ +/* Osmocom Authentication Protocol API */ + +/* (C) 2015 by Sysmocom s.f.m.c. GmbH + * All Rights Reserved + * + * Author: Neels Hofmeyr + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation; either version 3 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 Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + * + */ + +#pragma once + +#include + +struct sgsn_instance; +struct gprs_ipa_client; +struct msgb; + +/* This is the config part for vty. It is essentially copied in gprs_oap_state, + * where values are copied over once the config is considered valid. The shared + * secret is converted from hex string to octet buffer, the sgsn_id is simply + * copied. Is this separation really necessary? */ +struct gprs_oap_config { + uint16_t sgsn_id; + const char *shared_secret; +}; + +struct gprs_oap_state { + enum { + oap_uninitialized = 0, // just allocated. + oap_disabled, // disabled by config. + oap_config_error, // <-- TODO really? + oap_initialized, // shared_secret valid. + oap_requested_challenge, + oap_sent_challenge_result, + oap_registered + } state; + uint16_t sgsn_id; + uint8_t shared_secret[16]; + int challenges_count; +}; + +int gprs_oap_init(struct gprs_oap_config *config, struct gprs_oap_state *state); + +int gprs_oap_evaluate_challenge(struct gprs_oap_state *state, + const uint8_t *rx_random, + const uint8_t *rx_autn, + uint8_t *tx_sres, + uint8_t *tx_kc); + +int gprs_oap_register(struct gprs_ipa_client *gipac); +int gprs_oap_rx(struct gprs_ipa_client *gipac, struct msgb *msg); + diff --git a/openbsc/include/openbsc/gprs_oap_messages.h b/openbsc/include/openbsc/gprs_oap_messages.h new file mode 100644 index 0000000..b80e5ed --- /dev/null +++ b/openbsc/include/openbsc/gprs_oap_messages.h @@ -0,0 +1,70 @@ +/* Osmocom Authentication Protocol message encoder/decoder */ + +/* (C) 2015 by Sysmocom s.f.m.c. GmbH + * All Rights Reserved + * + * Author: Neels Hofmeyr + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation; either version 3 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 Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + * + */ +#pragma once + +#include +#include +#include + +/* Some numbers are out of sequence because (so far) they match gprs_gsup_iei. + */ +enum gprs_oap_iei { + GPRS_OAP_CAUSE_IE = 0x02, + GPRS_OAP_RAND_IE = 0x20, + GPRS_OAP_SRES_IE = 0x21, + GPRS_OAP_KC_IE = 0x22, + GPRS_OAP_AUTN_IE = 0x23, + GPRS_OAP_SGSN_ID_IE = 0x30, +}; + +enum gprs_oap_message_type { + GPRS_OAP_MSGT_REGISTER_REQUEST = 0b00000100, + GPRS_OAP_MSGT_REGISTER_ERROR = 0b00000101, + GPRS_OAP_MSGT_REGISTER_RESULT = 0b00000110, + + GPRS_OAP_MSGT_CHALLENGE_REQUEST = 0b00001000, + GPRS_OAP_MSGT_CHALLENGE_ERROR = 0b00001001, + GPRS_OAP_MSGT_CHALLENGE_RESULT = 0b00001010, +}; + +#define GPRS_OAP_IS_MSGT_REQUEST(msgt) (((msgt) & 0b00000011) == 0b00) +#define GPRS_OAP_IS_MSGT_ERROR(msgt) (((msgt) & 0b00000011) == 0b01) +#define GPRS_OAP_TO_MSGT_ERROR(msgt) (((msgt) & 0b11111100) | 0b01) + +struct gprs_oap_message { + enum gprs_oap_message_type message_type; + enum gsm48_gmm_cause cause; + uint16_t sgsn_id; + int rand_present; + uint8_t rand[16]; + int autn_present; + uint8_t autn[16]; + int sres_present; + uint8_t sres[4]; + int kc_present; + uint8_t kc[8]; +}; + +int gprs_oap_decode(const uint8_t *data, size_t data_len, + struct gprs_oap_message *oap_msg); +void gprs_oap_encode(struct msgb *msg, const struct gprs_oap_message *oap_msg); + diff --git a/openbsc/include/openbsc/gprs_utils.h b/openbsc/include/openbsc/gprs_utils.h index 6880e05..c67cee2 100644 --- a/openbsc/include/openbsc/gprs_utils.h +++ b/openbsc/include/openbsc/gprs_utils.h @@ -52,3 +52,8 @@ int gprs_match_tlv(uint8_t **data, size_t *data_len, int gprs_shift_lv(uint8_t **data, size_t *data_len, uint8_t **value, size_t *value_len); +uint64_t gprs_decode_big_endian(const uint8_t *data, size_t data_len); +/* Not thread safe: returns pointer to static buffer. */ +uint8_t *gprs_encode_big_endian(uint64_t value, size_t data_len); + +int gprs_constant_time_cmp(const uint8_t *exp, const uint8_t *rel, const int count); diff --git a/openbsc/include/openbsc/ipa_client.h b/openbsc/include/openbsc/ipa_client.h index 9537db4..531ee5d 100644 --- a/openbsc/include/openbsc/ipa_client.h +++ b/openbsc/include/openbsc/ipa_client.h @@ -1,9 +1,10 @@ -/* GPRS Subscriber Update Protocol client */ +/* General IPA client. + * ipa_client is ping/pong connection checking on an ipa_client_conn. */ -/* (C) 2014 by Sysmocom s.f.m.c. GmbH +/* (C) 2015 by Sysmocom s.f.m.c. GmbH * All Rights Reserved * - * Author: Jacob Erlbeck + * Authors: Jacob Erlbeck, Neels Hofmeyr * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by @@ -21,34 +22,44 @@ */ #pragma once +#include #include -#define GPRS_GSUP_RECONNECT_INTERVAL 10 -#define GPRS_GSUP_PING_INTERVAL 20 +#define IPA_CLIENT_RECONNECT_INTERVAL 10 +#define IPA_CLIENT_PING_INTERVAL 20 struct msgb; struct ipa_client_conn; -struct gprs_gsup_client; +struct ipa_client; + +typedef void (*ipa_client_updown_cb_t)(struct ipa_client *ipac, int up); /* Expects message in msg->l2h */ -typedef int (*gprs_gsup_read_cb_t)(struct gprs_gsup_client *gsupc, struct msgb *msg); +typedef void (*ipa_client_read_cb_t)(struct ipa_client *ipac, + uint8_t proto, + uint8_t proto_ext, + struct msgb *msg); -struct gprs_gsup_client { - struct ipa_client_conn *link; - gprs_gsup_read_cb_t read_cb; +struct ipa_client { + ipa_client_updown_cb_t updown_cb; + ipa_client_read_cb_t read_cb; void *data; + struct ipa_client_conn *link; + struct osmo_timer_list ping_timer; struct osmo_timer_list connect_timer; int is_connected; int got_ipa_pong; }; -struct gprs_gsup_client *gprs_gsup_client_create(const char *ip_addr, - unsigned int tcp_port, - gprs_gsup_read_cb_t read_cb); +struct ipa_client *ipa_client_create(const char *ip_addr, + unsigned int tcp_port, + ipa_client_updown_cb_t updown_cb, + ipa_client_read_cb_t read_cb, + void *data); -void gprs_gsup_client_destroy(struct gprs_gsup_client *gsupc); -int gprs_gsup_client_send(struct gprs_gsup_client *gsupc, struct msgb *msg); -struct msgb *gprs_gsup_msgb_alloc(void); +void ipa_client_destroy(struct ipa_client *ipac); +int ipa_client_send(struct ipa_client *ipac, uint8_t proto, uint8_t proto_ext, struct msgb *msg); +struct msgb *ipa_client_msgb_alloc(void); diff --git a/openbsc/include/openbsc/sgsn.h b/openbsc/include/openbsc/sgsn.h index d4f9913..cff4e9d 100644 --- a/openbsc/include/openbsc/sgsn.h +++ b/openbsc/include/openbsc/sgsn.h @@ -6,10 +6,11 @@ #include #include +#include #include -struct gprs_gsup_client; +struct gprs_ipa_client; struct hostent; enum sgsn_auth_policy { @@ -36,8 +37,8 @@ struct sgsn_config { enum sgsn_auth_policy auth_policy; struct llist_head imsi_acl; - struct sockaddr_in gsup_server_addr; - int gsup_server_port; + struct sockaddr_in ipa_server_addr; + int ipa_server_port; int require_authentication; int require_update_location; @@ -61,6 +62,8 @@ struct sgsn_config { } timers; int dynamic_lookup; + + struct gprs_oap_config oap; }; struct sgsn_instance { @@ -74,8 +77,8 @@ struct sgsn_instance { struct osmo_timer_list gtp_timer; /* GSN instance for libgtp */ struct gsn_t *gsn; - /* Subscriber */ - struct gprs_gsup_client *gsup_client; + /* Subscriber and SGSN registration*/ + struct gprs_ipa_client *gprs_ipa_client; /* LLME inactivity timer */ struct osmo_timer_list llme_timer; diff --git a/openbsc/src/gprs/Makefile.am b/openbsc/src/gprs/Makefile.am index b9c3070..6614a08 100644 --- a/openbsc/src/gprs/Makefile.am +++ b/openbsc/src/gprs/Makefile.am @@ -26,8 +26,10 @@ osmo_sgsn_SOURCES = gprs_gmm.c gprs_sgsn.c gprs_sndcp.c gprs_sndcp_vty.c \ sgsn_main.c sgsn_vty.c sgsn_libgtp.c \ gprs_llc.c gprs_llc_parse.c gprs_llc_vty.c crc24.c \ sgsn_ctrl.c sgsn_auth.c gprs_subscriber.c \ - gprs_gsup_messages.c gprs_utils.c ipa_client.c \ - gsm_04_08_gprs.c sgsn_cdr.c sgsn_ares.c + gprs_gsup_messages.c gprs_oap_messages.c gprs_oap.c \ + ipa_client.c gprs_ipa_client.c \ + gprs_utils.c gsm_04_08_gprs.c sgsn_cdr.c sgsn_ares.c + osmo_sgsn_LDADD = \ $(top_builddir)/src/libcommon/libcommon.a \ -lgtp $(OSMO_LIBS) $(LIBOSMOABIS_LIBS) $(LIBCARES_LIBS) -lrt diff --git a/openbsc/src/gprs/gprs_gsup_messages.c b/openbsc/src/gprs/gprs_gsup_messages.c index bdcff5f..d3cf058 100644 --- a/openbsc/src/gprs/gprs_gsup_messages.c +++ b/openbsc/src/gprs/gprs_gsup_messages.c @@ -33,34 +33,6 @@ #include -static uint64_t decode_big_endian(const uint8_t *data, size_t data_len) -{ - uint64_t value = 0; - - while (data_len > 0) { - value = (value << 8) + *data; - data += 1; - data_len -= 1; - } - - return value; -} - -static uint8_t *encode_big_endian(uint64_t value, size_t data_len) -{ - static uint8_t buf[sizeof(uint64_t)]; - int idx; - - OSMO_ASSERT(data_len <= ARRAY_SIZE(buf)); - - for (idx = data_len - 1; idx >= 0; idx--) { - buf[idx] = (uint8_t)value; - value = value >> 8; - } - - return buf; -} - static int decode_pdp_info(uint8_t *data, size_t data_len, struct gprs_gsup_pdp_info *pdp_info) { @@ -81,12 +53,12 @@ static int decode_pdp_info(uint8_t *data, size_t data_len, switch (iei) { case GPRS_GSUP_PDP_CONTEXT_ID_IE: - pdp_info->context_id = decode_big_endian(value, value_len); + pdp_info->context_id = gprs_decode_big_endian(value, value_len); break; case GPRS_GSUP_PDP_TYPE_IE: pdp_info->pdp_type = - decode_big_endian(value, value_len) & 0x0fff; + gprs_decode_big_endian(value, value_len) & 0x0fff; break; case GPRS_GSUP_ACCESS_POINT_NAME_IE: @@ -187,7 +159,7 @@ int gprs_gsup_decode(const uint8_t *const_data, size_t data_len, if (rc < 0) return -GMM_CAUSE_INV_MAND_INFO; - gsup_msg->message_type = decode_big_endian(value, 1); + gsup_msg->message_type = gprs_decode_big_endian(value, 1); rc = gprs_match_tlv(&data, &data_len, GPRS_GSUP_IMSI_IE, &value, &value_len); @@ -231,12 +203,12 @@ int gprs_gsup_decode(const uint8_t *const_data, size_t data_len, continue; case GPRS_GSUP_CAUSE_IE: - gsup_msg->cause = decode_big_endian(value, value_len); + gsup_msg->cause = gprs_decode_big_endian(value, value_len); break; case GPRS_GSUP_CANCEL_TYPE_IE: gsup_msg->cancel_type = - decode_big_endian(value, value_len) + 1; + gprs_decode_big_endian(value, value_len) + 1; break; case GPRS_GSUP_PDP_INFO_COMPL_IE: @@ -272,7 +244,7 @@ int gprs_gsup_decode(const uint8_t *const_data, size_t data_len, pdp_info.have_info = 1; } else { pdp_info.context_id = - decode_big_endian(value, value_len); + gprs_decode_big_endian(value, value_len); } gsup_msg->pdp_infos[gsup_msg->num_pdp_infos++] = @@ -334,8 +306,8 @@ static void encode_pdp_info(struct msgb *msg, enum gprs_gsup_iei iei, if (pdp_info->pdp_type) { msgb_tlv_put(msg, GPRS_GSUP_PDP_TYPE_IE, GPRS_GSUP_PDP_TYPE_SIZE, - encode_big_endian(pdp_info->pdp_type | 0xf000, - GPRS_GSUP_PDP_TYPE_SIZE)); + gprs_encode_big_endian(pdp_info->pdp_type | 0xf000, + GPRS_GSUP_PDP_TYPE_SIZE)); } if (pdp_info->apn_enc) { diff --git a/openbsc/src/gprs/gprs_ipa_client.c b/openbsc/src/gprs/gprs_ipa_client.c new file mode 100644 index 0000000..9f8f510 --- /dev/null +++ b/openbsc/src/gprs/gprs_ipa_client.c @@ -0,0 +1,159 @@ +/* Specific IPA client for GPRS: Multiplex for GSUP and OAP */ + +/* (C) 2015 by Sysmocom s.f.m.c. GmbH + * All Rights Reserved + * + * Author: Neels Hofmeyr + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation; either version 3 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 Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + * + */ + +#include +#include +#include + +#include +#include +#include +#include +#include + +#include +#include +#include + +#include + +#include +#include + + +int gprs_ipa_client_init(struct sgsn_instance *sgi) +{ + const char *addr_str; + + if (!sgi->cfg.ipa_server_addr.sin_addr.s_addr) + return 0; + + addr_str = inet_ntoa(sgi->cfg.ipa_server_addr.sin_addr); + + sgi->gprs_ipa_client = gprs_ipa_client_create( + addr_str, sgi->cfg.ipa_server_port); + + if (!sgi->gprs_ipa_client) + return -1; + + return 1; +} + + + +static void gprs_ipa_client_updown_cb(struct ipa_client *ipac, int up) +{ + struct gprs_ipa_client *gipac = ipac->data; + + if (up && (gipac->oap.sgsn_id != 0)) { + if (gprs_oap_register(gipac) < 0) { + /* TODO: fail fatally */ + } + } +} + +static void gprs_ipa_client_read_cb(struct ipa_client *ipac, + uint8_t proto, + uint8_t proto_ext, + struct msgb *msg) +{ + //int rc = -2; + struct gprs_ipa_client *gipac = ipac->data; + + if (proto != IPAC_PROTO_OSMO) + goto invalid; + + switch (proto_ext) { + case IPAC_PROTO_EXT_GSUP: + /*rc =*/ gprs_subscr_rx_gsup_message(msg); + break; + + case IPAC_PROTO_EXT_OAP: + /*rc =*/ gprs_oap_rx(gipac, msg); + break; + + default: + goto invalid; + } + + /* TODO: error rc? */ + + msgb_free(msg); + return; + +invalid: + LOGP(DGPRS, LOGL_NOTICE, + "received an invalid IPA message from %s:%d: proto=%d proto_ext=%d size=%d\n", + ipac->link->addr, (int)ipac->link->port, + (int)proto, (int)proto_ext, + msgb_length(msg)); + msgb_free(msg); + + /* TODO: error rc? */ +} + +struct gprs_ipa_client *gprs_ipa_client_create(const char *ip_addr, + unsigned int tcp_port) +{ + struct gprs_ipa_client *gipac; + + gipac = talloc_zero(tall_bsc_ctx, struct gprs_ipa_client); + OSMO_ASSERT(gipac); + + gipac->ipac = ipa_client_create(ip_addr, + tcp_port, + gprs_ipa_client_updown_cb, + gprs_ipa_client_read_cb, + /* data */ NULL); + + OSMO_ASSERT(gipac->ipac); + + if (!gipac->ipac) + goto failed; + + return gipac; + +failed: + gprs_ipa_client_destroy(gipac); + return NULL; +} + +void gprs_ipa_client_destroy(struct gprs_ipa_client *gipac) +{ + if (!gipac) + return; + + if (gipac->ipac) + ipa_client_destroy(gipac->ipac); + gipac->ipac = NULL; +} + +int gprs_ipa_client_send_gsup(struct gprs_ipa_client *gipac, struct msgb *msg) +{ + return ipa_client_send(gipac->ipac, IPAC_PROTO_OSMO, IPAC_PROTO_EXT_GSUP, msg); +} + +int gprs_ipa_client_send_oap(struct gprs_ipa_client *gipac, struct msgb *msg) +{ + return ipa_client_send(gipac->ipac, IPAC_PROTO_OSMO, IPAC_PROTO_EXT_OAP, msg); +} + diff --git a/openbsc/src/gprs/gprs_oap.c b/openbsc/src/gprs/gprs_oap.c new file mode 100644 index 0000000..0c30aa8 --- /dev/null +++ b/openbsc/src/gprs/gprs_oap.c @@ -0,0 +1,207 @@ +#include +#include + +#include +#include +#include +#include +#include +#include + +#include + +int gprs_oap_init(struct gprs_oap_config *config, struct gprs_oap_state *state) +{ + OSMO_ASSERT(state->state == oap_uninitialized); + + if (config->sgsn_id == 0) + goto disable; + + if (!(config->shared_secret) || (strlen(config->shared_secret) == 0)) + goto disable; + + /* this should probably happen in config parsing place?? */ + int secret_len = osmo_hexparse(config->shared_secret, + state->shared_secret, + sizeof(state->shared_secret)); + if (secret_len < 0) + goto failure; + + if (secret_len < 1) + goto disable; + + /* zero pad to fill 16 octets */ + for (; secret_len < 16; secret_len++) { + state->shared_secret[secret_len] = 0; + } + + state->sgsn_id = config->sgsn_id; + state->state = oap_initialized; + return 0; + +disable: + state->state = oap_disabled; + return 0; + +failure: + state->state = oap_config_error; + return -1; +} + + +int gprs_oap_evaluate_challenge(struct gprs_oap_state *state, + const uint8_t *rx_random, + const uint8_t *rx_autn, + uint8_t *tx_sres, + uint8_t *tx_kc) +{ + switch(state->state) { + case oap_uninitialized: + case oap_disabled: + case oap_config_error: + return -1; + default: + break; + } + + struct osmo_auth_vector vec; + + struct osmo_sub_auth_data auth = { + .type = OSMO_AUTH_TYPE_GSM, + .algo = OSMO_AUTH_ALG_MILENAGE, + }; + + OSMO_ASSERT(sizeof(auth.u.umts.opc) == sizeof(state->shared_secret)); + OSMO_ASSERT(sizeof(auth.u.umts.k) == sizeof(state->shared_secret)); + + memcpy(auth.u.umts.opc, state->shared_secret, sizeof(auth.u.umts.opc)); + memcpy(auth.u.umts.k, state->shared_secret, sizeof(auth.u.umts.k)); + memcpy(auth.u.umts.k, state->shared_secret, sizeof(auth.u.umts.k)); + memset(auth.u.umts.amf, 0, 2); + auth.u.umts.sqn = 42; // TODO? + + memset(&vec, 0, sizeof(vec)); + osmo_auth_gen_vec(&vec, &auth, rx_random); + + if (vec.res_len != 8) { + LOGP(DGPRS, LOGL_ERROR, "OAP: generated res length is wrong: %d\n", + vec.res_len); + return -3; + } + + if (gprs_constant_time_cmp(vec.autn, rx_autn, sizeof(vec.autn)) != 0) { + LOGP(DGPRS, LOGL_ERROR, "OAP: AUTN mismatch!\n"); + LOGP(DGPRS, LOGL_INFO, "OAP: AUTN from server: %s\n", + osmo_hexdump_nospc(rx_autn, sizeof(vec.autn))); + LOGP(DGPRS, LOGL_INFO, "OAP: AUTN expected: %s\n", + osmo_hexdump_nospc(vec.autn, sizeof(vec.autn))); + return -2; + } + + memcpy(tx_sres, vec.sres, sizeof(vec.sres)); + memcpy(tx_kc, vec.kc, sizeof(vec.kc)); + return 0; +} + +int gprs_oap_register(struct gprs_ipa_client *gipac) +{ + struct gprs_oap_state *state = &gipac->oap; + + OSMO_ASSERT(state); + OSMO_ASSERT(state->sgsn_id); + + struct msgb *msg = ipa_client_msgb_alloc(); + + struct gprs_oap_message oap_msg = {0}; + oap_msg.message_type = GPRS_OAP_MSGT_REGISTER_REQUEST; + oap_msg.sgsn_id = state->sgsn_id; + + gprs_oap_encode(msg, &oap_msg); + + state->state = oap_requested_challenge; + return gprs_ipa_client_send_oap(gipac, msg); +} + +int gprs_oap_rx(struct gprs_ipa_client *gipac, struct msgb *msg) +{ + struct gprs_oap_state *state = &gipac->oap; + + uint8_t *data = msgb_l2(msg); + size_t data_len = msgb_l2len(msg); + int rc = 0; + + struct gprs_oap_message oap_msg = {0}; + + rc = gprs_oap_decode(data, data_len, &oap_msg); + if (rc < 0) { + LOGP(DGPRS, LOGL_ERROR, + "Decoding OAP message failed with error '%s' (%d)\n", + get_value_string(gsm48_gmm_cause_names, -rc), -rc); + return rc; + } + + switch (oap_msg.message_type) { + case GPRS_OAP_MSGT_CHALLENGE_REQUEST: + // reply with challenge result + if (!(oap_msg.rand_present && oap_msg.autn_present)) { + LOGP(DGPRS, LOGL_ERROR, + "OAP challenge incomplete (rand_present: %d, autn_present: %d)\n", + oap_msg.rand_present, oap_msg.autn_present); + return -1; + } + + { + struct gprs_oap_message oap_reply = {0}; + oap_reply.message_type = GPRS_OAP_MSGT_CHALLENGE_RESULT; + + rc = gprs_oap_evaluate_challenge(state, + oap_msg.rand, + oap_msg.autn, + oap_reply.sres, + oap_reply.kc); + if (rc < 0) + return rc; + + oap_reply.sres_present = 1; + oap_reply.kc_present = 1; + + struct msgb *oap_reply_msg = ipa_client_msgb_alloc(); + OSMO_ASSERT(oap_reply_msg); + + gprs_oap_encode(oap_reply_msg, &oap_reply); + + state->state = oap_sent_challenge_result; + state->challenges_count ++; + gprs_ipa_client_send_oap(gipac, oap_reply_msg); + } + + break; + + case GPRS_OAP_MSGT_REGISTER_RESULT: + // successfully registered! + state->state = oap_registered; + break; + + case GPRS_OAP_MSGT_REGISTER_ERROR: + LOGP(DGPRS, LOGL_ERROR, + "OAP registration failed, from %s:%d\n", + gipac->ipac->link->addr, (int)gipac->ipac->link->port); + return -1; + break; + + case GPRS_OAP_MSGT_REGISTER_REQUEST: + case GPRS_OAP_MSGT_CHALLENGE_RESULT: + LOGP(DGPRS, LOGL_ERROR, + "Received invalid OAP message type for OAP client side: %d\n", + (int)oap_msg.message_type); + return -1; + + default: + LOGP(DGPRS, LOGL_ERROR, + "Unknown OAP message type: %d\n", + (int)oap_msg.message_type); + return -2; + } + + return 0; +} diff --git a/openbsc/src/gprs/gprs_oap_messages.c b/openbsc/src/gprs/gprs_oap_messages.c new file mode 100644 index 0000000..e79546e --- /dev/null +++ b/openbsc/src/gprs/gprs_oap_messages.c @@ -0,0 +1,179 @@ +/* GPRS Subscriber Update Protocol message encoder/decoder */ + +/* + * (C) 2014 by Sysmocom s.f.m.c. GmbH + * (C) 2015 by Holger Hans Peter Freyther + * All Rights Reserved + * + * Author: Jacob Erlbeck + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation; either version 3 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 Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + * + */ + +#include + +#include +#include + +#include +#include + +#include + + +int gprs_oap_decode(const uint8_t *const_data, size_t data_len, + struct gprs_oap_message *oap_msg) +{ + int rc; + uint8_t tag; + /* the shift/match functions expect non-const pointers, but we'll + * either copy the data or cast pointers back to const before returning + * them + */ + uint8_t *data = (uint8_t *)const_data; + uint8_t *value; + size_t value_len; + static const struct gprs_oap_message empty_oap_message = {0}; + + *oap_msg = empty_oap_message; + + /* message type */ + rc = gprs_shift_v_fixed(&data, &data_len, 1, &value); + if (rc < 0) + return -GMM_CAUSE_INV_MAND_INFO; + oap_msg->message_type = gprs_decode_big_endian(value, 1); + + /* specific parts */ + while (data_len > 0) { + enum gprs_oap_iei iei; + + rc = gprs_shift_tlv(&data, &data_len, &tag, &value, &value_len); + if (rc < 0) + return -GMM_CAUSE_PROTO_ERR_UNSPEC; + + iei = tag; + + switch (iei) { + case GPRS_OAP_SGSN_ID_IE: + if (value_len != 2) { + LOGP(DGPRS, LOGL_NOTICE, + "OAP IE type SGSN Id (%d) should be 2 octets, but has %d\n", + (int)iei, (int)value_len); + return -GMM_CAUSE_PROTO_ERR_UNSPEC; + } + + oap_msg->sgsn_id = gprs_decode_big_endian(value, value_len); + + if (oap_msg->sgsn_id == 0) { + LOGP(DGPRS, LOGL_NOTICE, + "OAP IE type SGSN Id (%d): SGSN Id must be nonzero.\n", + (int)iei); + return -GMM_CAUSE_PROTO_ERR_UNSPEC; + } + break; + + case GPRS_OAP_AUTN_IE: + if (value_len != sizeof(oap_msg->autn)) { + LOGP(DGPRS, LOGL_NOTICE, + "OAP IE type AUTN (%d) should be %d octets, but has %d\n", + (int)iei, (int)sizeof(oap_msg->autn), (int)value_len); + return -GMM_CAUSE_PROTO_ERR_UNSPEC; + } + memcpy(oap_msg->autn, value, value_len); + oap_msg->autn_present = value_len; + break; + + case GPRS_OAP_RAND_IE: + if (value_len != sizeof(oap_msg->rand)) { + LOGP(DGPRS, LOGL_NOTICE, + "OAP IE type RAND (%d) should be %d octets, but has %d\n", + (int)iei, (int)sizeof(oap_msg->rand), (int)value_len); + return -GMM_CAUSE_PROTO_ERR_UNSPEC; + } + memcpy(oap_msg->rand, value, value_len); + oap_msg->rand_present = value_len; + break; + + case GPRS_OAP_SRES_IE: + if (value_len != sizeof(oap_msg->sres)) { + LOGP(DGPRS, LOGL_NOTICE, + "OAP IE type SRES (%d) should be %d octets, but has %d\n", + (int)iei, (int)sizeof(oap_msg->sres), (int)value_len); + return -GMM_CAUSE_PROTO_ERR_UNSPEC; + } + memcpy(oap_msg->sres, value, value_len); + oap_msg->sres_present = value_len; + break; + + case GPRS_OAP_KC_IE: + if (value_len != sizeof(oap_msg->kc)) { + LOGP(DGPRS, LOGL_NOTICE, + "OAP IE type Kc (%d) should be %d octets, but has %d\n", + (int)iei, (int)sizeof(oap_msg->kc), (int)value_len); + return -GMM_CAUSE_PROTO_ERR_UNSPEC; + } + memcpy(oap_msg->kc, value, value_len); + oap_msg->kc_present = value_len; + break; + + case GPRS_OAP_CAUSE_IE: + if (value_len > 1) { + LOGP(DGPRS, LOGL_ERROR, + "OAP cause may not exceed one octet, is %d", (int)value_len); + return -GMM_CAUSE_PROTO_ERR_UNSPEC; + } + oap_msg->cause = *value; + break; + + default: + LOGP(DGPRS, LOGL_NOTICE, + "OAP IE type %d unknown\n", iei); + continue; + } + } + + return 0; +} + +void gprs_oap_encode(struct msgb *msg, const struct gprs_oap_message *oap_msg) +{ + uint8_t u8; + + /* generic part */ + OSMO_ASSERT(oap_msg->message_type); + msgb_v_put(msg, oap_msg->message_type); + + /* specific parts */ + if ((u8 = oap_msg->cause)) + msgb_tlv_put(msg, GPRS_OAP_CAUSE_IE, sizeof(u8), &u8); + + if (oap_msg->sgsn_id > 0) + msgb_tlv_put(msg, GPRS_OAP_SGSN_ID_IE, sizeof(oap_msg->sgsn_id), + gprs_encode_big_endian(oap_msg->sgsn_id, sizeof(oap_msg->sgsn_id))); + + if (oap_msg->autn_present) + msgb_tlv_put(msg, GPRS_OAP_AUTN_IE, sizeof(oap_msg->autn), oap_msg->autn); + + if (oap_msg->rand_present) + msgb_tlv_put(msg, GPRS_OAP_RAND_IE, sizeof(oap_msg->rand), oap_msg->rand); + + if (oap_msg->sres_present) + msgb_tlv_put(msg, GPRS_OAP_SRES_IE, sizeof(oap_msg->sres), oap_msg->sres); + + if (oap_msg->kc_present) + msgb_tlv_put(msg, GPRS_OAP_KC_IE, sizeof(oap_msg->kc), oap_msg->kc); +} + + diff --git a/openbsc/src/gprs/gprs_subscriber.c b/openbsc/src/gprs/gprs_subscriber.c index 0a3fe19..3d76d19 100644 --- a/openbsc/src/gprs/gprs_subscriber.c +++ b/openbsc/src/gprs/gprs_subscriber.c @@ -21,7 +21,7 @@ */ #include -#include +#include #include #include @@ -44,45 +44,12 @@ extern void *tall_bsc_ctx; -static int gsup_read_cb(struct gprs_gsup_client *gsupc, struct msgb *msg); - /* TODO: Some functions are specific to the SGSN, but this file is more general * (it has gprs_* name). Either move these functions elsewhere, split them and * move a part, or replace the gprs_ prefix by sgsn_. The applies to - * gprs_subscr_init, gsup_read_cb, and gprs_subscr_tx_gsup_message. + * gprs_subscr_tx_gsup_message. */ -int gprs_subscr_init(struct sgsn_instance *sgi) -{ - const char *addr_str; - - if (!sgi->cfg.gsup_server_addr.sin_addr.s_addr) - return 0; - - addr_str = inet_ntoa(sgi->cfg.gsup_server_addr.sin_addr); - - sgi->gsup_client = gprs_gsup_client_create( - addr_str, sgi->cfg.gsup_server_port, - &gsup_read_cb); - - if (!sgi->gsup_client) - return -1; - - return 1; -} - -static int gsup_read_cb(struct gprs_gsup_client *gsupc, struct msgb *msg) -{ - int rc; - - rc = gprs_subscr_rx_gsup_message(msg); - msgb_free(msg); - if (rc < 0) - return -1; - - return rc; -} - int gprs_subscr_purge(struct gsm_subscriber *subscr); static struct sgsn_subscriber_data *sgsn_subscriber_data_alloc(void *ctx) @@ -159,7 +126,7 @@ void gprs_subscr_cancel(struct gsm_subscriber *subscr) static int gprs_subscr_tx_gsup_message(struct gsm_subscriber *subscr, struct gprs_gsup_message *gsup_msg) { - struct msgb *msg = gprs_gsup_msgb_alloc(); + struct msgb *msg = ipa_client_msgb_alloc(); if (strlen(gsup_msg->imsi) == 0 && subscr) strncpy(gsup_msg->imsi, subscr->imsi, sizeof(gsup_msg->imsi) - 1); @@ -169,12 +136,12 @@ static int gprs_subscr_tx_gsup_message(struct gsm_subscriber *subscr, LOGGSUBSCRP(LOGL_INFO, subscr, "Sending GSUP, will send: %s\n", msgb_hexdump(msg)); - if (!sgsn->gsup_client) { + if (!sgsn->gprs_ipa_client) { msgb_free(msg); return -ENOTSUP; } - return gprs_gsup_client_send(sgsn->gsup_client, msg); + return gprs_ipa_client_send_gsup(sgsn->gprs_ipa_client, msg); } static int gprs_subscr_tx_gsup_error_reply(struct gsm_subscriber *subscr, diff --git a/openbsc/src/gprs/gprs_utils.c b/openbsc/src/gprs/gprs_utils.c index 2293f02..475a740 100644 --- a/openbsc/src/gprs/gprs_utils.c +++ b/openbsc/src/gprs/gprs_utils.c @@ -397,3 +397,42 @@ fail: return -1; } +uint64_t gprs_decode_big_endian(const uint8_t *data, size_t data_len) +{ + uint64_t value = 0; + + while (data_len > 0) { + value = (value << 8) + *data; + data += 1; + data_len -= 1; + } + + return value; +} + +uint8_t *gprs_encode_big_endian(uint64_t value, size_t data_len) +{ + static uint8_t buf[sizeof(uint64_t)]; + int idx; + + OSMO_ASSERT(data_len <= ARRAY_SIZE(buf)); + + for (idx = data_len - 1; idx >= 0; idx--) { + buf[idx] = (uint8_t)value; + value = value >> 8; + } + + return buf; +} + +/* Wishful thinking to generate a constant time compare */ +int gprs_constant_time_cmp(const uint8_t *exp, const uint8_t *rel, const int count) +{ + int x = 0, i; + + for (i = 0; i < count; ++i) + x |= exp[i] ^ rel[i]; + + return x != 0; +} + diff --git a/openbsc/src/gprs/ipa_client.c b/openbsc/src/gprs/ipa_client.c index bec33c4..9d02b44 100644 --- a/openbsc/src/gprs/ipa_client.c +++ b/openbsc/src/gprs/ipa_client.c @@ -1,9 +1,9 @@ -/* GPRS Subscriber Update Protocol client */ +/* Osmocom Authentication Protocol client */ -/* (C) 2014 by Sysmocom s.f.m.c. GmbH +/* (C) 2015 by Sysmocom s.f.m.c. GmbH * All Rights Reserved * - * Author: Jacob Erlbeck + * Authors: Jakob Erlbeck, Neels Hofmeyr * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by @@ -33,99 +33,102 @@ extern void *tall_bsc_ctx; -static void start_test_procedure(struct gprs_gsup_client *gsupc); +static void start_test_procedure(struct ipa_client *ipac); -static void gsup_client_send_ping(struct gprs_gsup_client *gsupc) +static void ipa_client_send_ping(struct ipa_client *ipac) { - struct msgb *msg = gprs_gsup_msgb_alloc(); + struct msgb *msg = ipa_client_msgb_alloc(); msg->l2h = msgb_put(msg, 1); msg->l2h[0] = IPAC_MSGT_PING; ipa_msg_push_header(msg, IPAC_PROTO_IPACCESS); - ipa_client_conn_send(gsupc->link, msg); + ipa_client_conn_send(ipac->link, msg); } -static int gsup_client_connect(struct gprs_gsup_client *gsupc) +static int ipa_client_connect(struct ipa_client *ipac) { int rc; - if (gsupc->is_connected) + if (ipac->is_connected) return 0; - if (osmo_timer_pending(&gsupc->connect_timer)) { + if (osmo_timer_pending(&ipac->connect_timer)) { LOGP(DLINP, LOGL_DEBUG, - "GSUP connect: connect timer already running\n"); - osmo_timer_del(&gsupc->connect_timer); + "IPA connect: connect timer already running\n"); + osmo_timer_del(&ipac->connect_timer); } - if (osmo_timer_pending(&gsupc->ping_timer)) { + if (osmo_timer_pending(&ipac->ping_timer)) { LOGP(DLINP, LOGL_DEBUG, - "GSUP connect: ping timer already running\n"); - osmo_timer_del(&gsupc->ping_timer); + "IPA connect: ping timer already running\n"); + osmo_timer_del(&ipac->ping_timer); } - if (ipa_client_conn_clear_queue(gsupc->link) > 0) - LOGP(DLINP, LOGL_DEBUG, "GSUP connect: discarded stored messages\n"); + if (ipa_client_conn_clear_queue(ipac->link) > 0) + LOGP(DLINP, LOGL_DEBUG, "IPA connect: discarded stored messages\n"); - rc = ipa_client_conn_open(gsupc->link); + rc = ipa_client_conn_open(ipac->link); if (rc >= 0) { - LOGP(DGPRS, LOGL_INFO, "GSUP connecting to %s:%d\n", - gsupc->link->addr, gsupc->link->port); + LOGP(DGPRS, LOGL_INFO, "IPA connecting to %s:%d\n", + ipac->link->addr, ipac->link->port); return 0; } - LOGP(DGPRS, LOGL_INFO, "GSUP failed to connect to %s:%d: %s\n", - gsupc->link->addr, gsupc->link->port, strerror(-rc)); + LOGP(DGPRS, LOGL_INFO, "IPA failed to connect to %s:%d: %s\n", + ipac->link->addr, ipac->link->port, strerror(-rc)); if (rc == -EBADF || rc == -ENOTSOCK || rc == -EAFNOSUPPORT || rc == -EINVAL) return rc; - osmo_timer_schedule(&gsupc->connect_timer, GPRS_GSUP_RECONNECT_INTERVAL, 0); + osmo_timer_schedule(&ipac->connect_timer, IPA_CLIENT_RECONNECT_INTERVAL, 0); - LOGP(DGPRS, LOGL_INFO, "Scheduled timer to retry GSUP connect to %s:%d\n", - gsupc->link->addr, gsupc->link->port); + LOGP(DGPRS, LOGL_INFO, "Scheduled timer to retry IPA connect to %s:%d\n", + ipac->link->addr, ipac->link->port); return 0; } -static void connect_timer_cb(void *gsupc_) +static void connect_timer_cb(void *ipac_) { - struct gprs_gsup_client *gsupc = gsupc_; + struct ipa_client *ipac = ipac_; - if (gsupc->is_connected) + if (ipac->is_connected) return; - gsup_client_connect(gsupc); + ipa_client_connect(ipac); } -static void gsup_client_updown_cb(struct ipa_client_conn *link, int up) +static void ipa_client_updown_cb(struct ipa_client_conn *link, int up) { - struct gprs_gsup_client *gsupc = link->data; + struct ipa_client *ipac = link->data; - LOGP(DGPRS, LOGL_INFO, "GSUP link to %s:%d %s\n", - link->addr, link->port, up ? "UP" : "DOWN"); + LOGP(DGPRS, LOGL_INFO, "IPA link to %s:%d %s\n", + link->addr, link->port, up ? "UP" : "DOWN"); - gsupc->is_connected = up; + ipac->is_connected = up; if (up) { - start_test_procedure(gsupc); + start_test_procedure(ipac); - osmo_timer_del(&gsupc->connect_timer); + osmo_timer_del(&ipac->connect_timer); } else { - osmo_timer_del(&gsupc->ping_timer); + osmo_timer_del(&ipac->ping_timer); - osmo_timer_schedule(&gsupc->connect_timer, - GPRS_GSUP_RECONNECT_INTERVAL, 0); + osmo_timer_schedule(&ipac->connect_timer, + IPA_CLIENT_RECONNECT_INTERVAL, 0); } + + if (ipac->updown_cb != NULL) + ipac->updown_cb(ipac, up); } -static int gsup_client_read_cb(struct ipa_client_conn *link, struct msgb *msg) +static int ipa_client_read_cb(struct ipa_client_conn *link, struct msgb *msg) { struct ipaccess_head *hh = (struct ipaccess_head *) msg->data; struct ipaccess_head_ext *he = (struct ipaccess_head_ext *) msgb_l2(msg); - struct gprs_gsup_client *gsupc = (struct gprs_gsup_client *)link->data; + struct ipa_client *ipac = (struct ipa_client *)link->data; int rc; static struct ipaccess_unit ipa_dev = { .unit_name = "SGSN" @@ -137,10 +140,10 @@ static int gsup_client_read_cb(struct ipa_client_conn *link, struct msgb *msg) if (rc < 0) { LOGP(DGPRS, LOGL_NOTICE, - "GSUP received an invalid IPA/CCM message from %s:%d\n", + "received an invalid IPA/CCM message from %s:%d\n", link->addr, link->port); /* Link has been closed */ - gsupc->is_connected = 0; + ipac->is_connected = 0; msgb_free(msg); return -1; } @@ -149,140 +152,154 @@ static int gsup_client_read_cb(struct ipa_client_conn *link, struct msgb *msg) uint8_t msg_type = *(msg->l2h); /* CCM message */ if (msg_type == IPAC_MSGT_PONG) { - LOGP(DGPRS, LOGL_DEBUG, "GSUP receiving PONG\n"); - gsupc->got_ipa_pong = 1; + LOGP(DGPRS, LOGL_DEBUG, "IPA receiving PONG\n"); + ipac->got_ipa_pong = 1; } msgb_free(msg); return 0; } - if (hh->proto != IPAC_PROTO_OSMO) - goto invalid; - - if (!he || msgb_l2len(msg) < sizeof(*he) || - he->proto != IPAC_PROTO_EXT_GSUP) + if (!he || msgb_l2len(msg) < sizeof(*he)) goto invalid; msg->l2h = &he->data[0]; - OSMO_ASSERT(gsupc->read_cb != NULL); - gsupc->read_cb(gsupc, msg); + OSMO_ASSERT(ipac->read_cb != NULL); + ipac->read_cb(ipac, hh->proto, he->proto, msg); /* Not freeing msg here, because that must be done by the read_cb. */ return 0; invalid: LOGP(DGPRS, LOGL_NOTICE, - "GSUP received an invalid IPA message from %s:%d, size = %d\n", + "received an invalid IPA message from %s:%d, size = %d\n", link->addr, link->port, msgb_length(msg)); msgb_free(msg); return -1; } -static void ping_timer_cb(void *gsupc_) +static void ping_timer_cb(void *ipac_) { - struct gprs_gsup_client *gsupc = gsupc_; + struct ipa_client *ipac = ipac_; - LOGP(DGPRS, LOGL_INFO, "GSUP ping callback (%s, %s PONG)\n", - gsupc->is_connected ? "connected" : "not connected", - gsupc->got_ipa_pong ? "got" : "didn't get"); + LOGP(DGPRS, LOGL_INFO, "IPA ping callback (%s, %s PONG)\n", + ipac->is_connected ? "connected" : "not connected", + ipac->got_ipa_pong ? "got" : "didn't get"); - if (gsupc->got_ipa_pong) { - start_test_procedure(gsupc); + if (ipac->got_ipa_pong) { + start_test_procedure(ipac); return; } - LOGP(DGPRS, LOGL_NOTICE, "GSUP ping timed out, reconnecting\n"); - ipa_client_conn_close(gsupc->link); - gsupc->is_connected = 0; + LOGP(DGPRS, LOGL_NOTICE, "IPA ping timed out, reconnecting\n"); + ipa_client_conn_close(ipac->link); + ipac->is_connected = 0; - gsup_client_connect(gsupc); + ipa_client_connect(ipac); } -static void start_test_procedure(struct gprs_gsup_client *gsupc) +static void start_test_procedure(struct ipa_client *ipac) { - gsupc->ping_timer.data = gsupc; - gsupc->ping_timer.cb = &ping_timer_cb; + ipac->ping_timer.data = ipac; + ipac->ping_timer.cb = &ping_timer_cb; - gsupc->got_ipa_pong = 0; - osmo_timer_schedule(&gsupc->ping_timer, GPRS_GSUP_PING_INTERVAL, 0); - LOGP(DGPRS, LOGL_DEBUG, "GSUP sending PING\n"); - gsup_client_send_ping(gsupc); + ipac->got_ipa_pong = 0; + osmo_timer_schedule(&ipac->ping_timer, IPA_CLIENT_PING_INTERVAL, 0); + LOGP(DGPRS, LOGL_DEBUG, "IPA sending PING\n"); + ipa_client_send_ping(ipac); } -struct gprs_gsup_client *gprs_gsup_client_create(const char *ip_addr, - unsigned int tcp_port, - gprs_gsup_read_cb_t read_cb) +struct ipa_client *ipa_client_create(const char *ip_addr, + unsigned int tcp_port, + ipa_client_updown_cb_t updown_cb, + ipa_client_read_cb_t read_cb, + void *data) { - struct gprs_gsup_client *gsupc; + struct ipa_client *ipac; int rc; - gsupc = talloc_zero(tall_bsc_ctx, struct gprs_gsup_client); - OSMO_ASSERT(gsupc); - - gsupc->link = ipa_client_conn_create(gsupc, - /* no e1inp */ NULL, - 0, - ip_addr, tcp_port, - gsup_client_updown_cb, - gsup_client_read_cb, - /* default write_cb */ NULL, - gsupc); - if (!gsupc->link) + ipac = talloc_zero(tall_bsc_ctx, struct ipa_client); + OSMO_ASSERT(ipac); + + ipac->updown_cb = updown_cb; + ipac->read_cb = read_cb; + ipac->data = data; + + ipac->link = ipa_client_conn_create(ipac, + /* no e1inp */ NULL, + 0, + ip_addr, tcp_port, + ipa_client_updown_cb, + ipa_client_read_cb, + /* default write_cb */ NULL, + ipac); + if (!ipac->link) goto failed; - gsupc->connect_timer.data = gsupc; - gsupc->connect_timer.cb = &connect_timer_cb; + ipac->connect_timer.data = ipac; + ipac->connect_timer.cb = &connect_timer_cb; - rc = gsup_client_connect(gsupc); + rc = ipa_client_connect(ipac); if (rc < 0) goto failed; - gsupc->read_cb = read_cb; + ipac->read_cb = read_cb; - return gsupc; + return ipac; failed: - gprs_gsup_client_destroy(gsupc); + ipa_client_destroy(ipac); return NULL; } -void gprs_gsup_client_destroy(struct gprs_gsup_client *gsupc) +void ipa_client_destroy(struct ipa_client *ipac) { - osmo_timer_del(&gsupc->connect_timer); - osmo_timer_del(&gsupc->ping_timer); + osmo_timer_del(&ipac->connect_timer); + osmo_timer_del(&ipac->ping_timer); - if (gsupc->link) { - ipa_client_conn_close(gsupc->link); - ipa_client_conn_destroy(gsupc->link); - gsupc->link = NULL; + if (ipac->link) { + ipa_client_conn_close(ipac->link); + ipa_client_conn_destroy(ipac->link); + ipac->link = NULL; } - talloc_free(gsupc); + talloc_free(ipac); } -int gprs_gsup_client_send(struct gprs_gsup_client *gsupc, struct msgb *msg) +int ipa_client_send(struct ipa_client *ipac, uint8_t proto, uint8_t proto_ext, + struct msgb *msg) { - if (!gsupc) { + OSMO_ASSERT(msg); + + if (!ipac) { msgb_free(msg); return -ENOTCONN; } - if (!gsupc->is_connected) { + if (!ipac->is_connected) { msgb_free(msg); return -EAGAIN; } - ipa_prepend_header_ext(msg, IPAC_PROTO_EXT_GSUP); - ipa_msg_push_header(msg, IPAC_PROTO_OSMO); - ipa_client_conn_send(gsupc->link, msg); + // l2h is not sent over the wire, but for the test suite it makes sense + // to make l2h point at the IPA message payload. + unsigned char *l2h = msg->data; + + ipa_prepend_header_ext(msg, proto); + ipa_msg_push_header(msg, proto_ext); + + msg->l2h = l2h; + + ipa_client_conn_send(ipac->link, msg); return 0; } -struct msgb *gprs_gsup_msgb_alloc(void) +struct msgb *ipa_client_msgb_alloc(void) { return msgb_alloc_headroom(4000, 64, __func__); } + + diff --git a/openbsc/src/gprs/sgsn_main.c b/openbsc/src/gprs/sgsn_main.c index 8cb7499..882b6a3 100644 --- a/openbsc/src/gprs/sgsn_main.c +++ b/openbsc/src/gprs/sgsn_main.c @@ -51,6 +51,7 @@ #include #include #include +#include #include #include @@ -359,9 +360,9 @@ int main(int argc, char **argv) exit(2); } - rc = gprs_subscr_init(&sgsn_inst); + rc = gprs_ipa_client_init(&sgsn_inst); if (rc < 0) { - LOGP(DGPRS, LOGL_FATAL, "Cannot set up subscriber management\n"); + LOGP(DGPRS, LOGL_FATAL, "Cannot establish IPA connection\n"); exit(2); } diff --git a/openbsc/src/gprs/sgsn_vty.c b/openbsc/src/gprs/sgsn_vty.c index 00a930f..75974c7 100644 --- a/openbsc/src/gprs/sgsn_vty.c +++ b/openbsc/src/gprs/sgsn_vty.c @@ -34,13 +34,14 @@ #include #include #include -#include #include #include #include #include +#include +#include #include @@ -208,12 +209,12 @@ static int config_write_sgsn(struct vty *vty) vty_out(vty, " auth-policy %s%s", get_value_string(sgsn_auth_pol_strs, g_cfg->auth_policy), VTY_NEWLINE); - if (g_cfg->gsup_server_addr.sin_addr.s_addr) - vty_out(vty, " gsup remote-ip %s%s", - inet_ntoa(g_cfg->gsup_server_addr.sin_addr), VTY_NEWLINE); - if (g_cfg->gsup_server_port) - vty_out(vty, " gsup remote-port %d%s", - g_cfg->gsup_server_port, VTY_NEWLINE); + if (g_cfg->ipa_server_addr.sin_addr.s_addr) + vty_out(vty, " ipa remote-ip %s%s", + inet_ntoa(g_cfg->ipa_server_addr.sin_addr), VTY_NEWLINE); + if (g_cfg->ipa_server_port) + vty_out(vty, " ipa remote-port %d%s", + g_cfg->ipa_server_port, VTY_NEWLINE); llist_for_each_entry(acl, &g_cfg->imsi_acl, list) vty_out(vty, " imsi-acl add %s%s", acl->imsi, VTY_NEWLINE); @@ -434,12 +435,12 @@ static void vty_dump_mmctx(struct vty *vty, const char *pfx, DEFUN(show_sgsn, show_sgsn_cmd, "show sgsn", SHOW_STR "Display information about the SGSN") { - if (sgsn->gsup_client) { - struct ipa_client_conn *link = sgsn->gsup_client->link; + if (sgsn->gprs_ipa_client) { + struct ipa_client *ipac = sgsn->gprs_ipa_client->ipac; vty_out(vty, - " Remote authorization: %sconnected to %s:%d via GSUP%s", - sgsn->gsup_client->is_connected ? "" : "not ", - link->addr, link->port, + " Remote authorization: %sconnected to %s:%d via IPA%s", + ipac->is_connected ? "" : "not ", + ipac->link->addr, ipac->link->port, VTY_NEWLINE); } /* FIXME: statistics */ @@ -873,24 +874,24 @@ DEFUN(update_subscr_update_auth_info, update_subscr_update_auth_info_cmd, return CMD_SUCCESS; } -DEFUN(cfg_gsup_remote_ip, cfg_gsup_remote_ip_cmd, - "gsup remote-ip A.B.C.D", - "GSUP Parameters\n" - "Set the IP address of the remote GSUP server\n" +DEFUN(cfg_ipa_remote_ip, cfg_ipa_remote_ip_cmd, + "ipa remote-ip A.B.C.D", + "IPA Parameters\n" + "Set the IP address of the remote IPA (GSUP+OAP) server\n" "IPv4 Address\n") { - inet_aton(argv[0], &g_cfg->gsup_server_addr.sin_addr); + inet_aton(argv[0], &g_cfg->ipa_server_addr.sin_addr); return CMD_SUCCESS; } -DEFUN(cfg_gsup_remote_port, cfg_gsup_remote_port_cmd, - "gsup remote-port <0-65535>", - "GSUP Parameters\n" - "Set the TCP port of the remote GSUP server\n" +DEFUN(cfg_ipa_remote_port, cfg_ipa_remote_port_cmd, + "ipa remote-port <0-65535>", + "IPA Parameters\n" + "Set the TCP port of the remote IPA (GSUP+OAP) server\n" "Remote TCP port\n") { - g_cfg->gsup_server_port = atoi(argv[0]); + g_cfg->ipa_server_port = atoi(argv[0]); return CMD_SUCCESS; } @@ -967,8 +968,8 @@ int sgsn_vty_init(void) install_element(SGSN_NODE, &cfg_ggsn_gtp_version_cmd); install_element(SGSN_NODE, &cfg_imsi_acl_cmd); install_element(SGSN_NODE, &cfg_auth_policy_cmd); - install_element(SGSN_NODE, &cfg_gsup_remote_ip_cmd); - install_element(SGSN_NODE, &cfg_gsup_remote_port_cmd); + install_element(SGSN_NODE, &cfg_ipa_remote_ip_cmd); + install_element(SGSN_NODE, &cfg_ipa_remote_port_cmd); install_element(SGSN_NODE, &cfg_apn_ggsn_cmd); install_element(SGSN_NODE, &cfg_apn_imsi_ggsn_cmd); install_element(SGSN_NODE, &cfg_apn_name_cmd); diff --git a/openbsc/src/osmo-bsc_nat/bsc_nat.c b/openbsc/src/osmo-bsc_nat/bsc_nat.c index 1fc262d..42d7c30 100644 --- a/openbsc/src/osmo-bsc_nat/bsc_nat.c +++ b/openbsc/src/osmo-bsc_nat/bsc_nat.c @@ -47,6 +47,7 @@ #include #include #include +#include #include #include @@ -987,17 +988,6 @@ static void ipaccess_close_bsc(void *data) bsc_close_connection(conn); } -/* Wishful thinking to generate a constant time compare */ -static int constant_time_cmp(const uint8_t *exp, const uint8_t *rel, const int count) -{ - int x = 0, i; - - for (i = 0; i < count; ++i) - x |= exp[i] ^ rel[i]; - - return x != 0; -} - static int verify_key(struct bsc_connection *conn, struct bsc_config *conf, const uint8_t *key, const int keylen) { struct osmo_auth_vector vec; @@ -1024,11 +1014,11 @@ static int verify_key(struct bsc_connection *conn, struct bsc_config *conf, cons if (vec.res_len != 8) { LOGP(DNAT, LOGL_ERROR, "Res length is wrong: %d for bsc nr %d\n", - keylen, conf->nr); + (int)vec.res_len, conf->nr); return 0; } - return constant_time_cmp(vec.res, key, 8) == 0; + return gprs_constant_time_cmp(vec.res, key, 8) == 0; } static void ipaccess_auth_bsc(struct tlv_parsed *tvp, struct bsc_connection *bsc) diff --git a/openbsc/tests/sgsn/Makefile.am b/openbsc/tests/sgsn/Makefile.am index ea29fce..3b45b3f 100644 --- a/openbsc/tests/sgsn/Makefile.am +++ b/openbsc/tests/sgsn/Makefile.am @@ -10,7 +10,8 @@ sgsn_test_LDFLAGS = \ -Wl,--wrap=sgsn_update_subscriber_data \ -Wl,--wrap=gprs_subscr_request_update_location \ -Wl,--wrap=gprs_subscr_request_auth_info \ - -Wl,--wrap=gprs_gsup_client_send + -Wl,--wrap=gprs_ipa_client_send_gsup \ + -Wl,--wrap=ipa_client_conn_send sgsn_test_LDADD = \ $(top_builddir)/src/gprs/gprs_llc_parse.o \ @@ -24,7 +25,10 @@ sgsn_test_LDADD = \ $(top_builddir)/src/gprs/sgsn_auth.o \ $(top_builddir)/src/gprs/sgsn_ares.o \ $(top_builddir)/src/gprs/gprs_gsup_messages.o \ + $(top_builddir)/src/gprs/gprs_oap_messages.o \ + $(top_builddir)/src/gprs/gprs_oap.o \ $(top_builddir)/src/gprs/ipa_client.o \ + $(top_builddir)/src/gprs/gprs_ipa_client.o \ $(top_builddir)/src/gprs/gprs_utils.o \ $(top_builddir)/src/gprs/gprs_subscriber.o \ $(top_builddir)/src/gprs/gsm_04_08_gprs.o \ diff --git a/openbsc/tests/sgsn/sgsn_test.c b/openbsc/tests/sgsn/sgsn_test.c index 251772e..84791d5 100644 --- a/openbsc/tests/sgsn/sgsn_test.c +++ b/openbsc/tests/sgsn/sgsn_test.c @@ -24,10 +24,16 @@ #include #include #include -#include -#include #include +#include +#include +#include +#include +#include +#include +#include + #include #include @@ -89,14 +95,24 @@ int __wrap_gprs_subscr_request_auth_info(struct sgsn_mm_ctx *mmctx) { return (*subscr_request_auth_info_cb)(mmctx); }; -/* override, requires '-Wl,--wrap=gprs_gsup_client_send' */ -int __real_gprs_gsup_client_send(struct gprs_gsup_client *gsupc, struct msgb *msg); -int (*gprs_gsup_client_send_cb)(struct gprs_gsup_client *gsupc, struct msgb *msg) = - &__real_gprs_gsup_client_send; +/* override, requires '-Wl,--wrap=gprs_ipa_client_send_gsup' */ +int __real_gprs_ipa_client_send_gsup(struct gprs_ipa_client *gipac, struct msgb *msg); +int (*gprs_ipa_client_send_gsup_cb)(struct gprs_ipa_client *gipac, struct msgb *msg) = + &__real_gprs_ipa_client_send_gsup; -int __wrap_gprs_gsup_client_send(struct gprs_gsup_client *gsupc, struct msgb *msg) +int __wrap_gprs_ipa_client_send_gsup(struct gprs_ipa_client *gipac, struct msgb *msg) { - return (*gprs_gsup_client_send_cb)(gsupc, msg); + return (*gprs_ipa_client_send_gsup_cb)(gipac, msg); +}; + +/* override, requires '-Wl,--wrap=ipa_client_conn_send' */ +void __real_ipa_client_conn_send(struct ipa_client_conn *link, struct msgb *msg); +void (*ipa_client_conn_send_cb)(struct ipa_client_conn *link, struct msgb *msg) = + &__real_ipa_client_conn_send; + +void __wrap_ipa_client_conn_send(struct ipa_client_conn *link, struct msgb *msg) +{ + return (*ipa_client_conn_send_cb)(link, msg); }; static int count(struct llist_head *head) @@ -651,7 +667,7 @@ static void test_subscriber_gsup(void) update_subscriber_data_cb = __real_sgsn_update_subscriber_data; } -int my_gprs_gsup_client_send_dummy(struct gprs_gsup_client *gsupc, struct msgb *msg) +int my_gprs_ipa_client_send_gsup_dummy(struct gprs_ipa_client *gipac, struct msgb *msg) { msgb_free(msg); return 0; @@ -1201,7 +1217,7 @@ static void test_gmm_attach_subscr_gsup_auth(int retry) auth_info_skip = 0; } -int my_gprs_gsup_client_send(struct gprs_gsup_client *gsupc, struct msgb *msg) +int my_gprs_ipa_client_send_gsup(struct gprs_ipa_client *gipac, struct msgb *msg) { struct gprs_gsup_message to_peer = {0}; struct gprs_gsup_message from_peer = {0}; @@ -1243,7 +1259,7 @@ int my_gprs_gsup_client_send(struct gprs_gsup_client *gsupc, struct msgb *msg) return 0; } - reply_msg = gprs_gsup_msgb_alloc(); + reply_msg = ipa_client_msgb_alloc(); reply_msg->l2h = reply_msg->data; gprs_gsup_encode(reply_msg, &from_peer); gprs_subscr_rx_gsup_message(reply_msg); @@ -1258,9 +1274,14 @@ static void test_gmm_attach_subscr_real_gsup_auth(int retry) struct gsm_subscriber *subscr; sgsn_inst.cfg.auth_policy = SGSN_AUTH_POLICY_REMOTE; - gprs_gsup_client_send_cb = my_gprs_gsup_client_send; + gprs_ipa_client_send_gsup_cb = my_gprs_ipa_client_send_gsup; - sgsn->gsup_client = talloc_zero(tall_bsc_ctx, struct gprs_gsup_client); + /* The sgsn->gprs_ipa_client will not have been initialized, because + cfg.ipa_server_addr is unset. Allocate empty structs to use them in + these tests. */ + OSMO_ASSERT(sgsn->gprs_ipa_client == NULL); + sgsn->gprs_ipa_client = talloc_zero(tall_bsc_ctx, struct gprs_ipa_client); + sgsn->gprs_ipa_client->ipac = talloc_zero(tall_bsc_ctx, struct ipa_client); if (retry) { upd_loc_skip = 3; @@ -1275,11 +1296,13 @@ static void test_gmm_attach_subscr_real_gsup_auth(int retry) assert_no_subscrs(); sgsn->cfg.auth_policy = saved_auth_policy; - gprs_gsup_client_send_cb = __real_gprs_gsup_client_send; + gprs_ipa_client_send_gsup_cb = __real_gprs_ipa_client_send_gsup; upd_loc_skip = 0; auth_info_skip = 0; - talloc_free(sgsn->gsup_client); - sgsn->gsup_client = NULL; + + talloc_free(sgsn->gprs_ipa_client->ipac); + talloc_free(sgsn->gprs_ipa_client); + sgsn->gprs_ipa_client = NULL; } /* @@ -1842,7 +1865,7 @@ static void test_ggsn_selection(void) printf("Testing GGSN selection\n"); - gprs_gsup_client_send_cb = my_gprs_gsup_client_send_dummy; + gprs_ipa_client_send_gsup_cb = my_gprs_ipa_client_send_gsup_dummy; /* Check for emptiness */ OSMO_ASSERT(gprs_subscr_get_by_imsi(imsi1) == NULL); @@ -1961,9 +1984,308 @@ static void test_ggsn_selection(void) sgsn_ggsn_ctx_free(ggcs[1]); sgsn_ggsn_ctx_free(ggcs[2]); - gprs_gsup_client_send_cb = __real_gprs_gsup_client_send; + gprs_ipa_client_send_gsup_cb = __real_gprs_ipa_client_send_gsup; +} + +static void test_oap(void) +{ + printf("Testing OAP API\n - Config parsing\n"); + + // No ipa_server_addr set, so initialization should do nothing. + OSMO_ASSERT(gprs_ipa_client_init(sgsn) <= 0); + OSMO_ASSERT(sgsn->gprs_ipa_client == NULL); + + struct gprs_oap_config *config = &(sgsn->cfg.oap); + + struct gprs_oap_state _state = {0}; + struct gprs_oap_state *state = &_state; + + // verify uninitialized state at program start + OSMO_ASSERT(state->state == oap_uninitialized); + + // make sure filling with zeros means uninitialized, too + memset(state, 0, sizeof(*state)); + OSMO_ASSERT(state->state == oap_uninitialized); + + + // invalid sgsn_id and shared secret + config->sgsn_id = 0; + config->shared_secret = NULL; + OSMO_ASSERT( gprs_oap_init(config, state) == 0 ); + OSMO_ASSERT(state->state == oap_disabled); + + // reset state + memset(state, 0, sizeof(*state)); + + // only sgsn_id is invalid + config->sgsn_id = 0; + config->shared_secret = "0102030405060708090a0b0c0d0e0f10"; + OSMO_ASSERT( gprs_oap_init(config, state) == 0 ); + OSMO_ASSERT(state->state == oap_disabled); + + memset(state, 0, sizeof(*state)); + + // omitted shared_secret + config->sgsn_id = 12345; + config->shared_secret = NULL; + OSMO_ASSERT( gprs_oap_init(config, state) == 0 ); + OSMO_ASSERT(state->state == oap_disabled); + + memset(state, 0, sizeof(*state)); + + // invalid hex chars in shared_secret config + config->sgsn_id = 12345; + config->shared_secret = "non-hex"; + OSMO_ASSERT( gprs_oap_init(config, state) < 0 ); + OSMO_ASSERT(state->state == oap_config_error); + + memset(state, 0, sizeof(*state)); + + // shared secret too long (defined to be 16 octets) + config->sgsn_id = 12345; + config->shared_secret = "0102030405060708090a0b0c0d0e0f101112131415161718"; + OSMO_ASSERT( gprs_oap_init(config, state) < 0 ); + OSMO_ASSERT(state->state == oap_config_error); + + memset(state, 0, sizeof(*state)); + + // odd number of hex chars + config->sgsn_id = 12345; + config->shared_secret = "01020304050607081"; + OSMO_ASSERT( gprs_oap_init(config, state) < 0 ); + OSMO_ASSERT(state->state == oap_config_error); + + memset(state, 0, sizeof(*state)); + + // zero padding of shared secret (defined to be 16 octets) + config->sgsn_id = 12345; + config->shared_secret = "0102030405060708"; + OSMO_ASSERT( gprs_oap_init(config, state) == 0 ); + OSMO_ASSERT(state->state == oap_initialized); + OSMO_ASSERT(strcmp("01020304050607080000000000000000", + osmo_hexdump_nospc(state->shared_secret, 16)) == 0); + + memset(state, 0, sizeof(*state)); + + + + // mint configuration + config->sgsn_id = 12345; + config->shared_secret = "0102030405060708090a0b0c0d0e0f10"; + OSMO_ASSERT( gprs_oap_init(config, state) == 0 ); + OSMO_ASSERT(state->state == oap_initialized); + OSMO_ASSERT(strcmp(config->shared_secret, + osmo_hexdump_nospc(state->shared_secret, 16)) == 0); + + printf(" - AUTN failure\n"); + uint8_t rx_random[16]; + uint8_t rx_autn[16]; + + uint8_t tx_sres[4]; + uint8_t tx_kc[8]; + + osmo_hexparse("0102030405060708090a0b0c0d0e0f10", + rx_random, 16); + + // wrong autn (by one bit) + osmo_hexparse("247d1e1c7fc1000008cc536e8788b027", + rx_autn, 16); + OSMO_ASSERT(gprs_oap_evaluate_challenge(state, rx_random, rx_autn, + tx_sres, tx_kc) + == -2); + + printf(" - AUTN success\n"); + // all correct + osmo_hexparse("347d1e1c7fc1000008cc536e8788b027", + rx_autn, 16); + // a successful return value here indicates correct rx_autn + OSMO_ASSERT(gprs_oap_evaluate_challenge(state, rx_random, rx_autn, + tx_sres, tx_kc) + == 0); + OSMO_ASSERT(strcmp("ce9da581", osmo_hexdump_nospc(tx_sres, sizeof(tx_sres))) == 0); + OSMO_ASSERT(strcmp("0a8356d779b197dd", osmo_hexdump_nospc(tx_kc, sizeof(tx_kc))) == 0); + + + // refuse to evaluate in uninitialized state + state->state = oap_uninitialized; + OSMO_ASSERT(gprs_oap_evaluate_challenge(state, rx_random, rx_autn, + tx_sres, tx_kc) + == -1); + state->state = oap_disabled; + OSMO_ASSERT(gprs_oap_evaluate_challenge(state, rx_random, rx_autn, + tx_sres, tx_kc) + == -1); + state->state = oap_config_error; + OSMO_ASSERT(gprs_oap_evaluate_challenge(state, rx_random, rx_autn, + tx_sres, tx_kc) + == -1); } +static int inject_rx_oap_message(const struct gprs_oap_message *oapm) +{ + fprintf(stderr, "inject_rx_oap_message: Injecting OAP Reply: %d\n", (int)oapm->message_type); + + struct gprs_ipa_client *gipac = sgsn->gprs_ipa_client; + OSMO_ASSERT(gipac); + + struct msgb *msg; + int rc; + + msg = ipa_client_msgb_alloc(); + OSMO_ASSERT(msg != NULL); + + gprs_oap_encode(msg, oapm); + + unsigned char *l2h = msg->data; + + ipa_prepend_header_ext(msg, IPAC_PROTO_OSMO); + ipa_msg_push_header(msg, IPAC_PROTO_EXT_OAP); + + msg->l2h = l2h; + OSMO_ASSERT(msg->l2h); + + rc = gprs_oap_rx(gipac, msg); + + msgb_free(msg); + + return rc; +} + + +void my_ipa_client_conn_send(struct ipa_client_conn *link, struct msgb *msg) +{ + // Simulate the remote side, which replies to registration etc: + // decode the msgb that the sgsn sends, and feed the matching reply to + // gprs_oap_rx(), as msgb. + + uint8_t *data = msgb_l2(msg); + size_t data_len = msgb_l2len(msg); + int rc = 0; + + struct gprs_oap_message oap_msg = {0}; + + OSMO_ASSERT(data); + rc = gprs_oap_decode(data, data_len, &oap_msg); + + if (rc < 0) { + printf("my_ipa_client_conn_send: decoding OAP message fails with error '%s' (%d)\n", + get_value_string(gsm48_gmm_cause_names, -rc), -rc); + goto dealloc; + } + + fprintf(stderr, "my_ipa_client_conn_send: Caught outgoing IPA message: %d\n", (int)oap_msg.message_type); + + switch (oap_msg.message_type) { + + case GPRS_OAP_MSGT_REGISTER_REQUEST: + // reply with challenge + { + OSMO_ASSERT(oap_msg.sgsn_id == 12345); + OSMO_ASSERT(!oap_msg.rand_present); + OSMO_ASSERT(!oap_msg.autn_present); + OSMO_ASSERT(!oap_msg.sres_present); + OSMO_ASSERT(!oap_msg.kc_present); + + struct gprs_oap_message oap_reply = {0}; + oap_reply.message_type = GPRS_OAP_MSGT_CHALLENGE_REQUEST; + + osmo_hexparse("0102030405060708090a0b0c0d0e0f10", + oap_reply.rand, 16); + oap_reply.rand_present = 1; + + osmo_hexparse("347d1e1c7fc1000008cc536e8788b027", + oap_reply.autn, 16); + oap_reply.autn_present = 1; + + OSMO_ASSERT(inject_rx_oap_message(&oap_reply) >= 0); + } + + break; + + case GPRS_OAP_MSGT_CHALLENGE_RESULT: + // verify challenge reply, reply with registration ack + { + OSMO_ASSERT(!oap_msg.sgsn_id); // not present + OSMO_ASSERT(!oap_msg.rand_present); + OSMO_ASSERT(!oap_msg.autn_present); + OSMO_ASSERT(oap_msg.sres_present); + OSMO_ASSERT(oap_msg.kc_present); + + OSMO_ASSERT(strcmp("ce9da581", osmo_hexdump_nospc(oap_msg.sres, sizeof(oap_msg.sres))) == 0); + OSMO_ASSERT(strcmp("0a8356d779b197dd", osmo_hexdump_nospc(oap_msg.kc, sizeof(oap_msg.kc))) == 0); + + struct gprs_oap_message oap_reply = {0}; + oap_reply.message_type = GPRS_OAP_MSGT_REGISTER_RESULT; + + OSMO_ASSERT(inject_rx_oap_message(&oap_reply) >= 0); + } + break; + + case GPRS_OAP_MSGT_REGISTER_ERROR: + case GPRS_OAP_MSGT_REGISTER_RESULT: + case GPRS_OAP_MSGT_CHALLENGE_REQUEST: + case GPRS_OAP_MSGT_CHALLENGE_ERROR: + printf("Not handled in this test: OAP message type %d\n", (int)oap_msg.message_type); + rc = -1; + goto dealloc; + + default: + printf("Unknown OAP message type: %d\n", (int)oap_msg.message_type); + rc = -2; + goto dealloc; + } + +dealloc: + msgb_free(msg); +} + +static void test_sgsn_registration(void) +{ + printf("Testing SGSN registration\n"); + + /* The sgsn->gprs_ipa_client will not have been initialized, because + cfg.ipa_server_addr is unset. Allocate empty structs to use them in + these tests. */ + OSMO_ASSERT(sgsn->gprs_ipa_client == NULL); + sgsn->gprs_ipa_client = talloc_zero(tall_bsc_ctx, struct gprs_ipa_client); + sgsn->gprs_ipa_client->ipac = talloc_zero(tall_bsc_ctx, struct ipa_client); + OSMO_ASSERT(sgsn->gprs_ipa_client && sgsn->gprs_ipa_client->ipac); + + // simulate working connection. + ipa_client_conn_send_cb = my_ipa_client_conn_send; + sgsn->gprs_ipa_client->ipac->is_connected = 1; + + struct gprs_ipa_client *gipac = sgsn->gprs_ipa_client; + + struct gprs_oap_config *config = &sgsn->cfg.oap; + struct gprs_oap_state *state = &gipac->oap; + + // make sure of clean slate + memset(state, 0, sizeof(*state)); + + config->sgsn_id = 12345; + config->shared_secret = "0102030405060708090a0b0c0d0e0f10"; + OSMO_ASSERT(gprs_oap_init(config, state) == 0); + + OSMO_ASSERT(gprs_oap_register(gipac) == 0); + + // my_ipa_client_conn_send (wrapped) will have caught this registration + // request and sent the test reply to gprs_oap_rx, which has in turn + // sent the next response using my_ipa_client_conn_send, and again + // gprs_oap_rx has evaluated the final result, all of this before above + // gprs_oap_register() has exited. So just evaluate the results. + + OSMO_ASSERT(state->state == oap_registered); + OSMO_ASSERT(state->challenges_count == 1); + + ipa_client_conn_send_cb = __real_ipa_client_conn_send; + + talloc_free(sgsn->gprs_ipa_client->ipac); + talloc_free(sgsn->gprs_ipa_client); + sgsn->gprs_ipa_client = NULL; +} + + static struct log_info_cat gprs_categories[] = { [DMM] = { .name = "DMM", @@ -2029,7 +2351,6 @@ int main(int argc, char **argv) tall_msgb_ctx = talloc_named_const(osmo_sgsn_ctx, 0, "msgb"); sgsn_auth_init(); - gprs_subscr_init(sgsn); test_llme(); test_subscriber(); @@ -2052,6 +2373,8 @@ int main(int argc, char **argv) test_gmm_ptmsi_allocation(); test_apn_matching(); test_ggsn_selection(); + test_oap(); + test_sgsn_registration(); printf("Done\n"); talloc_report_full(osmo_sgsn_ctx, stderr); diff --git a/openbsc/tests/sgsn/sgsn_test.ok b/openbsc/tests/sgsn/sgsn_test.ok index 7913a39..0eea1dd 100644 --- a/openbsc/tests/sgsn/sgsn_test.ok +++ b/openbsc/tests/sgsn/sgsn_test.ok @@ -27,4 +27,9 @@ Testing P-TMSI allocation - Repeated RA Update Request Testing APN matching Testing GGSN selection +Testing OAP API + - Config parsing + - AUTN failure + - AUTN success +Testing SGSN registration Done -- 2.1.4 From nhofmeyr at sysmocom.de Thu Sep 24 11:44:07 2015 From: nhofmeyr at sysmocom.de (Neels Hofmeyr) Date: Thu, 24 Sep 2015 13:44:07 +0200 Subject: [PATCH 2/3] ipa, gsup: file rename to prepare for refactoring In-Reply-To: <1443095048-4593-1-git-send-email-nhofmeyr@sysmocom.de> References: <1443095048-4593-1-git-send-email-nhofmeyr@sysmocom.de> Message-ID: <1443095048-4593-2-git-send-email-nhofmeyr@sysmocom.de> Rename gprs_gsup_client.* to ipa_client.*. To ease diff reading for the upcoming commit, this commit performs a file rename only. Background: currently, GSUP is the only protocol spoken on the IPA wire. We will now add OAP, a new protocol to register the SGSN with a MAP proxy. What has been only the GSUP client will mostly become the general IPA client. Sponsored-by: On-Waves ehf --- openbsc/include/openbsc/Makefile.am | 2 +- openbsc/include/openbsc/gprs_gsup_client.h | 54 ------ openbsc/include/openbsc/ipa_client.h | 54 ++++++ openbsc/src/gprs/Makefile.am | 2 +- openbsc/src/gprs/gprs_gsup_client.c | 288 ----------------------------- openbsc/src/gprs/gprs_subscriber.c | 2 +- openbsc/src/gprs/ipa_client.c | 288 +++++++++++++++++++++++++++++ openbsc/src/gprs/sgsn_vty.c | 2 +- openbsc/tests/sgsn/Makefile.am | 2 +- openbsc/tests/sgsn/sgsn_test.c | 2 +- 10 files changed, 348 insertions(+), 348 deletions(-) delete mode 100644 openbsc/include/openbsc/gprs_gsup_client.h create mode 100644 openbsc/include/openbsc/ipa_client.h delete mode 100644 openbsc/src/gprs/gprs_gsup_client.c create mode 100644 openbsc/src/gprs/ipa_client.c diff --git a/openbsc/include/openbsc/Makefile.am b/openbsc/include/openbsc/Makefile.am index 254f43d..7bc9d95 100644 --- a/openbsc/include/openbsc/Makefile.am +++ b/openbsc/include/openbsc/Makefile.am @@ -16,7 +16,7 @@ noinst_HEADERS = abis_nm.h abis_rsl.h db.h gsm_04_08.h gsm_data.h \ arfcn_range_encode.h nat_rewrite_trie.h bsc_nat_callstats.h \ osmux.h mgcp_transcode.h gprs_utils.h \ gprs_gb_parse.h smpp.h meas_feed.h gprs_gsup_messages.h \ - gprs_gsup_client.h bsc_msg_filter.h + ipa_client.h bsc_msg_filter.h openbsc_HEADERS = gsm_04_08.h meas_rep.h bsc_api.h openbscdir = $(includedir)/openbsc diff --git a/openbsc/include/openbsc/gprs_gsup_client.h b/openbsc/include/openbsc/gprs_gsup_client.h deleted file mode 100644 index 9537db4..0000000 --- a/openbsc/include/openbsc/gprs_gsup_client.h +++ /dev/null @@ -1,54 +0,0 @@ -/* GPRS Subscriber Update Protocol client */ - -/* (C) 2014 by Sysmocom s.f.m.c. GmbH - * All Rights Reserved - * - * Author: Jacob Erlbeck - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published by - * the Free Software Foundation; either version 3 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 Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . - * - */ -#pragma once - -#include - -#define GPRS_GSUP_RECONNECT_INTERVAL 10 -#define GPRS_GSUP_PING_INTERVAL 20 - -struct msgb; -struct ipa_client_conn; -struct gprs_gsup_client; - -/* Expects message in msg->l2h */ -typedef int (*gprs_gsup_read_cb_t)(struct gprs_gsup_client *gsupc, struct msgb *msg); - -struct gprs_gsup_client { - struct ipa_client_conn *link; - gprs_gsup_read_cb_t read_cb; - void *data; - - struct osmo_timer_list ping_timer; - struct osmo_timer_list connect_timer; - int is_connected; - int got_ipa_pong; -}; - -struct gprs_gsup_client *gprs_gsup_client_create(const char *ip_addr, - unsigned int tcp_port, - gprs_gsup_read_cb_t read_cb); - -void gprs_gsup_client_destroy(struct gprs_gsup_client *gsupc); -int gprs_gsup_client_send(struct gprs_gsup_client *gsupc, struct msgb *msg); -struct msgb *gprs_gsup_msgb_alloc(void); - diff --git a/openbsc/include/openbsc/ipa_client.h b/openbsc/include/openbsc/ipa_client.h new file mode 100644 index 0000000..9537db4 --- /dev/null +++ b/openbsc/include/openbsc/ipa_client.h @@ -0,0 +1,54 @@ +/* GPRS Subscriber Update Protocol client */ + +/* (C) 2014 by Sysmocom s.f.m.c. GmbH + * All Rights Reserved + * + * Author: Jacob Erlbeck + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation; either version 3 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 Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + * + */ +#pragma once + +#include + +#define GPRS_GSUP_RECONNECT_INTERVAL 10 +#define GPRS_GSUP_PING_INTERVAL 20 + +struct msgb; +struct ipa_client_conn; +struct gprs_gsup_client; + +/* Expects message in msg->l2h */ +typedef int (*gprs_gsup_read_cb_t)(struct gprs_gsup_client *gsupc, struct msgb *msg); + +struct gprs_gsup_client { + struct ipa_client_conn *link; + gprs_gsup_read_cb_t read_cb; + void *data; + + struct osmo_timer_list ping_timer; + struct osmo_timer_list connect_timer; + int is_connected; + int got_ipa_pong; +}; + +struct gprs_gsup_client *gprs_gsup_client_create(const char *ip_addr, + unsigned int tcp_port, + gprs_gsup_read_cb_t read_cb); + +void gprs_gsup_client_destroy(struct gprs_gsup_client *gsupc); +int gprs_gsup_client_send(struct gprs_gsup_client *gsupc, struct msgb *msg); +struct msgb *gprs_gsup_msgb_alloc(void); + diff --git a/openbsc/src/gprs/Makefile.am b/openbsc/src/gprs/Makefile.am index f46a402..b9c3070 100644 --- a/openbsc/src/gprs/Makefile.am +++ b/openbsc/src/gprs/Makefile.am @@ -26,7 +26,7 @@ osmo_sgsn_SOURCES = gprs_gmm.c gprs_sgsn.c gprs_sndcp.c gprs_sndcp_vty.c \ sgsn_main.c sgsn_vty.c sgsn_libgtp.c \ gprs_llc.c gprs_llc_parse.c gprs_llc_vty.c crc24.c \ sgsn_ctrl.c sgsn_auth.c gprs_subscriber.c \ - gprs_gsup_messages.c gprs_utils.c gprs_gsup_client.c \ + gprs_gsup_messages.c gprs_utils.c ipa_client.c \ gsm_04_08_gprs.c sgsn_cdr.c sgsn_ares.c osmo_sgsn_LDADD = \ $(top_builddir)/src/libcommon/libcommon.a \ diff --git a/openbsc/src/gprs/gprs_gsup_client.c b/openbsc/src/gprs/gprs_gsup_client.c deleted file mode 100644 index 807b0c1..0000000 --- a/openbsc/src/gprs/gprs_gsup_client.c +++ /dev/null @@ -1,288 +0,0 @@ -/* GPRS Subscriber Update Protocol client */ - -/* (C) 2014 by Sysmocom s.f.m.c. GmbH - * All Rights Reserved - * - * Author: Jacob Erlbeck - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published by - * the Free Software Foundation; either version 3 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 Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . - * - */ - -#include - -#include -#include -#include - -#include - -#include -#include - -extern void *tall_bsc_ctx; - -static void start_test_procedure(struct gprs_gsup_client *gsupc); - -static void gsup_client_send_ping(struct gprs_gsup_client *gsupc) -{ - struct msgb *msg = gprs_gsup_msgb_alloc(); - - msg->l2h = msgb_put(msg, 1); - msg->l2h[0] = IPAC_MSGT_PING; - ipa_msg_push_header(msg, IPAC_PROTO_IPACCESS); - ipa_client_conn_send(gsupc->link, msg); -} - -static int gsup_client_connect(struct gprs_gsup_client *gsupc) -{ - int rc; - - if (gsupc->is_connected) - return 0; - - if (osmo_timer_pending(&gsupc->connect_timer)) { - LOGP(DLINP, LOGL_DEBUG, - "GSUP connect: connect timer already running\n"); - osmo_timer_del(&gsupc->connect_timer); - } - - if (osmo_timer_pending(&gsupc->ping_timer)) { - LOGP(DLINP, LOGL_DEBUG, - "GSUP connect: ping timer already running\n"); - osmo_timer_del(&gsupc->ping_timer); - } - - if (ipa_client_conn_clear_queue(gsupc->link) > 0) - LOGP(DLINP, LOGL_DEBUG, "GSUP connect: discarded stored messages\n"); - - rc = ipa_client_conn_open(gsupc->link); - - if (rc >= 0) { - LOGP(DGPRS, LOGL_INFO, "GSUP connecting to %s:%d\n", - gsupc->link->addr, gsupc->link->port); - return 0; - } - - LOGP(DGPRS, LOGL_INFO, "GSUP failed to connect to %s:%d: %s\n", - gsupc->link->addr, gsupc->link->port, strerror(-rc)); - - if (rc == -EBADF || rc == -ENOTSOCK || rc == -EAFNOSUPPORT || - rc == -EINVAL) - return rc; - - osmo_timer_schedule(&gsupc->connect_timer, GPRS_GSUP_RECONNECT_INTERVAL, 0); - - LOGP(DGPRS, LOGL_INFO, "Scheduled timer to retry GSUP connect to %s:%d\n", - gsupc->link->addr, gsupc->link->port); - - return 0; -} - -static void connect_timer_cb(void *gsupc_) -{ - struct gprs_gsup_client *gsupc = gsupc_; - - if (gsupc->is_connected) - return; - - gsup_client_connect(gsupc); -} - -static void gsup_client_updown_cb(struct ipa_client_conn *link, int up) -{ - struct gprs_gsup_client *gsupc = link->data; - - LOGP(DGPRS, LOGL_INFO, "GSUP link to %s:%d %s\n", - link->addr, link->port, up ? "UP" : "DOWN"); - - gsupc->is_connected = up; - - if (up) { - start_test_procedure(gsupc); - - osmo_timer_del(&gsupc->connect_timer); - } else { - osmo_timer_del(&gsupc->ping_timer); - - osmo_timer_schedule(&gsupc->connect_timer, - GPRS_GSUP_RECONNECT_INTERVAL, 0); - } -} - -static int gsup_client_read_cb(struct ipa_client_conn *link, struct msgb *msg) -{ - struct ipaccess_head *hh = (struct ipaccess_head *) msg->data; - struct ipaccess_head_ext *he = (struct ipaccess_head_ext *) msgb_l2(msg); - struct gprs_gsup_client *gsupc = (struct gprs_gsup_client *)link->data; - int rc; - static struct ipaccess_unit ipa_dev = { - .unit_name = "SGSN" - }; - - msg->l2h = &hh->data[0]; - - rc = ipaccess_bts_handle_ccm(link, &ipa_dev, msg); - - if (rc < 0) { - LOGP(DGPRS, LOGL_NOTICE, - "GSUP received an invalid IPA/CCM message from %s:%d\n", - link->addr, link->port); - /* Link has been closed */ - gsupc->is_connected = 0; - msgb_free(msg); - return -1; - } - - if (rc == 1) { - uint8_t msg_type = *(msg->l2h); - /* CCM message */ - if (msg_type == IPAC_MSGT_PONG) { - LOGP(DGPRS, LOGL_DEBUG, "GSUP receiving PONG\n"); - gsupc->got_ipa_pong = 1; - } - - msgb_free(msg); - return 0; - } - - if (hh->proto != IPAC_PROTO_OSMO) - goto invalid; - - if (!he || msgb_l2len(msg) < sizeof(*he) || - he->proto != IPAC_PROTO_EXT_GSUP) - goto invalid; - - msg->l2h = &he->data[0]; - - OSMO_ASSERT(gsupc->read_cb != NULL); - gsupc->read_cb(gsupc, msg); - - /* Not freeing msg here, because that must be done by the read_cb. */ - return 0; - -invalid: - LOGP(DGPRS, LOGL_NOTICE, - "GSUP received an invalid IPA message from %s:%d, size = %d\n", - link->addr, link->port, msgb_length(msg)); - - msgb_free(msg); - return -1; -} - -static void ping_timer_cb(void *gsupc_) -{ - struct gprs_gsup_client *gsupc = gsupc_; - - LOGP(DGPRS, LOGL_INFO, "GSUP ping callback (%s, %s PONG)\n", - gsupc->is_connected ? "connected" : "not connected", - gsupc->got_ipa_pong ? "got" : "didn't get"); - - if (gsupc->got_ipa_pong) { - start_test_procedure(gsupc); - return; - } - - LOGP(DGPRS, LOGL_NOTICE, "GSUP ping timed out, reconnecting\n"); - ipa_client_conn_close(gsupc->link); - gsupc->is_connected = 0; - - gsup_client_connect(gsupc); -} - -static void start_test_procedure(struct gprs_gsup_client *gsupc) -{ - gsupc->ping_timer.data = gsupc; - gsupc->ping_timer.cb = &ping_timer_cb; - - gsupc->got_ipa_pong = 0; - osmo_timer_schedule(&gsupc->ping_timer, GPRS_GSUP_PING_INTERVAL, 0); - LOGP(DGPRS, LOGL_DEBUG, "GSUP sending PING\n"); - gsup_client_send_ping(gsupc); -} - -struct gprs_gsup_client *gprs_gsup_client_create(const char *ip_addr, - unsigned int tcp_port, - gprs_gsup_read_cb_t read_cb) -{ - struct gprs_gsup_client *gsupc; - int rc; - - gsupc = talloc_zero(tall_bsc_ctx, struct gprs_gsup_client); - OSMO_ASSERT(gsupc); - - gsupc->link = ipa_client_conn_create(gsupc, - /* no e1inp */ NULL, - 0, - ip_addr, tcp_port, - gsup_client_updown_cb, - gsup_client_read_cb, - /* default write_cb */ NULL, - gsupc); - if (!gsupc->link) - goto failed; - - gsupc->connect_timer.data = gsupc; - gsupc->connect_timer.cb = &connect_timer_cb; - - rc = gsup_client_connect(gsupc); - - if (rc < 0) - goto failed; - - gsupc->read_cb = read_cb; - - return gsupc; - -failed: - gprs_gsup_client_destroy(gsupc); - return NULL; -} - -void gprs_gsup_client_destroy(struct gprs_gsup_client *gsupc) -{ - osmo_timer_del(&gsupc->connect_timer); - osmo_timer_del(&gsupc->ping_timer); - - if (gsupc->link) { - ipa_client_conn_close(gsupc->link); - ipa_client_conn_destroy(gsupc->link); - gsupc->link = NULL; - } - talloc_free(gsupc); -} - -int gprs_gsup_client_send(struct gprs_gsup_client *gsupc, struct msgb *msg) -{ - if (!gsupc) { - msgb_free(msg); - return -ENOTCONN; - } - - if (!gsupc->is_connected) { - msgb_free(msg); - return -EAGAIN; - } - - ipa_prepend_header_ext(msg, IPAC_PROTO_EXT_GSUP); - ipa_msg_push_header(msg, IPAC_PROTO_OSMO); - ipa_client_conn_send(gsupc->link, msg); - - return 0; -} - -struct msgb *gprs_gsup_msgb_alloc(void) -{ - return msgb_alloc_headroom(4000, 64, __func__); -} diff --git a/openbsc/src/gprs/gprs_subscriber.c b/openbsc/src/gprs/gprs_subscriber.c index 8231e8c..0a3fe19 100644 --- a/openbsc/src/gprs/gprs_subscriber.c +++ b/openbsc/src/gprs/gprs_subscriber.c @@ -21,7 +21,7 @@ */ #include -#include +#include #include #include diff --git a/openbsc/src/gprs/ipa_client.c b/openbsc/src/gprs/ipa_client.c new file mode 100644 index 0000000..bec33c4 --- /dev/null +++ b/openbsc/src/gprs/ipa_client.c @@ -0,0 +1,288 @@ +/* GPRS Subscriber Update Protocol client */ + +/* (C) 2014 by Sysmocom s.f.m.c. GmbH + * All Rights Reserved + * + * Author: Jacob Erlbeck + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation; either version 3 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 Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + * + */ + +#include + +#include +#include +#include + +#include + +#include +#include + +extern void *tall_bsc_ctx; + +static void start_test_procedure(struct gprs_gsup_client *gsupc); + +static void gsup_client_send_ping(struct gprs_gsup_client *gsupc) +{ + struct msgb *msg = gprs_gsup_msgb_alloc(); + + msg->l2h = msgb_put(msg, 1); + msg->l2h[0] = IPAC_MSGT_PING; + ipa_msg_push_header(msg, IPAC_PROTO_IPACCESS); + ipa_client_conn_send(gsupc->link, msg); +} + +static int gsup_client_connect(struct gprs_gsup_client *gsupc) +{ + int rc; + + if (gsupc->is_connected) + return 0; + + if (osmo_timer_pending(&gsupc->connect_timer)) { + LOGP(DLINP, LOGL_DEBUG, + "GSUP connect: connect timer already running\n"); + osmo_timer_del(&gsupc->connect_timer); + } + + if (osmo_timer_pending(&gsupc->ping_timer)) { + LOGP(DLINP, LOGL_DEBUG, + "GSUP connect: ping timer already running\n"); + osmo_timer_del(&gsupc->ping_timer); + } + + if (ipa_client_conn_clear_queue(gsupc->link) > 0) + LOGP(DLINP, LOGL_DEBUG, "GSUP connect: discarded stored messages\n"); + + rc = ipa_client_conn_open(gsupc->link); + + if (rc >= 0) { + LOGP(DGPRS, LOGL_INFO, "GSUP connecting to %s:%d\n", + gsupc->link->addr, gsupc->link->port); + return 0; + } + + LOGP(DGPRS, LOGL_INFO, "GSUP failed to connect to %s:%d: %s\n", + gsupc->link->addr, gsupc->link->port, strerror(-rc)); + + if (rc == -EBADF || rc == -ENOTSOCK || rc == -EAFNOSUPPORT || + rc == -EINVAL) + return rc; + + osmo_timer_schedule(&gsupc->connect_timer, GPRS_GSUP_RECONNECT_INTERVAL, 0); + + LOGP(DGPRS, LOGL_INFO, "Scheduled timer to retry GSUP connect to %s:%d\n", + gsupc->link->addr, gsupc->link->port); + + return 0; +} + +static void connect_timer_cb(void *gsupc_) +{ + struct gprs_gsup_client *gsupc = gsupc_; + + if (gsupc->is_connected) + return; + + gsup_client_connect(gsupc); +} + +static void gsup_client_updown_cb(struct ipa_client_conn *link, int up) +{ + struct gprs_gsup_client *gsupc = link->data; + + LOGP(DGPRS, LOGL_INFO, "GSUP link to %s:%d %s\n", + link->addr, link->port, up ? "UP" : "DOWN"); + + gsupc->is_connected = up; + + if (up) { + start_test_procedure(gsupc); + + osmo_timer_del(&gsupc->connect_timer); + } else { + osmo_timer_del(&gsupc->ping_timer); + + osmo_timer_schedule(&gsupc->connect_timer, + GPRS_GSUP_RECONNECT_INTERVAL, 0); + } +} + +static int gsup_client_read_cb(struct ipa_client_conn *link, struct msgb *msg) +{ + struct ipaccess_head *hh = (struct ipaccess_head *) msg->data; + struct ipaccess_head_ext *he = (struct ipaccess_head_ext *) msgb_l2(msg); + struct gprs_gsup_client *gsupc = (struct gprs_gsup_client *)link->data; + int rc; + static struct ipaccess_unit ipa_dev = { + .unit_name = "SGSN" + }; + + msg->l2h = &hh->data[0]; + + rc = ipaccess_bts_handle_ccm(link, &ipa_dev, msg); + + if (rc < 0) { + LOGP(DGPRS, LOGL_NOTICE, + "GSUP received an invalid IPA/CCM message from %s:%d\n", + link->addr, link->port); + /* Link has been closed */ + gsupc->is_connected = 0; + msgb_free(msg); + return -1; + } + + if (rc == 1) { + uint8_t msg_type = *(msg->l2h); + /* CCM message */ + if (msg_type == IPAC_MSGT_PONG) { + LOGP(DGPRS, LOGL_DEBUG, "GSUP receiving PONG\n"); + gsupc->got_ipa_pong = 1; + } + + msgb_free(msg); + return 0; + } + + if (hh->proto != IPAC_PROTO_OSMO) + goto invalid; + + if (!he || msgb_l2len(msg) < sizeof(*he) || + he->proto != IPAC_PROTO_EXT_GSUP) + goto invalid; + + msg->l2h = &he->data[0]; + + OSMO_ASSERT(gsupc->read_cb != NULL); + gsupc->read_cb(gsupc, msg); + + /* Not freeing msg here, because that must be done by the read_cb. */ + return 0; + +invalid: + LOGP(DGPRS, LOGL_NOTICE, + "GSUP received an invalid IPA message from %s:%d, size = %d\n", + link->addr, link->port, msgb_length(msg)); + + msgb_free(msg); + return -1; +} + +static void ping_timer_cb(void *gsupc_) +{ + struct gprs_gsup_client *gsupc = gsupc_; + + LOGP(DGPRS, LOGL_INFO, "GSUP ping callback (%s, %s PONG)\n", + gsupc->is_connected ? "connected" : "not connected", + gsupc->got_ipa_pong ? "got" : "didn't get"); + + if (gsupc->got_ipa_pong) { + start_test_procedure(gsupc); + return; + } + + LOGP(DGPRS, LOGL_NOTICE, "GSUP ping timed out, reconnecting\n"); + ipa_client_conn_close(gsupc->link); + gsupc->is_connected = 0; + + gsup_client_connect(gsupc); +} + +static void start_test_procedure(struct gprs_gsup_client *gsupc) +{ + gsupc->ping_timer.data = gsupc; + gsupc->ping_timer.cb = &ping_timer_cb; + + gsupc->got_ipa_pong = 0; + osmo_timer_schedule(&gsupc->ping_timer, GPRS_GSUP_PING_INTERVAL, 0); + LOGP(DGPRS, LOGL_DEBUG, "GSUP sending PING\n"); + gsup_client_send_ping(gsupc); +} + +struct gprs_gsup_client *gprs_gsup_client_create(const char *ip_addr, + unsigned int tcp_port, + gprs_gsup_read_cb_t read_cb) +{ + struct gprs_gsup_client *gsupc; + int rc; + + gsupc = talloc_zero(tall_bsc_ctx, struct gprs_gsup_client); + OSMO_ASSERT(gsupc); + + gsupc->link = ipa_client_conn_create(gsupc, + /* no e1inp */ NULL, + 0, + ip_addr, tcp_port, + gsup_client_updown_cb, + gsup_client_read_cb, + /* default write_cb */ NULL, + gsupc); + if (!gsupc->link) + goto failed; + + gsupc->connect_timer.data = gsupc; + gsupc->connect_timer.cb = &connect_timer_cb; + + rc = gsup_client_connect(gsupc); + + if (rc < 0) + goto failed; + + gsupc->read_cb = read_cb; + + return gsupc; + +failed: + gprs_gsup_client_destroy(gsupc); + return NULL; +} + +void gprs_gsup_client_destroy(struct gprs_gsup_client *gsupc) +{ + osmo_timer_del(&gsupc->connect_timer); + osmo_timer_del(&gsupc->ping_timer); + + if (gsupc->link) { + ipa_client_conn_close(gsupc->link); + ipa_client_conn_destroy(gsupc->link); + gsupc->link = NULL; + } + talloc_free(gsupc); +} + +int gprs_gsup_client_send(struct gprs_gsup_client *gsupc, struct msgb *msg) +{ + if (!gsupc) { + msgb_free(msg); + return -ENOTCONN; + } + + if (!gsupc->is_connected) { + msgb_free(msg); + return -EAGAIN; + } + + ipa_prepend_header_ext(msg, IPAC_PROTO_EXT_GSUP); + ipa_msg_push_header(msg, IPAC_PROTO_OSMO); + ipa_client_conn_send(gsupc->link, msg); + + return 0; +} + +struct msgb *gprs_gsup_msgb_alloc(void) +{ + return msgb_alloc_headroom(4000, 64, __func__); +} diff --git a/openbsc/src/gprs/sgsn_vty.c b/openbsc/src/gprs/sgsn_vty.c index b74d01a..00a930f 100644 --- a/openbsc/src/gprs/sgsn_vty.c +++ b/openbsc/src/gprs/sgsn_vty.c @@ -34,7 +34,7 @@ #include #include #include -#include +#include #include #include diff --git a/openbsc/tests/sgsn/Makefile.am b/openbsc/tests/sgsn/Makefile.am index 3c202dd..ea29fce 100644 --- a/openbsc/tests/sgsn/Makefile.am +++ b/openbsc/tests/sgsn/Makefile.am @@ -24,7 +24,7 @@ sgsn_test_LDADD = \ $(top_builddir)/src/gprs/sgsn_auth.o \ $(top_builddir)/src/gprs/sgsn_ares.o \ $(top_builddir)/src/gprs/gprs_gsup_messages.o \ - $(top_builddir)/src/gprs/gprs_gsup_client.o \ + $(top_builddir)/src/gprs/ipa_client.o \ $(top_builddir)/src/gprs/gprs_utils.o \ $(top_builddir)/src/gprs/gprs_subscriber.o \ $(top_builddir)/src/gprs/gsm_04_08_gprs.o \ diff --git a/openbsc/tests/sgsn/sgsn_test.c b/openbsc/tests/sgsn/sgsn_test.c index 7e5ab1a..251772e 100644 --- a/openbsc/tests/sgsn/sgsn_test.c +++ b/openbsc/tests/sgsn/sgsn_test.c @@ -25,7 +25,7 @@ #include #include #include -#include +#include #include #include -- 2.1.4 From nhofmeyr at sysmocom.de Thu Sep 24 12:01:38 2015 From: nhofmeyr at sysmocom.de (Neels Hofmeyr) Date: Thu, 24 Sep 2015 14:01:38 +0200 Subject: [PATCH 1/3] Add initial OAP protocol design document In-Reply-To: <1443095048-4593-1-git-send-email-nhofmeyr@sysmocom.de> References: <1443095048-4593-1-git-send-email-nhofmeyr@sysmocom.de> Message-ID: <20150924120138.GA2463@dub5> Hello all, these patches are sitting in branch neels/sgsn-id in openbsc.git. The planned new feature is outlined in the commit log messages. It's my first larger patch submission for openbsc, which I am developing as a sysmocom employee, while this work is sponsored by On-Waves ehf. It's not completely done yet, in the sense of more tests and config UI, and the authentication method/direction may be subject to discussion: Currently, the server (MAP proxy) sends a 16 octet AUTN to authenticate itself. The client (SGSN) only sends a 4 byte SRES in response. IMHO that's not enough, so I've made the SGSN also send the Kc along with the SRES as a challenge response. That's a bit untypical, since the Kc is usually kept secret on both sides, to use as encryption key. We don't use it as encryption key, but it could make sense to turn the authn process around instead: let the *client* send a 16 bit AUTN, and have the server reply with 4 SRES octets (and omit Kc). This would make it more difficult to spoof an SGSN, while keeping Kc private as usual. (If a fake SGSN is accepted, the upstream network infra may be compromised. Guarding against a spoofed MAP proxy is less security sensitive, so 4 octets may suffice there.) Any comments are more than welcome! Thanks, ~Neels On Thu, Sep 24, 2015 at 01:44:06PM +0200, Neels Hofmeyr wrote: > Sponsored-by: On-Waves ehf > --- > openbsc/doc/osmocom-authn-protocol.txt | 191 +++++++++++++++++++++++++++++++++ > 1 file changed, 191 insertions(+) > create mode 100644 openbsc/doc/osmocom-authn-protocol.txt [...] -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 819 bytes Desc: Digital signature URL: From nhofmeyr at sysmocom.de Thu Sep 24 12:06:50 2015 From: nhofmeyr at sysmocom.de (Neels Hofmeyr) Date: Thu, 24 Sep 2015 14:06:50 +0200 Subject: [PATCH 1/3] Add initial OAP protocol design document In-Reply-To: <1443095048-4593-1-git-send-email-nhofmeyr@sysmocom.de> References: <1443095048-4593-1-git-send-email-nhofmeyr@sysmocom.de> Message-ID: <20150924120650.GB2463@dub5> On Thu, Sep 24, 2015 at 01:44:06PM +0200, Neels Hofmeyr wrote: > ...The remote peer is either a service > +that understands the protocol natively or a wrapper service that maps the > +messages to/from real MAP messages that can be used to directly communicate > +with an HLR. ^ That's copy-pasted from the GSUP spec and not applicable. Will remove. ~Neels -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 819 bytes Desc: Digital signature URL: From holger at freyther.de Thu Sep 24 14:36:31 2015 From: holger at freyther.de (Holger Freyther) Date: Thu, 24 Sep 2015 16:36:31 +0200 Subject: [PATCH 2/3] amr: Instead of putting ms/bts into the same struct.. use it twice In-Reply-To: <1443090576-63058-2-git-send-email-holger@freyther.de> References: <1443090576-63058-1-git-send-email-holger@freyther.de> <1443090576-63058-2-git-send-email-holger@freyther.de> Message-ID: > On 24 Sep 2015, at 12:29, Holger Hans Peter Freyther wrote: > > From: Holger Hans Peter Freyther > > This way a lot of if/else can just be killed by the caller deciding > which of the two instances to use. We should be able to shrink the amount of VTY commands down to one by making all the other modes optional (by adding ?(? ?)?) around these options. This would reduce the amount of copy and paste for hysteris and threshold too. Any volunteers? holger From holger at freyther.de Thu Sep 24 15:21:37 2015 From: holger at freyther.de (Holger Hans Peter Freyther) Date: Thu, 24 Sep 2015 17:21:37 +0200 Subject: [PATCH] amr: Attempt to unbreak the AMR support in the BSC Message-ID: <1443108097-66525-1-git-send-email-holger@freyther.de> From: Holger Hans Peter Freyther The signature of mr_config and the BSC implementation didn't match and the compiler was warning about it: osmo_bsc_api.c:530:2: warning: initialization from incompatible pointer type .mr_config = bsc_mr_config, ^ osmo_bsc_api.c:530:2: warning: (near initialization for ?bsc_handler.mr_config?) Change the mr_config again and provide an implementation that will set the ms and bts data structure. It would be better to put the size outside of the IE but I am not going to change it right now. It would also be nice to either move the AMR setting into the "nitb" structure or have the msc data be used _after_ the bts settings. This needs to be cleaned up in the next step. Manually verified by placing a MO call and checking that both the channel mode modify and the mode modify request contain the multi rate config with the rate mr config (length two bytes, version 1, icmi==1, no start mode being set). --- openbsc/include/openbsc/bsc_api.h | 2 +- openbsc/src/libbsc/bsc_api.c | 2 +- openbsc/src/osmo-bsc/osmo_bsc_api.c | 36 +++++++++++++++++++++++++----------- 3 files changed, 27 insertions(+), 13 deletions(-) diff --git a/openbsc/include/openbsc/bsc_api.h b/openbsc/include/openbsc/bsc_api.h index a70d765..a3d12f2 100644 --- a/openbsc/include/openbsc/bsc_api.h +++ b/openbsc/include/openbsc/bsc_api.h @@ -40,7 +40,7 @@ struct bsc_api { * not implemented AMR5.9 will be used. */ void (*mr_config)(struct gsm_subscriber_connection *conn, - uint8_t *mr_ms_lv, uint8_t *mr_bts_lv); + struct gsm_lchan *lchan, int full_rate); }; int bsc_api_init(struct gsm_network *network, struct bsc_api *api); diff --git a/openbsc/src/libbsc/bsc_api.c b/openbsc/src/libbsc/bsc_api.c index e157eb9..504f044 100644 --- a/openbsc/src/libbsc/bsc_api.c +++ b/openbsc/src/libbsc/bsc_api.c @@ -163,7 +163,7 @@ static void handle_mr_config(struct gsm_subscriber_connection *conn, struct gsm48_multi_rate_conf *mr_conf; if (api->mr_config) - return api->mr_config(conn, lchan->mr_ms_lv, lchan->mr_bts_lv); + return api->mr_config(conn, lchan, full_rate); if (full_rate) mr = &lchan->ts->trx->bts->mr_full; diff --git a/openbsc/src/osmo-bsc/osmo_bsc_api.c b/openbsc/src/osmo-bsc/osmo_bsc_api.c index 00a10b3..fbeed77 100644 --- a/openbsc/src/osmo-bsc/osmo_bsc_api.c +++ b/openbsc/src/osmo-bsc/osmo_bsc_api.c @@ -491,9 +491,10 @@ static void bsc_cm_update(struct gsm_subscriber_connection *conn, } static void bsc_mr_config(struct gsm_subscriber_connection *conn, - struct gsm48_multi_rate_conf *conf) + struct gsm_lchan *lchan, int full_rate) { struct osmo_msc_data *msc; + struct gsm48_multi_rate_conf *ms_conf, *bts_conf; if (!conn->sccp_con) { LOGP(DMSC, LOGL_ERROR, @@ -504,18 +505,31 @@ static void bsc_mr_config(struct gsm_subscriber_connection *conn, msc = conn->sccp_con->msc; - conf->ver = 1; - conf->icmi = 1; + /* initialize the data structure */ + lchan->mr_ms_lv[0] = sizeof(*ms_conf); + lchan->mr_bts_lv[0] = sizeof(*bts_conf); + ms_conf = (struct gsm48_multi_rate_conf *) &lchan->mr_ms_lv[1]; + bts_conf = (struct gsm48_multi_rate_conf *) &lchan->mr_bts_lv[1]; + memset(ms_conf, 0, sizeof(*ms_conf)); + memset(bts_conf, 0, sizeof(*bts_conf)); + + bts_conf->ver = ms_conf->ver = 1; + bts_conf->icmi = ms_conf->icmi = 1; /* maybe gcc see's it is copy of _one_ byte */ - conf->m4_75 = msc->amr_conf.m4_75; - conf->m5_15 = msc->amr_conf.m5_15; - conf->m5_90 = msc->amr_conf.m5_90; - conf->m6_70 = msc->amr_conf.m6_70; - conf->m7_40 = msc->amr_conf.m7_40; - conf->m7_95 = msc->amr_conf.m7_95; - conf->m10_2 = msc->amr_conf.m10_2; - conf->m12_2 = msc->amr_conf.m12_2; + bts_conf->m4_75 = ms_conf->m4_75 = msc->amr_conf.m4_75; + bts_conf->m5_15 = ms_conf->m5_15 = msc->amr_conf.m5_15; + bts_conf->m5_90 = ms_conf->m5_90 = msc->amr_conf.m5_90; + bts_conf->m6_70 = ms_conf->m6_70 = msc->amr_conf.m6_70; + bts_conf->m7_40 = ms_conf->m7_40 = msc->amr_conf.m7_40; + bts_conf->m7_95 = ms_conf->m7_95 = msc->amr_conf.m7_95; + if (full_rate) { + bts_conf->m10_2 = ms_conf->m10_2 = msc->amr_conf.m10_2; + bts_conf->m12_2 = ms_conf->m12_2 = msc->amr_conf.m12_2; + } + + /* now copy this into the bts structure */ + memcpy(lchan->mr_bts_lv, lchan->mr_ms_lv, sizeof(lchan->mr_ms_lv)); } static struct bsc_api bsc_handler = { -- 2.3.5 From laforge at gnumonks.org Thu Sep 24 20:14:41 2015 From: laforge at gnumonks.org (Harald Welte) Date: Thu, 24 Sep 2015 22:14:41 +0200 Subject: [PATCH 1/3] Add initial OAP protocol design document In-Reply-To: <1443095048-4593-1-git-send-email-nhofmeyr@sysmocom.de> References: <1443095048-4593-1-git-send-email-nhofmeyr@sysmocom.de> Message-ID: <20150924201441.GM31436@nataraja> Hi Neels, welcome to OpenBSC code :) > + Osmocom Authentication Protocol (OAP) I would argue it makes sense to at least specify/define the protocol also to support UMTS AKA, not just plain-old GSM authentication. This is important * for future compatibility once the SGSN suppots 3G * to use UMTS AKA for increased security over GERAN (GPRS/EDGE RAN) Regards, Harald -- - Harald Welte http://laforge.gnumonks.org/ ============================================================================ "Privacy in residential applications is a desirable marketing option." (ETSI EN 300 175-7 Ch. A6) From laforge at gnumonks.org Fri Sep 25 07:13:01 2015 From: laforge at gnumonks.org (Harald Welte) Date: Fri, 25 Sep 2015 09:13:01 +0200 Subject: KCM to parse / de-multiplex IPA in kernel? Message-ID: <20150925071301.GB8751@nataraja> Hi all, it seems like there is some work in the kernel network stack to have a generic multiplexor/demultiplexor for protocols that implement message-based semantics over TCP: http://thread.gmane.org/gmane.linux.network/378365 They don't implement a specific messaging protocol, but the userspace program can BPF to let the kernel muxer know how to find the length of the message. This seems like conceptually it is suitable for actually implementing an IPA multiplex inside the kernel and then get e.g. Abis OML and RSL on different sockets. Not that we urgently need anything like this, but I just wanted to point it out, in case somebody is interestd in it. -- - Harald Welte ============================================================================ "Privacy in residential applications is a desirable marketing option." (ETSI EN 300 175-7 Ch. A6) From holger at freyther.de Mon Sep 28 05:13:37 2015 From: holger at freyther.de (Holger Freyther) Date: Mon, 28 Sep 2015 07:13:37 +0200 Subject: [PATCH 1/3] Add initial OAP protocol design document In-Reply-To: <20150924201441.GM31436@nataraja> References: <1443095048-4593-1-git-send-email-nhofmeyr@sysmocom.de> <20150924201441.GM31436@nataraja> Message-ID: <544B12C9-A36C-4356-90C4-6EC201682F81@freyther.de> > On 24 Sep 2015, at 22:14, Harald Welte wrote: > > Hi Neels, > > welcome to OpenBSC code :) > >> + Osmocom Authentication Protocol (OAP) > > I would argue it makes sense to at least specify/define the protocol > also to support UMTS AKA, not just plain-old GSM authentication. > > This is important > * for future compatibility once the SGSN suppots 3G > * to use UMTS AKA for increased security over GERAN (GPRS/EDGE RAN) OAP is to authenticate something like the A-link, GSUP link or maybe even MNCC over TCP/IP, or a USSD provider, etc. It is using ?AKA? right now but in a restricted mode: * SQN will be 0 (because the clients might have no way to persistently store the SQNs). Yes, this will allow a replay against the client.[1] * There is not ?AuthenticationFailure? message with the AUTS. As the SQN will always be fixed in the first iteration there should not be a need to re-synchronize. [1] It is a trade off in efforts. The clients can not store a SQN, the last RANDS, etc. They could in theory start with a random RAND and client/server will go through one re-synchronization of the SQN. I obviously made a trade-off here and this protocol allows us to add SQN number handling in the future and client API users are not impacted. From holger at freyther.de Mon Sep 28 05:23:56 2015 From: holger at freyther.de (Holger Freyther) Date: Mon, 28 Sep 2015 07:23:56 +0200 Subject: [PATCH 1/3] Add initial OAP protocol design document In-Reply-To: <1443095048-4593-1-git-send-email-nhofmeyr@sysmocom.de> References: <1443095048-4593-1-git-send-email-nhofmeyr@sysmocom.de> Message-ID: <174E6D48-553D-43E6-B656-7C6AE7C96A08@freyther.de> > On 24 Sep 2015, at 13:44, Neels Hofmeyr wrote: > > > +This document describes the remote protocol that is used by the SGSN and MAP > +proxy to authenticate each other. The protocol and the messages are designed > +after the corresponding MAP messages (see GSM 09.02) with the following > +differences: not just remove the above but provide a short general statement about what this protocol should provide. > > +Ideal communication sequence: > + > + SGSN MAP Proxy GSM MAP is a protocol, the MAP Proxy is a system to relay these. You could also opt for more generic terms like ?Client?/?Server? ?Consumer?/?Provider? > +When the SGSN has received a Challenge, it may verify the server's > +authenticity, and reply with a CHALLENGE_RES message. This shall contain SRES > +(and Kc?) authentication tokens generated by milenage from the same random > +bytes received from the server and the same shared secet. If the SGSN cannot > +verify the server's authenticity, it shall instead send a CHALLENGE_ERR > +message. Okay, I just said something else to Harald but adding (and not implementing) the following. If the server key matches but the SQN is wrong an AUTS will be included by the client? No security expert here.. is it better to always include the AUTS or not? The attacker will then know the key was right.. and just needs one more try then. If using the wrong key to get the SQN.. it will always fail *shrug* So maybe omit the AUTS as we don?t handle SQN failures right now. the rest reads fine. holger From holger at freyther.de Mon Sep 28 05:27:01 2015 From: holger at freyther.de (Holger Freyther) Date: Mon, 28 Sep 2015 07:27:01 +0200 Subject: [PATCH 2/3] ipa, gsup: file rename to prepare for refactoring In-Reply-To: <1443095048-4593-2-git-send-email-nhofmeyr@sysmocom.de> References: <1443095048-4593-1-git-send-email-nhofmeyr@sysmocom.de> <1443095048-4593-2-git-send-email-nhofmeyr@sysmocom.de> Message-ID: <9628CD93-3253-41DB-9979-A8BACCCC2B54@freyther.de> > On 24 Sep 2015, at 13:44, Neels Hofmeyr wrote: > > Rename gprs_gsup_client.* to ipa_client.*. > > To ease diff reading for the upcoming commit, this commit performs a file > rename only. Okay, I should have looked before. Could you re-send this one with -M in the command line? But yes, it is good to just do the rename! From holger at freyther.de Mon Sep 28 05:56:17 2015 From: holger at freyther.de (Holger Freyther) Date: Mon, 28 Sep 2015 07:56:17 +0200 Subject: [PATCH 3/3] Implement OAP for SGSN registration. In-Reply-To: <1443095048-4593-3-git-send-email-nhofmeyr@sysmocom.de> References: <1443095048-4593-1-git-send-email-nhofmeyr@sysmocom.de> <1443095048-4593-3-git-send-email-nhofmeyr@sysmocom.de> Message-ID: > On 24 Sep 2015, at 13:44, Neels Hofmeyr wrote: Good Morning, in general this is a bit too much to review in one piece. > +struct gprs_ipa_client { > + struct ipa_client *ipac; In general we subclass by embedding the parent class directly because then you can do upwards casts very easily and can leave the ->data pointer for something else? > > +/* This is the config part for vty. It is essentially copied in gprs_oap_state, > + * where values are copied over once the config is considered valid. The shared > + * secret is converted from hex string to octet buffer, the sgsn_id is simply > + * copied. Is this separation really necessary? */ > +struct gprs_oap_config { > + uint16_t sgsn_id; > + const char *shared_secret; > +}; maybe we have two secrets to fill out K and OP(c) with different values? > + > +struct gprs_oap_state { > + enum { > + oap_uninitialized = 0, // just allocated. > + oap_disabled, // disabled by config. > + oap_config_error, // <-- TODO really? > + oap_initialized, // shared_secret valid. > + oap_requested_challenge, > + oap_sent_challenge_result, > + oap_registered > + } state; upper case like all our enums? > + uint16_t sgsn_id; > + uint8_t shared_secret[16]; good point. So here it is 16bytes and up there it is a const char *. Maybe use uint8_t everywhere and then re-write the secrets as hexdump? > > -/* (C) 2014 by Sysmocom s.f.m.c. GmbH > +/* (C) 2015 by Sysmocom s.f.m.c. GmbH Domain of copy-right. Is this 2014-2015, 2014,2015? Probably more like 2014,2015 here (yes, the bits from 2014 will expire at some point > - encode_big_endian(pdp_info->pdp_type | 0xf000, > - GPRS_GSUP_PDP_TYPE_SIZE)); > + gprs_encode_big_endian(pdp_info->pdp_type | 0xf000, > + GPRS_GSUP_PDP_TYPE_SIZE)); how much effort would it be to split this part and the ipa->gsup client part in two other commits and then adding OAP (even split up with message encoding/decoding)? > > +static void gprs_ipa_client_updown_cb(struct ipa_client *ipac, int up) > +{ > + struct gprs_ipa_client *gipac = ipac->data; > + > + if (up && (gipac->oap.sgsn_id != 0)) { > + if (gprs_oap_register(gipac) < 0) { > + /* TODO: fail fatally */ log an error at least. > > +struct gprs_ipa_client *gprs_ipa_client_create(const char *ip_addr, > + unsigned int tcp_port) > +{ > > + return gipac; > + > +failed: LOGL_ERROR? > + gprs_ipa_client_destroy(gipac); > + return NULL; > +} > + > > +int gprs_oap_init(struct gprs_oap_config *config, struct gprs_oap_state *state) > +{ > + OSMO_ASSERT(state->state == oap_uninitialized); > + > + if (config->sgsn_id == 0) > + goto disable; > + > + if (!(config->shared_secret) || (strlen(config->shared_secret) == 0)) > + goto disable; > + > + /* this should probably happen in config parsing place?? */ yes ;) the VTY commands should create/parse hex > + int secret_len = osmo_hexparse(config->shared_secret, > + state->shared_secret, > + sizeof(state->shared_secret)); > > + struct osmo_sub_auth_data auth = { > + .type = OSMO_AUTH_TYPE_GSM, UMTS and not GSM ;) > + .algo = OSMO_AUTH_ALG_MILENAGE, > + }; > + > + OSMO_ASSERT(sizeof(auth.u.umts.opc) == sizeof(state->shared_secret)); > + OSMO_ASSERT(sizeof(auth.u.umts.k) == sizeof(state->shared_secret)); > + > + memcpy(auth.u.umts.opc, state->shared_secret, sizeof(auth.u.umts.opc)); > + memcpy(auth.u.umts.k, state->shared_secret, sizeof(auth.u.umts.k)); > + memcpy(auth.u.umts.k, state->shared_secret, sizeof(auth.u.umts.k)); one copy too many. What did you try to create? But yes k and opc from two diferent keys would be great. > > +int gprs_oap_register(struct gprs_ipa_client *gipac) > +{ > + struct gprs_oap_state *state = &gipac->oap; > + > + OSMO_ASSERT(state); > + OSMO_ASSERT(state->sgsn_id); > + > + struct msgb *msg = ipa_client_msgb_alloc(); > + > + struct gprs_oap_message oap_msg = {0}; > + oap_msg.message_type = GPRS_OAP_MSGT_REGISTER_REQUEST; > + oap_msg.sgsn_id = state->sgsn_id; > + > + gprs_oap_encode(msg, &oap_msg); > + > + state->state = oap_requested_challenge; > + return gprs_ipa_client_send_oap(gipac, msg); > +} separating encoding and sending will allow us to unittest the encoder/decoder separately > > + switch (oap_msg.message_type) { > + case GPRS_OAP_MSGT_CHALLENGE_REQUEST: don?t do this in-place. Please call a function > +int gprs_oap_decode(const uint8_t *const_data, size_t data_len, > + struct gprs_oap_message *oap_msg) > +{ > > + static const struct gprs_oap_message empty_oap_message = {0}; > + > + *oap_msg = empty_oap_message; why do we need to copy this? An alternative to memset? Taken from gsup code? > +/* Wishful thinking to generate a constant time compare */ > +int gprs_constant_time_cmp(const uint8_t *exp, const uint8_t *rel, const int count) > +{ don?t copy and paste from the NAT but at least put it into a commonly used function (e.g. somewhere in libcommom/)? > + if (ipac->updown_cb != NULL) > + ipac->updown_cb(ipac, up); Does it make sense to have the updown_cb be NULL? > > - if (hh->proto != IPAC_PROTO_OSMO) > - goto invalid; > - > - if (!he || msgb_l2len(msg) < sizeof(*he) || > - he->proto != IPAC_PROTO_EXT_GSUP) > + if (!he || msgb_l2len(msg) < sizeof(*he)) > goto invalid; I think you want to have the first hh->proto check here. As the second part will use he which is only valid/there if it is IPAC_PROTO_OSMO? > > + // l2h is not sent over the wire, but for the test suite it makes sense > + // to make l2h point at the IPA message payload. Please don?t use C99 comments, e.g. use /* */ But why do we add the comment what changed from the previous implementation? > ); > - if (g_cfg->gsup_server_addr.sin_addr.s_addr) > - vty_out(vty, " gsup remote-ip %s%s", > - inet_ntoa(g_cfg->gsup_server_addr.sin_addr), VTY_NEWLINE); > - if (g_cfg->gsup_server_port) > - vty_out(vty, " gsup remote-port %d%s", > - g_cfg->gsup_server_port, VTY_NEWLINE); > + if (g_cfg->ipa_server_addr.sin_addr.s_addr) > + vty_out(vty, " ipa remote-ip %s%s", > + inet_ntoa(g_cfg->ipa_server_addr.sin_addr), VTY_NEWLINE); > + if (g_cfg->ipa_server_port) > + vty_out(vty, " ipa remote-port %d%s", > + g_cfg->ipa_server_port, VTY_NEWLINE); ?gsup? vs. ?ipa?. * If you change config files you need to provide an upgrade path from a config file that is using ?gsup?. E.g. by adding a DEFUN_DEPRECATED for the old parameter * ?ipa? is such a vague name. The SGSN might have several IPA connections to different kind of systems. One might be used for GSUP. Another one might be for sending telemetric data. We use this connection for GSUP so let?s keep the current configuration settings. And this you probably don?t want the s/gsup_client/gprs_ipa_client/ renaming as well. As we might have multiple IPA connections in the future to different systems. > > -/* Wishful thinking to generate a constant time compare */ > -static int constant_time_cmp(const uint8_t *exp, const uint8_t *rel, const int count) ah ha, but then please don?t call it gprs_constant_time.. > > static int verify_key(struct bsc_connection *conn, struct bsc_config *conf, const uint8_t *key, const int keylen) > { > > if (vec.res_len != 8) { > LOGP(DNAT, LOGL_ERROR, "Res length is wrong: %d for bsc nr %d\n", > - keylen, conf->nr); > + (int)vec.res_len, conf->nr); separate commit. And what type is res_len? size_t? then please change the format identifier. > static void ipaccess_auth_bsc(struct tlv_parsed *tvp, struct bsc_connection *bsc) > diff --git a/openbsc/tests/sgsn/Makefile.am b/openbsc/tests/sgsn/Makefile.am > index ea29fce..3b45b3f 100644 > --- a/openbsc/tests/sgsn/Makefile.am > +++ b/openbsc/tests/sgsn/Makefile.am I am afraid you really need to split this change a bit more. My attention span is over here. From nhofmeyr at sysmocom.de Mon Sep 28 12:58:03 2015 From: nhofmeyr at sysmocom.de (Neels Hofmeyr) Date: Mon, 28 Sep 2015 14:58:03 +0200 Subject: KCM to parse / de-multiplex IPA in kernel? In-Reply-To: <20150925071301.GB8751@nataraja> References: <20150925071301.GB8751@nataraja> Message-ID: <20150928125803.GA1431@dub5> On Fri, Sep 25, 2015 at 09:13:01AM +0200, Harald Welte wrote: > Hi all, > > it seems like there is some work in the kernel network stack to have a > generic multiplexor/demultiplexor for protocols that implement > message-based semantics over TCP: > http://thread.gmane.org/gmane.linux.network/378365 > > They don't implement a specific messaging protocol, but the userspace > program can BPF to let the kernel muxer know how to find the length > of the message. > > This seems like conceptually it is suitable for actually implementing an > IPA multiplex inside the kernel and then get e.g. Abis OML and RSL on > different sockets. Interesting, as my recent patch submission does some effort to multiplex the SGSN<->MAP IPA wire to GSUP and the new OAP. The difference between the two is visible from the proto_ext byte, easy to filter on. So IIUC with (e)BPF in the kernel, we can load two eBPF programs on an IPA socket and somehow get two separate sockets(?) to read from, where each will yield only those IPA packets that match the respective proto_ext. There is also the connection housekeeping (IPA ping/pong and so on), which is independent of the IPA proto payload. Could be a third eBPF program & socket (or the like) ... ? Interesting in the sense: "You want another proto on your IPA wire? just open another BPF without changing the current IPA code." But so far it sounds like the BPF can only examine and maybe drop packets on a single socket and not yet mux towards multiple readers (we can add a BPF sockopt on one socket, not get N sockets, AFAICT). And, when muxing is already working in internal code, replacing that with BPF is just more work, of course. But will keep in mind for the future, I guess :) ~Neels -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 819 bytes Desc: Digital signature URL: From nhofmeyr at sysmocom.de Tue Sep 29 11:17:41 2015 From: nhofmeyr at sysmocom.de (Neels Hofmeyr) Date: Tue, 29 Sep 2015 13:17:41 +0200 Subject: [PATCH] ipa, gsup: file rename to prepare for refactoring Message-ID: <1443525461-9694-2-git-send-email-nhofmeyr@sysmocom.de> Rename gprs_gsup_client.* to ipa_client.*. To ease diff reading for the upcoming commit, this commit performs a file rename only. Background: currently, GSUP is the only protocol spoken on the IPA wire. We will now add OAP, a new protocol to register the SGSN with a MAP proxy. What has been only the GSUP client will mostly become the general IPA client. Sponsored-by: On-Waves ehf --- openbsc/include/openbsc/Makefile.am | 2 +- openbsc/include/openbsc/{gprs_gsup_client.h => ipa_client.h} | 0 openbsc/src/gprs/Makefile.am | 2 +- openbsc/src/gprs/gprs_subscriber.c | 2 +- openbsc/src/gprs/{gprs_gsup_client.c => ipa_client.c} | 2 +- openbsc/src/gprs/sgsn_vty.c | 2 +- openbsc/tests/sgsn/Makefile.am | 2 +- openbsc/tests/sgsn/sgsn_test.c | 2 +- 8 files changed, 7 insertions(+), 7 deletions(-) rename openbsc/include/openbsc/{gprs_gsup_client.h => ipa_client.h} (100%) rename openbsc/src/gprs/{gprs_gsup_client.c => ipa_client.c} (99%) diff --git a/openbsc/include/openbsc/Makefile.am b/openbsc/include/openbsc/Makefile.am index 254f43d..7bc9d95 100644 --- a/openbsc/include/openbsc/Makefile.am +++ b/openbsc/include/openbsc/Makefile.am @@ -16,7 +16,7 @@ noinst_HEADERS = abis_nm.h abis_rsl.h db.h gsm_04_08.h gsm_data.h \ arfcn_range_encode.h nat_rewrite_trie.h bsc_nat_callstats.h \ osmux.h mgcp_transcode.h gprs_utils.h \ gprs_gb_parse.h smpp.h meas_feed.h gprs_gsup_messages.h \ - gprs_gsup_client.h bsc_msg_filter.h + ipa_client.h bsc_msg_filter.h openbsc_HEADERS = gsm_04_08.h meas_rep.h bsc_api.h openbscdir = $(includedir)/openbsc diff --git a/openbsc/include/openbsc/gprs_gsup_client.h b/openbsc/include/openbsc/ipa_client.h similarity index 100% rename from openbsc/include/openbsc/gprs_gsup_client.h rename to openbsc/include/openbsc/ipa_client.h diff --git a/openbsc/src/gprs/Makefile.am b/openbsc/src/gprs/Makefile.am index f46a402..b9c3070 100644 --- a/openbsc/src/gprs/Makefile.am +++ b/openbsc/src/gprs/Makefile.am @@ -26,7 +26,7 @@ osmo_sgsn_SOURCES = gprs_gmm.c gprs_sgsn.c gprs_sndcp.c gprs_sndcp_vty.c \ sgsn_main.c sgsn_vty.c sgsn_libgtp.c \ gprs_llc.c gprs_llc_parse.c gprs_llc_vty.c crc24.c \ sgsn_ctrl.c sgsn_auth.c gprs_subscriber.c \ - gprs_gsup_messages.c gprs_utils.c gprs_gsup_client.c \ + gprs_gsup_messages.c gprs_utils.c ipa_client.c \ gsm_04_08_gprs.c sgsn_cdr.c sgsn_ares.c osmo_sgsn_LDADD = \ $(top_builddir)/src/libcommon/libcommon.a \ diff --git a/openbsc/src/gprs/gprs_subscriber.c b/openbsc/src/gprs/gprs_subscriber.c index 8231e8c..0a3fe19 100644 --- a/openbsc/src/gprs/gprs_subscriber.c +++ b/openbsc/src/gprs/gprs_subscriber.c @@ -21,7 +21,7 @@ */ #include -#include +#include #include #include diff --git a/openbsc/src/gprs/gprs_gsup_client.c b/openbsc/src/gprs/ipa_client.c similarity index 99% rename from openbsc/src/gprs/gprs_gsup_client.c rename to openbsc/src/gprs/ipa_client.c index 807b0c1..bec33c4 100644 --- a/openbsc/src/gprs/gprs_gsup_client.c +++ b/openbsc/src/gprs/ipa_client.c @@ -20,7 +20,7 @@ * */ -#include +#include #include #include diff --git a/openbsc/src/gprs/sgsn_vty.c b/openbsc/src/gprs/sgsn_vty.c index b74d01a..00a930f 100644 --- a/openbsc/src/gprs/sgsn_vty.c +++ b/openbsc/src/gprs/sgsn_vty.c @@ -34,7 +34,7 @@ #include #include #include -#include +#include #include #include diff --git a/openbsc/tests/sgsn/Makefile.am b/openbsc/tests/sgsn/Makefile.am index 3c202dd..ea29fce 100644 --- a/openbsc/tests/sgsn/Makefile.am +++ b/openbsc/tests/sgsn/Makefile.am @@ -24,7 +24,7 @@ sgsn_test_LDADD = \ $(top_builddir)/src/gprs/sgsn_auth.o \ $(top_builddir)/src/gprs/sgsn_ares.o \ $(top_builddir)/src/gprs/gprs_gsup_messages.o \ - $(top_builddir)/src/gprs/gprs_gsup_client.o \ + $(top_builddir)/src/gprs/ipa_client.o \ $(top_builddir)/src/gprs/gprs_utils.o \ $(top_builddir)/src/gprs/gprs_subscriber.o \ $(top_builddir)/src/gprs/gsm_04_08_gprs.o \ diff --git a/openbsc/tests/sgsn/sgsn_test.c b/openbsc/tests/sgsn/sgsn_test.c index 7e5ab1a..251772e 100644 --- a/openbsc/tests/sgsn/sgsn_test.c +++ b/openbsc/tests/sgsn/sgsn_test.c @@ -25,7 +25,7 @@ #include #include #include -#include +#include #include #include -- 2.1.4 From nhofmeyr at sysmocom.de Tue Sep 29 11:30:12 2015 From: nhofmeyr at sysmocom.de (Neels Hofmeyr) Date: Tue, 29 Sep 2015 13:30:12 +0200 Subject: [PATCH 2/3] ipa, gsup: file rename to prepare for refactoring In-Reply-To: <9628CD93-3253-41DB-9979-A8BACCCC2B54@freyther.de> References: <1443095048-4593-1-git-send-email-nhofmeyr@sysmocom.de> <1443095048-4593-2-git-send-email-nhofmeyr@sysmocom.de> <9628CD93-3253-41DB-9979-A8BACCCC2B54@freyther.de> Message-ID: <20150929113012.GA1565@dub5> On Mon, Sep 28, 2015 at 07:27:01AM +0200, Holger Freyther wrote: > Could you re-send this one with -M just resent. ~Neels -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 819 bytes Desc: Digital signature URL: From nhofmeyr at sysmocom.de Tue Sep 29 13:10:37 2015 From: nhofmeyr at sysmocom.de (Neels Hofmeyr) Date: Tue, 29 Sep 2015 15:10:37 +0200 Subject: [PATCH 3/3] Implement OAP for SGSN registration. In-Reply-To: References: <1443095048-4593-1-git-send-email-nhofmeyr@sysmocom.de> <1443095048-4593-3-git-send-email-nhofmeyr@sysmocom.de> Message-ID: <20150929131037.GB1565@dub5> /me replying to two mails in one In summary, the questions I'd like answered, see below for details: - using memcmp() is ok? (re constant_time_cmp()) On Mon, Sep 28, 2015 at 07:23:56AM +0200, Holger Freyther wrote: > not just remove the above but provide a short general statement about what this > protocol should provide. done, I hope to satisfaction. (patch will follow) > GSM MAP is a protocol, the MAP Proxy is a system to relay these. You could > also opt for more generic terms like ?Client?/?Server? ?Consumer?/?Provider? Changed to "client"/"server". > Okay, I just said something else to Harald but adding (and not implementing) > the following. If the server key matches but the SQN is wrong an AUTS will > be included by the client? Spec'd a Sync Request message, but will not implement yet. > > memcpy(auth.u.umts.opc, state->shared_secret, sizeof(auth.u.umts.opc)); > > memcpy(auth.u.umts.k, state->shared_secret, sizeof(auth.u.umts.k)); > maybe we have two secrets to fill out K and OP(c) with different values? & > yes k and opc from two diferent keys would be great. I can make it one double-length shared secret and use one half each? Ah whatever, I'll add secret_k and secret_opc, who knows if we'd like to have an operator specifc key one day... On Mon, Sep 28, 2015 at 07:56:17AM +0200, Holger Freyther wrote: > in general this is a bit too much to review in one piece. you mean the patch is too large... ;) > > +struct gprs_ipa_client { > > + struct ipa_client *ipac; > > In general we subclass by embedding the parent class directly because then Problem being, we get a pointer from the constructor: struct ipa_client *ipa_client_create(const char *ip_addr, [...] (was gsup_client_create(), i.e. someone else wrote this.) Should I refactor this to void ipa_client_create(struct ipa_client*, ...) ?? I'm trying to limit API refactoring efforts though. > upper case like all our enums? ACK > > + uint16_t sgsn_id; > > + uint8_t shared_secret[16]; > > good point. So here it is 16bytes and up there it is a const char *. Maybe use > uint8_t everywhere and then re-write the secrets as hexdump? & > > + /* this should probably happen in config parsing place?? */ > > yes ;) the VTY commands should create/parse hex In a subsequent commit on the branch, the const char * has already disappeared into the vty (patch not posted yet). > > -/* (C) 2014 by Sysmocom s.f.m.c. GmbH > > +/* (C) 2015 by Sysmocom s.f.m.c. GmbH > > Domain of copy-right. Is this 2014-2015, 2014,2015? Probably more like > 2014,2015 here (yes, the bits from 2014 will expire at some point I have no idea about notation of copyright years... I'll write "2014,2015", then. > > - encode_big_endian(pdp_info->pdp_type | 0xf000, > > - GPRS_GSUP_PDP_TYPE_SIZE)); > > + gprs_encode_big_endian(pdp_info->pdp_type | 0xf000, > > + GPRS_GSUP_PDP_TYPE_SIZE)); > > how much effort would it be to split this part and the ipa->gsup client part > in two other commits and then adding OAP (even split up with message > encoding/decoding)? Some effort. I had considered it, but decided against it in the end. Slightly feels like unneccessary effort. If you need smaller review chunks though, it adds motivation to further split. Not sure what you mean by "split with message encoding/decoding", like, commit the oap_messages.c in a separate commit? IMHO it's already separate. > > +static void gprs_ipa_client_updown_cb(struct ipa_client *ipac, int up) > > +{ > > + struct gprs_ipa_client *gipac = ipac->data; > > + > > + if (up && (gipac->oap.sgsn_id != 0)) { > > + if (gprs_oap_register(gipac) < 0) { > > + /* TODO: fail fatally */ > > > > log an error at least. Am not clear yet how an error in a protocol callback should propagate to the main loop and barf there. Certainly something grave should happen. > > +struct gprs_ipa_client *gprs_ipa_client_create(const char *ip_addr, > > + unsigned int tcp_port) > > +{ > > > > + return gipac; > > + > > +failed: > > LOGL_ERROR? The only possible failure cause is from ipa_client_create(), so *that* one should log an error instead. But that's "older" code again, and I'm trying to stay on topic... should I add error logging to the older code?? > > + struct osmo_sub_auth_data auth = { > > + .type = OSMO_AUTH_TYPE_GSM, > > UMTS and not GSM ;) erm, well, "was just checking if you're paying attention" ^_^ > > + memcpy(auth.u.umts.k, state->shared_secret, sizeof(auth.u.umts.k)); > > + memcpy(auth.u.umts.k, state->shared_secret, sizeof(auth.u.umts.k)); Seems I had an echo on the 'p' key... > > > > > > > +int gprs_oap_register(struct gprs_ipa_client *gipac) > > +{ > > + struct gprs_oap_state *state = &gipac->oap; > > + > > + OSMO_ASSERT(state); > > + OSMO_ASSERT(state->sgsn_id); > > + > > + struct msgb *msg = ipa_client_msgb_alloc(); > > + > > + struct gprs_oap_message oap_msg = {0}; > > + oap_msg.message_type = GPRS_OAP_MSGT_REGISTER_REQUEST; > > + oap_msg.sgsn_id = state->sgsn_id; > > + > > + gprs_oap_encode(msg, &oap_msg); > > + > > + state->state = oap_requested_challenge; > > + return gprs_ipa_client_send_oap(gipac, msg); > > +} > > separating encoding and sending will allow us to unittest the > encoder/decoder separately gprs_oap_encode/_decode() can be called directly to test them? You mean I should have a separate create_oap_register_msg() function and call that from gprs_oap_register()? IMHO that's overkill in this instance... The registration message is part of a unit test already, I see no need to separate it further. Let me know if I'm wrong. > > + switch (oap_msg.message_type) { > > + case GPRS_OAP_MSGT_CHALLENGE_REQUEST: > > don?t do this in-place. Please call a function Don't do what in-place? You mean factor the guts of "case: { ... } break;" out to a new function? BTW, I'd be faster grasping the context if you left the entire patch in the reply... no filename, no linenr... :) > > + static const struct gprs_oap_message empty_oap_message = {0}; > > + > > + *oap_msg = empty_oap_message; > > why do we need to copy this? An alternative to memset? Taken from gsup > code? Yes, code pasting syndrome. I have no idea, would have used memset(). Looks interesting though :P > > +/* Wishful thinking to generate a constant time compare */ > > +int gprs_constant_time_cmp(const uint8_t *exp, const uint8_t *rel, const int count) > > +{ > > don?t copy and paste from the NAT but at least put it into a commonly used > function (e.g. somewhere in libcommom/)? I picked the scope most closely wrapping the two users: the gprs subdir. "gprs_utils" did sound like the proper kitchen sink for this... Then again, why not use memcmp()? (this is also basically code I copied from GSUP) > > + if (ipac->updown_cb != NULL) > > + ipac->updown_cb(ipac, up); > > Does it make sense to have the updown_cb be NULL? If no action upon connecting is required, no cb is needed. Here we'd like to call the gprs_oap_register() function once IPA is established, see gprs_ipa_client_updown_cb(). For example, GSUP doesn't need an updown_cb. Note, the "bare IPA client" timers etc. are handled one level deeper, in the function that calls the ipac->updown_cb(): ipa_client_updown_cb(). > > > > - if (hh->proto != IPAC_PROTO_OSMO) > > - goto invalid; > > - > > - if (!he || msgb_l2len(msg) < sizeof(*he) || > > - he->proto != IPAC_PROTO_EXT_GSUP) > > + if (!he || msgb_l2len(msg) < sizeof(*he)) > > goto invalid; > > I think you want to have the first hh->proto check here. As the second part will > use he which is only valid/there if it is IPAC_PROTO_OSMO? Hmmm. Is it? I'd love to assumed that there is always both a PROTO and PROTO_EXT value available... ipaccess_head_ext is defined in ipaccess.h, so is it really specific to IPAC_PROTO_OSMO? > > + // l2h is not sent over the wire, but for the test suite it makes sense > > + // to make l2h point at the IPA message payload. > > Please don?t use C99 comments, e.g. use /* */ hrm. It's so much more effort :P I often disagree on how people use commenting styles... anyway, I'll submit to local rule. Is it: *never* use '//' ? > But why do we add the comment > what changed from the previous implementation? Without the change, l2h pointed at the wrong index and the messages could not be decoded in the test. Re-reading it now, though, makes me think that the order may be wrong entirely. Last time I concluded that this causes l2h to point at the proto_ext header instead of the payload: ipa_prepend_header_ext(msg, proto); ipa_msg_push_header(msg, proto_ext) Like: ipa_prepend_header_ext() prepends the proto_ext byte, and then ipa_msg_push_header() again prepends the "Osmo" protocol header but makes l2h point at the ipa_prepend_header_ext() part. Only, just now I noticed that the proto and proto_ext seem to be swapped. I'll take another look at it, wait for next patch mail... > ?gsup? vs. ?ipa?. > > * If you change config files you need to provide an upgrade path from a config file > that is using ?gsup?. E.g. by adding a DEFUN_DEPRECATED for the old parameter good to know. > * ?ipa? is such a vague name. The SGSN might have several IPA connections to > different kind of systems. One might be used for GSUP. Another one might be for > sending telemetric data. We use this connection for GSUP so let?s keep the current > configuration settings. Was not aware of it, my name choice based on the naive assumption that there is just the one IPA connection. But we're also talking OAP on that IPA line. Can I call it gprs_map_proxy_client, plz? > > -/* Wishful thinking to generate a constant time compare */ > > -static int constant_time_cmp(const uint8_t *exp, const uint8_t *rel, const int count) > > ah ha, but then please don?t call it gprs_constant_time.. wasn't me, was it. I just copied it around. I guess I'll use memcmp() and leave constant_time_cmp() where it belongs: a dark corner of a static C file context. > > if (vec.res_len != 8) { > > LOGP(DNAT, LOGL_ERROR, "Res length is wrong: %d for bsc nr %d\n", > > - keylen, conf->nr); > > + (int)vec.res_len, conf->nr); > > separate commit. And what type is res_len? size_t? then please change the format > identifier. Hey, how did that sneak in here? That patch was committed separately on master. I must have mixed up a branchpoint, this change was supposed to be separate. > > static void ipaccess_auth_bsc(struct tlv_parsed *tvp, struct bsc_connection *bsc) > > diff --git a/openbsc/tests/sgsn/Makefile.am b/openbsc/tests/sgsn/Makefile.am > > index ea29fce..3b45b3f 100644 > > --- a/openbsc/tests/sgsn/Makefile.am > > +++ b/openbsc/tests/sgsn/Makefile.am > > I am afraid you really need to split this change a bit more. My attention span is over > here. come on, just adding entries to a Makefile? ;) And the tests, true. Admitted, I have enough to polish as it is. I'll come back with smaller chunks, if the effort remains reasonable. ~Neels -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 819 bytes Desc: Digital signature URL: From holger at freyther.de Tue Sep 29 13:25:15 2015 From: holger at freyther.de (Holger Freyther) Date: Tue, 29 Sep 2015 15:25:15 +0200 Subject: [PATCH 3/3] Implement OAP for SGSN registration. In-Reply-To: <20150929131037.GB1565@dub5> References: <1443095048-4593-1-git-send-email-nhofmeyr@sysmocom.de> <1443095048-4593-3-git-send-email-nhofmeyr@sysmocom.de> <20150929131037.GB1565@dub5> Message-ID: > On 29 Sep 2015, at 15:10, Neels Hofmeyr wrote: > > /me replying to two mails in one > > > In summary, the questions I'd like answered, see below for details: > - using memcmp() is ok? (re constant_time_cmp()) When comparing the result we should use a constant time compare as otherwise the attacker can find out (by timing) how many bytes of the result were correct and by this determine/find the secrets The classic memcmp will stop on the first byte that is not the same. > >> yes k and opc from two diferent keys would be great. > > I can make it one double-length shared secret and use one half each? > Ah whatever, I'll add secret_k and secret_opc, who knows if we'd like to have > an operator specifc key one day? thanks > >>> +struct gprs_ipa_client { >>> + struct ipa_client *ipac; >> >> In general we subclass by embedding the parent class directly because then > > Problem being, we get a pointer from the constructor: > > struct ipa_client *ipa_client_create(const char *ip_addr, [...] > > (was gsup_client_create(), i.e. someone else wrote this.) > Should I refactor this to > > void ipa_client_create(struct ipa_client*, ...) > > ?? I'm trying to limit API refactoring efforts though. you are right, then leave it as it is. > Not sure what you mean by "split with message encoding/decoding", like, > commit the oap_messages.c in a separate commit? IMHO it's already > separate. but I review top to bottom and then stop somewhere in the middle. if you have separate patches I at least have a natural break somewhere and can easily resume it. :) > log an error at least. > > Am not clear yet how an error in a protocol callback should propagate to > the main loop and barf there. Certainly something grave should happen. ?log an error? means LOGP(BLA, LOGL_ERROR, ?Something bad happened %d\n?, rc); >>> + switch (oap_msg.message_type) { >>> + case GPRS_OAP_MSGT_CHALLENGE_REQUEST: >> >> don?t do this in-place. Please call a function > > Don't do what in-place? You mean factor the guts of "case: { ... } break;" out > to a new function? Yes, factor out the significant code between the {}. > >>> - if (hh->proto != IPAC_PROTO_OSMO) >>> - goto invalid; >>> - >>> - if (!he || msgb_l2len(msg) < sizeof(*he) || >>> - he->proto != IPAC_PROTO_EXT_GSUP) >>> + if (!he || msgb_l2len(msg) < sizeof(*he)) >>> goto invalid; >> >> I think you want to have the first hh->proto check here. As the second part will >> use he which is only valid/there if it is IPAC_PROTO_OSMO? > > Hmmm. Is it? I'd love to assumed that there is always both a PROTO and > PROTO_EXT value available... ipaccess_head_ext is defined in ipaccess.h, so is > it really specific to IPAC_PROTO_OSMO? If there is a PROTO_EXT there is a PROTO but a PROTO does not imply the PROTO_EXT. > hrm. It's so much more effort :P > I often disagree on how people use commenting styles... > anyway, I'll submit to local rule. Is it: *never* use '//? ? Only if the Linux Kernel starts using // > >> * ?ipa? is such a vague name. The SGSN might have several IPA connections to >> different kind of systems. One might be used for GSUP. Another one might be for >> sending telemetric data. We use this connection for GSUP so let?s keep the current >> configuration settings. > > Was not aware of it, my name choice based on the naive assumption that there is > just the one IPA connection. > > But we're also talking OAP on that IPA line. > Can I call it gprs_map_proxy_client, plz? Check with Jacob, he had a reason to pick gsup. For me both names are fine (and gsup slightly favoarable as it is less long). > > >>> -/* Wishful thinking to generate a constant time compare */ >>> -static int constant_time_cmp(const uint8_t *exp, const uint8_t *rel, const int count) >> >> ah ha, but then please don?t call it gprs_constant_time.. > > wasn't me, was it. I just copied it around. I guess I'll use memcmp() and leave > constant_time_cmp() where it belongs: a dark corner of a static C file context. you probably want a constant time comparison too. cheers holger From nhofmeyr at sysmocom.de Wed Sep 30 10:49:42 2015 From: nhofmeyr at sysmocom.de (Neels Hofmeyr) Date: Wed, 30 Sep 2015 12:49:42 +0200 Subject: [PATCH 3/3] Implement OAP for SGSN registration. In-Reply-To: References: <1443095048-4593-1-git-send-email-nhofmeyr@sysmocom.de> <1443095048-4593-3-git-send-email-nhofmeyr@sysmocom.de> <20150929131037.GB1565@dub5> Message-ID: <20150930104942.GA2521@dub5> On Tue, Sep 29, 2015 at 03:25:15PM +0200, Holger Freyther wrote: > > Am not clear yet how an error in a protocol callback should propagate to > > the main loop and barf there. Certainly something grave should happen. > > ?log an error? means LOGP(BLA, LOGL_ERROR, ?Something bad happened %d\n?, rc); yes yes, instead I meant: when a fatal error happens in a callback, how do I make the main loop exit. Specifically, if SGSN registration failed, then do (from the cb), in order of effort: LOGP and... - ignore otherwise, SGSN services may not work. - exit(-ENOTREGISTERED). - set a flag to break main loop. - set a timer at program start, and if we're not registered after a while, exit. - ... Is there a typical way for the osmo universe? ~Neels -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 819 bytes Desc: Digital signature URL: From holger at freyther.de Wed Sep 30 19:52:45 2015 From: holger at freyther.de (Holger Freyther) Date: Wed, 30 Sep 2015 21:52:45 +0200 Subject: [PATCH 3/3] Implement OAP for SGSN registration. In-Reply-To: <20150930104942.GA2521@dub5> References: <1443095048-4593-1-git-send-email-nhofmeyr@sysmocom.de> <1443095048-4593-3-git-send-email-nhofmeyr@sysmocom.de> <20150929131037.GB1565@dub5> <20150930104942.GA2521@dub5> Message-ID: > On 30 Sep 2015, at 12:49, Neels Hofmeyr wrote: > > On Tue, Sep 29, 2015 at 03:25:15PM +0200, Holger Freyther wrote: >>> Am not clear yet how an error in a protocol callback should propagate to >>> the main loop and barf there. Certainly something grave should happen. >> >> ?log an error? means LOGP(BLA, LOGL_ERROR, ?Something bad happened %d\n?, rc); > > yes yes, instead I meant: when a fatal error happens in a callback, how do > I make the main loop exit. Specifically, if SGSN registration failed, then > do (from the cb), in order of effort: > LOGP and... > - ignore otherwise, SGSN services may not work. mostly this and retry and hope that the machine has fixed itself. ;) From y.vashinko at gmail.com Wed Sep 30 13:18:08 2015 From: y.vashinko at gmail.com (Yury Vashinko) Date: Wed, 30 Sep 2015 13:18:08 -0000 Subject: =?UTF-8?Q?openBSC_=D0=B8_Asterisk?= Message-ID: ?????? ????! ????? ??? ?????????, ??? ????? ????. ?????????? openBSC ?? USRP B210 SDR ??? ????????????? asterIsk - ??? ???????? - ??????, ???? ????? ??????. (?????????? Ubuntu) ?????????? ????????????? asterisk ?? ??????? http://openbsc.osmocom.org/trac/wiki/Ettus_USRP_B2xx_family ????? ????????? ????? ?? ??????????????? - ???????????. ????? ??????????, ??? ????? ???? - ????????????? ?????? ???????????? ? ?????????, ???? -------------- next part -------------- An HTML attachment was scrubbed... URL: From bturi01 at bellarmine.edu Wed Sep 23 15:33:42 2015 From: bturi01 at bellarmine.edu (Turi, Benjamin Thomas) Date: Wed, 23 Sep 2015 15:33:42 -0000 Subject: Osmo TRX Make Issue Message-ID: Greetings! I'm not sure if I am emailing the right list, but I got stuck with an error with making Osmo-TRX and need some help. To give you some background, I am doing a project with OpenBTS and GSM. My project is being built on the small, yet powerful Beaglebone Black. As you might now, Osmo TRX is one of the few ARM-friendly transceivers for OpenBTS. I was following the instructions as provided on the main website for install it and when it came time to make the project, I ran across an error: Make: ***No rule to make target '/Makefile.common', needed by 'Makefile.in'. Stop. I am using the code from the github site. Unfortunately, I could not diagnose the bug and the error. Would anyone be able to assist me? Thank you so much for your help, I really do appreciate it! As an added note: Another error that I ran into that you might want to know about is when I ran "autoreconf -i", I got an error saying: C objects in subdir but 'AM_PROG_CC_C_0' not in 'configure.ac' Which caused automake to fail with exit status 1. However, simply adding 'AM_PROG_CC_C_0' to the file configure.ac seemed to fix the problem. Thanks again! :) -------------- next part -------------- An HTML attachment was scrubbed... URL: