diff --git a/.gitignore b/.gitignore index 706d848..85ae554 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ +*~ ._* *.a *.o @@ -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 @@ -46,3 +49,5 @@ TransceiverRAD1/transceiver apps/OpenBTS-UMTS apps/OpenBTS-UMTSCLI apps/OpenBTS-UMTSDo +vlm-asn1c-0959ffb/ +README diff --git a/.gitmodules b/.gitmodules index f515ff8..2d80048 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,4 +1,4 @@ [submodule "NodeManager"] path = NodeManager - url = https://github.com/RangeNetworks/NodeManager.git + url = https://github.com/FlUxIuS/NodeManager branch = master diff --git a/ASN/makefile b/ASN/makefile index 4da1ee8..747ac17 100644 --- a/ASN/makefile +++ b/ASN/makefile @@ -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 diff --git a/CommonLibs/ScalarTypes.h b/CommonLibs/ScalarTypes.h index b6072fb..7dc0666 100644 --- a/CommonLibs/ScalarTypes.h +++ b/CommonLibs/ScalarTypes.h @@ -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. @@ -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 \ struct Classname_i { \ @@ -39,6 +51,14 @@ }; \ typedef Classname_i<0> Classname_z; +#define _DECLARE_SCALAR_TYPEBOOL(Classname_i,Classname_z,Basetype) \ + template \ + 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: @@ -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 { diff --git a/Globals/Globals.cpp b/Globals/Globals.cpp index bf89bef..87f9bda 100644 --- a/Globals/Globals.cpp +++ b/Globals/Globals.cpp @@ -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" diff --git a/NodeManager b/NodeManager index 45420fe..720d812 160000 --- a/NodeManager +++ b/NodeManager @@ -1 +1 @@ -Subproject commit 45420fe5f81a18e029f56f6cca24f2b6eeeba0cd +Subproject commit 720d812f285e01e68ad18a49036b30ae132208cc diff --git a/README.md b/README.md index 74b0bad..348bee6 100644 --- a/README.md +++ b/README.md @@ -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). diff --git a/SGSNGGSN/Sgsn.cpp b/SGSNGGSN/Sgsn.cpp index 74dd92c..fe8b9dd 100644 --- a/SGSNGGSN/Sgsn.cpp +++ b/SGSNGGSN/Sgsn.cpp @@ -124,7 +124,7 @@ void SgsnInfo::sirm() { std::ostringstream ss; sgsnInfoDump(this,ss); - SGSNLOG("Removing SgsnInfo:"<19)||(namelen<18)) { LOG(WARNING) << "INVITE with malformed username \"" << IMSI << "\""; - return false; + return nullptr; } // Skip first 4 char "IMSI". return IMSI+4; diff --git a/SMS/SMSMessages.cpp b/SMS/SMSMessages.cpp index 2b33d01..adbc6d3 100644 --- a/SMS/SMSMessages.cpp +++ b/SMS/SMSMessages.cpp @@ -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; diff --git a/TransceiverUHD/UHDDevice.cpp b/TransceiverUHD/UHDDevice.cpp index 454d036..fab60ba 100644 --- a/TransceiverUHD/UHDDevice.cpp +++ b/TransceiverUHD/UHDDevice.cpp @@ -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 @@ -22,8 +23,7 @@ #include #include -#include -#include +#include #include "Threads.h" #include "Logger.h" @@ -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; } @@ -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) : @@ -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("/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("/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 " @@ -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; diff --git a/TransceiverUHD/UHDDevice.h b/TransceiverUHD/UHDDevice.h index e01172d..f354b98 100644 --- a/TransceiverUHD/UHDDevice.h +++ b/TransceiverUHD/UHDDevice.h @@ -14,6 +14,7 @@ enum uhd_dev_type { B2XX, X300, UMTRX, + LimeSDRUSB, // picked from http://swigerco.com/UHDDevice.h.diff NUM_USRP_TYPES, }; diff --git a/UMTS/UMTSConfig.cpp b/UMTS/UMTSConfig.cpp index 7ca6723..e540f83 100644 --- a/UMTS/UMTSConfig.cpp +++ b/UMTS/UMTSConfig.cpp @@ -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 diff --git a/UMTS/UMTSRadioModem.h b/UMTS/UMTSRadioModem.h index 82df8a4..07bc8d0 100644 --- a/UMTS/UMTSRadioModem.h +++ b/UMTS/UMTSRadioModem.h @@ -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: diff --git a/configure.ac b/configure.ac index 9cd991a..e1cb14e 100644 --- a/configure.ac +++ b/configure.ac @@ -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 diff --git a/install_dependences.sh b/install_dependences.sh new file mode 100755 index 0000000..20cb8d9 --- /dev/null +++ b/install_dependences.sh @@ -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.