Server id sent on all outbound and inbound SERVER now. last parameter before desc.
Min params for SERVER is now 5, not 4.
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@7918
e03df62e-2008-0410-955e-
edbf42e46eb7
+std::string& TreeServer::GetID()
+{
+ return sid;
+}
+
+void TreeServer::SetID(const std::string &id)
+{
+ sid = id;
+}
+
int TreeServer::QuitUsers(const std::string &reason)
{
const char* reason_s = reason.c_str();
int TreeServer::QuitUsers(const std::string &reason)
{
const char* reason_s = reason.c_str();
time_t NextPing; /* After this time, the server should be PINGed*/
bool LastPingWasGood; /* True if the server responded to the last PING with a PONG */
SpanningTreeUtilities* Utils; /* Utility class */
time_t NextPing; /* After this time, the server should be PINGed*/
bool LastPingWasGood; /* True if the server responded to the last PING with a PONG */
SpanningTreeUtilities* Utils; /* Utility class */
+ std::string sid; /* Server ID */
+ /** Get server ID
+ */
+ std::string& GetID();
+
+ /** Set server ID
+ */
+ void SetID(const std::string &id);
+
/** Destructor
*/
~TreeServer();
/** Destructor
*/
~TreeServer();
ServerState LinkState; /* Link state */
std::string InboundServerName; /* Server name sent to us by other side */
std::string InboundDescription; /* Server description (GECOS) sent to us by the other side */
ServerState LinkState; /* Link state */
std::string InboundServerName; /* Server name sent to us by other side */
std::string InboundDescription; /* Server description (GECOS) sent to us by the other side */
+ std::string InboundSID; /* Server ID sent to us by the other side */
int num_lost_users; /* Users lost in split */
int num_lost_servers; /* Servers lost in split */
time_t NextPing; /* Time when we are due to ping this server */
int num_lost_users; /* Users lost in split */
int num_lost_servers; /* Servers lost in split */
time_t NextPing; /* Time when we are due to ping this server */
TreeServer* recursive_server = Current->GetChild(q);
if (recursive_server != s)
{
TreeServer* recursive_server = Current->GetChild(q);
if (recursive_server != s)
{
- snprintf(command,1024,":%s SERVER %s * %d :%s",Current->GetName().c_str(),recursive_server->GetName().c_str(),hops,recursive_server->GetDesc().c_str());
+ snprintf(command,1024,":%s SERVER %s * %d %s :%s",Current->GetName().c_str(),recursive_server->GetName().c_str(),hops,
+ recursive_server->GetID().c_str(),
+ recursive_server->GetDesc().c_str());
this->WriteLine(command);
this->WriteLine(":"+recursive_server->GetName()+" VERSION :"+recursive_server->GetVersion());
/* down to next level */
this->WriteLine(command);
this->WriteLine(":"+recursive_server->GetName()+" VERSION :"+recursive_server->GetVersion());
/* down to next level */
}
else if (params[0] == "END")
{
}
else if (params[0] == "END")
{
+ std::string OurSID;
+
+ OurSID += (char)((Instance->Config->sid / 100) + 48);
+ OurSID += (char)((Instance->Config->sid / 10) % 10 + 48);
+ OurSID += (char)(Instance->Config->sid % 10 + 48);
+
std::string reason;
int ip6support = 0;
#ifdef SUPPORT_IP6LINKS
std::string reason;
int ip6support = 0;
#ifdef SUPPORT_IP6LINKS
this->SetTheirChallenge(n->second);
if (!this->GetTheirChallenge().empty() && (this->LinkState == CONNECTING))
{
this->SetTheirChallenge(n->second);
if (!this->GetTheirChallenge().empty() && (this->LinkState == CONNECTING))
{
- this->WriteLine(std::string("SERVER ")+this->Instance->Config->ServerName+" "+this->MakePass(OutboundPass, this->GetTheirChallenge())+" 0 :"+this->Instance->Config->ServerDesc);
+ this->WriteLine(std::string("SERVER ")+this->Instance->Config->ServerName+" "+this->MakePass(OutboundPass, this->GetTheirChallenge())+" 0 "+
+ OurSID+" :"+this->Instance->Config->ServerDesc);
}
}
else
{
/* They didnt specify a challenge or we don't have m_sha256.so, we use plaintext */
if (this->LinkState == CONNECTING)
}
}
else
{
/* They didnt specify a challenge or we don't have m_sha256.so, we use plaintext */
if (this->LinkState == CONNECTING)
- this->WriteLine(std::string("SERVER ")+this->Instance->Config->ServerName+" "+OutboundPass+" 0 :"+this->Instance->Config->ServerDesc);
+ this->WriteLine(std::string("SERVER ")+this->Instance->Config->ServerName+" "+OutboundPass+" 0 "+OurSID+" :"+this->Instance->Config->ServerDesc);
bool TreeSocket::RemoteServer(const std::string &prefix, std::deque<std::string> ¶ms)
{
bool TreeSocket::RemoteServer(const std::string &prefix, std::deque<std::string> ¶ms)
{
return false;
std::string servername = params[0];
std::string password = params[1];
// hopcount is not used for a remote server, we calculate this ourselves
return false;
std::string servername = params[0];
std::string password = params[1];
// hopcount is not used for a remote server, we calculate this ourselves
- std::string description = params[3];
+ std::string sid = params[3];
+ std::string description = params[4];
TreeServer* ParentOfThis = Utils->FindServer(prefix);
if (!ParentOfThis)
{
TreeServer* ParentOfThis = Utils->FindServer(prefix);
if (!ParentOfThis)
{
Link* lnk = Utils->FindLink(servername);
TreeServer* Node = new TreeServer(this->Utils,this->Instance,servername,description,ParentOfThis,NULL, lnk ? lnk->Hidden : false);
ParentOfThis->AddChild(Node);
Link* lnk = Utils->FindLink(servername);
TreeServer* Node = new TreeServer(this->Utils,this->Instance,servername,description,ParentOfThis,NULL, lnk ? lnk->Hidden : false);
ParentOfThis->AddChild(Node);
- params[3] = ":" + params[3];
+ Node->SetID(sid);
+ params[4] = ":" + params[4];
Utils->SetRemoteBursting(Node, true);
Utils->DoOneToAllButSender(prefix,"SERVER",params,prefix);
this->Instance->SNO->WriteToSnoMask('l',"Server \002"+prefix+"\002 introduced server \002"+servername+"\002 ("+description+")");
Utils->SetRemoteBursting(Node, true);
Utils->DoOneToAllButSender(prefix,"SERVER",params,prefix);
this->Instance->SNO->WriteToSnoMask('l',"Server \002"+prefix+"\002 introduced server \002"+servername+"\002 ("+description+")");
bool TreeSocket::Outbound_Reply_Server(std::deque<std::string> ¶ms)
{
bool TreeSocket::Outbound_Reply_Server(std::deque<std::string> ¶ms)
{
return false;
irc::string servername = params[0].c_str();
std::string sname = params[0];
std::string password = params[1];
return false;
irc::string servername = params[0].c_str();
std::string sname = params[0];
std::string password = params[1];
- std::string description = params[3];
+ std::string sid = params[3];
+ std::string description = params[4];
int hops = atoi(params[2].c_str());
this->InboundServerName = sname;
this->InboundDescription = description;
int hops = atoi(params[2].c_str());
this->InboundServerName = sname;
this->InboundDescription = description;
+ this->InboundSID = sid;
if (!sentcapab)
this->SendCapabilities();
if (!sentcapab)
this->SendCapabilities();
// node.
TreeServer* Node = new TreeServer(this->Utils,this->Instance,sname,description,Utils->TreeRoot,this,x->Hidden);
Utils->TreeRoot->AddChild(Node);
// node.
TreeServer* Node = new TreeServer(this->Utils,this->Instance,sname,description,Utils->TreeRoot,this,x->Hidden);
Utils->TreeRoot->AddChild(Node);
- params[3] = ":" + params[3];
+ params[4] = ":" + params[4];
+ Node->SetID(params[3]);
Utils->DoOneToAllButSender(Utils->TreeRoot->GetName(),"SERVER",params,sname);
this->bursting = true;
this->DoBurst(Node);
Utils->DoOneToAllButSender(Utils->TreeRoot->GetName(),"SERVER",params,sname);
this->bursting = true;
this->DoBurst(Node);
bool TreeSocket::Inbound_Server(std::deque<std::string> ¶ms)
{
bool TreeSocket::Inbound_Server(std::deque<std::string> ¶ms)
{
return false;
irc::string servername = params[0].c_str();
std::string sname = params[0];
std::string password = params[1];
return false;
irc::string servername = params[0].c_str();
std::string sname = params[0];
std::string password = params[1];
- std::string description = params[3];
+ std::string sid = params[3];
+ std::string description = params[4];
+ std::string OurSID;
int hops = atoi(params[2].c_str());
this->InboundServerName = sname;
this->InboundDescription = description;
int hops = atoi(params[2].c_str());
this->InboundServerName = sname;
this->InboundDescription = description;
+ this->InboundSID = sid;
+
+ OurSID += (char)((Instance->Config->sid / 100) + 48);
+ OurSID += (char)((Instance->Config->sid / 10) % 10 + 48);
+ OurSID += (char)(Instance->Config->sid % 10 + 48);
if (!sentcapab)
this->SendCapabilities();
if (!sentcapab)
this->SendCapabilities();
// this is good. Send our details: Our server name and description and hopcount of 0,
// along with the sendpass from this block.
// this is good. Send our details: Our server name and description and hopcount of 0,
// along with the sendpass from this block.
- this->WriteLine(std::string("SERVER ")+this->Instance->Config->ServerName+" "+this->MakePass(x->SendPass, this->GetTheirChallenge())+" 0 :"+this->Instance->Config->ServerDesc);
+ this->WriteLine(std::string("SERVER ")+this->Instance->Config->ServerName+" "+this->MakePass(x->SendPass, this->GetTheirChallenge())+" 0 "+OurSID+" :"+this->Instance->Config->ServerDesc);
// move to the next state, we are now waiting for THEM.
this->LinkState = WAIT_AUTH_2;
return true;
// move to the next state, we are now waiting for THEM.
this->LinkState = WAIT_AUTH_2;
return true;
params.push_back(InboundServerName);
params.push_back("*");
params.push_back("1");
params.push_back(InboundServerName);
params.push_back("*");
params.push_back("1");
+ params.push_back(InboundSID);
params.push_back(":"+InboundDescription);
params.push_back(":"+InboundDescription);
+ Node->SetID(InboundSID);
Utils->DoOneToAllButSender(Utils->TreeRoot->GetName(),"SERVER",params,InboundServerName);
this->bursting = true;
this->DoBurst(Node);
Utils->DoOneToAllButSender(Utils->TreeRoot->GetName(),"SERVER",params,InboundServerName);
this->bursting = true;
this->DoBurst(Node);