From mike.mcternan at wavemobile.com Fri May 1 08:35:08 2015 From: mike.mcternan at wavemobile.com (Mike McTernan (wavemobile)) Date: Fri, 1 May 2015 08:35:08 +0000 Subject: [PATCH] opensgsn: Replace some TODOs with error paths and fix compiler warning In-Reply-To: References: <32C9C3EF-CAFC-4285-A9CA-D107A290E68E@freyther.de> Message-ID: Hi Holger, Sorry about this - I know you are busy. > Which version of OpenGGSN are you using? Where did you check it out? > What is the last git commit? I ask because the patch does not apply and the > line numbers in tun.c are quite different. That's odd. I've cloned from git.osmocom.org. Just taking a fresh tree, it applies cleanly here: $ git clone git://git.osmocom.org/openggsn.git Cloning into 'openggsn'... remote: Counting objects: 1401, done. remote: Compressing objects: 100% (530/530), done. remote: Total 1401 (delta 990), reused 1194 (delta 850) Receiving objects: 100% (1401/1401), 887.13 KiB | 1.58 MiB/s, done. Resolving deltas: 100% (990/990), done. $ cd openggsn $ git apply -p2 ../../osmobss/patches/Check-and-fix-tun-setup-error-paths-v2.patch $ git status # On branch master # Changes not staged for commit: # (use "git add ..." to update what will be committed) # (use "git checkout -- ..." to discard changes in working directory) # # modified: lib/tun.c # no changes added to commit (use "git add" and/or "git commit -a") One thing I should probably have mentioned is that it needs -p2 since I'm using quilt to manage patch sets across the various libosmo*, openbsc, openggsn, bts etc... so it's one dir up. Did I do something wrong in the above? Kind Regards, Mike From mike.mcternan at wavemobile.com Fri May 1 10:23:00 2015 From: mike.mcternan at wavemobile.com (Mike McTernan (wavemobile)) Date: Fri, 1 May 2015 10:23:00 +0000 Subject: [PATCH] bssgp: Fix call to llist_entry in fc_queue_timer_cfg In-Reply-To: <5542756A.2080705@sysmocom.de> References: <1430414883-25640-1-git-send-email-jerlbeck@sysmocom.de> <9BBAB7D2-64C7-4643-9F47-DFD3300F54A9@freyther.de> <5542756A.2080705@sysmocom.de> Message-ID: > On 30.04.2015 20:01, Holger Freyther wrote: > > > >> On 30 Apr 2015, at 19:28, Jacob Erlbeck wrote: > >> This is due to an '&' operator at the wrong place, accessing some > >> parts in fc instead of the first element of the list. Yikes! I think the definition of container_of() shouldn't cast ptr: #define container_of(ptr, type, member) ({ \ - const typeof( ((type *)0)->member ) *__mptr = (typeof( ((type *)0)->member ) *)(ptr); \ + const typeof( ((type *)0)->member ) *__mptr = (ptr); \ (type *)( (char *)__mptr - offsetof(type, member) );}) Signed-off-by: Michael McTernan Then we get one nice warning from gcc: gprs_bssgp.c: In function 'fc_queue_timer_cfg': gprs_bssgp.c:631:9: warning: initialization from incompatible pointer type [enabled by default] Everything I've tried* still compiles and runs with this change (and generates no other warnings), but obviously libosmocore could be used somewhere else where container_of type abuse will now make warnings. If such a case is found where the cast is correct and required, I'd recommend the casting be placed at the calls to container_of() where it is more visible and auditable. Please try the above patch and consider applying it to libosmocore. Jacob, would you also like/be able to check that the above change is good with Coverity, incase that can dig out any other bugs? Kind Regards, Mike * I build the following into my system, some of which use libosmocore: libdbi-0.9.0 libdbi-drivers-0.9.0 libosmo-abis libosmocore libosmo-netif libosmo-sccp openbsc openggsn ortp-0.22.0 osmo-bts osmo-pcu From holger at freyther.de Fri May 1 14:13:41 2015 From: holger at freyther.de (Holger Freyther) Date: Fri, 1 May 2015 16:13:41 +0200 Subject: [PATCH] bssgp: Fix call to llist_entry in fc_queue_timer_cfg In-Reply-To: References: <1430414883-25640-1-git-send-email-jerlbeck@sysmocom.de> <9BBAB7D2-64C7-4643-9F47-DFD3300F54A9@freyther.de> <5542756A.2080705@sysmocom.de> Message-ID: <3A1493EB-72A3-4937-B847-AB4A26905125@freyther.de> > On 01 May 2015, at 12:23, Mike McTernan (wavemobile) wrote: > > > I think the definition of container_of() shouldn't cast ptr: > > #define container_of(ptr, type, member) ({ \ > - const typeof( ((type *)0)->member ) *__mptr = (typeof( ((type *)0)->member ) *)(ptr); \ > + const typeof( ((type *)0)->member ) *__mptr = (ptr); \ > (type *)( (char *)__mptr - offsetof(type, member) );}) good point. I thought we have a void* in our hands but we do have the llist_head here. The container_of macro in linux 2.6.12-rc2 (initial git commit) didn?t cast either so we should definitely take your commit. > Jacob, would you also like/be able to check that the above change is good with Coverity, incase that can dig out any other bugs? Our jenkins only submits HEAD as build to coverity. We don?t have a try server or similar From mike.mcternan at wavemobile.com Fri May 1 15:09:59 2015 From: mike.mcternan at wavemobile.com (Mike McTernan (wavemobile)) Date: Fri, 1 May 2015 15:09:59 +0000 Subject: [PATCH] bssgp: Fix call to llist_entry in fc_queue_timer_cfg In-Reply-To: <3A1493EB-72A3-4937-B847-AB4A26905125@freyther.de> References: <1430414883-25640-1-git-send-email-jerlbeck@sysmocom.de> <9BBAB7D2-64C7-4643-9F47-DFD3300F54A9@freyther.de> <5542756A.2080705@sysmocom.de> <3A1493EB-72A3-4937-B847-AB4A26905125@freyther.de> Message-ID: Hi Holger, > good point. I thought we have a void* in our hands but we do have the > llist_head here. The container_of macro in linux 2.6.12-rc2 (initial git > commit) didn?t cast either so we should definitely take your commit. Great! I subsequently checked too, and couldn't find a version of Linux with the cast. The other change to perhaps consider is what happens when the passed ptr is null. In my projects I tend to use a version of containerof that will return NULL in that case. This is both convenient for NULL checks and ensures we don't end up with a pointer to the top of memory (which will _probably_ segfault so would have been detected). > Our jenkins only submits HEAD as build to coverity. Cool! I just found the Jenkins pages... that's nice to know, thanks. Kind Regards, Mike From holger at freyther.de Sat May 2 06:03:29 2015 From: holger at freyther.de (Holger Freyther) Date: Sat, 2 May 2015 08:03:29 +0200 Subject: [PATCH] bssgp: Fix call to llist_entry in fc_queue_timer_cfg In-Reply-To: References: <1430414883-25640-1-git-send-email-jerlbeck@sysmocom.de> <9BBAB7D2-64C7-4643-9F47-DFD3300F54A9@freyther.de> <5542756A.2080705@sysmocom.de> Message-ID: > On 01 May 2015, at 12:23, Mike McTernan (wavemobile) wrote: > > Yikes! > > I think the definition of container_of() shouldn't cast ptr: > > #define container_of(ptr, type, member) ({ \ > - const typeof( ((type *)0)->member ) *__mptr = (typeof( ((type *)0)->member ) *)(ptr); \ > + const typeof( ((type *)0)->member ) *__mptr = (ptr); \ > (type *)( (char *)__mptr - offsetof(type, member) );}) In OpenBSC the cast was added in be68f6fc6cde1367a4481d2e774a64e2cd657267 Change the variable "new" to "_new" in order to include it from C++ code. The define "container_of" will cast pointer before assigning. Compilers with stricter options require this. (Andreas Eversberg) I still think we should revert the cast and see how C++ code complains and then look at the compiler warning. As you were able to compile osmo-pcu (a C++ app that uses linked lists) it can?t be that bad. From jerlbeck at sysmocom.de Mon May 4 05:57:52 2015 From: jerlbeck at sysmocom.de (Jacob Erlbeck) Date: Mon, 4 May 2015 07:57:52 +0200 Subject: [PATCH] bssgp/test: Fix bssgp-fc test In-Reply-To: <1430414883-25640-1-git-send-email-jerlbeck@sysmocom.de> References: <1430414883-25640-1-git-send-email-jerlbeck@sysmocom.de> Message-ID: <1430719072-10974-1-git-send-email-jerlbeck@sysmocom.de> The fix in the commit "bssgp: Fix call to llist_entry in fc_queue_timer_cfg" prevents the flow control code from generating certain logging messages ("-BSSGP-FC: fc_timer_cb() but still not able to send PDU of 10 bytes") during the tests. This breaks the test suite, since the update of the correseponding stderr output file misses. This commit updates the bssgp_fc_tests.err file accordingly. Sponsored-by: On-Waves ehf --- tests/gb/bssgp_fc_tests.err | 30 ------------------------------ 1 file changed, 30 deletions(-) diff --git a/tests/gb/bssgp_fc_tests.err b/tests/gb/bssgp_fc_tests.err index 2f285af..113a359 100644 --- a/tests/gb/bssgp_fc_tests.err +++ b/tests/gb/bssgp_fc_tests.err @@ -1,23 +1,3 @@ -BSSGP-FC: fc_timer_cb() but still not able to send PDU of 10 bytes -BSSGP-FC: fc_timer_cb() but still not able to send PDU of 10 bytes -BSSGP-FC: fc_timer_cb() but still not able to send PDU of 10 bytes -BSSGP-FC: fc_timer_cb() but still not able to send PDU of 10 bytes -BSSGP-FC: fc_timer_cb() but still not able to send PDU of 10 bytes -BSSGP-FC: fc_timer_cb() but still not able to send PDU of 10 bytes -BSSGP-FC: fc_timer_cb() but still not able to send PDU of 10 bytes -BSSGP-FC: fc_timer_cb() but still not able to send PDU of 10 bytes -BSSGP-FC: fc_timer_cb() but still not able to send PDU of 10 bytes -BSSGP-FC: fc_timer_cb() but still not able to send PDU of 10 bytes -BSSGP-FC: fc_timer_cb() but still not able to send PDU of 10 bytes -BSSGP-FC: fc_timer_cb() but still not able to send PDU of 10 bytes -BSSGP-FC: fc_timer_cb() but still not able to send PDU of 10 bytes -BSSGP-FC: fc_timer_cb() but still not able to send PDU of 10 bytes -BSSGP-FC: fc_timer_cb() but still not able to send PDU of 10 bytes -BSSGP-FC: fc_timer_cb() but still not able to send PDU of 10 bytes -BSSGP-FC: fc_timer_cb() but still not able to send PDU of 10 bytes -BSSGP-FC: fc_timer_cb() but still not able to send PDU of 10 bytes -BSSGP-FC: fc_timer_cb() but still not able to send PDU of 10 bytes -BSSGP-FC: fc_timer_cb() but still not able to send PDU of 10 bytes Single PDU (size=1000) is larger than maximum bucket size (100)! Single PDU (size=1000) is larger than maximum bucket size (100)! Single PDU (size=1000) is larger than maximum bucket size (100)! @@ -38,13 +18,3 @@ Single PDU (size=1000) is larger than maximum bucket size (100)! Single PDU (size=1000) is larger than maximum bucket size (100)! Single PDU (size=1000) is larger than maximum bucket size (100)! Single PDU (size=1000) is larger than maximum bucket size (100)! -BSSGP-FC: fc_timer_cb() but still not able to send PDU of 10 bytes -BSSGP-FC: fc_timer_cb() but still not able to send PDU of 10 bytes -BSSGP-FC: fc_timer_cb() but still not able to send PDU of 10 bytes -BSSGP-FC: fc_timer_cb() but still not able to send PDU of 10 bytes -BSSGP-FC: fc_timer_cb() but still not able to send PDU of 10 bytes -BSSGP-FC: fc_timer_cb() but still not able to send PDU of 10 bytes -BSSGP-FC: fc_timer_cb() but still not able to send PDU of 10 bytes -BSSGP-FC: fc_timer_cb() but still not able to send PDU of 10 bytes -BSSGP-FC: fc_timer_cb() but still not able to send PDU of 10 bytes -BSSGP-FC: fc_timer_cb() but still not able to send PDU of 10 bytes -- 1.9.1 From mike.mcternan at wavemobile.com Tue May 5 08:25:27 2015 From: mike.mcternan at wavemobile.com (Mike McTernan (wavemobile)) Date: Tue, 5 May 2015 08:25:27 +0000 Subject: [PATCH] bssgp: Fix call to llist_entry in fc_queue_timer_cfg In-Reply-To: References: <1430414883-25640-1-git-send-email-jerlbeck@sysmocom.de> <9BBAB7D2-64C7-4643-9F47-DFD3300F54A9@freyther.de> <5542756A.2080705@sysmocom.de> Message-ID: > I still think we should revert the cast and see how C++ code complains Is anyone suggesting the cast should be kept? In my view it would be a kind of madness to keep the cast - C is weakly typed as it is, so removing the little type checking we can get from the compiler is foolhardy and will just create subtle timewasting bugs. C++ has better typing, generics and true OO, so I don't see why the cast should be present there, or that container_of should be particularly useful when better type-safety can be achieved. > and then look at the compiler warning. The particular warning I highlighted is the one fixed by Jacob's recent patch. It's something of a proof as to how dangerous that cast is. I'm happy to take a look at others if they can be found (hence I was wondering about Coverity, but it looks like we have to submit a change before we can get the results via Jenkins). > As you were able to compile osmo-pcu (a C++ app > that uses linked lists) it can?t be that bad. Just to recap, I've complied and ran the following without any additional warnings or problems (though I've not ran all the tests, the libosmocore test all pass without the cast): libdbi-0.9.0 libosmo-abis libosmo-netif openggsn osmo-bts libdbi-drivers-0.9.0 libosmocore libosmo-sccp openbsc ortp-0.22.0 osmo-pcu sqlite-autoconf-3080802 There are many packages in the osmocom git - are there any other significant projects which should be checked? Is there anything significant that Jenkins doesn't cover? Kind Regards, Mike From holger at freyther.de Tue May 5 09:38:30 2015 From: holger at freyther.de (Holger Freyther) Date: Tue, 5 May 2015 11:38:30 +0200 Subject: [PATCH] bssgp: Fix call to llist_entry in fc_queue_timer_cfg In-Reply-To: References: <1430414883-25640-1-git-send-email-jerlbeck@sysmocom.de> <9BBAB7D2-64C7-4643-9F47-DFD3300F54A9@freyther.de> <5542756A.2080705@sysmocom.de> Message-ID: <9D0129F0-B5CA-445D-B97B-7AA0657E69FF@freyther.de> > On 05 May 2015, at 10:25, Mike McTernan (wavemobile) wrote: > >> I still think we should revert the cast and see how C++ code complains > > Is anyone suggesting the cast should be kept? no, and I had already pushed a change (outlook mangled your diff so I applied the change by hand). Thanks for proposing this solution.. i thought we deal with void* at this point. http://git.osmocom.org/libosmocore/commit/?id=780bba625d2d09478527ec6038f0f6e15eb6e651 From mike.mcternan at wavemobile.com Tue May 5 09:44:05 2015 From: mike.mcternan at wavemobile.com (Mike McTernan (wavemobile)) Date: Tue, 5 May 2015 09:44:05 +0000 Subject: [PATCH] bssgp: Fix call to llist_entry in fc_queue_timer_cfg In-Reply-To: <9D0129F0-B5CA-445D-B97B-7AA0657E69FF@freyther.de> References: <1430414883-25640-1-git-send-email-jerlbeck@sysmocom.de> <9BBAB7D2-64C7-4643-9F47-DFD3300F54A9@freyther.de> <5542756A.2080705@sysmocom.de> <9D0129F0-B5CA-445D-B97B-7AA0657E69FF@freyther.de> Message-ID: > no, and I had already pushed a change Great! Thanks, that's one less patch in my quilt :-) > (outlook mangled your diff so I applied the change by hand). Hmm, Outlook is such a pain. Many Thanks, Mike From jerlbeck at sysmocom.de Wed May 6 07:29:32 2015 From: jerlbeck at sysmocom.de (Jacob Erlbeck) Date: Wed, 6 May 2015 09:29:32 +0200 Subject: [PATCH] bssgp: Fix bssgp_tx_fc_bvc parameter type Message-ID: <1430897372-32371-1-git-send-email-jerlbeck@sysmocom.de> Currently large values for Bmax default MS get sliced since a uint16_t is used as the type of the corresponding parameter of bssgp_tx_fc_bvc. GSM 48.018, 11.3.2 which in turn refers to 11.3.5 specifies a maximum of 6MB (0xffff * 100). This commit changes the type to uint32_t to cover the full value range. Sponsored-by: On-Waves ehf --- TODO-RELEASE | 1 + include/osmocom/gprs/gprs_bssgp_bss.h | 2 +- src/gb/gprs_bssgp_bss.c | 2 +- tests/gb/gprs_bssgp_test.c | 75 +++++++++++++++++++++++++++++++++++ tests/gb/gprs_bssgp_test.ok | 4 ++ 5 files changed, 82 insertions(+), 2 deletions(-) diff --git a/TODO-RELEASE b/TODO-RELEASE index 43b1e8e..322dfb0 100644 --- a/TODO-RELEASE +++ b/TODO-RELEASE @@ -1 +1,2 @@ #library what description / commit summary line +libosmocore abi-change bssgp: Fix bssgp_tx_fc_bvc parameter type diff --git a/include/osmocom/gprs/gprs_bssgp_bss.h b/include/osmocom/gprs/gprs_bssgp_bss.h index e426698..d79b210 100644 --- a/include/osmocom/gprs/gprs_bssgp_bss.h +++ b/include/osmocom/gprs/gprs_bssgp_bss.h @@ -65,7 +65,7 @@ int bssgp_rx_paging(struct bssgp_paging_info *pinfo, int bssgp_tx_fc_bvc(struct bssgp_bvc_ctx *bctx, uint8_t tag, uint32_t bucket_size, uint32_t bucket_leak_rate, - uint16_t bmax_default_ms, uint32_t r_default_ms, + uint32_t bmax_default_ms, uint32_t r_default_ms, uint8_t *bucket_full_ratio, uint32_t *queue_delay_ms); int bssgp_tx_fc_ms(struct bssgp_bvc_ctx *bctx, uint32_t tlli, uint8_t tag, diff --git a/src/gb/gprs_bssgp_bss.c b/src/gb/gprs_bssgp_bss.c index 5731959..962bf2e 100644 --- a/src/gb/gprs_bssgp_bss.c +++ b/src/gb/gprs_bssgp_bss.c @@ -315,7 +315,7 @@ int bssgp_tx_bvc_reset(struct bssgp_bvc_ctx *bctx, uint16_t bvci, uint8_t cause) */ int bssgp_tx_fc_bvc(struct bssgp_bvc_ctx *bctx, uint8_t tag, uint32_t bucket_size, uint32_t bucket_leak_rate, - uint16_t bmax_default_ms, uint32_t r_default_ms, + uint32_t bmax_default_ms, uint32_t r_default_ms, uint8_t *bucket_full_ratio, uint32_t *queue_delay_ms) { struct msgb *msg; diff --git a/tests/gb/gprs_bssgp_test.c b/tests/gb/gprs_bssgp_test.c index b454430..63abf8b 100644 --- a/tests/gb/gprs_bssgp_test.c +++ b/tests/gb/gprs_bssgp_test.c @@ -17,6 +17,7 @@ #include #include #include +#include #include #include @@ -60,6 +61,17 @@ int gprs_ns_callback(enum gprs_ns_evt event, struct gprs_nsvc *nsvc, return 0; } +struct msgb *last_ns_tx_msg = NULL; + +/* override */ +int gprs_ns_sendmsg(struct gprs_ns_inst *nsi, struct msgb *msg) +{ + msgb_free(last_ns_tx_msg); + last_ns_tx_msg = msg; + + return msgb_length(msg); +} + int bssgp_prim_cb(struct osmo_prim_hdr *oph, void *ctx) { printf("BSSGP primitive, SAP %d, prim = %d, op = %d, msg = %s\n", @@ -174,6 +186,68 @@ static void test_bssgp_bad_reset() msgb_bssgp_send_and_free(msg); } +static void test_bssgp_flow_control_bvc(void) +{ + struct bssgp_bvc_ctx bctx = { + .nsei = 0x1234, + .bvci = 0x5678, + }; + const uint8_t tag = 42; + const uint32_t bmax = 0x1022 * 100; + const uint32_t rate = 0xc040 / 8 * 100; + const uint32_t bmax_ms = bmax / 2; + const uint32_t rate_ms = rate / 2; + uint8_t ratio = 0x78; + uint32_t qdelay = 0x1144 * 10; + int rc; + + static uint8_t expected_simple_msg[] = { + 0x26, + 0x1e, 0x81, 0x2a, /* tag */ + 0x05, 0x82, 0x10, 0x22, /* Bmax */ + 0x03, 0x82, 0xc0, 0x40, /* R */ + 0x01, 0x82, 0x08, 0x11, /* Bmax_MS */ + 0x1c, 0x82, 0x60, 0x20, /* R_MS */ + }; + + static uint8_t expected_ext_msg[] = { + 0x26, + 0x1e, 0x81, 0x2a, /* tag */ + 0x05, 0x82, 0x10, 0x22, /* Bmax */ + 0x03, 0x82, 0xc0, 0x40, /* R */ + 0x01, 0x82, 0x08, 0x11, /* Bmax_MS */ + 0x1c, 0x82, 0x60, 0x20, /* R_MS */ + 0x3c, 0x81, 0x78, /* ratio */ + 0x06, 0x82, 0x11, 0x44, /* Qdelay */ + }; + + printf("----- %s START\n", __func__); + + rc = bssgp_tx_fc_bvc(&bctx, tag, bmax, rate, bmax_ms, rate_ms, + NULL, NULL); + + OSMO_ASSERT(rc >= 0); + OSMO_ASSERT(last_ns_tx_msg != NULL); + printf("Got message: %s\n", msgb_hexdump(last_ns_tx_msg)); + OSMO_ASSERT(msgb_length(last_ns_tx_msg) == sizeof(expected_simple_msg)); + OSMO_ASSERT(0 == memcmp(msgb_data(last_ns_tx_msg), + expected_simple_msg, sizeof(expected_simple_msg))); + + rc = bssgp_tx_fc_bvc(&bctx, tag, bmax, rate, bmax_ms, rate_ms, + &ratio, &qdelay); + + OSMO_ASSERT(rc >= 0); + OSMO_ASSERT(last_ns_tx_msg != NULL); + printf("Got message: %s\n", msgb_hexdump(last_ns_tx_msg)); + OSMO_ASSERT(msgb_length(last_ns_tx_msg) == sizeof(expected_ext_msg)); + OSMO_ASSERT(0 == memcmp(msgb_data(last_ns_tx_msg), + expected_ext_msg, sizeof(expected_ext_msg))); + + msgb_free(last_ns_tx_msg); + last_ns_tx_msg = NULL; + + printf("----- %s END\n", __func__); +} static struct log_info info = {}; @@ -198,6 +272,7 @@ int main(int argc, char **argv) test_bssgp_suspend_resume(); test_bssgp_status(); test_bssgp_bad_reset(); + test_bssgp_flow_control_bvc(); printf("===== BSSGP test END\n\n"); exit(EXIT_SUCCESS); diff --git a/tests/gb/gprs_bssgp_test.ok b/tests/gb/gprs_bssgp_test.ok index 0392e6a..a011bee 100644 --- a/tests/gb/gprs_bssgp_test.ok +++ b/tests/gb/gprs_bssgp_test.ok @@ -7,5 +7,9 @@ BSSGP primitive, SAP 16777219, prim = 4, op = 0, msg = 0e 1f 84 f0 12 34 56 1b 8 BSSGP primitive, SAP 16777221, prim = 11, op = 2, msg = 41 07 81 27 BSSGP primitive, SAP 16777221, prim = 11, op = 2, msg = 41 07 81 05 04 82 04 d2 ----- test_bssgp_status END +----- test_bssgp_flow_control_bvc START +Got message: 26 1e 81 2a 05 82 10 22 03 82 c0 40 01 82 08 11 1c 82 60 20 +Got message: 26 1e 81 2a 05 82 10 22 03 82 c0 40 01 82 08 11 1c 82 60 20 3c 81 78 06 82 11 44 +----- test_bssgp_flow_control_bvc END ===== BSSGP test END -- 1.9.1 From amber_sarosh at hotmail.com Wed May 6 07:38:50 2015 From: amber_sarosh at hotmail.com (Amber and Sarosh) Date: Wed, 6 May 2015 12:38:50 +0500 Subject: =?windows-1256?Q?Help_-_Dua?= =?windows-1256?Q?l_channel_?= =?windows-1256?Q?on_UmTRX=FE?= Message-ID: Hi We have configured OsmoNITB, OsmoBTS and OsmoTRX to run two transceivers using UmTRX. But somehow when the spectrum is monitored, the only frequency that is detected is the one TRX0 is tuned to. ARFCN set for TRX1 is not detected i.e. TRX1 does not seem to be transmitting on the specified frequency. Can anyone please tell what possibly could be the issue? Thanks & Regards, Amber & Sarosh -------------- next part -------------- An HTML attachment was scrubbed... URL: From holger at freyther.de Wed May 6 15:48:28 2015 From: holger at freyther.de (Holger Freyther) Date: Wed, 6 May 2015 17:48:28 +0200 Subject: [PATCH 2/5] sgsn: Extract the MSISDN from the subscr data structure In-Reply-To: <1430927311-7972-1-git-send-email-holger@freyther.de> References: <1430927311-7972-1-git-send-email-holger@freyther.de> Message-ID: <1430927311-7972-2-git-send-email-holger@freyther.de> From: Holger Hans Peter Freyther In case there is a subscr attached to the MM context and there is an encoded MSISDN we will attempt to decode it and in case of an international number prepend a '+'. Assume that the array size of gsm_mmcc_called->number is as big as ctx->msisdn for the strncpy. --- openbsc/src/gprs/gprs_gmm.c | 34 ++++++++++++++++++++++++++++++++++ openbsc/tests/sgsn/sgsn_test.c | 4 ++++ 2 files changed, 38 insertions(+) diff --git a/openbsc/src/gprs/gprs_gmm.c b/openbsc/src/gprs/gprs_gmm.c index ace0c2e..2a856a6 100644 --- a/openbsc/src/gprs/gprs_gmm.c +++ b/openbsc/src/gprs/gprs_gmm.c @@ -545,6 +545,38 @@ static int gsm48_rx_gmm_auth_ciph_resp(struct sgsn_mm_ctx *ctx, return gsm48_gmm_authorize(ctx); } +static void extract_subscr_msisdn(struct sgsn_mm_ctx *ctx) +{ + struct gsm_mncc_number called; + uint8_t msisdn[sizeof(ctx->subscr->sgsn_data->msisdn) + 1]; + + /* Convert MSISDN from encoded to string.. */ + if (!ctx->subscr) + return; + + if (ctx->subscr->sgsn_data->msisdn_len < 1) + return; + + /* prepare the data for the decoder */ + memset(&called, 0, sizeof(called)); + msisdn[0] = ctx->subscr->sgsn_data->msisdn_len; + memcpy(&msisdn[1], ctx->subscr->sgsn_data->msisdn, + ctx->subscr->sgsn_data->msisdn_len); + + /* decode the string now */ + gsm48_decode_called(&called, msisdn); + + /* Prepend a '+' for international numbers */ + if (called.plan == 1 && called.type == 1) { + ctx->msisdn[0] = '+'; + strncpy(&ctx->msisdn[1], called.number, + sizeof(ctx->msisdn) - 1); + } else { + strncpy(&ctx->msisdn[0], called.number, + sizeof(ctx->msisdn) - 1); + } +} + /* Check if we can already authorize a subscriber */ static int gsm48_gmm_authorize(struct sgsn_mm_ctx *ctx) { @@ -604,6 +636,8 @@ static int gsm48_gmm_authorize(struct sgsn_mm_ctx *ctx) "no pending request, authorization completed\n"); break; case GSM48_MT_GMM_ATTACH_REQ: + + extract_subscr_msisdn(ctx); #ifdef PTMSI_ALLOC /* Start T3350 and re-transmit up to 5 times until ATTACH COMPLETE */ mmctx_timer_start(ctx, 3350, GSM0408_T3350_SECS); diff --git a/openbsc/tests/sgsn/sgsn_test.c b/openbsc/tests/sgsn/sgsn_test.c index d9b162d..879dfe3 100644 --- a/openbsc/tests/sgsn/sgsn_test.c +++ b/openbsc/tests/sgsn/sgsn_test.c @@ -953,6 +953,8 @@ retry_attach_req: /* check that the MM context has not been removed due to a * failed authorization */ OSMO_ASSERT(ctx == sgsn_mm_ctx_by_tlli(foreign_tlli, &raid)); + if (ctx->subscr && ctx->subscr->sgsn_data->msisdn_len > 0) + OSMO_ASSERT(strcmp(ctx->msisdn, "+49166213323") == 0); } if (retry && sgsn_tx_counter == 0) @@ -1151,6 +1153,8 @@ int my_subscr_request_update_gsup_auth(struct sgsn_mm_ctx *mmctx) { 0x10, 0x01, 0x01, 0x11, 0x02, 0xf1, 0x21, /* IPv4 */ 0x12, 0x09, 0x04, 't', 'e', 's', 't', 0x03, 'a', 'p', 'n', + 0x08, 0x07, /* MSISDN 49166213323 encoded */ + 0x91, 0x94, 0x61, 0x26, 0x31, 0x23, 0xF3, }; OSMO_ASSERT(!mmctx || mmctx->subscr); -- 2.3.5 From holger at freyther.de Wed May 6 15:48:27 2015 From: holger at freyther.de (Holger Freyther) Date: Wed, 6 May 2015 17:48:27 +0200 Subject: [PATCH 1/5] sgsn: Make the free function internal Message-ID: <1430927311-7972-1-git-send-email-holger@freyther.de> From: Holger Hans Peter Freyther All calls should and do go through the sgsn_mm_ctx_cleanup_free function. --- openbsc/include/openbsc/gprs_sgsn.h | 1 - openbsc/src/gprs/gprs_sgsn.c | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/openbsc/include/openbsc/gprs_sgsn.h b/openbsc/include/openbsc/gprs_sgsn.h index 7a429cd..9e855f8 100644 --- a/openbsc/include/openbsc/gprs_sgsn.h +++ b/openbsc/include/openbsc/gprs_sgsn.h @@ -152,7 +152,6 @@ struct sgsn_mm_ctx *sgsn_mm_ctx_by_imsi(const char *imsi); /* Allocate a new SGSN MM context */ struct sgsn_mm_ctx *sgsn_mm_ctx_alloc(uint32_t tlli, const struct gprs_ra_id *raid); -void sgsn_mm_ctx_free(struct sgsn_mm_ctx *mm); void sgsn_mm_ctx_cleanup_free(struct sgsn_mm_ctx *ctx); struct sgsn_ggsn_ctx *sgsn_mm_ctx_find_ggsn_ctx(struct sgsn_mm_ctx *mmctx, diff --git a/openbsc/src/gprs/gprs_sgsn.c b/openbsc/src/gprs/gprs_sgsn.c index 711540e..2f5d39e 100644 --- a/openbsc/src/gprs/gprs_sgsn.c +++ b/openbsc/src/gprs/gprs_sgsn.c @@ -183,7 +183,7 @@ struct sgsn_mm_ctx *sgsn_mm_ctx_alloc(uint32_t tlli, /* this is a hard _free_ function, it doesn't clean up the PDP contexts * in libgtp! */ -void sgsn_mm_ctx_free(struct sgsn_mm_ctx *mm) +static void sgsn_mm_ctx_free(struct sgsn_mm_ctx *mm) { struct sgsn_pdp_ctx *pdp, *pdp2; -- 2.3.5 From holger at freyther.de Wed May 6 15:48:29 2015 From: holger at freyther.de (Holger Freyther) Date: Wed, 6 May 2015 17:48:29 +0200 Subject: [PATCH 3/5] sgsn: Add various signals consumed by CDR or other client code In-Reply-To: <1430927311-7972-1-git-send-email-holger@freyther.de> References: <1430927311-7972-1-git-send-email-holger@freyther.de> Message-ID: <1430927311-7972-3-git-send-email-holger@freyther.de> From: Holger Hans Peter Freyther --- openbsc/include/openbsc/signal.h | 21 ++++++++++++++++++++- openbsc/src/gprs/gprs_gmm.c | 31 ++++++++++++++++++++++++++++++- openbsc/src/gprs/gprs_sgsn.c | 19 +++++++++++++++++++ openbsc/src/gprs/sgsn_libgtp.c | 11 +++++++++++ 4 files changed, 80 insertions(+), 2 deletions(-) diff --git a/openbsc/include/openbsc/signal.h b/openbsc/include/openbsc/signal.h index 39319f1..8f27b38 100644 --- a/openbsc/include/openbsc/signal.h +++ b/openbsc/include/openbsc/signal.h @@ -1,5 +1,5 @@ /* Generic signalling/notification infrastructure */ -/* (C) 2009-2010 by Holger Hans Peter Freyther +/* (C) 2009-2010, 2015 by Holger Hans Peter Freyther * (C) 2009 by Harald Welte * (C) 2010 by On-Waves * All Rights Reserved @@ -46,6 +46,7 @@ enum signal_subsystems { SS_MSC, SS_HO, SS_CCCH, + SS_SGSN, }; /* SS_PAGING signals */ @@ -241,4 +242,22 @@ struct ccch_signal_data { uint16_t rach_access_count; }; +/* GPRS SGSN signals SS_SGSN */ +enum signal_sgsn { + S_SGSN_ATTACH, + S_SGSN_DETACH, + S_SGSN_UPDATE, + S_SGSN_PDP_ACT, + S_SGSN_PDP_DEACT, + S_SGSN_PDP_TERMINATE, + S_SGSN_PDP_FREE, + S_SGSN_MM_FREE, +}; + +struct sgsn_mm_ctx; +struct sgsn_signal_data { + struct sgsn_mm_ctx *mm; + struct sgsn_pdp_ctx *pdp; /* non-NULL for PDP_ACT, PDP_DEACT, PDP_FREE */ +}; + #endif diff --git a/openbsc/src/gprs/gprs_gmm.c b/openbsc/src/gprs/gprs_gmm.c index 2a856a6..8ada3d4 100644 --- a/openbsc/src/gprs/gprs_gmm.c +++ b/openbsc/src/gprs/gprs_gmm.c @@ -52,6 +52,7 @@ #include #include #include +#include #include @@ -580,6 +581,10 @@ static void extract_subscr_msisdn(struct sgsn_mm_ctx *ctx) /* Check if we can already authorize a subscriber */ static int gsm48_gmm_authorize(struct sgsn_mm_ctx *ctx) { +#ifndef PTMSI_ALLOC + struct sgsn_signal_data sig_data; +#endif + /* Request IMSI and IMEI from the MS if they are unknown */ if (!strlen(ctx->imei)) { ctx->t3370_id_type = GSM_MI_TYPE_IMEI; @@ -643,6 +648,9 @@ static int gsm48_gmm_authorize(struct sgsn_mm_ctx *ctx) mmctx_timer_start(ctx, 3350, GSM0408_T3350_SECS); ctx->t3350_mode = GMM_T3350_MODE_ATT; #else + memset(&sig_data, 0, sizeof(sig_data)); + sig_data.mm = mmctx; + osmo_signal_dispatch(SS_SGSN, S_SGSN_ATTACH, &sig_data); ctx->mm_state = GMM_REGISTERED_NORMAL; #endif @@ -976,8 +984,13 @@ static int gsm48_rx_gmm_det_req(struct sgsn_mm_ctx *ctx, struct msgb *msg) rc = gsm48_tx_gmm_det_ack_oldmsg(msg, 0); } - if (ctx) + if (ctx) { + struct sgsn_signal_data sig_data; + memset(&sig_data, 0, sizeof(sig_data)); + sig_data.mm = ctx; + osmo_signal_dispatch(SS_SGSN, S_SGSN_DETACH, &sig_data); mm_ctx_cleanup_free(ctx, "GPRS DETACH REQUEST"); + } return rc; } @@ -1083,6 +1096,9 @@ static void process_ms_ctx_status(struct sgsn_mm_ctx *mmctx, static int gsm48_rx_gmm_ra_upd_req(struct sgsn_mm_ctx *mmctx, struct msgb *msg, struct gprs_llc_llme *llme) { +#ifndef PTMSI_ALLOC + struct sgsn_signal_data sig_data; +#endif struct gsm48_hdr *gh = (struct gsm48_hdr *) msgb_gmmh(msg); uint8_t *cur = gh->data; uint8_t ms_ra_acc_cap_len; @@ -1168,6 +1184,10 @@ static int gsm48_rx_gmm_ra_upd_req(struct sgsn_mm_ctx *mmctx, struct msgb *msg, #else /* Make sure we are NORMAL (i.e. not SUSPENDED anymore) */ mmctx->mm_state = GMM_REGISTERED_NORMAL; + + memset(&sig_data, 0, sizeof(sig_data)); + sig_data.mm = mmctx; + osmo_signal_dispatch(SS_SGSN, S_SGSN_UPDATE, &sig_data); #endif /* Even if there is no P-TMSI allocated, the MS will switch from * foreign TLLI to local TLLI */ @@ -1217,6 +1237,7 @@ static int gsm48_rx_gmm_status(struct sgsn_mm_ctx *mmctx, struct msgb *msg) static int gsm0408_rcv_gmm(struct sgsn_mm_ctx *mmctx, struct msgb *msg, struct gprs_llc_llme *llme) { + struct sgsn_signal_data sig_data; struct gsm48_hdr *gh = (struct gsm48_hdr *) msgb_gmmh(msg); int rc; @@ -1298,6 +1319,10 @@ static int gsm0408_rcv_gmm(struct sgsn_mm_ctx *mmctx, struct msgb *msg, GPRS_ALGO_GEA0, NULL); mmctx->mm_state = GMM_REGISTERED_NORMAL; rc = 0; + + memset(&sig_data, 0, sizeof(sig_data)); + sig_data.mm = mmctx; + osmo_signal_dispatch(SS_SGSN, S_SGSN_ATTACH, &sig_data); break; case GSM48_MT_GMM_RA_UPD_COMPL: /* only in case SGSN offered new P-TMSI */ @@ -1312,6 +1337,10 @@ static int gsm0408_rcv_gmm(struct sgsn_mm_ctx *mmctx, struct msgb *msg, GPRS_ALGO_GEA0, NULL); mmctx->mm_state = GMM_REGISTERED_NORMAL; rc = 0; + + memset(&sig_data, 0, sizeof(sig_data)); + sig_data.mm = mmctx; + osmo_signal_dispatch(SS_SGSN, S_SGSN_UPDATE, &sig_data); break; case GSM48_MT_GMM_PTMSI_REALL_COMPL: LOGMMCTXP(LOGL_INFO, mmctx, "-> PTMSI REALLLICATION COMPLETE\n"); diff --git a/openbsc/src/gprs/gprs_sgsn.c b/openbsc/src/gprs/gprs_sgsn.c index 2f5d39e..5fe4e61 100644 --- a/openbsc/src/gprs/gprs_sgsn.c +++ b/openbsc/src/gprs/gprs_sgsn.c @@ -36,6 +36,7 @@ #include #include #include +#include #include "openbsc/gprs_llc.h" #include @@ -204,6 +205,7 @@ void sgsn_mm_ctx_cleanup_free(struct sgsn_mm_ctx *mm) struct gprs_llc_llme *llme = mm->llme; uint32_t tlli = mm->tlli; struct sgsn_pdp_ctx *pdp, *pdp2; + struct sgsn_signal_data sig_data; /* delete all existing PDP contexts for this MS */ llist_for_each_entry_safe(pdp, pdp2, &mm->pdp_list, list) { @@ -217,6 +219,11 @@ void sgsn_mm_ctx_cleanup_free(struct sgsn_mm_ctx *mm) osmo_timer_del(&mm->timer); } + memset(&sig_data, 0, sizeof(sig_data)); + sig_data.mm = mm; + osmo_signal_dispatch(SS_SGSN, S_SGSN_MM_FREE, &sig_data); + + /* Detach from subscriber which is possibly freed then */ if (mm->subscr) { struct gsm_subscriber *subscr = subscr_get(mm->subscr); @@ -289,6 +296,8 @@ struct sgsn_pdp_ctx *sgsn_pdp_ctx_alloc(struct sgsn_mm_ctx *mm, */ void sgsn_pdp_ctx_terminate(struct sgsn_pdp_ctx *pdp) { + struct sgsn_signal_data sig_data; + OSMO_ASSERT(pdp->mm != NULL); /* There might still be pending callbacks in libgtp. So the parts of @@ -299,6 +308,10 @@ void sgsn_pdp_ctx_terminate(struct sgsn_pdp_ctx *pdp) /* Force the deactivation of the SNDCP layer */ sndcp_sm_deactivate_ind(&pdp->mm->llme->lle[pdp->sapi], pdp->nsapi); + memset(&sig_data, 0, sizeof(sig_data)); + sig_data.pdp = pdp; + osmo_signal_dispatch(SS_SGSN, S_SGSN_PDP_TERMINATE, &sig_data); + /* Detach from MM context */ llist_del(&pdp->list); pdp->mm = NULL; @@ -313,6 +326,12 @@ void sgsn_pdp_ctx_terminate(struct sgsn_pdp_ctx *pdp) */ void sgsn_pdp_ctx_free(struct sgsn_pdp_ctx *pdp) { + struct sgsn_signal_data sig_data; + + memset(&sig_data, 0, sizeof(sig_data)); + sig_data.pdp = pdp; + osmo_signal_dispatch(SS_SGSN, S_SGSN_PDP_FREE, &sig_data); + rate_ctr_group_free(pdp->ctrg); if (pdp->mm) llist_del(&pdp->list); diff --git a/openbsc/src/gprs/sgsn_libgtp.c b/openbsc/src/gprs/sgsn_libgtp.c index eee3ef2..af5c93d 100644 --- a/openbsc/src/gprs/sgsn_libgtp.c +++ b/openbsc/src/gprs/sgsn_libgtp.c @@ -287,6 +287,7 @@ static const struct cause_map gtp2sm_cause_map[] = { /* The GGSN has confirmed the creation of a PDP Context */ static int create_pdp_conf(struct pdp_t *pdp, void *cbp, int cause) { + struct sgsn_signal_data sig_data; struct sgsn_pdp_ctx *pctx = cbp; uint8_t reject_cause; @@ -322,6 +323,11 @@ static int create_pdp_conf(struct pdp_t *pdp, void *cbp, int cause) /* Activate the SNDCP layer */ sndcp_sm_activate_ind(&pctx->mm->llme->lle[pctx->sapi], pctx->nsapi); + /* Inform others about it */ + memset(&sig_data, 0, sizeof(sig_data)); + sig_data.pdp = pctx; + osmo_signal_dispatch(SS_SGSN, S_SGSN_PDP_ACT, &sig_data); + /* Send PDP CTX ACT to MS */ return gsm48_tx_gsm_act_pdp_acc(pctx); @@ -349,12 +355,17 @@ reject: /* Confirmation of a PDP Context Delete */ static int delete_pdp_conf(struct pdp_t *pdp, void *cbp, int cause) { + struct sgsn_signal_data sig_data; struct sgsn_pdp_ctx *pctx = cbp; int rc = 0; LOGPDPCTXP(LOGL_INFO, pctx, "Received DELETE PDP CTX CONF, cause=%d(%s)\n", cause, get_value_string(gtp_cause_strs, cause)); + memset(&sig_data, 0, sizeof(sig_data)); + sig_data.pdp = pctx; + osmo_signal_dispatch(SS_SGSN, S_SGSN_PDP_DEACT, &sig_data); + if (pctx->mm) { /* Deactivate the SNDCP layer */ sndcp_sm_deactivate_ind(&pctx->mm->llme->lle[pctx->sapi], pctx->nsapi); -- 2.3.5 From holger at freyther.de Wed May 6 15:48:30 2015 From: holger at freyther.de (Holger Freyther) Date: Wed, 6 May 2015 17:48:30 +0200 Subject: [PATCH 4/5] sgsn: Create an initial and limited CDR module In-Reply-To: <1430927311-7972-1-git-send-email-holger@freyther.de> References: <1430927311-7972-1-git-send-email-holger@freyther.de> Message-ID: <1430927311-7972-4-git-send-email-holger@freyther.de> From: Holger Hans Peter Freyther This is consuming the new signals and allows to install several different CDR/observing/event/audit modules in the future. For getting the bytes in/out the code would have had to undo what the rate counter is doing and at the same time adding a "total" to the ratecounter didn't look like a good idea, the same went for making it a plain counter. Begin writing the values one by one and open/closing a new FILE for every log messages. This is not efficient but easily deals with external truncation/rotation of the file (no fstat for and checking the links and size). As usual we will wait and see if this is an issue. Add some new members to our PDP context structure to see what it is about. --- openbsc/include/openbsc/gprs_sgsn.h | 5 + openbsc/include/openbsc/sgsn.h | 14 ++ openbsc/src/gprs/Makefile.am | 2 +- openbsc/src/gprs/sgsn_cdr.c | 254 ++++++++++++++++++++++++++++++++++++ openbsc/src/gprs/sgsn_libgtp.c | 6 + openbsc/src/gprs/sgsn_main.c | 1 + 6 files changed, 281 insertions(+), 1 deletion(-) create mode 100644 openbsc/src/gprs/sgsn_cdr.c diff --git a/openbsc/include/openbsc/gprs_sgsn.h b/openbsc/include/openbsc/gprs_sgsn.h index 9e855f8..c88a2bb 100644 --- a/openbsc/include/openbsc/gprs_sgsn.h +++ b/openbsc/include/openbsc/gprs_sgsn.h @@ -207,6 +207,11 @@ struct sgsn_pdp_ctx { struct osmo_timer_list timer; unsigned int T; /* Txxxx number */ unsigned int num_T_exp; /* number of consecutive T expirations */ + + struct osmo_timer_list cdr_timer; /* CDR record wird timer */ + struct timespec cdr_start; /* The start of the CDR */ + uint64_t cdr_bytes_in; + uint64_t cdr_bytes_out; }; #define LOGPDPCTXP(level, pdp, fmt, args...) \ diff --git a/openbsc/include/openbsc/sgsn.h b/openbsc/include/openbsc/sgsn.h index 7d3a68c..0f9a59f 100644 --- a/openbsc/include/openbsc/sgsn.h +++ b/openbsc/include/openbsc/sgsn.h @@ -16,6 +16,11 @@ enum sgsn_auth_policy { SGSN_AUTH_POLICY_REMOTE }; +struct sgsn_cdr { + char *filename; + int interval; +}; + struct sgsn_config { /* parsed from config file */ @@ -33,6 +38,9 @@ struct sgsn_config { int require_authentication; int require_update_location; + + /* CDR configuration */ + struct sgsn_cdr cdr; }; struct sgsn_instance { @@ -85,4 +93,10 @@ int sndcp_unitdata_req(struct msgb *msg, struct gprs_llc_lle *lle, uint8_t nsapi int sndcp_llunitdata_ind(struct msgb *msg, struct gprs_llc_lle *lle, uint8_t *hdr, uint16_t len); + +/* + * CDR related functionality + */ +int sgsn_cdr_init(struct sgsn_instance *sgsn); + #endif diff --git a/openbsc/src/gprs/Makefile.am b/openbsc/src/gprs/Makefile.am index bc3e21e..3d02822 100644 --- a/openbsc/src/gprs/Makefile.am +++ b/openbsc/src/gprs/Makefile.am @@ -24,7 +24,7 @@ osmo_sgsn_SOURCES = gprs_gmm.c gprs_sgsn.c gprs_sndcp.c gprs_sndcp_vty.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 \ - gsm_04_08_gprs.c + gsm_04_08_gprs.c sgsn_cdr.c osmo_sgsn_LDADD = \ $(top_builddir)/src/libcommon/libcommon.a \ -lgtp $(OSMO_LIBS) $(LIBOSMOABIS_LIBS) -lrt diff --git a/openbsc/src/gprs/sgsn_cdr.c b/openbsc/src/gprs/sgsn_cdr.c new file mode 100644 index 0000000..0fcdd3b --- /dev/null +++ b/openbsc/src/gprs/sgsn_cdr.c @@ -0,0 +1,254 @@ +/* GPRS SGSN CDR dumper */ + +/* (C) 2015 by Holger Hans Peter Freyther + * All Rights Reserved + * + * 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 + +/* TODO...avoid going through a global */ +extern struct sgsn_instance *sgsn; + +/** + * The CDR module will generate an entry like: + * + * IMSI, # Subscriber IMSI + * IMEI, # Subscriber IMEI + * MSISDN, # Subscriber MISDN + * Charging_Timestamp, # Event start Time + * Charging_UTC, # Time zone of event start time + * Duration, # Session DURATION + * Cell_Id, # CELL_ID + * Location_Area, # LAC + * GGSN_ADDR, # GGSN_ADDR + * SGSN_ADDR, # SGSN_ADDR + * APNI, # APNI + * PDP_ADDR, # PDP_ADDR + * VOL_IN, # VOL_IN in Bytes + * VOL_OUT, # VOL_OUT in Bytes + * CAUSE_FOR_TERM, # CAUSE_FOR_TERM + */ + + +static void maybe_print_header(FILE *cdr_file) +{ + if (ftell(cdr_file) != 0) + return; + + fprintf(cdr_file, "timestamp,imsi,imei,msisdn,cell_id,lac,event,pdp_duration,ggsn_addr,sgsn_addr,apni,eua_addr,vol_in,vol_out\n"); +} + +static void cdr_log_mm(struct sgsn_instance *inst, const char *ev, + struct sgsn_mm_ctx *mmctx) +{ + FILE *cdr_file; + struct tm tm; + struct timeval tv; + + if (!inst->cfg.cdr.filename) + return; + + cdr_file = fopen(inst->cfg.cdr.filename, "a"); + if (!cdr_file) { + LOGP(DGPRS, LOGL_ERROR, "Failed to open %s\n", + inst->cfg.cdr.filename); + return; + } + + maybe_print_header(cdr_file); + gettimeofday(&tv, NULL); + gmtime_r(&tv.tv_sec, &tm); + fprintf(cdr_file, "%04d%02d%02d%02d%02d%02d%03d,%s,%s,%s,%d,%d,%s\n", + tm.tm_year + 1900, tm.tm_mon + 1, tm.tm_mday, + tm.tm_hour, tm.tm_min, tm.tm_sec, + (int)(tv.tv_usec / 1000), + mmctx->imsi, + mmctx->imei, + mmctx->msisdn, + mmctx->cell_id, + mmctx->ra.lac, + ev); + + fclose(cdr_file); +} + +static void extract_eua(struct ul66_t *eua, char *eua_addr) +{ + if (eua->l < 2) + return; + + /* there is no addr for ETSI/PPP */ + if ((eua->v[0] & 0x0F) != 1) { + strcpy(eua_addr, "ETSI"); + return; + } + + if (eua->v[1] == 0x21 && eua->l == 6) + inet_ntop(AF_INET, &eua->v[2], eua_addr, INET_ADDRSTRLEN); + else if (eua->v[1] == 0x57 && eua->l == 18) + inet_ntop(AF_INET6, &eua->v[2], eua_addr, INET6_ADDRSTRLEN); + else { + /* e.g. both IPv4 and IPv6 */ + strcpy(eua_addr, "Unknown address"); + } +} + +static void cdr_log_pdp(struct sgsn_instance *inst, const char *ev, + struct sgsn_pdp_ctx *pdp) +{ + FILE *cdr_file; + char apni[(pdp->lib ? pdp->lib->apn_use.l : 0) + 1]; + char ggsn_addr[INET_ADDRSTRLEN + 1]; + char sgsn_addr[INET_ADDRSTRLEN + 1]; + char eua_addr[INET6_ADDRSTRLEN + 1]; + struct tm tm; + struct timeval tv; + time_t duration; + struct timespec tp; + + if (!inst->cfg.cdr.filename) + return; + + memset(apni, 0, sizeof(apni)); + memset(ggsn_addr, 0, sizeof(ggsn_addr)); + memset(eua_addr, 0, sizeof(eua_addr)); + + + if (pdp->lib) { + gprs_apn_to_str(apni, pdp->lib->apn_use.v, pdp->lib->apn_use.l); + inet_ntop(AF_INET, &pdp->lib->hisaddr0.s_addr, ggsn_addr, sizeof(ggsn_addr)); + extract_eua(&pdp->lib->eua, eua_addr); + } + + if (pdp->ggsn) + inet_ntop(AF_INET, &pdp->ggsn->gsn->gsnc.s_addr, sgsn_addr, sizeof(sgsn_addr)); + + cdr_file = fopen(inst->cfg.cdr.filename, "a"); + if (!cdr_file) { + LOGP(DGPRS, LOGL_ERROR, "Failed to open %s\n", + inst->cfg.cdr.filename); + return; + } + + maybe_print_header(cdr_file); + + clock_gettime(CLOCK_MONOTONIC, &tp); + gettimeofday(&tv, NULL); + + /* convert the timestamp to UTC */ + gmtime_r(&tv.tv_sec, &tm); + + /* Check the duration of the PDP context */ + duration = tp.tv_sec - pdp->cdr_start.tv_sec; + + fprintf(cdr_file, + "%04d%02d%02d%02d%02d%02d%03d,%s,%s,%s,%d,%d,%s,%ld,%s,%s,%s,%s,%" PRIu64 ",%" PRIu64 "\n", + tm.tm_year + 1900, tm.tm_mon + 1, tm.tm_mday, + tm.tm_hour, tm.tm_min, tm.tm_sec, + (int)(tv.tv_usec / 1000), + pdp->mm ? pdp->mm->imsi : "N/A", + pdp->mm ? pdp->mm->imei : "N/A", + pdp->mm ? pdp->mm->msisdn : "N/A", + pdp->mm ? pdp->mm->cell_id : -1, + pdp->mm ? pdp->mm->ra.lac : -1, + ev, + (unsigned long ) duration, + ggsn_addr, + sgsn_addr, + apni, + eua_addr, + pdp->cdr_bytes_in, + pdp->cdr_bytes_out); + fclose(cdr_file); +} + +static void cdr_pdp_timeout(void *_data) +{ + struct sgsn_pdp_ctx *pdp = _data; + cdr_log_pdp(sgsn, "pdp-periodic", pdp); + osmo_timer_schedule(&pdp->cdr_timer, sgsn->cfg.cdr.interval, 0); +} + +static int handle_sgsn_sig(unsigned int subsys, unsigned int signal, + void *handler_data, void *_signal_data) +{ + struct sgsn_signal_data *signal_data = _signal_data; + struct sgsn_instance *inst = handler_data; + + if (subsys != SS_SGSN) + return 0; + + switch (signal) { + case S_SGSN_ATTACH: + cdr_log_mm(inst, "attach", signal_data->mm); + break; + case S_SGSN_UPDATE: + cdr_log_mm(inst, "update", signal_data->mm); + break; + case S_SGSN_DETACH: + cdr_log_mm(inst, "detach", signal_data->mm); + break; + case S_SGSN_MM_FREE: + cdr_log_mm(inst, "free", signal_data->mm); + break; + case S_SGSN_PDP_ACT: + clock_gettime(CLOCK_MONOTONIC, &signal_data->pdp->cdr_start); + cdr_log_pdp(inst, "pdp-act", signal_data->pdp); + signal_data->pdp->cdr_timer.cb = cdr_pdp_timeout; + signal_data->pdp->cdr_timer.data = signal_data->pdp; + osmo_timer_schedule(&signal_data->pdp->cdr_timer, inst->cfg.cdr.interval, 0); + break; + case S_SGSN_PDP_DEACT: + cdr_log_pdp(inst, "pdp-deact", signal_data->pdp); + osmo_timer_del(&signal_data->pdp->cdr_timer); + break; + case S_SGSN_PDP_TERMINATE: + cdr_log_pdp(inst, "pdp-terminate", signal_data->pdp); + osmo_timer_del(&signal_data->pdp->cdr_timer); + break; + case S_SGSN_PDP_FREE: + cdr_log_pdp(inst, "pdp-free", signal_data->pdp); + osmo_timer_del(&signal_data->pdp->cdr_timer); + break; + } + + return 0; +} + +int sgsn_cdr_init(struct sgsn_instance *sgsn) +{ + /* register for CDR related events */ + sgsn->cfg.cdr.interval = 10 * 60; + osmo_signal_register_handler(SS_SGSN, handle_sgsn_sig, sgsn); + + return 0; +} diff --git a/openbsc/src/gprs/sgsn_libgtp.c b/openbsc/src/gprs/sgsn_libgtp.c index af5c93d..9972cdd 100644 --- a/openbsc/src/gprs/sgsn_libgtp.c +++ b/openbsc/src/gprs/sgsn_libgtp.c @@ -534,6 +534,9 @@ static int cb_data_ind(struct pdp_t *lib, void *packet, unsigned int len) rate_ctr_inc(&mm->ctrg->ctr[GMM_CTR_PKTS_UDATA_OUT]); rate_ctr_add(&mm->ctrg->ctr[GMM_CTR_BYTES_UDATA_OUT], len); + /* It is easier to have a global count */ + pdp->cdr_bytes_out += len; + return sndcp_unitdata_req(msg, &mm->llme->lle[pdp->sapi], pdp->nsapi, mm); } @@ -569,6 +572,9 @@ int sgsn_rx_sndcp_ud_ind(struct gprs_ra_id *ra_id, int32_t tlli, uint8_t nsapi, rate_ctr_inc(&mmctx->ctrg->ctr[GMM_CTR_PKTS_UDATA_IN]); rate_ctr_add(&mmctx->ctrg->ctr[GMM_CTR_BYTES_UDATA_IN], npdu_len); + /* It is easier to have a global count */ + pdp->cdr_bytes_in += npdu_len; + return gtp_data_req(pdp->ggsn->gsn, pdp->lib, npdu, npdu_len); } diff --git a/openbsc/src/gprs/sgsn_main.c b/openbsc/src/gprs/sgsn_main.c index 0db90d5..d5f7f65 100644 --- a/openbsc/src/gprs/sgsn_main.c +++ b/openbsc/src/gprs/sgsn_main.c @@ -344,6 +344,7 @@ int main(int argc, char **argv) gprs_llc_vty_init(); gprs_sndcp_vty_init(); sgsn_auth_init(); + sgsn_cdr_init(&sgsn_inst); /* FIXME: register signal handler for SS_L_NS */ rc = sgsn_parse_config(sgsn_inst.config_file, &sgsn_inst.cfg); -- 2.3.5 From holger at freyther.de Wed May 6 15:48:31 2015 From: holger at freyther.de (Holger Freyther) Date: Wed, 6 May 2015 17:48:31 +0200 Subject: [PATCH 5/5] sgsn: Add VTY configuration for the CDR module In-Reply-To: <1430927311-7972-1-git-send-email-holger@freyther.de> References: <1430927311-7972-1-git-send-email-holger@freyther.de> Message-ID: <1430927311-7972-5-git-send-email-holger@freyther.de> From: Holger Hans Peter Freyther Make it possible to set a filename to use for the CDR. By default no CDR will be generated. Forbid to set the interval of 0 seconds as this will cause a lot of work. Add a very basic VTY test. --- openbsc/src/gprs/sgsn_vty.c | 36 ++++++++++++++++++++++++++++++++++++ openbsc/tests/vty_test_runner.py | 28 ++++++++++++++++++++++++++++ 2 files changed, 64 insertions(+) diff --git a/openbsc/src/gprs/sgsn_vty.c b/openbsc/src/gprs/sgsn_vty.c index be575d3..8b6e3ec 100644 --- a/openbsc/src/gprs/sgsn_vty.c +++ b/openbsc/src/gprs/sgsn_vty.c @@ -1,6 +1,7 @@ /* * (C) 2010-2013 by Harald Welte * (C) 2010 by On-Waves + * (C) 2015 by Holger Hans Peter Freyther * All Rights Reserved * * This program is free software; you can redistribute it and/or modify @@ -164,6 +165,12 @@ static int config_write_sgsn(struct vty *vty) actx->ggsn->id, VTY_NEWLINE); } + if (g_cfg->cdr.filename) + vty_out(vty, " cdr filename %s%s", g_cfg->cdr.filename, VTY_NEWLINE); + else + vty_out(vty, " no cdr filename%s", VTY_NEWLINE); + vty_out(vty, " cdr interval %d%s", g_cfg->cdr.interval, VTY_NEWLINE); + return CMD_SUCCESS; } @@ -811,6 +818,32 @@ DEFUN(cfg_no_apn_name, cfg_no_apn_name_cmd, return CMD_SUCCESS; } +DEFUN(cfg_cdr_filename, cfg_cdr_filename_cmd, + "cdr filename NAME", + "CDR\nSet filename\nname\n") +{ + talloc_free(g_cfg->cdr.filename); + g_cfg->cdr.filename = talloc_strdup(tall_vty_ctx, argv[0]); + return CMD_SUCCESS; +} + +DEFUN(cfg_no_cdr_filename, cfg_no_cdr_filename_cmd, + "no cdr filename", + NO_STR "CDR\nDisable CDR generation\n") +{ + talloc_free(g_cfg->cdr.filename); + g_cfg->cdr.filename = NULL; + return CMD_SUCCESS; +} + +DEFUN(cfg_cdr_interval, cfg_cdr_interval_cmd, + "cdr interval <1-2147483647>", + "CDR\nPDP periodic log interval\nSeconds\n") +{ + g_cfg->cdr.interval = atoi(argv[0]); + return CMD_SUCCESS; +} + int sgsn_vty_init(void) { install_element_ve(&show_sgsn_cmd); @@ -842,6 +875,9 @@ int sgsn_vty_init(void) install_element(SGSN_NODE, &cfg_apn_imsi_ggsn_cmd); install_element(SGSN_NODE, &cfg_apn_name_cmd); install_element(SGSN_NODE, &cfg_no_apn_name_cmd); + install_element(SGSN_NODE, &cfg_cdr_filename_cmd); + install_element(SGSN_NODE, &cfg_no_cdr_filename_cmd); + install_element(SGSN_NODE, &cfg_cdr_interval_cmd); return 0; } diff --git a/openbsc/tests/vty_test_runner.py b/openbsc/tests/vty_test_runner.py index 3581b67..4cd4665 100644 --- a/openbsc/tests/vty_test_runner.py +++ b/openbsc/tests/vty_test_runner.py @@ -891,6 +891,34 @@ class TestVTYSGSN(TestVTYGenericBSC): res = self.vty.command("show running-config") self.assertEquals(res.find("apn internet"), -1) + def testVtyCDR(self): + self.vty.enable() + self.assertTrue(self.vty.verify('configure terminal', [''])) + self.assertEquals(self.vty.node(), 'config') + self.assertTrue(self.vty.verify('sgsn', [''])) + self.assertEquals(self.vty.node(), 'config-sgsn') + + res = self.vty.command("show running-config") + self.assert_(res.find("no cdr filename") > 0) + + self.vty.command("cdr filename bla.cdr") + res = self.vty.command("show running-config") + self.assertEquals(res.find("no cdr filename"), -1) + self.assert_(res.find(" cdr filename bla.cdr") > 0) + + self.vty.command("no cdr filename") + res = self.vty.command("show running-config") + self.assert_(res.find("no cdr filename") > 0) + self.assertEquals(res.find(" cdr filename bla.cdr"), -1) + + res = self.vty.command("show running-config") + self.assert_(res.find(" cdr interval 600") > 0) + + self.vty.command("cdr interval 900") + res = self.vty.command("show running-config") + self.assert_(res.find(" cdr interval 900") > 0) + self.assertEquals(res.find(" cdr interval 600"), -1) + def add_nat_test(suite, workdir): if not os.path.isfile(os.path.join(workdir, "src/osmo-bsc_nat/osmo-bsc_nat")): print("Skipping the NAT test") -- 2.3.5 From mike.mcternan at wavemobile.com Thu May 7 08:40:16 2015 From: mike.mcternan at wavemobile.com (Mike McTernan (wavemobile)) Date: Thu, 7 May 2015 08:40:16 +0000 Subject: talloc vs ASAN and other tools (Was: [PATCH] bssgp: Fix call to llist_entry in fc_queue_timer_cfg) Message-ID: Hi, On 30.04.2015 20:33, Jacob Erlbeck wrote: > On 30.04.2015 20:01, Holger Freyther wrote: > > Did ASAN help? > No, since the data seems to be taken from then fc struct, so the memory area is > valid. ASAN was enabled and didn't complain. It wouldn't have helped here, but since ASAN is discussed in the context of memory errors, I'd like to check that it's been considered that ASAN's ability to detect and report memory errors may be being impaired by the use of talloc - particularly use after free bugs. I took a very quick look at the talloc code, and it looks like the Valgrind memory poisoning macros are added, but not in a way that I can see as being active (missing #include of the Valgrind API headers + DEVELOPER needs to be defined). The 2.1.2 version of talloc looks to be perhaps more complete in this respect. I'm not sure if ASAN can utilise the Valgrind macros though - perhaps something like Mozilla's approach to cover poisoning is needed: https://dxr.mozilla.org/mozilla-central/source/mfbt/MemoryChecking.h Also I noticed that there is a --disable-talloc option to configure. I hoped this would fall back to libc malloc/free, but it actually disables use of the packaged talloc.c, and links with -ltalloc instead i.e. talloc isn't actually disabled: if ENABLE_TALLOC libosmocore_la_SOURCES += talloc.c else libosmocore_la_LIBADD += -ltalloc endif It may be better named --disable-builtin-talloc. Kind Regards, Mike From holger at freyther.de Thu May 7 10:29:06 2015 From: holger at freyther.de (Holger Freyther) Date: Thu, 7 May 2015 12:29:06 +0200 Subject: talloc vs ASAN and other tools (Was: [PATCH] bssgp: Fix call to llist_entry in fc_queue_timer_cfg) In-Reply-To: References: Message-ID: <8A96763A-A8F0-4A7A-ADD5-39CF8EC4D936@freyther.de> > On 07 May 2015, at 10:40, Mike McTernan (wavemobile) wrote: Hi! > It wouldn't have helped here, but since ASAN is discussed in the context of memory errors, I'd like to check that it's been considered that ASAN's ability to detect and report memory errors may be being impaired by the use of talloc - particularly use after free bugs. On double talloc_free I do get aborts from the libc memory management. We don?t use the pool feature (yet) so all calls to talloc_free/talloc_alloc will go directly to malloc/free and should be handled by ASAN. holger From alexander.chemeris at gmail.com Thu May 7 15:52:13 2015 From: alexander.chemeris at gmail.com (Alexander Chemeris) Date: Thu, 7 May 2015 11:52:13 -0400 Subject: =?UTF-8?Q?Re=3A_Help_=2D_Dual_channel_on_UmTRX=E2=80=8F?= In-Reply-To: References: Message-ID: Amber & Sarosh, According to the GSM Standard, only TRX0 has to transmit constantly. Secondary TRX's can transmit only when there is actual data to transmit. So if you want to see transmission on the TRX1 you should either: 1. have more than 6 active call legs (more than 3 acive calls), or 2. make TRX0 SDCCH only and leave TCH only on the TRX1 and make a call. In either case you'll see that the transmission on TRX1 is not continuous, unless you have all TCH's on TRX1 busy. On Wed, May 6, 2015 at 3:38 AM, Amber and Sarosh wrote: > Hi > We have configured OsmoNITB, OsmoBTS and OsmoTRX to run two transceivers > using UmTRX. But somehow when the spectrum is monitored, the only frequency > that is detected is the one TRX0 is tuned to. ARFCN set for TRX1 is not > detected i.e. TRX1 does not seem to be transmitting on the specified > frequency. > Can anyone please tell what possibly could be the issue? > > Thanks & Regards, > Amber & Sarosh -- Regards, Alexander Chemeris. CEO, Fairwaves, Inc. https://fairwaves.co From Max.Suraev at fairwaves.co Thu May 7 21:47:09 2015 From: Max.Suraev at fairwaves.co (=?UTF-8?B?4piO?=) Date: Thu, 07 May 2015 23:47:09 +0200 Subject: talloc vs ASAN and other tools (Was: [PATCH] bssgp: Fix call to llist_entry in fc_queue_timer_cfg) In-Reply-To: References: Message-ID: <554BDD5D.7090606@fairwaves.co> Why not just disable copy-pasted talloc once and for all? Corresponding patches been floating in ML for quite some time. 07.05.2015 10:40, Mike McTernan (wavemobile) ?????: > Hi, > > On 30.04.2015 20:33, Jacob Erlbeck wrote: >> On 30.04.2015 20:01, Holger Freyther wrote: >>> Did ASAN help? >> No, since the data seems to be taken from then fc struct, so the memory area is >> valid. ASAN was enabled and didn't complain. > > It wouldn't have helped here, but since ASAN is discussed in the context of memory errors, I'd like to check that it's been considered that ASAN's ability to detect and report memory errors may be being impaired by the use of talloc - particularly use after free bugs. > > I took a very quick look at the talloc code, and it looks like the Valgrind memory poisoning macros are added, but not in a way that I can see as being active (missing #include of the Valgrind API headers + DEVELOPER needs to be defined). The 2.1.2 version of talloc looks to be perhaps more complete in this respect. > > I'm not sure if ASAN can utilise the Valgrind macros though - perhaps something like Mozilla's approach to cover poisoning is needed: https://dxr.mozilla.org/mozilla-central/source/mfbt/MemoryChecking.h > > Also I noticed that there is a --disable-talloc option to configure. I hoped this would fall back to libc malloc/free, but it actually disables use of the packaged talloc.c, and links with -ltalloc instead i.e. talloc isn't actually disabled: > > if ENABLE_TALLOC > libosmocore_la_SOURCES += talloc.c > else > libosmocore_la_LIBADD += -ltalloc > endif > > It may be better named --disable-builtin-talloc. > > Kind Regards, > > Mike > -- best regards, Max, http://fairwaves.co From mail at rotty.xx.vu Sun May 17 14:31:54 2015 From: mail at rotty.xx.vu (mail at rotty.xx.vu) Date: Sun, 17 May 2015 16:31:54 +0200 Subject: [PATCH 1/2] Fix out-of-tree builds In-Reply-To: <1431873115-23794-1-git-send-email-mail@rotty.xx.vu> References: <1431873115-23794-1-git-send-email-mail@rotty.xx.vu> Message-ID: <1431873115-23794-2-git-send-email-mail@rotty.xx.vu> From: Andreas Rottmann --- src/sim/Makefile.am | 2 +- utils/Makefile.am | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/sim/Makefile.am b/src/sim/Makefile.am index 185e8df..e241dc9 100644 --- a/src/sim/Makefile.am +++ b/src/sim/Makefile.am @@ -2,7 +2,7 @@ # Please read Chapter 6 "Library interface versions" of the libtool documentation before making any modification LIBVERSION=0:0:0 -INCLUDES = $(all_includes) -I$(top_srcdir)/include +AM_CPPFLAGS = $(all_includes) -I$(top_srcdir)/include -I$(top_builddir)/include AM_CFLAGS = -fPIC -Wall $(PCSC_CFLAGS) AM_LDFLAGS = $(COVERAGE_LDFLAGS) diff --git a/utils/Makefile.am b/utils/Makefile.am index 41f91f9..63a32ed 100644 --- a/utils/Makefile.am +++ b/utils/Makefile.am @@ -1,5 +1,5 @@ if ENABLE_UTILITIES -AM_CPPFLAGS = -I$(top_srcdir)/include +AM_CPPFLAGS = -I$(top_srcdir)/include -I$(top_builddir)/include AM_CFLAGS = -Wall bin_PROGRAMS = osmo-arfcn osmo-auc-gen -- 1.9.1 From mail at rotty.xx.vu Sun May 17 14:31:53 2015 From: mail at rotty.xx.vu (mail at rotty.xx.vu) Date: Sun, 17 May 2015 16:31:53 +0200 Subject: Some build system patches for libosmocore Message-ID: <1431873115-23794-1-git-send-email-mail@rotty.xx.vu> The first patch fixes the build-system wrt. out-of-tree builds, while the second future-proofs the build system by enabling the subdir-objects automake option (see commit message for details). From mail at rotty.xx.vu Sun May 17 14:31:55 2015 From: mail at rotty.xx.vu (mail at rotty.xx.vu) Date: Sun, 17 May 2015 16:31:55 +0200 Subject: [PATCH 2/2] Add subdir-objects automake option In-Reply-To: <1431873115-23794-1-git-send-email-mail@rotty.xx.vu> References: <1431873115-23794-1-git-send-email-mail@rotty.xx.vu> Message-ID: <1431873115-23794-3-git-send-email-mail@rotty.xx.vu> From: Andreas Rottmann Having subdir-objects enabled is recommended by automake 1.14, to avoid future incompatibilities. However, adding that option breaks out-of-tree builds, and also seems to break "make distclean" for in-tree builds. The reason is that apparently, automake with subdir-objects enabled cannot cope with source files in a different, non-child directory. To avoid that, instead of referencing the source files, we (just) link against that library. --- configure.ac | 2 +- tests/Makefile.am | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/configure.ac b/configure.ac index acd153d..dccc564 100644 --- a/configure.ac +++ b/configure.ac @@ -2,7 +2,7 @@ AC_INIT([libosmocore], m4_esyscmd([./git-version-gen .tarball-version]), [openbsc at lists.osmocom.org]) -AM_INIT_AUTOMAKE([foreign dist-bzip2 no-dist-gzip 1.6]) +AM_INIT_AUTOMAKE([subdir-objects foreign dist-bzip2 no-dist-gzip 1.6]) AC_CONFIG_TESTDIR(tests) dnl kernel style compile messages diff --git a/tests/Makefile.am b/tests/Makefile.am index 8db2533..efbea3b 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -1,4 +1,4 @@ -AM_CPPFLAGS = -I$(top_srcdir)/include +AM_CPPFLAGS = -I$(top_srcdir)/include -I$(top_builddir)/include AM_CFLAGS = -Wall check_PROGRAMS = timer/timer_test sms/sms_test ussd/ussd_test \ @@ -18,12 +18,13 @@ endif utils_utils_test_SOURCES = utils/utils_test.c utils_utils_test_LDADD = $(top_builddir)/src/libosmocore.la -a5_a5_test_SOURCES = a5/a5_test.c ../src/gsm/a5.c +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 -kasumi_kasumi_test_SOURCES = kasumi/kasumi_test.c ../src/gsm/kasumi.c +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 comp128_comp128_test_SOURCES = comp128/comp128_test.c comp128_comp128_test_LDADD = $(top_builddir)/src/libosmocore.la $(top_builddir)/src/gsm/libosmogsm.la -- 1.9.1 From mail at rotty.xx.vu Sun May 17 14:48:15 2015 From: mail at rotty.xx.vu (mail at rotty.xx.vu) Date: Sun, 17 May 2015 16:48:15 +0200 Subject: [PATCH] Fix "make distcheck" Message-ID: <1431874095-25609-1-git-send-email-mail@rotty.xx.vu> From: Andreas Rottmann Running "make distcheck" failed trying to generate ".version" into the read-only unpacked source directory. Actually shipping ".version" in the tarball fixes that. --- Makefile.am | 1 + 1 file changed, 1 insertion(+) diff --git a/Makefile.am b/Makefile.am index 9c82f09..fdcddb9 100644 --- a/Makefile.am +++ b/Makefile.am @@ -6,6 +6,7 @@ SUBDIRS = include src tests pkgconfigdir = $(libdir)/pkgconfig pkgconfig_DATA = libosmoabis.pc libosmotrau.pc +EXTRA_DIST = .version BUILT_SOURCES = $(top_srcdir)/.version $(top_srcdir)/.version: echo $(VERSION) > $@-t && mv $@-t $@ -- 1.9.1 From mail at rotty.xx.vu Sun May 17 15:25:27 2015 From: mail at rotty.xx.vu (Andreas Rottmann) Date: Sun, 17 May 2015 17:25:27 +0200 Subject: [PATCH] Fix "make distcheck" In-Reply-To: <1431874095-25609-1-git-send-email-mail@rotty.xx.vu> (mail@rotty.xx.vu's message of "Sun, 17 May 2015 16:48:15 +0200") References: <1431874095-25609-1-git-send-email-mail@rotty.xx.vu> Message-ID: <87lhgnz0ns.fsf@delenn.home.rotty.xx.vu> mail at rotty.xx.vu writes: > From: Andreas Rottmann > [... patch elided ...] This was a patch for libosmo-abis, FWIW. -- Andreas Rottmann -- From holger at freyther.de Sun May 17 16:08:33 2015 From: holger at freyther.de (Holger Freyther) Date: Sun, 17 May 2015 18:08:33 +0200 Subject: [PATCH] Fix "make distcheck" In-Reply-To: <1431874095-25609-1-git-send-email-mail@rotty.xx.vu> References: <1431874095-25609-1-git-send-email-mail@rotty.xx.vu> Message-ID: <33FFCC54-C42F-4C9E-9BEE-3DE39DA92622@freyther.de> > On 17 May 2015, at 16:48, mail at rotty.xx.vu wrote: > > Running "make distcheck" failed trying to generate ".version" into the > read-only unpacked source directory. Actually shipping ".version" in the > tarball fixes that. What is the actual error your are seeing. We run make distcheck after each commit on both a Linux and FreeBSD build (with different versions of autoconf/automake) E.g. I went to this build log http://jenkins.osmocom.org/jenkins/job/libosmo-abis/label=FreeBSD_amd64/1086/console and checked: LD_LIBRARY_PATH=/home/builder/source/workspace/libosmo-abis/label/FreeBSD_amd64/deps/install/lib gmake distcheck gmake dist-bzip2 am__post_remove_distdir=?@: holger From holger at freyther.de Sun May 17 16:11:02 2015 From: holger at freyther.de (Holger Freyther) Date: Sun, 17 May 2015 18:11:02 +0200 Subject: [PATCH 1/2] Fix out-of-tree builds In-Reply-To: <1431873115-23794-2-git-send-email-mail@rotty.xx.vu> References: <1431873115-23794-1-git-send-email-mail@rotty.xx.vu> <1431873115-23794-2-git-send-email-mail@rotty.xx.vu> Message-ID: > On 17 May 2015, at 16:31, mail at rotty.xx.vu wrote: > > From: Andreas Rottmann What is the actual build error you are fixing here? Our Yocto/meta-telephony builds use srcdir != builddir so I would like to see the actual build error and understand how it occurs and what it is related to. From holger at freyther.de Sun May 17 17:05:50 2015 From: holger at freyther.de (Holger Freyther) Date: Sun, 17 May 2015 19:05:50 +0200 Subject: [PATCH 0/4] core/conv: Fast Viterbi decoding In-Reply-To: References: <20140429041352.GA5213@phenom.hsd1.va.comcast.net> Message-ID: <67121C8F-38EA-4835-AA8E-025DD0C024F4@freyther.de> > On 01 May 2014, at 20:02, Tom Tsou wrote: Dear Tom, > The patch for additional test codes was already posted and is run with > 'make check'. Those cases mostly serve as regression tests. For AWGN > tests, I feel less certain that wireless channel modeling belong in > libosmocore. The error rate simulations will not fit the current make > check model since they are probabilistic and non-deterministic by > definition. I am going through patchwork and it doesn?t seem this was applied? I assumed you and Sylvain would figure it out and merge it. What should we do with the four patches? kind regards holger From mail at rotty.xx.vu Sun May 17 17:11:09 2015 From: mail at rotty.xx.vu (Andreas Rottmann) Date: Sun, 17 May 2015 19:11:09 +0200 Subject: [PATCH 1/2] Fix out-of-tree builds In-Reply-To: (Holger Freyther's message of "Sun, 17 May 2015 18:11:02 +0200") References: <1431873115-23794-1-git-send-email-mail@rotty.xx.vu> <1431873115-23794-2-git-send-email-mail@rotty.xx.vu> Message-ID: <87h9rbyvrm.fsf@delenn.home.rotty.xx.vu> Holger Freyther writes: >> On 17 May 2015, at 16:31, mail at rotty.xx.vu wrote: >> >> From: Andreas Rottmann > > > What is the actual build error you are fixing here? Our Yocto/meta-telephony builds > use srcdir != builddir so I would like to see the actual build error and understand how > it occurs and what it is related to. > I've included the build logs; the build steps were (on Debian jessie amd64): % git clone git://git.osmocom.org/libosmocore.git % cd libosmocore % autoreconf -i % mkdir _build % cd _build % autoreconf -i -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: libosmocore-autoreconf.log URL: -------------- next part -------------- % ../configure --prefix=$HOME/.system/stow/libosmocore -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: libosmocore-configure.log URL: -------------- next part -------------- % make -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: libosmocore-make.log URL: -------------- next part -------------- The error happens during the last step, obviously. HTH, Rotty -- Andreas Rottmann -- From holger at freyther.de Sun May 17 17:12:04 2015 From: holger at freyther.de (Holger Freyther) Date: Sun, 17 May 2015 19:12:04 +0200 Subject: [PATCH] Use generic auth API In-Reply-To: <5440EFFB.4060903@fairwaves.co> References: <1413541198-18547-1-git-send-email-max.suraev@fairwaves.co> <5440EFFB.4060903@fairwaves.co> Message-ID: > On 17 Oct 2014, at 12:31, ? wrote: Dear Max, > Just realized that this long time ago published patch s not visible at patchwork. > I'd appreciate help with testing it against sim cards using xor - don't have any at > hands. okay this is still needed to be applied. Could you please re-base and re-send the patch? sorry for the delay. holger From holger at freyther.de Sun May 17 17:22:46 2015 From: holger at freyther.de (Holger Freyther) Date: Sun, 17 May 2015 19:22:46 +0200 Subject: [PATCH 1/2] Fix out-of-tree builds In-Reply-To: <87h9rbyvrm.fsf@delenn.home.rotty.xx.vu> References: <1431873115-23794-1-git-send-email-mail@rotty.xx.vu> <1431873115-23794-2-git-send-email-mail@rotty.xx.vu> <87h9rbyvrm.fsf@delenn.home.rotty.xx.vu> Message-ID: > On 17 May 2015, at 19:11, Andreas Rottmann wrote: > > > In file included from ../../../include/osmocom/core/msgb.h:25:0, > from ../../../include/osmocom/sim/sim.h:4, > from ../../../src/sim/core.c:29: > ../../../include/osmocom/core/bits.h:6:35: fatal error: osmocom/core/bit16gen.h: No such file or directory > #include thank you. I have amended the commit message and pushed it. From mail at rotty.xx.vu Sun May 17 17:29:21 2015 From: mail at rotty.xx.vu (Andreas Rottmann) Date: Sun, 17 May 2015 19:29:21 +0200 Subject: [PATCH] Fix "make distcheck" In-Reply-To: <33FFCC54-C42F-4C9E-9BEE-3DE39DA92622@freyther.de> (Holger Freyther's message of "Sun, 17 May 2015 18:08:33 +0200") References: <1431874095-25609-1-git-send-email-mail@rotty.xx.vu> <33FFCC54-C42F-4C9E-9BEE-3DE39DA92622@freyther.de> Message-ID: <87d21zyuxa.fsf@delenn.home.rotty.xx.vu> Holger Freyther writes: >> On 17 May 2015, at 16:48, mail at rotty.xx.vu wrote: > > >> >> Running "make distcheck" failed trying to generate ".version" into the >> read-only unpacked source directory. Actually shipping ".version" in the >> tarball fixes that. > > What is the actual error your are seeing. We run make distcheck after > each commit on both a Linux and FreeBSD build (with different versions > of autoconf/automake) > Again, the log (also on Debian jessie amd64): -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: libosmo-abis-make-distcheck.log URL: -------------- next part -------------- The build steps were the usual (git clone, autoreconf, mkdir _build, cd _build, configure, make distcheck). Regards, Rotty -- Andreas Rottmann -- From holger at freyther.de Sun May 17 17:50:49 2015 From: holger at freyther.de (Holger Freyther) Date: Sun, 17 May 2015 19:50:49 +0200 Subject: [PATCH] Fix "make distcheck" In-Reply-To: <87d21zyuxa.fsf@delenn.home.rotty.xx.vu> References: <1431874095-25609-1-git-send-email-mail@rotty.xx.vu> <33FFCC54-C42F-4C9E-9BEE-3DE39DA92622@freyther.de> <87d21zyuxa.fsf@delenn.home.rotty.xx.vu> Message-ID: <59DADFBC-D530-4C37-9321-C370583A44D8@freyther.de> > On 17 May 2015, at 19:29, Andreas Rottmann wrote: > > Holger Freyther writes: > > make[1]: Entering directory '/home/.big/rotty/src/_readonly/libosmo-abis/_build/libosmo-abis-0.3.1.2-3a58/_build' > echo 0.3.1.2-3a58 > ../.version-t && mv ../.version-t ../.version > /bin/bash: ../.version-t: Permission denied > Makefile:879: recipe for target '../.version? failed BUILT_SOURCES = $(top_srcdir)/.version $(top_srcdir)/.version: echo $(VERSION) > $@-t && mv $@-t $@ I assume the dir name implies that it is really ro, So what would it take to to not generate this in the ?srcdir? at all? From mail at rotty.xx.vu Sun May 17 18:06:42 2015 From: mail at rotty.xx.vu (mail at rotty.xx.vu) Date: Sun, 17 May 2015 20:06:42 +0200 Subject: A build system patch for libosmo-netif Message-ID: <1431886004-815-1-git-send-email-mail@rotty.xx.vu> This patch series fixes some build issues in libosmo-abis. The failures occurred on a Debian jessie amd64 system, with libosmo* build dependencies installed into distinct prefixes. From mail at rotty.xx.vu Sun May 17 18:06:44 2015 From: mail at rotty.xx.vu (mail at rotty.xx.vu) Date: Sun, 17 May 2015 20:06:44 +0200 Subject: [PATCH 2/2] build: fix "make distcheck" In-Reply-To: <1431886004-815-1-git-send-email-mail@rotty.xx.vu> References: <1431886004-815-1-git-send-email-mail@rotty.xx.vu> Message-ID: <1431886004-815-3-git-send-email-mail@rotty.xx.vu> From: Andreas Rottmann Running "make distcheck" failed trying to generate ".version" into the read-only unpacked source directory: make[1]: Entering directory '/tmp/build/libosmo-netif-0.0.4.10-7d1d/_build' echo 0.0.4.10-7d1d > ../.version-t && mv ../.version-t ../.version /bin/bash: ../.version-t: Permission denied Makefile:877: recipe for target '../.version' failed Actually shipping ".version" in the tarball fixes that. --- Makefile.am | 2 ++ configure.ac | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/Makefile.am b/Makefile.am index 519d1ae..7b43d4d 100644 --- a/Makefile.am +++ b/Makefile.am @@ -6,6 +6,8 @@ SUBDIRS = include src examples tests pkgconfigdir = $(libdir)/pkgconfig pkgconfig_DATA = libosmo-netif.pc +EXTRA_DIST = .version + BUILT_SOURCES = $(top_srcdir)/.version $(top_srcdir)/.version: echo $(VERSION) > $@-t && mv $@-t $@ diff --git a/configure.ac b/configure.ac index 47fba65..a7fe334 100644 --- a/configure.ac +++ b/configure.ac @@ -2,7 +2,7 @@ AC_INIT([libosmo-netif], m4_esyscmd([./git-version-gen .tarball-version]), [openbsc-devel at lists.openbsc.org]) -AM_INIT_AUTOMAKE([dist-bzip2]) +AM_INIT_AUTOMAKE([subdir-objects dist-bzip2]) AC_CONFIG_TESTDIR(tests) dnl kernel style compile messages -- 1.9.1 From mail at rotty.xx.vu Sun May 17 18:06:43 2015 From: mail at rotty.xx.vu (mail at rotty.xx.vu) Date: Sun, 17 May 2015 20:06:43 +0200 Subject: [PATCH 1/2] build: fix regarding missing CFLAGS constituents In-Reply-To: <1431886004-815-1-git-send-email-mail@rotty.xx.vu> References: <1431886004-815-1-git-send-email-mail@rotty.xx.vu> Message-ID: <1431886004-815-2-git-send-email-mail@rotty.xx.vu> From: Andreas Rottmann When libosmo-abis is installed in a distinct prefix, the build failed with non-found headers, for example: ../../src/rs232.c:38:35: fatal error: osmocom/abis/e1_input.h: No such file or directory #include --- src/Makefile.am | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Makefile.am b/src/Makefile.am index 7fbdaf2..a61bd00 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -3,7 +3,7 @@ LIBVERSION=2:0:0 AM_CPPFLAGS = -I$(top_srcdir)/include -I$(top_builddir) -AM_CFLAGS= -fPIC -Wall $(LIBOSMOCORE_CFLAGS) $(LIBOSMOGSM_CFLAGS) $(LIBOSMOVTY_CFLAGS) $(COVERAGE_CFLAGS) +AM_CFLAGS= -fPIC -Wall $(LIBOSMOCORE_CFLAGS) $(LIBOSMOGSM_CFLAGS) $(LIBOSMOVTY_CFLAGS) $(LIBOSMOABIS_CFLAGS) $(COVERAGE_CFLAGS) AM_LDFLAGS = $(COVERAGE_LDFLAGS) SUBDIRS = channel -- 1.9.1 From mail at rotty.xx.vu Sun May 17 18:18:03 2015 From: mail at rotty.xx.vu (Andreas Rottmann) Date: Sun, 17 May 2015 20:18:03 +0200 Subject: [PATCH] Fix "make distcheck" In-Reply-To: <59DADFBC-D530-4C37-9321-C370583A44D8@freyther.de> (Holger Freyther's message of "Sun, 17 May 2015 19:50:49 +0200") References: <1431874095-25609-1-git-send-email-mail@rotty.xx.vu> <33FFCC54-C42F-4C9E-9BEE-3DE39DA92622@freyther.de> <87d21zyuxa.fsf@delenn.home.rotty.xx.vu> <59DADFBC-D530-4C37-9321-C370583A44D8@freyther.de> Message-ID: <878ucnyso4.fsf@delenn.home.rotty.xx.vu> Holger Freyther writes: >> On 17 May 2015, at 19:29, Andreas Rottmann wrote: >> >> Holger Freyther writes: > > >> >> make[1]: Entering directory '/home/.big/rotty/src/_readonly/libosmo-abis/_build/libosmo-abis-0.3.1.2-3a58/_build' >> echo 0.3.1.2-3a58 > ../.version-t && mv ../.version-t ../.version >> /bin/bash: ../.version-t: Permission denied >> Makefile:879: recipe for target '../.version? failed > > BUILT_SOURCES = $(top_srcdir)/.version > $(top_srcdir)/.version: > echo $(VERSION) > $@-t && mv $@-t $@ > > I assume the dir name implies that it is really ro, So what would it take to > to not generate this in the ?srcdir? at all? > No, this is misleading; I use the _readonly directory for stuff I don't intend to touch (much). However, automake makes the unpacked tarball (containing $(top_srcdir), obviously) readonly during "make distcheck". Regarding generating ".version" into the build dir: the way I fixed things is the way is consistent with the recipe in git-version-gen (implied in the text of the git-version-gen revision in libosmo-abis, explicit in newer versions). Regards, Rotty -- Andreas Rottmann -- From holger at freyther.de Tue May 19 06:20:31 2015 From: holger at freyther.de (Holger Freyther) Date: Tue, 19 May 2015 08:20:31 +0200 Subject: [PATCH 0/4] core/conv: Fast Viterbi decoding In-Reply-To: References: <20140429041352.GA5213@phenom.hsd1.va.comcast.net> <67121C8F-38EA-4835-AA8E-025DD0C024F4@freyther.de> Message-ID: > On 18 May 2015, at 21:23, Tom Tsou wrote: > > Hi Holger, Dear Tom, > On Sun, May 17, 2015 at 10:05 AM, Holger Freyther wrote: >> I am going through patchwork and it doesn?t seem this was applied? I >> assumed you and Sylvain would figure it out and merge it. What should >> we do with the four patches? > > There was some discussion, but we never got around to completing the > review. If there is still interest, we can revive that discussion. I am not an user of the viterbi decoding but I assume a speed-up will benefit osmo-trx and it would be a shame to lose it. holger From holger at freyther.de Tue May 19 18:53:47 2015 From: holger at freyther.de (Holger Freyther) Date: Tue, 19 May 2015 20:53:47 +0200 Subject: [PATCH] Fix "make distcheck" In-Reply-To: <878ucnyso4.fsf@delenn.home.rotty.xx.vu> References: <1431874095-25609-1-git-send-email-mail@rotty.xx.vu> <33FFCC54-C42F-4C9E-9BEE-3DE39DA92622@freyther.de> <87d21zyuxa.fsf@delenn.home.rotty.xx.vu> <59DADFBC-D530-4C37-9321-C370583A44D8@freyther.de> <878ucnyso4.fsf@delenn.home.rotty.xx.vu> Message-ID: > On 17 May 2015, at 20:18, Andreas Rottmann wrote: > > > Regarding generating ".version" into the build dir: the way I fixed > things is the way is consistent with the recipe in git-version-gen > (implied in the text of the git-version-gen revision in libosmo-abis, > explicit in newer versions). applied. thanks. From alexander.chemeris at gmail.com Wed May 20 00:28:06 2015 From: alexander.chemeris at gmail.com (Alexander Chemeris) Date: Tue, 19 May 2015 20:28:06 -0400 Subject: [PATCH 0/4] core/conv: Fast Viterbi decoding In-Reply-To: References: <20140429041352.GA5213@phenom.hsd1.va.comcast.net> <67121C8F-38EA-4835-AA8E-025DD0C024F4@freyther.de> Message-ID: On Tue, May 19, 2015 at 2:20 AM, Holger Freyther wrote: >> On 18 May 2015, at 21:23, Tom Tsou wrote: >> On Sun, May 17, 2015 at 10:05 AM, Holger Freyther wrote: >>> I am going through patchwork and it doesn?t seem this was applied? I >>> assumed you and Sylvain would figure it out and merge it. What should >>> we do with the four patches? >> >> There was some discussion, but we never got around to completing the >> review. If there is still interest, we can revive that discussion. > > I am not an user of the viterbi decoding but I assume a speed-up will benefit > osmo-trx and it would be a shame to lose it. Strictly speaking, it speeds up lower parts of osmo-bts. And yes, it's a great improvement and I hope the review can be finished and patch merged. Viterbi is the most CPU hungry part of osmo-bts on UmTRX and other SDR platforms. -- Regards, Alexander Chemeris. CEO, Fairwaves, Inc. https://fairwaves.co From holger at freyther.de Thu May 21 06:53:54 2015 From: holger at freyther.de (Holger Freyther) Date: Thu, 21 May 2015 14:53:54 +0800 Subject: [PATCH 0/4] core/conv: Fast Viterbi decoding In-Reply-To: References: <20140429041352.GA5213@phenom.hsd1.va.comcast.net> <67121C8F-38EA-4835-AA8E-025DD0C024F4@freyther.de> Message-ID: > On 20 May 2015, at 08:28, Alexander Chemeris wrote: > > > Strictly speaking, it speeds up lower parts of osmo-bts. > > And yes, it's a great improvement and I hope the review can be > finished and patch merged. Viterbi is the most CPU hungry part of > osmo-bts on UmTRX and other SDR platforms. then please find some time to review/include it. I can set barriers like (requires a testcase, ABI/API changes need a TODO-RELEASE entry) but I would like the people that end up using these routines to comment and review them. thanks holger From 246tnt at gmail.com Sat May 23 12:56:53 2015 From: 246tnt at gmail.com (Sylvain Munaut) Date: Sat, 23 May 2015 14:56:53 +0200 Subject: [PATCH 0/4] core/conv: Fast Viterbi decoding In-Reply-To: References: <20140429041352.GA5213@phenom.hsd1.va.comcast.net> <67121C8F-38EA-4835-AA8E-025DD0C024F4@freyther.de> Message-ID: >> Strictly speaking, it speeds up lower parts of osmo-bts. >> >> And yes, it's a great improvement and I hope the review can be >> finished and patch merged. Viterbi is the most CPU hungry part of >> osmo-bts on UmTRX and other SDR platforms. > > then please find some time to review/include it. I can set barriers like > (requires a testcase, ABI/API changes need a TODO-RELEASE entry) > but I would like the people that end up using these routines to comment > and review them. Yeah, it's my bad ... But I'm travelling for the next 10 days so won't happen immediately. I'll at least try to re-read the discussion to see exactly what needs to be done to get to a state where it can be merged even if it's not perfect. Cheers, Sylvain From holger at freyther.de Sat May 23 13:00:45 2015 From: holger at freyther.de (Holger Freyther) Date: Sat, 23 May 2015 21:00:45 +0800 Subject: [PATCH 0/4] core/conv: Fast Viterbi decoding In-Reply-To: References: <20140429041352.GA5213@phenom.hsd1.va.comcast.net> <67121C8F-38EA-4835-AA8E-025DD0C024F4@freyther.de> Message-ID: <8596A2FB-95E4-49DB-964E-7A73823C4271@freyther.de> > On 23 May 2015, at 20:56, Sylvain Munaut <246tnt at gmail.com> wrote: Good Evening. > Yeah, it's my bad ? don?t worry and no pressure. I just went through patchwork and noticed what nice things we didn?t merge yet (e.g. the external libtalloc patch). holger From mail at rotty.xx.vu Sun May 24 22:10:03 2015 From: mail at rotty.xx.vu (Andreas Rottmann) Date: Mon, 25 May 2015 00:10:03 +0200 Subject: Build system patches for libosmo-sccp Message-ID: <1432505406-25240-1-git-send-email-mail@rotty.xx.vu> These are two buildsystem tweaks, in the same vein as the ones I posted recently for libosmocore, plus a gitignore update thrown in for good measure. From mail at rotty.xx.vu Sun May 24 22:10:04 2015 From: mail at rotty.xx.vu (Andreas Rottmann) Date: Mon, 25 May 2015 00:10:04 +0200 Subject: [PATCH 1/3] build: Add subdir-objects automake option In-Reply-To: <1432505406-25240-1-git-send-email-mail@rotty.xx.vu> References: <1432505406-25240-1-git-send-email-mail@rotty.xx.vu> Message-ID: <1432505406-25240-2-git-send-email-mail@rotty.xx.vu> From: Andreas Rottmann Having subdir-objects enabled is recommended by automake 1.14, to avoid future incompatibilities. However, adding that option breaks out-of-tree builds, and also seems to break "make distclean" for in-tree builds. The reason is that apparently, automake with subdir-objects enabled cannot cope with source files in a different, non-child directory. To avoid that, instead of referencing the source files, we (just) link against that library. --- configure.ac | 2 +- tests/sccp/Makefile.am | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/configure.ac b/configure.ac index 49c5f7e..2b4062b 100644 --- a/configure.ac +++ b/configure.ac @@ -3,7 +3,7 @@ AC_INIT([libosmo-sccp], m4_esyscmd([./git-version-gen .tarball-version]), [openbsc at lists.osmocom.org]) -AM_INIT_AUTOMAKE([dist-bzip2]) +AM_INIT_AUTOMAKE([subdir-objects dist-bzip2]) AC_CONFIG_TESTDIR(tests) dnl kernel style compile messages diff --git a/tests/sccp/Makefile.am b/tests/sccp/Makefile.am index 8cce20c..c22801a 100644 --- a/tests/sccp/Makefile.am +++ b/tests/sccp/Makefile.am @@ -5,6 +5,6 @@ EXTRA_DIST = sccp_test.ok noinst_PROGRAMS = sccp_test -sccp_test_SOURCES = sccp_test.c $(top_srcdir)/src/sccp.c -sccp_test_LDADD = $(LIBOSMOCORE_LIBS) +sccp_test_SOURCES = sccp_test.c +sccp_test_LDADD = $(top_builddir)/src/libsccp.a $(LIBOSMOCORE_LIBS) -- 2.1.4 From mail at rotty.xx.vu Sun May 24 22:10:05 2015 From: mail at rotty.xx.vu (Andreas Rottmann) Date: Mon, 25 May 2015 00:10:05 +0200 Subject: [PATCH 2/3] gitignore: Add 'compile' In-Reply-To: <1432505406-25240-1-git-send-email-mail@rotty.xx.vu> References: <1432505406-25240-1-git-send-email-mail@rotty.xx.vu> Message-ID: <1432505406-25240-3-git-send-email-mail@rotty.xx.vu> From: Andreas Rottmann This file is dropped into the top-level source directory by "autoreconf -i". --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 65fb1ef..48b2e76 100644 --- a/.gitignore +++ b/.gitignore @@ -15,6 +15,7 @@ bsc_mgcp #configure aclocal.m4 autom4te.cache/ +compile config.log config.status configure -- 2.1.4 From mail at rotty.xx.vu Sun May 24 22:10:06 2015 From: mail at rotty.xx.vu (Andreas Rottmann) Date: Mon, 25 May 2015 00:10:06 +0200 Subject: [PATCH 3/3] build: Fix "make distcheck" In-Reply-To: <1432505406-25240-1-git-send-email-mail@rotty.xx.vu> References: <1432505406-25240-1-git-send-email-mail@rotty.xx.vu> Message-ID: <1432505406-25240-4-git-send-email-mail@rotty.xx.vu> From: Andreas Rottmann Running "make distcheck" failed trying to generate ".version" into the read-only unpacked source directory. Actually shipping ".version" in the tarball fixes that. The error manifested as: make[1]: Entering directory '/tmp/build/libosmo-sccp-0.0.6.3.24-758d/_build' echo 0.0.6.3.24-758d > ../.version-t && mv ../.version-t ../.version /bin/bash: ../.version-t: Permission denied Makefile:807: recipe for target '../.version' failed --- Makefile.am | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Makefile.am b/Makefile.am index e300b31..534fdc2 100644 --- a/Makefile.am +++ b/Makefile.am @@ -6,6 +6,8 @@ SUBDIRS = include src tests pkgconfigdir = $(libdir)/pkgconfig pkgconfig_DATA = libosmo-sccp.pc libosmo-mtp.pc +EXTRA_DIST = .version + BUILT_SOURCES = $(top_srcdir)/.version $(top_srcdir)/.version: echo $(VERSION) > $@-t && mv $@-t $@ -- 2.1.4 From alexander.chemeris at gmail.com Mon May 25 01:01:19 2015 From: alexander.chemeris at gmail.com (Alexander Chemeris) Date: Sun, 24 May 2015 21:01:19 -0400 Subject: [PATCH 0/4] core/conv: Fast Viterbi decoding In-Reply-To: References: <20140429041352.GA5213@phenom.hsd1.va.comcast.net> <67121C8F-38EA-4835-AA8E-025DD0C024F4@freyther.de> Message-ID: Hi Holger, On Thu, May 21, 2015 at 2:53 AM, Holger Freyther wrote: >> On 20 May 2015, at 08:28, Alexander Chemeris wrote: >> Strictly speaking, it speeds up lower parts of osmo-bts. >> >> And yes, it's a great improvement and I hope the review can be >> finished and patch merged. Viterbi is the most CPU hungry part of >> osmo-bts on UmTRX and other SDR platforms. > > then please find some time to review/include it. I can set barriers like > (requires a testcase, ABI/API changes need a TODO-RELEASE entry) > but I would like the people that end up using these routines to comment > and review them. Unfortunately only Sylvain can do a meaningful review of that patch. Even though this patch was funded by us and I guess we're the primary users of it, I don't have enough expertise in that part of the code to meaningfully contribute to the discussion. Otherwise I would already did it. -- Regards, Alexander Chemeris. CEO, Fairwaves, Inc. https://fairwaves.co From kluchnikovi at gmail.com Tue May 26 10:53:11 2015 From: kluchnikovi at gmail.com (Ivan Kluchnikov) Date: Tue, 26 May 2015 13:53:11 +0300 Subject: [PATCH] gsm_04_08: Use osmo_assert for transt->conn and conn only in case of paging succeeded Message-ID: <1432637591-24130-1-git-send-email-kluchnikovi@gmail.com> setup_trig_pag_evt function can receive parameter conn = NULL, if T3113 expires. --- openbsc/src/libmsc/gsm_04_08.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/openbsc/src/libmsc/gsm_04_08.c b/openbsc/src/libmsc/gsm_04_08.c index 5609602..d45ae08 100644 --- a/openbsc/src/libmsc/gsm_04_08.c +++ b/openbsc/src/libmsc/gsm_04_08.c @@ -1389,13 +1389,12 @@ static int setup_trig_pag_evt(unsigned int hooknum, unsigned int event, struct gsm_subscriber_connection *conn = _conn; struct gsm_trans *transt = _transt; - OSMO_ASSERT(!transt->conn); - OSMO_ASSERT(conn); - /* check all tranactions (without lchan) for subscriber */ switch (event) { case GSM_PAGING_SUCCEEDED: DEBUGP(DCC, "Paging subscr %s succeeded!\n", transt->subscr->extension); + OSMO_ASSERT(!transt->conn); + OSMO_ASSERT(conn); /* Assign lchan */ transt->conn = conn; /* send SETUP request to called party */ -- 1.7.9.5 From holger at freyther.de Wed May 27 10:09:12 2015 From: holger at freyther.de (Holger Freyther) Date: Wed, 27 May 2015 12:09:12 +0200 Subject: [PATCH] gsm_04_08: Use osmo_assert for transt->conn and conn only in case of paging succeeded In-Reply-To: <1432637591-24130-1-git-send-email-kluchnikovi@gmail.com> References: <1432637591-24130-1-git-send-email-kluchnikovi@gmail.com> Message-ID: > On 26 May 2015, at 12:53, Ivan Kluchnikov wrote: HI, > setup_trig_pag_evt function can receive parameter conn = NULL, if T3113 expires. ah thank you very much for the patch and you are obviously right that in case the paging times out there will be no subscriber connection. > --- > openbsc/src/libmsc/gsm_04_08.c | 5 ++--- > 1 file changed, 2 insertions(+), 3 deletions(-) > > diff --git a/openbsc/src/libmsc/gsm_04_08.c b/openbsc/src/libmsc/gsm_04_08.c > index 5609602..d45ae08 100644 > --- a/openbsc/src/libmsc/gsm_04_08.c > +++ b/openbsc/src/libmsc/gsm_04_08.c > @@ -1389,13 +1389,12 @@ static int setup_trig_pag_evt(unsigned int hooknum, unsigned int event, > struct gsm_subscriber_connection *conn = _conn; > struct gsm_trans *transt = _transt; > > - OSMO_ASSERT(!transt->conn); Is there any reason to move this assert as well? setup_trig_pag_evt should be called exactly once right? And there should be no pre-existing subscriber connection? Do you have time to re-test with just moving one of the two asserts? thank you holger From Ivan.Kluchnikov at fairwaves.ru Fri May 29 08:56:37 2015 From: Ivan.Kluchnikov at fairwaves.ru (Ivan Kluchnikov) Date: Fri, 29 May 2015 11:56:37 +0300 Subject: [PATCH] gsm_04_08: Use osmo_assert for transt->conn and conn only in case of paging succeeded In-Reply-To: References: <1432637591-24130-1-git-send-email-kluchnikovi@gmail.com> Message-ID: Hi Holger, Yes, you are right, I retested this patch and it is enough to move only OSMO_ASSERT(conn). I updated patch for this issue. 2015-05-27 13:09 GMT+03:00 Holger Freyther : > > > On 26 May 2015, at 12:53, Ivan Kluchnikov wrote: > > > HI, > > > setup_trig_pag_evt function can receive parameter conn = NULL, if T3113 > expires. > > ah thank you very much for the patch and you are obviously right that in > case the > paging times out there will be no subscriber connection. > > > > --- > > openbsc/src/libmsc/gsm_04_08.c | 5 ++--- > > 1 file changed, 2 insertions(+), 3 deletions(-) > > > > diff --git a/openbsc/src/libmsc/gsm_04_08.c > b/openbsc/src/libmsc/gsm_04_08.c > > index 5609602..d45ae08 100644 > > --- a/openbsc/src/libmsc/gsm_04_08.c > > +++ b/openbsc/src/libmsc/gsm_04_08.c > > @@ -1389,13 +1389,12 @@ static int setup_trig_pag_evt(unsigned int > hooknum, unsigned int event, > > struct gsm_subscriber_connection *conn = _conn; > > struct gsm_trans *transt = _transt; > > > > - OSMO_ASSERT(!transt->conn); > > Is there any reason to move this assert as well? setup_trig_pag_evt should > be > called exactly once right? And there should be no pre-existing subscriber > connection? > Do you have time to re-test with just moving one of the two asserts? > > > thank you > > holger -- Regards, Ivan Kluchnikov. http://fairwaves.ru -------------- next part -------------- An HTML attachment was scrubbed... URL: From kluchnikovi at gmail.com Fri May 29 08:59:51 2015 From: kluchnikovi at gmail.com (Ivan Kluchnikov) Date: Fri, 29 May 2015 11:59:51 +0300 Subject: [PATCH] gsm_04_08: Use osmo_assert for transt->conn and conn only in case of paging succeeded Message-ID: <1432889991-12614-1-git-send-email-kluchnikovi@gmail.com> setup_trig_pag_evt function can receive parameter conn = NULL, if T3113 expires. --- openbsc/src/libmsc/gsm_04_08.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openbsc/src/libmsc/gsm_04_08.c b/openbsc/src/libmsc/gsm_04_08.c index 5609602..29ab2ba 100644 --- a/openbsc/src/libmsc/gsm_04_08.c +++ b/openbsc/src/libmsc/gsm_04_08.c @@ -1390,12 +1390,12 @@ static int setup_trig_pag_evt(unsigned int hooknum, unsigned int event, struct gsm_trans *transt = _transt; OSMO_ASSERT(!transt->conn); - OSMO_ASSERT(conn); /* check all tranactions (without lchan) for subscriber */ switch (event) { case GSM_PAGING_SUCCEEDED: DEBUGP(DCC, "Paging subscr %s succeeded!\n", transt->subscr->extension); + OSMO_ASSERT(conn); /* Assign lchan */ transt->conn = conn; /* send SETUP request to called party */ -- 1.7.9.5 From holger at freyther.de Sat May 30 06:37:05 2015 From: holger at freyther.de (Holger Freyther) Date: Sat, 30 May 2015 08:37:05 +0200 Subject: [PATCH] gsm_04_08: Use osmo_assert for transt->conn and conn only in case of paging succeeded In-Reply-To: References: <1432637591-24130-1-git-send-email-kluchnikovi@gmail.com> Message-ID: <6EF52F88-9D61-4BBE-8D5B-6B87BD432CAA@freyther.de> > On 29 May 2015, at 10:56, Ivan Kluchnikov wrote: > > Hi Holger, > > Yes, you are right, I retested this patch and it is enough to move only OSMO_ASSERT(conn). > I updated patch for this issue. thanks, I cherry-picked it from your branch. holger From alexander.chemeris at gmail.com Sat May 30 14:20:37 2015 From: alexander.chemeris at gmail.com (Alexander Chemeris) Date: Sat, 30 May 2015 10:20:37 -0400 Subject: [PATCH] obscvty: Implement readlines() generator function. Message-ID: The function is useful to process logs generated by OpenBSC/OsmoBTS VTY. -- Regards, Alexander Chemeris. CEO, Fairwaves, Inc. https://fairwaves.co -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: 0001-obscvty-Implement-readlines-generator-function.patch Type: text/x-patch Size: 1267 bytes Desc: not available URL: From alexander.chemeris at gmail.com Sat May 30 18:59:51 2015 From: alexander.chemeris at gmail.com (Alexander Chemeris) Date: Sat, 30 May 2015 14:59:51 -0400 Subject: [PATCH] libmsc: Improve 'max_power_red' VTY command. Message-ID: Changes: * Apply change even if the supplied value is odd, just warn that it is rounded. Previously the value was not set at all, which may have lead to a situation when a user thinks the BTS operating at low power, while it is running full power. * Apply change even if the supplied value is higher than the 24dB maximum suggested by the standard, just warn about this. UmSITE and probably other SDR based BTS support much wider power regulation range. * Apply change to the BTS over OML immediately. -- Regards, Alexander Chemeris. CEO, Fairwaves, Inc. https://fairwaves.co -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: 0001-libmsc-Update-max_power_red-VTY-command.patch Type: text/x-patch Size: 2524 bytes Desc: not available URL: From Alexander.Chemeris at fairwaves.co Sat May 30 19:42:16 2015 From: Alexander.Chemeris at fairwaves.co (Alexander Chemeris) Date: Sat, 30 May 2015 15:42:16 -0400 Subject: [PATCH 1/2] libbsc: Abstract out SIs update/generation for a BTS into a separate function. Message-ID: The code to do that doesn't belong to the control interface, so abstract it out to a separate function gsm_bts_set_system_infos(). -- Regards, Alexander Chemeris. CEO, Fairwaves, Inc. https://fairwaves.co -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: 0001-libbsc-Abstract-out-SIs-update-generation-for-a-BTS-.patch Type: text/x-patch Size: 3195 bytes Desc: not available URL: From alexander.chemeris at gmail.com Sat May 30 19:43:05 2015 From: alexander.chemeris at gmail.com (Alexander Chemeris) Date: Sat, 30 May 2015 15:43:05 -0400 Subject: [PATCH 2/2] libbsc: Update a BTS's SIs when ms_max_power is changed from VTY. Message-ID: Otherwise you have to restart BTS or at least break the RSL connection to apply the change. -- Regards, Alexander Chemeris. CEO, Fairwaves, Inc. https://fairwaves.co -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: 0002-libbsc-Update-a-BTS-s-SIs-when-ms_max_power-is-chang.patch Type: text/x-patch Size: 1057 bytes Desc: not available URL: From tom at tsou.cc Mon May 18 19:24:03 2015 From: tom at tsou.cc (Tom Tsou) Date: Mon, 18 May 2015 19:24:03 -0000 Subject: [PATCH 0/4] core/conv: Fast Viterbi decoding In-Reply-To: <67121C8F-38EA-4835-AA8E-025DD0C024F4@freyther.de> References: <20140429041352.GA5213@phenom.hsd1.va.comcast.net> <67121C8F-38EA-4835-AA8E-025DD0C024F4@freyther.de> Message-ID: Hi Holger, On Sun, May 17, 2015 at 10:05 AM, Holger Freyther wrote: > I am going through patchwork and it doesn?t seem this was applied? I > assumed you and Sylvain would figure it out and merge it. What should > we do with the four patches? There was some discussion, but we never got around to completing the review. If there is still interest, we can revive that discussion. -TT