Skip to content

Fixes for Ubuntu 22.04 #51

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 26 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
*~
._*
*.a
*.o
Expand All @@ -17,11 +18,13 @@ apps/fpga.rbf
apps/transceiver
build-arch-stamp
build-indep-stamp
compile
config/libtool.m4
config/ltoptions.m4
config/ltsugar.m4
config/ltversion.m4
config/lt~obsolete.m4
config/test_ortp_version
config.guess
config.h
config.log
Expand All @@ -46,3 +49,5 @@ TransceiverRAD1/transceiver
apps/OpenBTS-UMTS
apps/OpenBTS-UMTSCLI
apps/OpenBTS-UMTSDo
vlm-asn1c-0959ffb/
README
2 changes: 1 addition & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[submodule "NodeManager"]
path = NodeManager
url = https://github.com/RangeNetworks/NodeManager.git
url = https://github.com/FlUxIuS/NodeManager
branch = master
3 changes: 0 additions & 3 deletions ASN/makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4916,7 +4916,4 @@ check: ${TARGET}
@echo ================

distclean: clean
rm -f $(ASN_MODULE_SOURCES)
rm -f $(ASN_MODULE_HEADERS)
rm -f $(ASN_CONVERTER_SOURCES) $(ASN_CONVERTER_HEADERS)
rm -f Makefile.am.sample
24 changes: 22 additions & 2 deletions CommonLibs/ScalarTypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* traditionally complex, proprietary hardware systems.
*
* Copyright 2011-2014 Range Networks, Inc.
*
* Patched by FlUxIuS @ Penthertz SAS
* This software is distributed under the terms of the GNU Affero General
* Public License version 3. See the COPYING and NOTICE files in the main
* directory for licensing information.
Expand Down Expand Up @@ -31,6 +31,18 @@
Basetype* operator&() { return &value; } \


#define _INITIALIZED_SCALAR_FUNCSBOOL(Classname,Basetype,Init) \
Classname() : value(Init) {} \
Classname(Basetype wvalue) { value = wvalue; } /* Can set from basetype. */ \
operator Basetype(void) const { return value; } /* Converts from basetype. */ \
Basetype operator++() { return true; } \
Basetype operator++(int) { return true; } \
Basetype operator=(Basetype wvalue) { return value = wvalue; } \
Basetype operator+=(Basetype wvalue) { return value = value + wvalue; } \
Basetype operator-=(Basetype wvalue) { return value = value - wvalue; } \
Basetype* operator&() { return &value; } \


#define _DECLARE_SCALAR_TYPE(Classname_i,Classname_z,Basetype) \
template <Basetype Init> \
struct Classname_i { \
Expand All @@ -39,6 +51,14 @@
}; \
typedef Classname_i<0> Classname_z;

#define _DECLARE_SCALAR_TYPEBOOL(Classname_i,Classname_z,Basetype) \
template <Basetype Init> \
struct Classname_i { \
Basetype value; \
_INITIALIZED_SCALAR_FUNCSBOOL(Classname_i,Basetype,Init) \
}; \
typedef Classname_i<0> Classname_z;


// Usage:
// Where 'classname' is one of the types listed below, then:
Expand All @@ -55,7 +75,7 @@ _DECLARE_SCALAR_TYPE(UInt8_i, UInt8_z, uint8_t)
_DECLARE_SCALAR_TYPE(UInt16_i, UInt16_z, uint16_t)
_DECLARE_SCALAR_TYPE(UInt32_i, UInt32_z, uint32_t)
_DECLARE_SCALAR_TYPE(Size_t_i, Size_t_z, size_t)
_DECLARE_SCALAR_TYPE(Bool_i, Bool_z, bool)
_DECLARE_SCALAR_TYPEBOOL(Bool_i, Bool_z, bool)

