make format

pull/1282/head
Jason Rhinelander 4 years ago
parent a2d46eda1e
commit 3bb24580a4

@ -159,8 +159,7 @@ namespace llarp
if (pkt.IsV6()) if (pkt.IsV6())
pkt.UpdateIPv6Address(src, m_IP); pkt.UpdateIPv6Address(src, m_IP);
else else
pkt.UpdateIPv4Address( pkt.UpdateIPv4Address(xhtonl(net::TruncateV6(src)), xhtonl(net::TruncateV6(m_IP)));
xhtonl(net::TruncateV6(src)), xhtonl(net::TruncateV6(m_IP)));
const auto _pktbuf = pkt.Buffer(); const auto _pktbuf = pkt.Buffer();
const llarp_buffer_t& pktbuf = _pktbuf.underlying; const llarp_buffer_t& pktbuf = _pktbuf.underlying;

@ -486,8 +486,7 @@ namespace llarp
if (m_UseV6) if (m_UseV6)
pkt.UpdateIPv6Address(from, m_IfAddr); pkt.UpdateIPv6Address(from, m_IfAddr);
else else
pkt.UpdateIPv4Address( pkt.UpdateIPv4Address(xhtonl(net::TruncateV6(from)), xhtonl(net::TruncateV6(m_IfAddr)));
xhtonl(net::TruncateV6(from)), xhtonl(net::TruncateV6(m_IfAddr)));
return llarp_ev_tun_async_write(&m_Tun, pkt.Buffer()); return llarp_ev_tun_async_write(&m_Tun, pkt.Buffer());
} }

