Skip to contentSkip to conversation

ovpn daemon not seeing my plugin thread...

Openvpn-devel Vineet Kumar 2 participants 3 messages Jun 24, 2010

lore
Share & tools
lore
#0 lore raw

Hi,
I am writing a plugin that creates a thread at plugin-open time. But
when I start ovpn as a daemon the ovpn code has no knowledge of that thread. The reason is obviously the fact that the thread-creation occurred *before* the daemon() call (that forked off a child which has no way of inheriting a copy of that thread).
So does this mean then that the ovpn daemon infrastructure will only work with plugins that don't do threading of their own?

If no, then pl. let me know how to get this working.
NOTE: All this works smoothly when ovpn doesn't start as a daemon.

Thanks a lot,

Vineet

#1 lore raw
Quoted 5 lines

The reason is obviously the fact that the thread-creation occurred *before* the daemon() call (that forked off a child which has no way of inheriting a copy of that thread).
So does this mean then that the ovpn daemon infrastructure will only work with plugins that don't do threading of their own?

You might want to look at openvpn_plugin_select_initialization_point_v1 function

as done here
http://redmine.debuntu.org/projects/openvpn-ldap-auth/repository/revisions/master/entry/src/ldap-auth.c#L430

Signature · 4 lines
http://www.debuntu.org


!DSPAM:4c23486761671948424632!
#2 lore raw

Perfect! The following worked:
I defined openvpn_plugin_select_initialization_point_v1() to return OPENVPN_PLUGIN_INIT_POST_DAEMON and now it all works since the plugin invocation now gets delayed to be after the daemon thread starts up.

Thanks a lot,

Vineet

Quoted 17 lines · chantra

The reason is obviously the fact that the thread-creation occurred
*before* the daemon() call (that forked off a child which has no way of inheriting a copy of that thread).
So does this mean then that the ovpn daemon infrastructure will only work with plugins that don't do threading of their own?

You might want to look at
openvpn_plugin_select_initialization_point_v1 function

as done here

http://redmine.debuntu.org/projects/openvpn-ldap-auth/repository/revisions/master/entry/src/ldap-auth.c#L430

-- http://www.debuntu.org

!DSPAM:4c23486761678150054016!