Commit Graph

48 Commits

Author SHA1 Message Date
Max d09843c692 Remove unused headers
Change-Id: Idadb17aeb85b011d114ffc1d81c920544bac1989
2018-01-04 14:31:54 +01:00
Harald Welte 1468a5c3dc SocketsTest: Fix printing of non-nul-terminated string
Change-Id: I33d0ddf851d84b81ab5252e3755422170cee54ee
Fixes: Coverity CID#149363
2017-11-07 20:32:09 +00:00
Pau Espin 8c80095017 Add -j option to bind to specific address
Before this patch, the binding of the listening sockets was hardcoded to
a local IP.

Change-Id: I9ba184a1251c823e413a9230943ed263e52142ec
2017-08-16 17:06:54 +02:00
Tom Tsou 87d158cc2d common: Declare explicit Vector move constructor
Vector class already has a semantically odd non-const copy
constructor that serves the same function as a C++11 move
constructor. Make the move constructor semantics explicit
and address Coverity at the same time.

Change-Id: I22e0099abe601b0c59beee808f7560837c6977dd
Fixes: Coverity CID 170738
2017-06-19 17:02:41 +00:00
Alexander Chemeris 082bbbf8fe PRBS: a Pseudo-random binary sequence (PRBS) generator class.
Implemeted with a Galois LFSR for speed and flexibility compared to Fibonacci version.

Aliases for three popular PRBS' are added for convenience - PRBS9, PRBS15 and PRBS64.

Note that we can't test PRBS64 completely, because the sequence is too long to
be generated.

Change-Id: Ib5331ba5d0b5819929541686fdd87905e2177b74
2017-06-08 18:33:47 +00:00
Alexander Chemeris 15f9d95f5f BitVector: Remove Generator class.
It is not used in osmo-trx, because we're not doing FEC or CRC checks.

Change-Id: I1509e785c1187ebdafe5b2518bd298fbbd1cd036
2017-05-30 20:12:58 +00:00
Alexander Chemeris 73dbccda78 Configuration: Variables allocated with 'new' must be freed with 'delete'.
Thank you Valgrind.

Change-Id: I8477e4e37282947f9841cee9002565631ca0c0b6
2017-05-30 19:19:19 +00:00
Tom Tsou 15da7e1f7e Configuration: Fix const and signedness compile warnings
Change-Id: I701559814b2aee6f84f10e612f128da40f6a51c1
2017-04-03 18:55:02 -07:00
Alexander Chemeris f0189c47be vector: Introduce shrink() function to shrink vector size without loosing data.
Change-Id: I9c0ac2715aea1a90c9e6ebcd982522b80a547099
2017-03-24 01:25:06 +00:00
Alexander Chemeris c708816be1 vector: Introduce segmentMove() method to move data inside of a vector.
Change-Id: I2f3f4267b4137a0bc031f27e0f896fba9b9f3433
2017-03-24 01:24:23 +00:00
Alexander Chemeris 38b69871ae BitVector: Convert SoftVector from 0..1 to -1..+1 soft bits.
This makes code simpler and will allow us send -127..127 soft bits towards
osmo-bts instead of 0..255 bits.

Change-Id: I16ecc3d4c829dcf0f619ad995bc9d4a4ed8af0a4
2017-03-22 18:31:22 +00:00
Alexander Chemeris 7db522b6d9 BitVector: Remove convolutional codec - we don't use it in osmo-trx.
Now we have more fexibility in how we represent SoftVector, since we
no longer depend on the particular convolutional codec implementation.

Change-Id: I3006b6a26c5eff59dbe9c034f689961802f1d0d0
2017-03-22 18:31:17 +00:00
Alexander Chemeris ae09b04e26 CommonLibs: Print soft bits with less confidence to console when printing a soft vector.
We use other symbols to show that these bits has less confidence:
o and . for 0 with less confidence
| and ' for 1 with less confidence

Change-Id: I747a17568ee48f1f3163e8dfab2e450af85e6435
2017-03-22 18:31:12 +00:00
Alexander Chemeris 4793f4679b CommonLibs: Remove unused files.
Change-Id: I2bfb45a1c7d01785bdb30204dba38c683a4288a9
2017-03-20 17:32:04 +00:00
Max 2dee3e996e Fix building against sqlite3
* Explicitly check for sqlite3 at configure stage, remove old include
  dir, fix header inclusion.
* Use configure results for linking instead of hardcoded linker option
  for sqlite.
* Add dependency on -dev package for .deb