// float is special, because C++ does not permit the template initalization:
struct Float_z {
Expand Down
1 change: 1 addition & 0 deletions Globals/Globals.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ const char *gOpenWelcome =
"Copyright 2008, 2009, 2010 Free Software Foundation, Inc.\n"
"Copyright 2010 Kestrel Signal Processing, Inc.\n"
"Copyright 2011, 2012, 2013, 2014 Range Networks, Inc.\n"
"Reloaded for 2023 by FlUxIuS @ Penthertz SAS.\n"
"Release " VERSION " " PROD_CAT " formal build date " TIMESTAMP_ISO " " REPO_REV "\n"
"\"OpenBTS\" is a trademark of Range Networks, Inc.\n"
"\"OpenBTS-UMTS\" is a trademark of Range Networks, Inc.\n"
Expand Down
2 changes: 1 addition & 1 deletion NodeManager
27 changes: 24 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,26 @@
Welcome to the OpenBTS-UMTS source code
========================================
# OpenBTS-UMTS reloaded 2024

For information on supported hardware, and build, install, setup and run instructions see [the wiki page](http://openbts.org/w/index.php/OpenBTS-UMTS).
OpenBTS-UMTS reloaded for 2024. This fork extends changes from @EurecatSecurity make it compatiblee with latest UHD drivers, several fixes to work on Ubuntu 22.04.

## Compatible devices

* USRP
* B200/B210/B205-mini*
* X300/X310
* N200/N210
* USRP2
* LimeSDR (experimental)

## Documentation

Refer to this wiki page for the new documentation: https://github.com/PentHertz/OpenBTS-UMTS/wiki

## Docker images

We are also providing a Docker images, so you will not to follow the installation instructions and run it straightfoward even if system dependencies are broken in the future (in theory!).

Checkout the images there: https://hub.docker.com/r/penthertz/openbts-umts


## Original notes from Range Networks (obsolete):
For information on supported hardware, and build, install, setup and run instructions see [the wiki page](http://openbts.org/w/index.php/OpenBTS-UMTS).
4 changes: 2 additions & 2 deletions SGSNGGSN/Sgsn.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ void SgsnInfo::sirm()
{
std::ostringstream ss;
sgsnInfoDump(this,ss);
SGSNLOG("Removing SgsnInfo:"<<ss);
SGSNLOG(string("Removing SgsnInfo: ") + ss.str());
sSgsnInfoList.remove(this);
delete this;
}
Expand Down Expand Up @@ -221,7 +221,7 @@ static void GmmRemove(GmmInfo *gmm)
{
std::ostringstream ss;
gmmInfoDump(gmm,ss,0);
SGSNLOG("Removing gmm:"<<ss);
SGSNLOG(string("Removing gmm: ") + ss.str());
SgsnInfo *si;
RN_FOR_ALL(SgsnInfoList_t,sSgsnInfoList,si) {
// The second test here should be redundant.
Expand Down
2 changes: 1 addition & 1 deletion SIP/SIPEngine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -754,7 +754,7 @@ void SIPEngine::InitRTP(const osip_message_t * msg )
#ifdef ORTP_NEW_API
rtp_session_set_local_addr(mSession, "0.0.0.0", mRTPPort, -1);
#else
rtp_session_set_local_addr(mSession, "0.0.0.0", mRTPPort);
rtp_session_set_local_addr(mSession, "0.0.0.0", mRTPPort, mRTPPort+1);
#endif
rtp_session_set_remote_addr(mSession, d_ip_addr, atoi(d_port));

Expand Down
2 changes: 1 addition & 1 deletion SIP/SIPInterface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ const char* extractIMSI(const osip_message_t *msg)
unsigned namelen = strlen(IMSI);
if ((namelen>19)||(namelen<18)) {
LOG(WARNING) << "INVITE with malformed username \"" << IMSI << "\"";
return false;
return nullptr;
}
// Skip first 4 char "IMSI".
return IMSI+4;
Expand Down
2 changes: 1 addition & 1 deletion SMS/SMSMessages.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ RPData *SMS::hex2rpdata(const char *hexstring)

BitVector RPDUbits(strlen(hexstring)*4);
if (!RPDUbits.unhex(hexstring)) {
return false;
return nullptr;
}
LOG(DEBUG) << "SMS RPDU bits: " << RPDUbits;

Expand Down
92 changes: 37 additions & 55 deletions TransceiverUHD/UHDDevice.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
*
* Copyright 2010-2011 Free Software Foundation, Inc.
* Copyright 2014 Ettus Research LLC
* Patched by FlUxIuS @ Penthertz SAS
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
Expand All @@ -22,8 +23,7 @@

#include <uhd/version.hpp>
#include <uhd/property_tree.hpp>
#include <uhd/utils/thread_priority.hpp>
#include <uhd/utils/msg.hpp>
#include <uhd/utils/thread.hpp>

#include "Threads.h"
#include "Logger.h"
Expand Down Expand Up @@ -82,11 +82,12 @@ static struct uhd_dev_offset uhd_offsets[NUM_USRP_TYPES] = {
{ B2XX, 99 },
{ X300, 73 },
{ UMTRX, 0 },
{ LimeSDRUSB, 50 }, // picked from http://swigerco.com/UHDDevice.cpp.diff
};

static int get_dev_offset(enum uhd_dev_type type)
{
if ((type != B2XX) && (type != USRP2) && (type != X300)) {
if ((type != B2XX) && (type != USRP2) && (type != X300) && (type != LimeSDRUSB)) {
LOG(ALERT) << "Unsupported device type";
return 0;
}
Expand All @@ -109,28 +110,6 @@ static void *async_event_loop(UHDDevice *dev)
return NULL;
}

/*
* Catch and drop underrun 'U' and overrun 'O' messages from stdout
* since we already report using the logging facility. Direct
* everything else appropriately.
*/
void uhd_msg_handler(uhd::msg::type_t type, const std::string &msg)
{
switch (type) {
case uhd::msg::status:
LOG(INFO) << msg;
break;
case uhd::msg::warning:
LOG(WARNING) << msg;
break;
case uhd::msg::error:
LOG(ERR) << msg;
break;
case uhd::msg::fastpath:
break;
}
}

static void thread_enable_cancel(bool cancel)
{
cancel ? pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL) :
Expand Down Expand Up @@ -257,33 +236,39 @@ double UHDDevice::setRxGain(double db)
*/
bool UHDDevice::parse_dev_type()
{
std::string mboard_str, dev_str;
uhd::property_tree::sptr prop_tree;
size_t usrp2_str, b200_str, b210_str, x300_str, x310_str;

prop_tree = usrp_dev->get_device()->get_tree();
dev_str = prop_tree->access<std::string>("/name").get();
mboard_str = usrp_dev->get_mboard_name();

usrp2_str = dev_str.find("USRP2");
b200_str = mboard_str.find("B200");
b210_str = mboard_str.find("B210");
x300_str = mboard_str.find("X300");
x310_str = mboard_str.find("X310");

if (b200_str != std::string::npos) {
dev_type = B2XX;
} else if (b210_str != std::string::npos) {
dev_type = B2XX;
} else if (usrp2_str != std::string::npos) {
dev_type = USRP2;
} else if (x300_str != std::string::npos) {
dev_type = X300;
} else if (x310_str != std::string::npos) {
dev_type = X300;
} else {
goto nosupport;
}
std::string mboard_str, dev_str;
uhd::property_tree::sptr prop_tree;
size_t usrp2_str, b200_str, b210_str, x300_str, x310_str, b205mini_str, LimeSDRUSB_str;

prop_tree = usrp_dev->get_device()->get_tree();
dev_str = prop_tree->access<std::string>("/name").get();
mboard_str = usrp_dev->get_mboard_name();

usrp2_str = dev_str.find("USRP2");
b200_str = mboard_str.find("B200");
b205mini_str = mboard_str.find("B205mini");
b210_str = mboard_str.find("B210");
x300_str = mboard_str.find("X300");
x310_str = mboard_str.find("X310");
LimeSDRUSB_str = mboard_str.find("LimeSDR");

if (b200_str != std::string::npos) {
dev_type = B2XX;
} else if (b205mini_str != std::string::npos) {
dev_type = B2XX;
} else if (b210_str != std::string::npos) {
dev_type = B2XX;
} else if (usrp2_str != std::string::npos) {
dev_type = USRP2;
} else if (x300_str != std::string::npos) {
dev_type = X300;
} else if (x310_str != std::string::npos) {
dev_type = X300;
} else if (LimeSDRUSB_str != std::string::npos) {
dev_type = LimeSDRUSB;
} else {
goto nosupport;
}

tx_window = TX_WINDOW_FIXED;
LOG(INFO) << "Using fixed transmit window for "
Expand Down Expand Up @@ -410,9 +395,6 @@ bool UHDDevice::start()

setPriority();

/* Register msg handler */
uhd::msg::register_handler(&uhd_msg_handler);

/* Start receive streaming */
if (!restart())
return false;
Expand Down
1 change: 1 addition & 0 deletions TransceiverUHD/UHDDevice.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ enum uhd_dev_type {
B2XX,
X300,
UMTRX,
LimeSDRUSB, // picked from http://swigerco.com/UHDDevice.h.diff
NUM_USRP_TYPES,
};

Expand Down
5 changes: 4 additions & 1 deletion UMTS/UMTSConfig.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1027,7 +1027,10 @@ void BeaconConfig::regenerate()
uint32_t *cellID = RN_CALLOC(uint32_t);
// (pat) TODO: Is this right? network order is high byte first.
// Luckily, hardly matters.
*cellID = htonl(gConfig.getNum("UMTS.Identity.CI"));
*cellID = gConfig.getNum("UMTS.Identity.CI");
// UMTS protocol specifies that the cell ID is a 28 bit number, but it is casted into a 32 bit value. The 4 LSB bits are considered padding, so the "real" data must be shifted about this padding.
*cellID = *cellID << 4;
*cellID = htonl(*cellID);
// cellID is a 28-bit BIT_STRING
setAsnBIT_STRING(&mSIB3.cellIdentity,(uint8_t*)cellID,28);
// ASN CellSelectReselectInfoSIB_3_4 cellSelectReselectInfo, 10.3.2.3
Expand Down
2 changes: 1 addition & 1 deletion UMTS/UMTSRadioModem.h
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ class RadioModem
friend void *RACHLoopAdapter(RadioModem*);
friend void *DCHLoopAdapter(DCHLoopInfo*);

static const float mRACHThreshold = 10.0;
static constexpr float mRACHThreshold = 10.0;


private:
Expand Down
2 changes: 1 addition & 1 deletion configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ dnl See the LEGAL file in the main directory for details.
dnl FIXME -- Need to add dependency check for asn1c.

AC_PREREQ(2.57)
AC_INIT(openbts-umts,1.0-master)
AC_INIT(openbts-umts,1.1-master)

AC_CANONICAL_BUILD
AC_CANONICAL_HOST
Expand Down
17 changes: 17 additions & 0 deletions install_dependences.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/bin/bash
# This script has been tested in Ubuntu 16.04 and 18.04. Please report any problem you find.

# Install all package dependencies
sudo apt-get install -y autoconf libtool build-essential libuhd-dev uhd-host libzmq3-dev libosip2-dev libortp-dev libusb-1.0-0-dev asn1c libtool-bin libsqlite3-dev libreadline-dev

# Clone submodules from base repo
git submodule init
git submodule update
# Uncompress, configure, compile and install bundled version of ASN1 compiler, necessary in build-time
tar -xvzf asn1c-0.9.23.tar.gz
cd ./vlm-asn1c-0959ffb/
./configure
make
sudo make install
cd ../
# TODO: possibly more dependencies to be added here. Please suggest any requirement package you detect as missing.