Hello, I am new at openvpn, I am trying to do a very simple plugin to
see connections/disconnections and to be able to notify to another
system in "real" time.

The problem is that I haven't found any documentation about the code or
about how to make plugins except on the code (I have been reading the
comments and I have some code of my plugin).

The main problem is that there are two functions: OPENVPN_PLUGIN_DEF int
OPENVPN_PLUGIN_FUNC(openvpn_plugin_func_v1)
     (openvpn_plugin_handle_t handle, const int type, const char
*argv[], const char *envp[]);
and
OPENVPN_PLUGIN_DEF int OPENVPN_PLUGIN_FUNC(openvpn_plugin_func_v2)
     (openvpn_plugin_handle_t handle,
      const int type,
      const char *argv[],
      const char *envp[],
      void *per_client_context,
      struct openvpn_plugin_string_list **return_list);

What I need is to obtain the public (inet IP) and the private (vpn ip)
when a client connects/disconnect to notify it to another program (I
know I can make a ping or similar things but it seems to be too slow
when there are a lot of clients connected (> 100)).

What I need is to know in which variable is that data and which function
I need to implement (v1 or v2) and how these functions works (Is any
documentation on any site?).

In openvpn_plugin_open_v1 I have registered the events: *type_mask =
OPENVPN_PLUGIN_MASK(OPENVPN_PLUGIN_CLIENT_CONNECT) |
OPENVPN_PLUGIN_MASK(OPENVPN_PLUGIN_CLIENT_DISCONNECT); and even on
openvpn_plugin_func_v1  I can know if there is if (type ==
OPENVPN_PLUGIN_CLIENT_CONNECT) or OPENVPN_PLUGIN_CLIENT_DISCONNECT but I
don't know how to recover IP information.

If somebody could help me or saying me where the documentation is would
be great.

Thanks in advance and excuse my english (I have written this too
quickly) and excuse me if what i am asking is answered on another place
that I haven't found.

-- 
Jose Sánchez <jose dot informatica at centrolamilagrosa dot org>



Reply via email to