fix inet4 to inet6 transition bug

This commit is contained in:
despair86 2018-10-08 20:38:25 -05:00
parent 252b2ee3fb
commit 630cf99bae
2 changed files with 7 additions and 5 deletions

View File

@ -383,7 +383,7 @@ namespace llarp
out << "]";
}
return out << ":" << a.port();
return out << ":" << ntohs(a.port());
}
operator const sockaddr*() const

View File

@ -12,6 +12,7 @@
#include "str.hpp"
#include <fstream>
#include <cstdlib>
namespace llarp
{
@ -666,8 +667,8 @@ llarp_router::Run()
routerProfiling.Load(routerProfilesFile.c_str());
// zero out router contact
sockaddr *dest = (sockaddr *)&this->ip4addr;
llarp::Addr publicAddr(*dest);
//sockaddr *dest = (sockaddr *)&this->ip4addr;
llarp::Addr publicAddr(this->addrInfo);
if(this->publicOverride)
{
@ -1245,8 +1246,9 @@ namespace llarp
if(StrEq(key, "public-port"))
{
llarp::LogInfo("Setting public port ", val);
self->ip4addr.sin_port = htons(atoi(val));
self->addrInfo.port = htons(atoi(val));
int p = atoi(val);
self->ip4addr.sin_port = htons(p);
self->addrInfo.port = htons(p);
self->publicOverride = true;
}
}