Change-Id: I6d7f697d67651f02ceb77fc4da4317b64fa47f9e
Fixes: OS#1928
2017-01-26 17:06:06 +01:00
Tom Tsou 2c650a6895 common: Add mandatory length field to UDP receive calls
Current UDP receive reads up to MAX_UDP_LENGTH bytes into the
passed in buffer, which may lead to buffer overflow if the
write buffer is of insufficient size.

Add mandatory length argument to UDP socket receive calls.

Reported-by: Simone Margaritelli <simone@zimperium.com>
Signed-off-by: Tom Tsou <tom.tsou@ettus.com>
2016-05-02 17:37:05 -07:00
Tom Tsou d4555f267e common: Restrict UDP binding to localhost only
Reported security vulnerability where control and data UDP
packets can be injected into the transceiver externally due
to socket binding to all interfaces using INADDR_ANY.

Existing socket interface does not allow specifying local
address; only the local port and remote address/port are
arguments.

Restrict socket bind to localhost with INADDR_LOOPBACK. If
external interfaces do need to be used, the API should be
modified to allow specifying the local socket address.

Reported-by: Simone Margaritelli <simone@zimperium.com>
Signed-off-by: Tom Tsou <tom.tsou@ettus.com>
2016-05-02 17:35:01 -07:00
Alexander Chemeris a8cf208616 Common: Make sure gLogEarly() log to the same facilities as the normal log. 2016-04-20 12:33:41 -07:00
Alexander Chemeris f84232d30a Common: Get rid of a compilation warning.
debugLogEarly was replaced to an empty space and arguments of the function
became operators, grouped together by ():
Configuration.cpp: In member function 'bool ConfigurationTable::defines(const string&)':
Configuration.cpp:272:28: warning: left operand of comma operator has no effect [-Wunused-value]
   debugLogEarly(LOG_ALERT, "configuration parameter %s not found", key.c_str());
                            ^

This fix removes debugLogEarly together with its arguments.
2016-04-20 12:26:57 -07:00
Alexander Chemeris cc6f79b1c0 Logger: Output ERR log messages to stderr as well.
Signed-off-by: Tom Tsou <tom.tsou@ettus.com>
2015-07-30 14:24:20 -07:00
Alexander Chemeris 909ffbfd23 Common: Use a scoped lock in the Logger to avoid deadlock on thread cancel.
Signed-off-by: Tom Tsou <tom.tsou@ettus.com>
2015-07-30 14:14:23 -07:00
Alexander Chemeris 57ef87d061 Common: Log to console instead of loging to syslog by default. 2015-05-24 13:23:11 -04:00
Alexander Chemeris 5721920a08 Common: Introduce a global variable to disable syslog logging.
When we enable DEBUG logging level, syslog gets Gb's of data and can completely
exhaust the file system free space. Now we can just enable it. This is not to
say that logging to syslog it just not very useful in general.
2015-05-24 13:20:44 -04:00
Tom Tsou b999759175 CommonLibs: Add thread cancellation capability
For clean shutdown in the transceiver we need to cancel and join
running threads for orderly unwinding. Thread cancellation points
already exist, so we just need to be able to call on the threads to
exit out when stopping or shutting down.

Don't error when joining a NULL thread, which would be the case if a
thread was stopped before ever being started to begin with.

Signed-off-by: Tom Tsou <tom@tsou.cc>
2014-12-15 16:20:15 -07:00
kurtis.heimerl 5a87247fdf syncing commonlibs with Many thanks to Michael Iedema for these patches, makes config a lot better.
git-svn-id: http://wush.net/svn/range/software/public/openbts/trunk@5655 19bc5d8c-e614-43d4-8b26-e1612bc8e597
2013-05-31 21:47:25 +00:00
kurtis.heimerl f7afddd398 Synced sqlite3utils with private and fixed a small recursive bug in SIPEngine that was already fixed in private
git-svn-id: http://wush.net/svn/range/software/public/openbts/trunk@4912 19bc5d8c-e614-43d4-8b26-e1612bc8e597
2013-02-15 02:57:54 +00:00
kurtis.heimerl 1a2d244c70 Correction of trivial warnings.
git-svn-id: http://wush.net/svn/range/software/public/openbts/trunk@4670 19bc5d8c-e614-43d4-8b26-e1612bc8e597
2012-12-22 04:30:56 +00:00
kurtis.heimerl 0775c80140 From b453f10d65dd1ff1df0dd3747adf63f4e1fd7d30 Mon Sep 17 00:00:00 2001
From: Alexander Chemeris <Alexander.Chemeris@gmail.com>
Date: Sun, 16 Dec 2012 17:44:10 +0400
Subject: [PATCH] Use gethostbyname2_r() instead of gethostbyname() if
 available.

