attempt to fix snode traffic ip rewrite bug

pull/1319/head
jeff 4 years ago committed by Jeff Becker
parent fac5502c55
commit 75f9643776
No known key found for this signature in database
GPG Key ID: F357B3B42F6F9B05

@ -36,6 +36,12 @@ namespace llarp
void
SendPacketToRemote(const llarp_buffer_t&) override{};
huint128_t
ObtainIPForAddr(const AlignedBuffer<32>&, bool) override
{
return {0};
}
};
} // namespace handlers
} // namespace llarp

@ -164,7 +164,7 @@ namespace llarp
/// get ip address for key unconditionally
huint128_t
ObtainIPForAddr(const AlignedBuffer<32>& addr, bool serviceNode);
ObtainIPForAddr(const AlignedBuffer<32>& addr, bool serviceNode) override;
/// flush network traffic
void

@ -1071,11 +1071,18 @@ namespace llarp
// TODO: check for collision lol no we don't but maybe we will...
// some day :DDDDD
tag.Randomize();
const auto src = xhtonl(net::TruncateV6(GetIfAddr()));
const auto dst = xhtonl(net::TruncateV6(ObtainIPForAddr(snode, true)));
auto session = std::make_shared<exit::SNodeSession>(
snode,
[=](const llarp_buffer_t& pkt) -> bool {
[=](const llarp_buffer_t& buf) -> bool {
net::IPPacket pkt;
if (not pkt.Load(buf))
return false;
pkt.UpdateIPv4Address(src, dst);
/// TODO: V6
return HandleInboundPacket(tag, pkt, eProtocolTrafficV4);
return HandleInboundPacket(tag, pkt.ConstBuffer(), eProtocolTrafficV4);
},
Router(),
numPaths,

@ -182,8 +182,8 @@ namespace llarp
void
SetAuthInfoForEndpoint(Address remote, AuthInfo info);
// virtual huint128_t
// ObtainIPForAddr(const AlignedBuffer< 32 >& addr, bool serviceNode) = 0;
virtual huint128_t
ObtainIPForAddr(const AlignedBuffer<32>& addr, bool serviceNode) = 0;
// virtual bool
// HasServiceAddress(const AlignedBuffer< 32 >& addr) const = 0;

@ -56,6 +56,12 @@ namespace llarp
return false;
}
llarp::huint128_t
ObtainIPForAddr(const llarp::AlignedBuffer<32>&, bool) override
{
return {0};
}
using PacketHandler_t =
std::function<void(service::Address, std::vector<byte_t>, service::ProtocolType)>;

Loading…
Cancel
Save