Hello,
I m trying to use divert-to and Perl to manage in one place incoming packet,
keeping the destination address intact
As man says :
--
divert-to host port port Used to redirect packets to a local socket
bound to host and port. The packets will not be modified, so
getsockname(2) on the socket will return the original destination
address of the packet.
--
OI::Socket in perl do
sub recv {
@_ == 3 || @_ == 4 or croak 'usage: $sock->recv(BUF, LEN [, FLAGS])';
my $sock = $_[0];
my $len = $_[2];
my $flags = $_[3] || 0;
# remember who we recv'd from
${*$sock}{'io_socket_peername'} = recv($sock, $_[1]='', $len, $flags);
}
But RECV read a buffer, that could be multiple incoming data.
--
any call to getsockname(2) reply 127.0.0.1 which is the bind i pass
to the UDP socket ,
which is kinda normal .
i did `pass on ingress proto udp divert-to 127.0.0.1 port 1234`
So far I do not see how i could make this work. And relayd use divert
socket, is there
an example of this somewhere ?
Best.
--
--
---------------------------------------------------------------------------------------------------------------------
Knowing is not enough; we must apply. Willing is not enough; we must do