gethostbyname() is not thread-safe. It's recommended to use gethostbyname_r() or gethostbyname2_r() instead.
---
 CommonLibs/Sockets.cpp |   44 +++++++++++++++++++++++++++++++++-----------
 configure.ac           |    4 ++++
 2 files changed, 37 insertions(+), 11 deletions(-)

git-svn-id: http://wush.net/svn/range/software/public/openbts/trunk@4637 19bc5d8c-e614-43d4-8b26-e1612bc8e597
2012-12-17 11:22:04 +00:00
kurtis.heimerl eb63ec9c5f From 32bbfc3c89b1c56672bf2fd3660a45c513ac54d4 Mon Sep 17 00:00:00 2001
From: Alexander Chemeris <Alexander.Chemeris@gmail.com>
Date: Sun, 16 Dec 2012 17:33:46 +0400
Subject: [PATCH 1/4] Fix typos in comments.

---
 CommonLibs/Logger.h |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

git-svn-id: http://wush.net/svn/range/software/public/openbts/trunk@4635 19bc5d8c-e614-43d4-8b26-e1612bc8e597
2012-12-17 11:21:32 +00:00
kurtis.heimerl 8fd86a50e5 OH GOOD GIT MISSED THESE FILES THANKS GIT
git-svn-id: http://wush.net/svn/range/software/public/openbts/trunk@4630 19bc5d8c-e614-43d4-8b26-e1612bc8e597
2012-12-16 06:23:29 +00:00
kurtis.heimerl 00913d74d9 Sylvain patch #2, with modifications:
CommonLibs: Avoid direct syslog calls in ConfigurationTable

    We instead introduce a 'log early' facility in Logger.h to accomplish
    the same

    Signed-off-by: Sylvain Munaut <tnt@246tNt.com>

I added similar code to the reporting functions, which did not exist when sylvain made this patch

git-svn-id: http://wush.net/svn/range/software/public/openbts/trunk@4629 19bc5d8c-e614-43d4-8b26-e1612bc8e597
2012-12-16 06:08:18 +00:00
kurtis.heimerl db70eb4c6e Patch 4545 in private:
Added support for performance-reporting counters.

and

Patch 4588 in private:
For some reason, ReportingTest won't build on all systems.  Since it is not part of the actuall application, I am commenting it out from the Makefile.am for now.

git-svn-id: http://wush.net/svn/range/software/public/openbts/trunk@4627 19bc5d8c-e614-43d4-8b26-e1612bc8e597
2012-12-16 06:06:32 +00:00
kurtis.heimerl 9eafbe9c88 missed something in one of the socket patches. now works as expected
git-svn-id: http://wush.net/svn/range/software/public/openbts/trunk@4516 19bc5d8c-e614-43d4-8b26-e1612bc8e597
2012-11-23 08:38:04 +00:00
kurtis.heimerl a7fee637af r4425 in private:
Double check the FD set to be sure that the correct FD was really touched.

git-svn-id: http://wush.net/svn/range/software/public/openbts/trunk@4513 19bc5d8c-e614-43d4-8b26-e1612bc8e597
2012-11-23 08:36:18 +00:00
kurtis.heimerl 0aaabd44c2 r4408 in private:
Add code from David to keep the transceiver running when OpenBTS crashes and check if it is running when starting up.

git-svn-id: http://wush.net/svn/range/software/public/openbts/trunk@4512 19bc5d8c-e614-43d4-8b26-e1612bc8e597
2012-11-23 08:35:46 +00:00
kurtis.heimerl c9f268dbed Oh kay. Lots of patches trying to catch up to mainline:
r4232: Major change in hos entries are removed from a TransactionTable.

>From now on, the only place were entries are actually removed is in TransactionTable::innerRemove.
Anywhere else, the remove methods just set a flag to tag the entry for later removal be innerRemove.
This allows us to survive situations where we try to touch transactions that have been removed already.  We still log at the ERR level, but no more segfaults.

Updated all of the TransactionTable "find" methods to not return pointers to dead or removed tranactions.

Updated find-by-channel search to return the transaction entry with the highest transaction number, which fixes a bug that sometimes picked up the wrong transaction records during EA TCH assignment.

r4253: New exception class for when someone tries to use a "removed" transaction.

r4254: Updated copyright notice.

r4265: Unlock TransactionEntry::mLock while blocked on SIP message FIFOs in SIPEngine.  This does wonders to reduce lock contention and make everything more snappy.

Use Mutex::tryLock in TransactionEntry::dead and if lock is held, assume that it is not dead.  This also does a lot to reduce lock contention.

r4294: Change Um congestion response back to SIP 503.

r4295: When deleting an entry that has failed to respond to paging, send a SIP 480 response so the switch knows that transaction is dead.

