peer linking fixes

unstable
Tom Early 4 years ago
parent 437f8fb17a
commit be8f037952

@ -85,7 +85,7 @@ cp ../config/urfd.interlink .
cp ../config/urfd.terminal .
```
If you are not going to support G3 linking, you don't need to copy the .terminal file. Use your favorite editor to modify each of these files. If you want a totally open network, the blacklist and whitelist files are ready to go. The blacklist determine which callsigns can't use the reflector. The whitelist determines which callsigns can use the reflector. The interlink file sets up the XLX<--->XLX inter-linking and/or out-going XRF peer linking.
If you are not going to support G3 linking, you don't need to copy the .terminal file. Use your favorite editor to modify each of these files. If you want a totally open network, the blacklist and whitelist files are ready to go. The blacklist determine which callsigns can't use the reflector. The whitelist determines which callsigns can use the reflector. The interlink file sets up the URF<--->URF inter-linking and/or out-going XRF peer linking.
When you are done with the configuration files and ready to start the installation process, you can return to the main repository directory:
@ -105,9 +105,9 @@ There are only a few things that need to be specified. Most important are, the r
You can configure any modules, from **A** to **Z**. They don't have to be contigious. If your reflector is configured with a transcoder, you can specify which configured modules will be transcoded. Up to three modules can be transcoded. There are also true/false flags to prevent G3 support and so that you can build executables that will support gdb debugging.
You can support your own YSF frequency database. This is very useful for hot-spots that use YSF linking. These linked hot-spots can then use the *WiresX* command on their radios to be able to connect to any configured XLX module. Users can register their TX and RX frequency (typically the same for most hot-spot configurations) on http:<*xlx url*>/wiresx/login.php. Once their hot-spot is registered, XLX will return the correct frequency for their hot-spot when a *WiresX* command is sent to the reflector. You'll need to enable YSF auto-linking, specify a default module and define a database name, user and user password. When you write you XLX configuration, a database **configure.sql** script will be built to not only create the database and database user, but also the table for the hot-spot frequency data.
You can support your own YSF frequency database. This is very useful for hot-spots that use YSF linking. These linked hot-spots can then use the *WiresX* command on their radios to be able to connect to any configured URF module. Users can register their TX and RX frequency (typically the same for most hot-spot configurations) on http:<*urf url*>/wiresx/login.php. Once their hot-spot is registered, URF will return the correct frequency for their hot-spot when a *WiresX* command is sent to the reflector. You'll need to enable YSF auto-linking, specify a default module and define a database name, user and user password. When you write you URF configuration, a database **configure.sql** script will be built to not only create the database and database user, but also the table for the hot-spot frequency data.
Be sure to write out the configuration files and look over the up to seven different configration files that are created. The first file, reflector.cfg is the memory file for rconfig so that if you start that script again, it will remember how you left things. There are one or two `.h` files for the reflector and tcd and there are one or two `.mk` files for the reflector and tcd makefiles. You should **not** modify these files by hand unless you really know exactly how they work. The rconfig script will not start if it detects that an XLX or XRF server is already running. You can override this behavior in expert mode: `./rconfig expert`. If you do change the configuration after you have already compiled the code, it is safest if you clean the repo and then recompile.
Be sure to write out the configuration files and look over the up to seven different configration files that are created. The first file, reflector.cfg is the memory file for rconfig so that if you start that script again, it will remember how you left things. There are one or two `.h` files for the reflector and tcd and there are one or two `.mk` files for the reflector and tcd makefiles. You should **not** modify these files by hand unless you really know exactly how they work. The rconfig script will not start if it detects that an URF server is already running. You can override this behavior in expert mode: `./rconfig expert`. If you do change the configuration after you have already compiled the code, it is safest if you clean the repo and then recompile.
### Compling and installing your system
@ -130,10 +130,10 @@ You can start each component by replacing `stop` with `start`, or you can restar
### Copy dashboard to /var/www
There are two supplied, one for XRF systems and one for XLX systems.
There are two supplied, one for XRF systems and one for URF systems.
```bash
sudo cp -r ~/urfd/dashboard.xlx /var/www/db # or dashboard.xrf
sudo cp -r ~/urfd/dashboard /var/www/db # or dashboard.xrf
```
Please note that your www root directory might be some place else. There is one file that needs configuration. Edit the copied files, not the ones from the repository:
@ -156,10 +156,10 @@ If you change any configuration after your reflector has been compiled, be sure
## Firewall settings
XLX Server requires the following ports to be open and forwarded properly for in- and outgoing network traffic:
URF Server requires the following ports to be open and forwarded properly for in- and outgoing network traffic:
- TCP port 80 (http) optional TCP port 443 (https)
- UDP port 10002 (XLX interlink)
- UDP port 10002 (XLX interlink, used for BM connections)
- UDP port 42000 (YSF protocol)
- UDP port 30001 (DExtra protocol)
- UPD port 20001 (DPlus protocol)
@ -171,13 +171,15 @@ XLX Server requires the following ports to be open and forwarded properly for in
## YSF Master Server
Pay attention, the XLX Server acts as an YSF Master, which provides 26 wires-x rooms.
It has nothing to do with the regular YSFReflector network, hence you dont need to register your XLX at ysfreflector.de !
Pay attention, the URF Server acts as an YSF Master, which provides 26 wires-x rooms.
It has nothing to do with the regular YSFReflector network, hence you dont need to register your URF at ysfreflector.de !
## To-dos
I will eventually support a remote transcoder option, so that you can, for example, run urfd in a data center, and then run the transcoder somewhere you have physical access to it so you can plug in your AMBE vocoders. I don't recommend this as it will add unnessary and variable latency to your reflector.
There is also much to for the dashboard...
## Copyright
- Copyright © 2016 Jean-Luc Deltombe LX3JL and Luc Engelmann LX1IQ

@ -226,11 +226,6 @@ WriteSRCMKFile ()
local file
file="$srcm"
echo "# Created on `date`" > $file
if [[ "$callsign" == XLX* ]]; then
echo "is_xlx = true" >> $file
else
echo "is_xlx = false" >> $file
fi
[ -z ${ip4addr+x} ] || echo "ipv4 = $ip4addr" >> $file
[ -z ${ip6addr+x} ] || echo "ipv6 = $ip6addr" >> $file
[ -z ${tcaddress+x} ] || echo "tc_ip = $tcaddress" >> $file
@ -397,9 +392,7 @@ if [ -z ${expertmode+x} ]; then
if [ -e $urfserv ]; then
echo -n "You cannot change the configuration right now beacuse there is an "
if [ -e $urfserv ]; then
echo "XLX server running."
else
echo "XRF server running."
echo "URFD server running."
fi;
echo "===========${rcfg}============="
cat $rcfg

@ -284,7 +284,7 @@ void CBMProtocol::HandleKeepalives(void)
Send(disconnect, peer->GetIp());
// remove it
std::cout << "XLX peer " << peer->GetCallsign() << " keepalive timeout" << std::endl;
std::cout << "BM peer " << peer->GetCallsign() << " keepalive timeout" << std::endl;
peers->RemovePeer(peer);
}
}
@ -313,7 +313,7 @@ void CBMProtocol::HandlePeerLinks(void)
// send disconnect packet
EncodeDisconnectPacket(&buffer);
Send(buffer, peer->GetIp());
std::cout << "Sending disconnect packet to XLX peer " << peer->GetCallsign() << std::endl;
std::cout << "Sending disconnect packet to BM peer " << peer->GetCallsign() << std::endl;
// remove client
peers->RemovePeer(peer);
}
@ -323,16 +323,15 @@ void CBMProtocol::HandlePeerLinks(void)
// if not, connect or reconnect
for ( auto it=list->begin(); it!=list->end(); it++ )
{
if ( (*it).GetCallsign().HasSameCallsignWithWildcard(CCallsign("XRF*")) )
continue;
if ( peers->FindPeer((*it).GetCallsign(), EProtocol::bm) == nullptr )
CCallsign cs = it->GetCallsign();
if (cs.HasSameCallsignWithWildcard(CCallsign("BM*")) && (nullptr==peers->FindPeer(cs, EProtocol::bm)))
{
// resolve again peer's IP in case it's a dynamic IP
(*it).ResolveIp();
it->ResolveIp();
// send connect packet to re-initiate peer link
EncodeConnectPacket(&buffer, (*it).GetModules());
Send(buffer, (*it).GetIp(), XLX_PORT);
std::cout << "Sending connect packet to BM peer " << (*it).GetCallsign() << " @ " << (*it).GetIp() << " for modules " << (*it).GetModules() << std::endl;
EncodeConnectPacket(&buffer, it->GetModules());
Send(buffer, it->GetIp(), XLX_PORT);
std::cout << "Sending connect packet to BM peer " << cs << " @ " << it->GetIp() << " for modules " << it->GetModules() << std::endl;
}
}

@ -374,18 +374,18 @@ void CDextraProtocol::HandlePeerLinks(void)
// if not, connect or reconnect
for ( auto it=list->begin(); it!=list->end(); it++ )
{
if ( !(*it).GetCallsign().HasSameCallsignWithWildcard(CCallsign("XRF*")) )
if ( !it->GetCallsign().HasSameCallsignWithWildcard(CCallsign("XRF*")) )
continue;
if ( strlen((*it).GetModules()) != 2 )
if ( strlen(it->GetModules()) != 2 )
continue;
if ( peers->FindPeer((*it).GetCallsign(), EProtocol::dextra) == nullptr )
if ( peers->FindPeer(it->GetCallsign(), EProtocol::dextra) == nullptr )
{
// resolve again peer's IP in case it's a dynamic IP
(*it).ResolveIp();
it->ResolveIp();
// send connect packet to re-initiate peer link
EncodeConnectPacket(&buffer, (*it).GetModules());
Send(buffer, (*it).GetIp(), DEXTRA_PORT);
std::cout << "Sending connect packet to XRF peer " << (*it).GetCallsign() << " @ " << (*it).GetIp() << " for module " << (*it).GetModules()[1] << " (module " << (*it).GetModules()[0] << ")" << std::endl;
EncodeConnectPacket(&buffer, it->GetModules());
Send(buffer, it->GetIp(), DEXTRA_PORT);
std::cout << "Sending connect packet to XRF peer " << it->GetCallsign() << " @ " << it->GetIp() << " for module " << it->GetModules()[1] << " (module " << it->GetModules()[0] << ")" << std::endl;
}
}

@ -98,7 +98,7 @@ enum class EProtocol { any, none, dextra, dplus, dcs, bm, urf, dmrplus, dmrmmdvm
#define DCS_KEEPALIVE_PERIOD 1 // in seconds
#define DCS_KEEPALIVE_TIMEOUT (DCS_KEEPALIVE_PERIOD*30) // in seconds
// XLX
// XLX, used for BM
#define XLX_PORT 10002 // UDP port
#define XLX_KEEPALIVE_PERIOD 1 // in seconds
#define XLX_KEEPALIVE_TIMEOUT (XLX_KEEPALIVE_PERIOD*30) // in seconds

@ -577,7 +577,7 @@ void CReflector::WriteXmlFile(std::ofstream &xmlFile)
// iterate on users
for ( auto it=users->begin(); it!=users->end(); it++ )
{
(*it).WriteXml(xmlFile);
it->WriteXml(xmlFile);
}
// unlock
ReleaseUsers();

@ -36,7 +36,7 @@ CURFPeer::CURFPeer(const CCallsign &callsign, const CIp &ip, const char *modules
{
// get protocol revision
EProtoRev protrev = GetProtocolRevision(version);
//std::cout << "Adding XLX peer with protocol revision " << protrev << std::endl;
//std::cout << "Adding URF peer with protocol revision " << protrev << std::endl;
// and construct all xlx clients
for ( unsigned i = 0; i < ::strlen(modules); i++ )

@ -80,7 +80,7 @@ void CURFProtocol::Task(void)
}
else if ( IsValidConnectPacket(Buffer, &Callsign, Modules, &Version) )
{
std::cout << "XLX (" << Version.GetMajor() << "." << Version.GetMinor() << "." << Version.GetRevision() << ") connect packet for modules " << Modules << " from " << Callsign << " at " << Ip << std::endl;
std::cout << "URF (" << Version.GetMajor() << "." << Version.GetMinor() << "." << Version.GetRevision() << ") connect packet for modules " << Modules << " from " << Callsign << " at " << Ip << std::endl;
// callsign authorized?
if ( g_GateKeeper.MayLink(Callsign, Ip, EProtocol::urf, Modules) )
@ -115,7 +115,7 @@ void CURFProtocol::Task(void)
}
else if ( IsValidAckPacket(Buffer, &Callsign, Modules, &Version) )
{
std::cout << "XLX ack packet for modules " << Modules << " from " << Callsign << " at " << Ip << std::endl;
std::cout << "URF ack packet for modules " << Modules << " from " << Callsign << " at " << Ip << std::endl;
// callsign authorized?
if ( g_GateKeeper.MayLink(Callsign, Ip, EProtocol::urf, Modules) )
@ -137,7 +137,7 @@ void CURFProtocol::Task(void)
}
else if ( IsValidDisconnectPacket(Buffer, &Callsign) )
{
std::cout << "XLX disconnect packet from " << Callsign << " at " << Ip << std::endl;
std::cout << "URF disconnect packet from " << Callsign << " at " << Ip << std::endl;
// find peer
CPeers *peers = g_Reflector.GetPeers();
@ -153,11 +153,11 @@ void CURFProtocol::Task(void)
}
else if ( IsValidNackPacket(Buffer, &Callsign) )
{
std::cout << "XLX nack packet from " << Callsign << " at " << Ip << std::endl;
std::cout << "URF nack packet from " << Callsign << " at " << Ip << std::endl;
}
else if ( IsValidKeepAlivePacket(Buffer, &Callsign) )
{
//std::cout << "XLX keepalive packet from " << Callsign << " at " << Ip << std::endl;
//std::cout << "URF keepalive packet from " << Callsign << " at " << Ip << std::endl;
// find peer
CPeers *peers = g_Reflector.GetPeers();
@ -171,7 +171,7 @@ void CURFProtocol::Task(void)
}
else
{
std::string title("Unknown XLX packet from ");
std::string title("Unknown URF packet from ");
title += Ip.GetAddress();
Buffer.Dump(title);
}
@ -217,7 +217,7 @@ void CURFProtocol::HandleQueue(void)
// check if origin of packet is local
// if not, do not stream it out as it will cause
// network loop between linked XLX peers
// network loop between linked URF peers
if ( packet->IsLocalOrigin() )
{
// encode it
@ -283,7 +283,7 @@ void CURFProtocol::HandleKeepalives(void)
Send(disconnect, peer->GetIp());
// remove it
std::cout << "XLX peer " << peer->GetCallsign() << " keepalive timeout" << std::endl;
std::cout << "URF peer " << peer->GetCallsign() << " keepalive timeout" << std::endl;
peers->RemovePeer(peer);
}
}
@ -312,7 +312,7 @@ void CURFProtocol::HandlePeerLinks(void)
// send disconnect packet
EncodeDisconnectPacket(&buffer);
Send(buffer, peer->GetIp());
std::cout << "Sending disconnect packet to XLX peer " << peer->GetCallsign() << std::endl;
std::cout << "Sending disconnect packet to URF peer " << peer->GetCallsign() << std::endl;
// remove client
peers->RemovePeer(peer);
}
@ -322,16 +322,19 @@ void CURFProtocol::HandlePeerLinks(void)
// if not, connect or reconnect
for ( auto it=list->begin(); it!=list->end(); it++ )
{
if ( (*it).GetCallsign().HasSameCallsignWithWildcard(CCallsign("XRF*")) )
if ( it->GetCallsign().HasSameCallsignWithWildcard(CCallsign("XRF*")) )
continue;
if ( peers->FindPeer((*it).GetCallsign(), EProtocol::urf) == nullptr )
if ( it->GetCallsign().HasSameCallsignWithWildcard(CCallsign("BM*")) )
continue;
CCallsign cs = it->GetCallsign();
if (cs.HasSameCallsignWithWildcard(CCallsign("URF*")) && (nullptr==peers->FindPeer(cs, EProtocol::urf)))
{
// resolve again peer's IP in case it's a dynamic IP
(*it).ResolveIp();
it->ResolveIp();
// send connect packet to re-initiate peer link
EncodeConnectPacket(&buffer, (*it).GetModules());
Send(buffer, (*it).GetIp(), URF_PORT);
std::cout << "Sending connect packet to XLX peer " << (*it).GetCallsign() << " @ " << (*it).GetIp() << " for modules " << (*it).GetModules() << std::endl;
EncodeConnectPacket(&buffer, it->GetModules());
Send(buffer, it->GetIp(), URF_PORT);
std::cout << "Sending connect packet to URF peer " << cs << " @ " << it->GetIp() << " for modules " << it->GetModules() << std::endl;
}
}
@ -348,7 +351,7 @@ void CURFProtocol::OnDvHeaderPacketIn(std::unique_ptr<CDvHeaderPacket> &Header,
{
CCallsign peer;
// todo: verify Packet.GetModuleId() is in authorized list of XLX of origin
// todo: verify Packet.GetModuleId() is in authorized list of URF of origin
// todo: do the same for DVFrame and DVLAstFrame packets
// tag packet as remote peer origin

Loading…
Cancel
Save

Powered by TurnKey Linux.