Skip to content
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

Renewing OpenBTS for 2023 #52

Open
wants to merge 34 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
ea62587
Replacing submodules URLs
FlUxIuS Jan 5, 2023
14c1311
Fixing build error in Ubuntu 22.04 with C++11
FlUxIuS Jan 5, 2023
00d0e0e
Use new submodule version
FlUxIuS Jan 5, 2023
c89d1f6
Uploading a preinstall script for EASY BUILDING
FlUxIuS Jan 5, 2023
75d8da0
Commenting missing handler from old API
FlUxIuS Jan 5, 2023
e449095
Fixing presintall script quickly
FlUxIuS Jan 5, 2023
2e27be5
Fix mistake in preinstall.sh script
FlUxIuS Jan 5, 2023
18e9416
Updating preinstall script
FlUxIuS Jan 5, 2023
c15926b
Adding support for B205-mini*w
FlUxIuS Jan 5, 2023
8d02a81
Updating preinstall script
FlUxIuS Jan 6, 2023
7149db6
Update README
FlUxIuS Jan 6, 2023
4e5e5aa
Changing README format
FlUxIuS Jan 6, 2023
17e1585
Merge branch 'master' of github.com:PentHertz/OpenBTS
FlUxIuS Jan 6, 2023
0fe64ba
Including contribution headers
FlUxIuS Jan 6, 2023
245f72e
including ldconfig
FlUxIuS Jan 6, 2023
fe05f7d
Update README.md
FlUxIuS Jan 6, 2023
b1b7d20
Backporting patch from @alexanderkjall for GPRS attach (https://githu…
FlUxIuS Jan 6, 2023
57e988c
Merge branch 'master' of github.com:PentHertz/OpenBTS
FlUxIuS Jan 6, 2023
c85cc77
Fix several buffer overflows in TRXManager by @jduck
FlUxIuS Jan 6, 2023
19a4966
Fix bug with command lengths over 127 from @Will-W
FlUxIuS Jan 6, 2023
c93cc1b
Extending support for B200mini as well from @devnulling
FlUxIuS Jan 6, 2023
c4ff920
Updating UHD's thread header that was deprecated by new one
FlUxIuS Jan 7, 2023
d9ad8a5
Fixing versions displayed
FlUxIuS Jan 7, 2023
1563615
Adding support for subdevices from @STKFLT (https://github.com/RangeN…
FlUxIuS Jan 7, 2023
720286d
Update README.md
FlUxIuS Jan 9, 2023
4186c5d
Update README.md
FlUxIuS Jan 18, 2023
137320d
fixing liba53 install
FlUxIuS Jan 21, 2023
b5a8b6d
Experimental support for E200 (didn't tested as I don't owe a E200 ye…
FlUxIuS Jan 21, 2023
5bb98f7
Update README.md
FlUxIuS Jan 21, 2023
3459ac0
Fixing an enum mistake for E200
FlUxIuS Jan 21, 2023
fd4cf3e
Merge branch 'master' of github.com:PentHertz/OpenBTS
FlUxIuS Jan 21, 2023
42f46da
Fixing comment
FlUxIuS Jan 21, 2023
06d7204
Update preinstall.sh
FlUxIuS Jun 28, 2024
d2ee00c
Update README.md
FlUxIuS Jul 4, 2024
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
4 changes: 2 additions & 2 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
[submodule "CommonLibs"]
path = CommonLibs
url = https://github.com/RangeNetworks/CommonLibs.git
url = https://github.com/PentHertz/CommonLibs.git
branch = master
[submodule "NodeManager"]
path = NodeManager
url = https://github.com/RangeNetworks/NodeManager.git
url = https://github.com/PentHertz/NodeManager.git
branch = master
2 changes: 1 addition & 1 deletion CLI/CLIServer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ void Parser::cliServer()
close(i);
continue; // go to next socket
}
if (len < (int) sizeof(len)) // should never get here
if (nread < (int) sizeof(len)) // should never get here
{
char buf[BUFSIZ];
sprintf(buf, "Unable to read complete length, s.b. %d bytes, got %d bytes\n", sizeof(len), len);
Expand Down
2 changes: 1 addition & 1 deletion CommonLibs
Submodule CommonLibs updated 1 files
+6 −5 Logger.h
7 changes: 4 additions & 3 deletions Control/L3StateMachine.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/**@file Declarations for Circuit Switched State Machine and related classes. */
/*
* Copyright 2013, 2014 Range Networks, Inc.
* Renewed for 2023 by FlUxIuS @ Penthertz
*
* This software is distributed under multiple licenses;
* see the COPYING file in the main directory for licensing
Expand Down Expand Up @@ -85,11 +86,11 @@ void MachineBase::machineErrorMessage(int level, int state, const L3Message *l3m

// This kind sucks, digging into the Logger. The logger could be better.
if (l3msg) {
Log(level).get() <<os <<" Unexpected L3 message:"<<l3msg;
Log(level).get() <<os.str() <<" Unexpected L3 message:"<<l3msg;
} else if (sipmsg) {
Log(level).get() <<os <<" Unexpected SIP message:"<<sipmsg;
Log(level).get() <<os.str() <<" Unexpected SIP message:"<<sipmsg;
} else {
Log(level).get() <<os <<" Unexpected"<<LOGHEX(state);
Log(level).get() <<os.str() <<" Unexpected"<<LOGHEX(state);
}
}

Expand Down
3 changes: 2 additions & 1 deletion GPRS/MSInfo.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/*
* Copyright 2011, 2014 Range Networks, Inc.
* Renewed for 2023 by FlUxIuS @ Penthertz
*
* This software is distributed under multiple licenses;
* see the COPYING file in the main directory for licensing
Expand Down Expand Up @@ -638,7 +639,7 @@ bool MSInfo::msAssignChannels()
if (msPCHDowns.size() > 1) {
std::ostringstream os;
msDumpChannels(os);
LOG(INFO) << "Multislot assignment for "<<this<<os;
LOG(INFO) << "Multislot assignment for "<<this<<os.str();
}

} else {
Expand Down
4 changes: 2 additions & 2 deletions GSMShare/A51.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@

// Renewed for 2023 by FlUxIuS @ Penthertz

#include <stdio.h>
#include <stdlib.h>
Expand All @@ -7,5 +7,5 @@ typedef unsigned char byte;
typedef unsigned long word;
typedef word bit;

void A51_GSM( byte *key, int klen, int count, byte *block1, byte *block2 );
void A51_GSM( unsigned char *key, int klen, int count, unsigned char *block1, unsigned char *block2 );

1 change: 1 addition & 0 deletions Globals/GlobalVars.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ const char* gOpenBTSWelcome =
"Copyright 2008, 2009, 2010 Free Software Foundation, Inc.\n"
"Copyright 2010 Kestrel Signal Processing, Inc.\n"
"Copyright 2011-2021 Range Networks, Inc.\n"
"Reloaded for 2023 by FlUxIuS @ Penthertz SAS.\n"
"Release " VERSION "+" REPO_REV " " PROD_CAT " formal build date " TIMESTAMP_ISO "\n"
"\"OpenBTS\" is a registered trademark of Range Networks, Inc.\n"
"\nContributors:\n"
Expand Down
2 changes: 1 addition & 1 deletion NodeManager
Submodule NodeManager updated 1 files
+28 −28 nmcli.py
90 changes: 87 additions & 3 deletions README → README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,88 @@
Welcome to the OpenBTS source code.
Welcome to the OpenBTS source code reloaded for 2024 supporting new UHD drivers and Ubuntu 22.04 LTS to be compiled against C++11 and C++17.

# What is this project?

This projects provides a GSM+GPRS Radio Access Network Node with Software-Defined Radio.

# Supported hardware

* USRPs:
* USRP v1 (with 52 MHz clock -> but can be patched for default 64 MHz)
* USRP2
* USRP B200/B210 and B205mini-*
* USRP N210
* USRP X3*0
* USRP N210
* UmTRX
* LimeSDR with OsmoTRX transceiver by now
* ANTSDR E200: Warning! Super experimental as we don't own the hardware yet (send your captures centered on the used ARFCN for debug)

# Quick usage

## Setup

Clone the repository and use the pre-installation script `preinstall.sh` to clone all other projects, submodules and install dependencies:

```
$ git clone https://github.com/PentHertz/OpenBTS.git
$ cd OpenBTS
$ # Optionally, checkout 5.1.0 branch which is the stable one with `git checkout 5.1.0`
$ ./preinstall.sh # note that for now libcoredumper will show some failures but we quickly bypass them forcing the compilation
```

Once it is finished, you can proceed with the installation of OpenBTS as follows:

```
$ ./autogen.sh
$ ./configure --with-uhd # use different options for other drivers
$ make -j$(nproc)
$ sudo make install
$ sudo ldconfig
```

And then we can launch everything!

## Running everything

Preferably run the probe UHD tool to load the firmware and FPGA into the USRP first:

```
$ uhd_usrp_probe
[INFO] [UHD] linux; GNU C++ version 11.2.0; Boost_107400; UHD_4.1.0.5-3
[INFO] [B200] Loading firmware image: /usr/share/uhd/images/usrp_b200_fw.hex...
[INFO] [B200] Detected Device: B210
[INFO] [B200] Loading FPGA image: /usr/share/uhd/images/usrp_b210_fpga.bin...
[...]
```

You can use `screen`, `tmux` or just laucnh everything except `OpenBTS` in background:

```
$ sudo smqueue &
$ sudo sipauthserve &
$ sudo /OpenBTS/OpenBTS
```

And voilà!

# Docker container

A Docker images has been also generated for the backup and is ready to use with all installed tools: https://hub.docker.com/r/penthertz/openbts

# Fuzzing with OpenBTS

The Testcall feature has been reintroduced and includes also a SMS Fuzzing features thanks to @Djimmer work, and is under test with this new version of OpenBTS.

You can already test it with the `fuzzing-dev` branch:

```
git checkout fuzzing-dev
```

Do not hesitate to send issue or pull requests in order to stabilize it.


# Old README

For free support, please subscribe to [email protected].
See http://sourceforge.net/mailarchive/forum.php?forum_name=openbts-discuss
Expand Down Expand Up @@ -58,8 +141,7 @@ normal GNU build process with the rest of OpenBTS. To build smqueue, go
into the smqueue directory and just type "make -f Makefile.standalone".



Release history:
# Release history:

Release Name SVN Reposiory SVN Rev Comments

Expand Down Expand Up @@ -178,3 +260,5 @@ Release Name SVN Reposiory SVN Rev Comments

2.9 Plaquemine Range socket-based remote CLI
merge-in of "S" Release
5.0 ? ? ?
5.1 FlUxIuS Penthertz Release for 2023 compiling with fresh Ubuntu 22.04
20 changes: 20 additions & 0 deletions SGSNGGSN/GPRSL3Messages.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -367,6 +367,22 @@ void GMMAttach::gmParseIEs(L3GmmFrame &src, size_t &rp, const char *culprit)
mTmsiStatus = iei & 1;
continue;
}
if ((iei & 0xf0) == 0xd0) {
// 10.5.7.8 Device properties. Ignore for now
continue;
}
if ((iei & 0xf0) == 0xe0) {
// 10.5.5.29 P-TMSI type. Ignore for now
continue;
}
if ((iei & 0xf0) == 0xc0) {
// 10.5.1.15 MS network feature support. Ignore for now
continue;
}
if ((iei & 0xf0) == 0xf0) {
// 10.5.5.0 Additional update type. Ignore for now
continue;
}
switch (iei) {
case 0x19: // TV Old P-TMSI signature.
// Dont have a 3 byte 'read' function so use getField then advance rp by 3.
Expand All @@ -385,6 +401,10 @@ void GMMAttach::gmParseIEs(L3GmmFrame &src, size_t &rp, const char *culprit)
// The specified length is of the ie itself, excluding the iei type and length byte.
// Get the length, but dont move rp - let the IEs do that, because
// some of them need the length byte.
if (rp >= src.size()) {
SGSNERROR("invalid message size in "<<culprit <<" bytes="<<src.hexstr());
return;
}
int len = src.getByte(rp);
size_t nextrp = rp + len + 1;
if (nextrp > src.size()) { // last one will have nextrp == src.size()
Expand Down
5 changes: 3 additions & 2 deletions SGSNGGSN/Sgsn.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/*
* Copyright 2011, 2014 Range Networks, Inc.
* Renewed for 2023 by FlUxIuS @ Penthertz
*
* This software is distributed under multiple licenses;
* see the COPYING file in the main directory for licensing
Expand Down Expand Up @@ -127,7 +128,7 @@ void SgsnInfo::sirm()
{
std::ostringstream ss;
sgsnInfoDump(this,ss);
SGSNLOG("Removing SgsnInfo:"<<ss);
SGSNLOG("Removing SgsnInfo:"<<ss.str());
sSgsnInfoList.remove(this);
delete this;
}
Expand Down Expand Up @@ -224,7 +225,7 @@ static void GmmRemove(GmmInfo *gmm)
{
std::ostringstream ss;
gmmInfoDump(gmm,ss,0);
SGSNLOG("Removing gmm:"<<ss);
SGSNLOG("Removing gmm:"<<ss.str());
SgsnInfo *si;
RN_FOR_ALL(SgsnInfoList_t,sSgsnInfoList,si) {
// The second test here should be redundant.
Expand Down
3 changes: 2 additions & 1 deletion SIP/SIP2Interface.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/*
* Copyright 2008, 2009, 2010 Free Software Foundation, Inc.
* Copyright 2011, 2014 Range Networks, Inc.
* Renewed for 2023 by FlUxIuS @ Penthertz
*
* This software is distributed under multiple licenses;
* see the COPYING file in the main directory for licensing
Expand Down Expand Up @@ -756,7 +757,7 @@ void MySipInterface::msiInit()
// FIXME -- Can we coordinate this with the global logger?
//ortp_set_log_level_mask(ORTP_MESSAGE|ORTP_WARNING|ORTP_ERROR);

ortp_set_log_handler(ortpLogFunc);
ortp_set_log_handler((BctbxLogFunc) ortpLogFunc);

mDriveThread.start((void *(*)(void*))driveLoop2, &gSipInterface );
mPeriodicServiceThread.start((void *(*)(void*))periodicServiceLoop, &gSipInterface );
Expand Down
5 changes: 3 additions & 2 deletions SIP/SIPRtp.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/*
* Copyright 2014 Range Networks, Inc.
* Renewed for 2023 by FlUxIuS @ Penthertz
*
* This software is distributed under multiple licenses;
* see the COPYING file in the main directory for licensing
Expand Down Expand Up @@ -125,13 +126,13 @@ void SipRtp::initRTP1(const char *d_ip_addr, unsigned d_port, unsigned dialogId)
rtp_session_set_payload_type(mSession, 3);
// (pat added) The last argument is user payload data that is passed to ourRtpTimestampJumpCallback()
// I was going to use the dialogId but decided to look up the dialog by mSession.
rtp_session_signal_connect(mSession,"timestamp_jump",(RtpCallback)ourRtpTimestampJumpCallback,dialogId);
rtp_session_signal_connect(mSession,"timestamp_jump",(RtpCallback)ourRtpTimestampJumpCallback,(void *) dialogId);

gCountRtpSockets++;
#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, d_port);
WATCHF("*** initRTP local=%d remote=%s %d\n",mRTPPort,d_ip_addr,d_port);
Expand Down
12 changes: 4 additions & 8 deletions TRXManager/TRXManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -320,9 +320,8 @@ int ::ARFCNManager::sendCommand(const char*command, const char*param, int *respo
int rspLen = sendCommandPacket(cmdBuf,response);
if (rspLen<=0) return -1;
// Parse and check status.
char cmdNameTest[15];
char cmdNameTest[16] = { 0 };
int status;
cmdNameTest[0]='\0';
if (!responseParam)
sscanf(response,"RSP %15s %d", cmdNameTest, &status);
else
Expand All @@ -340,9 +339,8 @@ int ::ARFCNManager::sendCommand(const char*command, int param, int *responsePara
int rspLen = sendCommandPacket(cmdBuf,response);
if (rspLen<=0) return -1;
// Parse and check status.
char cmdNameTest[15];
char cmdNameTest[16] = { 0 };
int status;
cmdNameTest[0]='\0';
if (!responseParam)
sscanf(response,"RSP %15s %d", cmdNameTest, &status);
else
Expand All @@ -361,9 +359,8 @@ int ::ARFCNManager::sendCommand(const char*command, const char* param)
int rspLen = sendCommandPacket(cmdBuf,response);
if (rspLen<=0) return -1;
// Parse and check status.
char cmdNameTest[15];
char cmdNameTest[16] = { 0 };
int status;
cmdNameTest[0]='\0';
sscanf(response,"RSP %15s %d", cmdNameTest, &status);
if (strcmp(cmdNameTest,command)!=0) return -1;
return status;
Expand All @@ -380,9 +377,8 @@ int ::ARFCNManager::sendCommand(const char*command)
int rspLen = sendCommandPacket(cmdBuf,response);
if (rspLen<=0) return -1;
// Parse and check status.
char cmdNameTest[15];
char cmdNameTest[16] = { 0 };
int status;
cmdNameTest[0]='\0';
sscanf(response,"RSP %15s %d", cmdNameTest, &status);
if (strcmp(cmdNameTest,command)!=0) return -1;
return status;
Expand Down
Loading