r4412: Fixed bug that was causing SIPInterface to crash when the IMSI cannot be extracted from the To: header.

git-svn-id: http://wush.net/svn/range/software/public/openbts/trunk@4497 19bc5d8c-e614-43d4-8b26-e1612bc8e597
2012-11-22 05:30:27 +00:00
kurtis.heimerl e766abbf82 Alexander's patch #1:
This patch makes a step towards using a system-wide sqlite3 lib. It
moves sqlite3util.cpp/.h to CommonLibs and leaves only original
sqlite3 files in the sqlite3 dir of OpenBTS.

I do not claim any copyright over this change, as it's very basic.
Looking forward to see it merged into mainline.

git-svn-id: http://wush.net/svn/range/software/public/openbts/trunk@4467 19bc5d8c-e614-43d4-8b26-e1612bc8e597
2012-11-14 03:51:51 +00:00
kurtis.heimerl 42267fd116 Alexander's patch #3: Configuration Tests should not include crashing
git-svn-id: http://wush.net/svn/range/software/public/openbts/trunk@4459 19bc5d8c-e614-43d4-8b26-e1612bc8e597
2012-11-11 10:15:43 +00:00
kurtis.heimerl bcf60a8fc9 merged private Config to public: r4211:
Changes to ConfigurationTable class.  Cleaner locking operations, fewer messages for normal operations, ALERT logging for truly abnormal operations.

git-svn-id: http://wush.net/svn/range/software/public/openbts/trunk@4348 19bc5d8c-e614-43d4-8b26-e1612bc8e597
2012-10-26 06:25:56 +00:00
kurtis.heimerl 9123274be9 Public release now works with g++4.7. In 4.7, unistd.h is no longer imported by default
git-svn-id: http://wush.net/svn/range/software/public/openbts/trunk@3918 19bc5d8c-e614-43d4-8b26-e1612bc8e597
2012-07-22 05:09:00 +00:00
kurtis.heimerl 7645fcaa5d Harvind found a bug in BitVector.cpp:
Basically the unpack method and fillField method assume MSB-first bit packing.   The unpack method calls fillField for each byte that needs to be unpacked.  The problem occurs on its final call to fillField when it has a partial byte to unpack; it uses the LSB bits instead of the MSB bits.

git-svn-id: http://wush.net/svn/range/software/public/openbts/trunk@3288 19bc5d8c-e614-43d4-8b26-e1612bc8e597
2012-03-08 07:13:15 +00:00
kurtis.heimerl d0093191d0 Locking gethostbyname call, as Alexander notes that it is not thread safe
git-svn-id: http://wush.net/svn/range/software/public/openbts/trunk@2865 19bc5d8c-e614-43d4-8b26-e1612bc8e597
2011-12-24 02:53:10 +00:00
kurtis.heimerl f041e25777 Reverted bad function header. There are no timing inversion deadlocks, I made those up.
git-svn-id: http://wush.net/svn/range/software/public/openbts/trunk@2836 19bc5d8c-e614-43d4-8b26-e1612bc8e597
2011-12-17 00:05:31 +00:00
kurtis.heimerl 4395f4b597 Alexander's change. Fixes MTC bug by supporting 64bit processors in Timeval. Math was bad.
git-svn-id: http://wush.net/svn/range/software/public/openbts/trunk@2835 19bc5d8c-e614-43d4-8b26-e1612bc8e597
2011-12-17 00:03:24 +00:00
kurtis.heimerl 1ac561b06d Fixing Thomas's MTC receive bug. We don't have a ticket for it, but there seemed to be a timing inversion deadlock in Interthread.h. We mostly duck it, instead of solving it.
git-svn-id: http://wush.net/svn/range/software/public/openbts/trunk@2822 19bc5d8c-e614-43d4-8b26-e1612bc8e597
2011-12-15 06:23:39 +00:00
dburgess 7b2d522c71 git-svn-id: http://wush.net/svn/range/software/public/openbts/trunk@2583 19bc5d8c-e614-43d4-8b26-e1612bc8e597 2011-11-20 00:22:41 +00:00
dburgess ec3d77d0ea Fixed the license notices.
git-svn-id: http://wush.net/svn/range/software/public/openbts/trunk@2305 19bc5d8c-e614-43d4-8b26-e1612bc8e597
2011-10-12 01:23:28 +00:00
dburgess 82c46ff7ae Putting the actual OpenBTS P2.8 source code into the public SVN branch.
git-svn-id: http://wush.net/svn/range/software/public/openbts/trunk@2242 19bc5d8c-e614-43d4-8b26-e1612bc8e597
2011-10-07 02:40:51 +00:00