@ -950,8 +950,7 @@ namespace llarp
{ {
return false; return false;
} }
pkt.UpdateIPv4Address( pkt.UpdateIPv4Address(xhtonl(net::TruncateV6(themIP)), xhtonl(net::TruncateV6(usIP)));
xhtonl(net::TruncateV6(themIP)), xhtonl(net::TruncateV6(usIP)));
} }
else if (pkt.IsV6()) else if (pkt.IsV6())
{ {

@ -253,8 +253,7 @@ namespace llarp
else else
{ {
if (pkt.IsV4()) if (pkt.IsV4())
pkt.UpdateIPv4Address( pkt.UpdateIPv4Address(xhtonl(pkt.srcv4()), xhtonl(net::TruncateV6(m_OurIP)));
xhtonl(pkt.srcv4()), xhtonl(net::TruncateV6(m_OurIP)));
else else
return false; return false;
} }

@ -1,8 +1,8 @@
#include <net/ip.hpp> #include <net/ip.hpp>
#include <cstring> #include <cstring>
namespace llarp::net { namespace llarp::net
{
huint128_t huint128_t
In6ToHUInt(in6_addr addr) In6ToHUInt(in6_addr addr)
{ {

@ -2,7 +2,6 @@
namespace llarp namespace llarp
{ {
bool bool
IPRange::ContainsV4(const huint32_t& ip) const IPRange::ContainsV4(const huint32_t& ip) const
{ {

@ -16,8 +16,7 @@ namespace llarp
static constexpr IPRange static constexpr IPRange
FromIPv4(byte_t a, byte_t b, byte_t c, byte_t d, byte_t mask) FromIPv4(byte_t a, byte_t b, byte_t c, byte_t d, byte_t mask)
{ {
return IPRange{net::ExpandV4(ipaddr_ipv4_bits(a, b, c, d)), return IPRange{net::ExpandV4(ipaddr_ipv4_bits(a, b, c, d)), netmask_ipv6_bits(mask + 96)};
netmask_ipv6_bits(mask + 96)};
} }
/// return true if ip is contained in this ip range /// return true if ip is contained in this ip range

@ -465,8 +465,8 @@ namespace llarp
if (addr->sin_addr.s_addr) if (addr->sin_addr.s_addr)
// skip unconfig'd adapters (windows passes these through the unix-y // skip unconfig'd adapters (windows passes these through the unix-y
// wrapper) // wrapper)
currentRanges.emplace_back(IPRange{net::ExpandV4(xntohl(ifaddr)), currentRanges.emplace_back(
net::ExpandV4(xntohl(ifmask))}); IPRange{net::ExpandV4(xntohl(ifaddr)), net::ExpandV4(xntohl(ifmask))});
} }
}); });
// try 10.x.0.0/16 // try 10.x.0.0/16
@ -635,7 +635,10 @@ namespace llarp
} }
#else #else
bool bool
IsIPv4Bogon(const huint32_t&) { return false; } IsIPv4Bogon(const huint32_t&)
{
return false;
}
#endif #endif
} // namespace llarp } // namespace llarp

@ -45,7 +45,6 @@ operator==(const in6_addr& a, const in6_addr& b);
namespace llarp namespace llarp
{ {
/// get a netmask with the higest numset bits set /// get a netmask with the higest numset bits set
constexpr huint128_t constexpr huint128_t
_netmask_ipv6_bits(uint32_t numset) _netmask_ipv6_bits(uint32_t numset)

@ -194,8 +194,7 @@ namespace llarp
{ {
if (failedAt) if (failedAt)
{ {
r->NotifyRouterEvent<tooling::PathBuildRejectedEvent>( r->NotifyRouterEvent<tooling::PathBuildRejectedEvent>(Endpoint(), RXID(), *failedAt);
Endpoint(), RXID(), *failedAt);
LogWarn(Name(), " build failed at ", *failedAt); LogWarn(Name(), " build failed at ", *failedAt);
r->routerProfiling().MarkHopFail(*failedAt); r->routerProfiling().MarkHopFail(*failedAt);
} }

@ -548,7 +548,7 @@ namespace llarp
} }
// Network config // Network config
if (conf->network.m_enableProfiling.has_value() and not *conf->network.m_enableProfiling) if (conf->network.m_enableProfiling.has_value() and not*conf->network.m_enableProfiling)
{ {
routerProfiling().Disable(); routerProfiling().Disable();
LogWarn("router profiling explicitly disabled"); LogWarn("router profiling explicitly disabled");

@ -20,7 +20,8 @@ namespace llarp
} }
bool bool
ServiceInfo::Update(const byte_t* sign, const byte_t* enc, const std::optional<VanityNonce>& nonce) ServiceInfo::Update(
const byte_t* sign, const byte_t* enc, const std::optional<VanityNonce>& nonce)
{ {
signkey = sign; signkey = sign;
enckey = enc; enckey = enc;

@ -2,12 +2,12 @@
#include <cstdint> #include <cstdint>
namespace llarp::service { namespace llarp::service
{
using ProtocolType = uint64_t; using ProtocolType = uint64_t;
constexpr ProtocolType eProtocolControl = 0UL; constexpr ProtocolType eProtocolControl = 0UL;
constexpr ProtocolType eProtocolTrafficV4 = 1UL; constexpr ProtocolType eProtocolTrafficV4 = 1UL;
constexpr ProtocolType eProtocolTrafficV6 = 2UL; constexpr ProtocolType eProtocolTrafficV6 = 2UL;
} } // namespace llarp::service

@ -56,8 +56,8 @@ namespace llarp
else if (*m_id != std::this_thread::get_id()) else if (*m_id != std::this_thread::get_id())
{ {
std::cerr << "NullMutex " << this << " was used across threads: locked by " std::cerr << "NullMutex " << this << " was used across threads: locked by "
<< std::this_thread::get_id() << " and was previously locked by " << std::this_thread::get_id() << " and was previously locked by " << *m_id
<< *m_id << "\n"; << "\n";
// if you're encountering this abort() call, you may have discovered a // if you're encountering this abort() call, you may have discovered a
// case where a NullMutex should be reverted to a "real mutex" // case where a NullMutex should be reverted to a "real mutex"
std::abort(); std::abort();

Loading…
Cancel
Save