AgeCommit message (Collapse)AuthorFilesLines
2015-07-28nitb: Rename "use-tmsi" into "assign-tmsi", add a missing space after "no"ciaby/2015-07-28Ciaby1-2/+2
2015-07-28Merge branch 'zecke/features/no-tmsi' into ciaby/2015-07-28Ciaby3-32/+89
2015-07-28Handover fix, needs to be tested.Ciaby1-0/+4
2015-07-28Revert MNCC_SOCK_VERSION to 2 (from 4), otherwise there is no know LCR ↵Ciaby1-1/+1
version which can work with it :) Also mentioned at: https://gitorious.org/sysmocom-openembedded/meta-telephony/commit/4da2963d82e7bee3045f73448d17395f78f1caf0
2015-07-28Added SMPP support in the debian build, include libsmpp34-dev as a dependency.Ciaby2-2/+2
2015-07-14nitb: Add a mode to not use TMSI for normal operationzecke/features/no-tmsiHolger Hans Peter Freyther3-31/+88
In case foreign simcards are used we can not do authentication and ciphering. In case a TMSI is re-used too early and we do page using TMSI we can't know which of the two MS is responding to us. We could change the "secure channel" routine to ask for the IMSI and only then stop the paging. As we don't have ciphering there is not much use in using the TMSI. Add a mode "no assign-tmsi" that will not assign the TMSI during LU. Now CM Service Request and Paging Response will work using the IMSI. There can't be a clash with that.
2015-07-13nitb: Be less strict about the reject causeHolger Hans Peter Freyther1-1/+1
When we can't find the TMSI then the subscriber is not in our VLR. We have not consulted with the HLR and it is better to not use such a severe error code.
2015-07-13sms: Fix the non-SMPP mode of the testHolger Hans Peter Freyther1-3/+4
List needs to be executed from within the right configuration node to see if it is available or not. list on the toplevel will uncoditionally show "smpp" as part of the logging config.
2015-07-13bsc: Rename core_ncc to core_mncHolger Hans Peter Freyther5-9/+9
Struct osmo_msc_data contains int core_ncc, which is actually the MNC part of the PLMN, not to be confused with the Network Colour Code. The following patch renames this field for clarity and consistency with the standards.
2015-07-13Merge branch 'zecke/features/smpp-route'Holger Hans Peter Freyther5-41/+136
2015-07-13sms: Do not go through the routing a second timeHolger Hans Peter Freyther1-1/+7
If we have tried SMPP first and it was not routable, and then tried the local delivery there is no point in trying SMPP with the same parameters again. Leave early and return unknown sub to the caller.
2015-07-06sms: Add a way to always route SMS through SMPP systemsHolger Hans Peter Freyther5-0/+73
default-route would only be looked at after there has been no subscriber in the local database. Depending on the setup this is not what one wants. This has been discussed at the OsmoDevCon and there have been hacks in some branches. Let's introduce a VTY command to select if SMPP should be consulted first and then fallback to the current behavior.
2015-07-06sms: Simplify the return handling for SMPP routes/unroutableHolger Hans Peter Freyther1-2/+1
2015-07-06sms: Put the try_deliver into the header fileHolger Hans Peter Freyther2-2/+8
Even if it is using BSC/NITB types let's put it in the header file than just declaring it at a place that could bitrot in a way that doesn't lead a warning.
2015-07-06sms: Move the routing of the sms to a separate functionHolger Hans Peter Freyther1-39/+50
The "default-route" for SMPP will be used after a local subscriber look-up. Sometimes we want to route everything to SMPP. Make this possible by changing this routine.
2015-07-02configure: Do not link all applications against libgsmHolger Hans Peter Freyther3-3/+5
Use the same trick as done by the dlopen check to not have everyone link against the library.
2015-07-02configure: No need to check for crypt hereHolger Hans Peter Freyther1-2/+0
We just link to libosmovty and if it requires crypt internally it needs to link to that (and not us). This looks like a left-over from when we moved the VTY code out of OpenBSC
2015-07-01nat: Use RAND_bytes instead of /dev/urandomHolger Hans Peter Freyther4-24/+8
We don't need to consume all the entropy of the kernel but can use libcrypto (OpenSSL) to generate random data. It is not clear if we need to call RAND_load_file but I think we can assume that our Unices have a /dev/urandom. This takes less CPU time, provides good enough entropy (in theory) and leaves some in the kernel entropy pool.
2015-07-01Merge branch 'zecke/features/auth'Holger Hans Peter Freyther9-36/+291
Introduce another authentication scheme using MILENAGE. In the future reading from /dev/urandom will be replaced with libcrypto.
2015-07-01nat: After we identified the bsc check the keyHolger Hans Peter Freyther3-4/+91
We are using the token to find the right bsc_config and then we can use the last_rand of the bsc_connection to calculate the expected result and try to compare it with a time constant(???) memcmp.
2015-07-01bsc: Check for the rand and then generate a resHolger Hans Peter Freyther6-7/+94
Check if the NAT has sent 16 bytes of RAND and if a key has been configured in the system and then generate a result using milenage. The milenage res will be sent and noth the four byte GSM SRES derivation.
2015-07-01nat: Send 16 bytes of rand to the BSC and remember itHolger Hans Peter Freyther2-3/+38
Generate 16 byte of random data to be used for A3A8 by the BSC in the response. We can't know which BSC it is at this point and I don't want to send another message once the token has been received so always send the data with an undefined code. The old BSCs don't parse the message and will happily ignore the RAND. /dev/urandom can give short reads on Linux so loop around it until the bytes have been read from the kernel.
2015-07-01nat: Provide access to /dev/urandom for the codeHolger Hans Peter Freyther2-0/+12
Instead of doing open/read/close all the time, open the FD in the beginning and keep it open. To scare me even more I have seen /dev/urandom actually providing a short read and then blocking but it seems to be the best way to get the random byes we need for authentication. So one should/could run the cheap random generator on the system (e.g. haveged) or deal with the NAT process to block.
2015-07-01bsc/nat: Fix the structure of the identity request messageHolger Hans Peter Freyther4-8/+28
Unfortunately the basic structure of the response is broken. There is a two byte length followed by data. The concept of a 'tag' happens to be the first byte of the data. This means we want to write strlen of the token, then we want to write the NUL and then we need to account for the tag in front. Introduce a flag if the new or old format should be used. This will allow to have new BSCs talk to old NATs without an additional change. In the long run we can clean that up.
2015-07-01nat: Close the connection after we couldn't find the userHolger Hans Peter Freyther1-0/+1
In case the token was not correct, just close the connection. It is not clear that forcing a new TCP connection is going to give us any extra security here. But with the upcoming auth handling it does make sense to have both case look similar.
2015-07-01nat: Factor out the config by token searchHolger Hans Peter Freyther3-19/+32
In the upcoming authentication improvements it is nice to separate the finding of the config from the post-allow handling of it.
2015-07-01nat: Add size check for the payloadHolger Hans Peter Freyther1-1/+1
The msgb will always have these bytes but it is better practice to verify that the message really has space for the two bytes.
2015-06-20bts: Arfcn can never be smaller than 0Holger Hans Peter Freyther1-2/+1
Remove the condition because it can never be true. Fixes: Coverity CID#1307793
2015-06-19build: avoid spurious hard dependency on libosmo-sccpAndreas Rottmann1-3/+0
In the libfilter source code, which is built regardless of --enable-nat, headers from libosmo-sccp were used, thus causing a build failure (see below) when building without --enable-nat, and libosmo-sccp not being installed (or being installed in a prefix not otherwise included in the build). The build fails like this: In file included from ../../../src/libfilter/bsc_msg_filter.c:27:0: ../../../include/openbsc/bsc_nat_sccp.h:27:37: fatal error: osmocom/sccp/sccp_types.h: No such file or directory As the includes seem not to be actually needed, this change fixes the issue by just omitting them.
2015-06-19Fix "make distcheck"Andreas Rottmann1-1/+1
Running "make distcheck" failed trying to generate ".version" into the read-only unpacked source directory. Actually shipping ".version" in the tarball fixes that.
2015-06-19Fix build wrt. missing CFLAGS constituentsAndreas Rottmann7-7/+8
When libosmo-netif and/or libosmo-abis are installed in distinct prefixes, the build failed with non-found headers.
2015-06-19Fix GSM900 ARFCN range checkMichael McTernan1-2/+2
Allow ARFCN 0 to be used in GSM900 band.
2015-06-15bsc: Attempt to fix crash when sending a SCCP CREF messageHolger Hans Peter Freyther1-1/+1
There was no context for the SCCP CREF message and this means that the msc_con was a plain NULL pointer that was dereferenced and the application would crash. Use the new API to pass the incoming MSC Connection which sould be used for the SCCP CREF message as context. The code has not been fed with an actual SCCP CR message.
2015-06-02sgsn: Simplify finding/using the first address of the resultHolger Hans Peter Freyther1-7/+2
The loop was used to print all returned addresses but we can simply pick the first one. This is fixing a coverity issue that the loop will be executed eaxactly once (and that was on purpose). Simplify the code and just take the first element (which might be NULL). Fixes: Coverity CID#1302852
2015-06-02sgsn: seleted_apn_str might be NULL do not strcpyHolger Hans Peter Freyther1-1/+4
The subscriber might simply not be allowed to use the APN that was specified. So selected_apn_str might very well be NULL. Fixes: Coverity CID#1302853
2015-06-02sgsn: Check the return value of osmo_fd_registerHolger Hans Peter Freyther1-1/+2
We can't do much in case the fd is failing to be registered. There should be a timeout that is catching this and it might be able to repair it self. Fixes: Coverity CID#1302854
2015-06-02libbsc: Move SIs update/generation for a BTS into a separate function.Alexander Chemeris3-14/+27
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(). [hfreyther: Fix the coding style...]
2015-06-01sgsn: Do not search the name with the "domain" name attached to itHolger Hans Peter Freyther1-1/+1
In case the query for "hostname" will fail c-ares will append the domain name of /etc/resolv.conf and query again. We don't want that so claim we provide a list of domain names and then don't provide any. I didn't intend to have pushed the c-ares code to master yet.
2015-05-29gsm_04_08: Use osmo_assert for transt->conn and conn only in case of paging ↵Ivan Kluchnikov1-1/+1
succeeded setup_trig_pag_evt function can receive parameter conn = NULL, if T3113 expires.
2015-05-29ggsn: The id is a uint32_t don't print it as signedHolger Hans Peter Freyther2-3/+3
This was noticed as I started to use UINT32_MAX for dynamically created GGSNs.
2015-05-25sgsn: Allow to specify the DNS servers that should be usedHolger Hans Peter Freyther3-1/+26
If no server is specified the default list will be used. This allows to separate the servers for the local network and GRX from each other.
2015-05-25sgsn: Allow to resolve the IPv4 address of a GGSN through DNSHolger Hans Peter Freyther8-21/+232
For real networks we need to check if the requested APN string is allowed and then resolve the GGSN address through DNS. There are countries with two or three digit MNCs and one could either try to keep a list of countries that have two/three digits or just try both of them. I have opted for the later for the ease of the implementation. C-Ares doesn't allow to cancel a request so we will need to have the MMCTX and the Lookup have different lifetimes. We simply set ->mmctx to NULL in case the MMCTX dies more early. The selected and verified apn_str will be copied into the out parameter. In case no static APN/GGSN config is present and the dynamic mode is enabled a request will be made.
2015-05-25sgsn: Integrate c-ares with the osmocom event loopHolger Hans Peter Freyther4-6/+196
c-ares is an asynchronous DNS resolver and we need it to resolve the GGSN address. This is integrating the library into our infrastructure. We will create and maintain a list of registered FDs (c-ares is currently only using one of them) and (re-)schedule the timer after events occurred.
2015-05-25sgsn: Create a copy of the msgb for later usageHolger Hans Peter Freyther1-3/+35
When needing to do an asynchronous DNS query we need to keep the TLV data around. So create a wrapper that takes a copy of it and frees it after the call. I can change the code to add an out parameter to decide if the msgb should be freed or not. Pick network failure in case the msgb could not be cloned in the hope the MS will retry then.
2015-05-25sgsn: Re-factor the activate PDP code for future changesHolger Hans Peter Freyther1-24/+39
A real SGSN will dynamically resolve the APN name into the GGSN IP Address. This means that after we have collected all information we need to start to resolve the GGSN and then can continue.
2015-05-25sgsn: Deal with no static ggsn being configured at allHolger Hans Peter Freyther1-0/+7
In case no static ggsn is configured the code would crash with the assumption that there is always such a GGSN.
2015-05-25sgsn: If there is a subscr don't allow an empty listHolger Hans Peter Freyther2-6/+6
This is a left-over from the initial system where no PDP was provided by the system. For now if there is a subscr attached and no PDP context provisioned. He is not allowed to have a data connection. Update the testcase to create the pdp list entry more early with a wildcard and then change it to a specific match.
2015-05-24Merge branch 'zecke/features/sgsn-hlr-number'Holger Hans Peter Freyther10-5/+108
Store the hlr-Number for purgeMS and CDR handling
2015-05-24sgsn: Extract the hlr Number into the mm contextHolger Hans Peter Freyther4-5/+48
Include the hlr-Number of the subscriber in the CDR. This is useful for debugging and understanding which equipment was used during the test. In contrast to the MSISDN the '+' is emitted as the number must be in international format already.
2015-05-24gsup: Copy the hlr-Number and use it during purgeHolger Hans Peter Freyther3-0/+23
Copy the hlr-Number into the sgsn_data and use it during the purgeMS. There is no unit test that looks at the data we send so I manually verified this by looking at the output. Below is the output of the test that purges the subscriber. <000f> gprs_subscriber.c:170 SUBSCR(123456789012345) Sending GSUP, will send: 0c 01 08 21 43 65 87 09 21 43 f5 09 07 91 83 61 26 31 23 f3