Hi, On Fri, Jun 04, 2021 at 12:55:04PM +0200, Gert Doering wrote: > That said, I have no idea if it is ever exposed to management API or > plugin/script env... "some reading of the source" is needed.
So. "OpenVPN side" address is only available if ENABLE_IP_PKTINFO
is valid, and then it can be found in the "link_socket_actual" structure
in act->pi.in4 / act->pi.in4.ip_spec_dst / act->pi.in6.ipi6_addr, see
socket.c, print_link_socket_actual_ex().
The most interesting caller of this seems to be linksock_print_addr(),
which is called at the end of link_socket_init_phase2().
The incoming source address is setenv'ed by
tls_process()
link_socket_set_outgoing_addr()
link_socket_connection_initiated()
setenv_trusted()
setenv_link_socket_actual()
setenv_sockaddr()
... so that would be the call chain where one could add a "this is
the local address used" setenv() call, similar to what
print_link_socket_actual_ex() does.
Good practice might be to extract the whole "local address" part of
print_link_socket_actual_ex() into a new subfunction used for both
cases (= less code duplication, less testing). But this is still not
a totally trivial task.
gert
--
"If was one thing all people took for granted, was conviction that if you
feed honest figures into a computer, honest figures come out. Never doubted
it myself till I met a computer with a sense of humor."
Robert A. Heinlein, The Moon is a Harsh Mistress
Gert Doering - Munich, Germany [email protected]
signature.asc
Description: PGP signature
_______________________________________________ Openvpn-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/openvpn-users
