mirror of
https://github.com/hyperion-project/hyperion.ng.git
synced 2023-10-10 13:36:59 +02:00
basic loop connection detection. prevent if you configure forward to 127.0.0.1:<port> and your server has the same port.
But this doesn't protect if not forwarded to localhost "127.0.0.1". Loop connections across different hosts arn't detected too. Former-commit-id: 464a80708ebd11c0f7c83dc87a1afe0f10e0e078
This commit is contained in:
parent
a9e8f0264a
commit
0f17e031e8
@ -16,6 +16,14 @@ JsonServer::JsonServer(Hyperion *hyperion, uint16_t port) :
|
||||
throw std::runtime_error("Json server could not bind to port");
|
||||
}
|
||||
|
||||
QList<MessageForwarder::JsonSlaveAddress> list = _hyperion->getForwarder()->getJsonSlaves();
|
||||
for ( int i=0; i<list.size(); i++ )
|
||||
{
|
||||
if ( list.at(i).addr == QHostAddress::LocalHost && list.at(i).port == port ) {
|
||||
throw std::runtime_error("Loop between proto server and forwarder detected. Fix your config!");
|
||||
}
|
||||
}
|
||||
|
||||
// Set trigger for incoming connections
|
||||
connect(&_server, SIGNAL(newConnection()), this, SLOT(newConnection()));
|
||||
|
||||
|
@ -18,6 +18,10 @@ ProtoServer::ProtoServer(Hyperion *hyperion, uint16_t port) :
|
||||
QStringList slaves = forwarder->getProtoSlaves();
|
||||
|
||||
for (int i = 0; i < slaves.size(); ++i) {
|
||||
if ( QString("127.0.0.1:%1").arg(port) == slaves.at(i) ) {
|
||||
throw std::runtime_error("Loop between proto server and forwarder detected. Fix your config!");
|
||||
}
|
||||
|
||||
ProtoConnection* p = new ProtoConnection(slaves.at(i).toLocal8Bit().constData());
|
||||
p->setSkipReply(true);
|
||||
_proxy_connections << p;
|
||||
|
Loading…
Reference in New Issue
Block a user