All of lore.kernel.org
 help / color / mirror / Atom feed
* [Openvpn-devel] [PATCH 1/2] show correct default for plugin dir in configure help
@ 2016-11-28 16:16 Christian Hesse
  2016-11-28 16:16 ` [Openvpn-devel] [PATCH 2/2] allow to enable plugin lookup with configure argument Christian Hesse
  2016-11-28 23:56 ` [Openvpn-devel] [PATCH 1/2] show correct default for plugin dir in configure help David Sommerseth
  0 siblings, 2 replies; 23+ messages in thread
From: Christian Hesse @ 2016-11-28 16:16 UTC (permalink / raw)
  To: openvpn-devel; +Cc: Christian Hesse <mail@

From: Christian Hesse <mail@...1798...>

Signed-off-by: Christian Hesse <mail@...1798...>
---
 configure.ac | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/configure.ac b/configure.ac
index f4073d0..d0fe889 100644
--- a/configure.ac
+++ b/configure.ac
@@ -303,7 +303,7 @@ AC_ARG_WITH(
 
 AC_ARG_WITH(
 	[plugindir],
-	[AS_HELP_STRING([--with-plugindir], [plugin directory @<:@default=LIBDIR/openvpn@:>@])],
+	[AS_HELP_STRING([--with-plugindir], [plugin directory @<:@default=LIBDIR/openvpn/plugins@:>@])],
 	,
 	[with_plugindir="\$(libdir)/openvpn/plugins"]
 )
-- 
2.10.2



^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [Openvpn-devel] [PATCH 2/2] allow to enable plugin lookup with configure argument
  2016-11-28 16:16 [Openvpn-devel] [PATCH 1/2] show correct default for plugin dir in configure help Christian Hesse
@ 2016-11-28 16:16 ` Christian Hesse
  2016-11-28 23:47   ` David Sommerseth
  2016-11-28 23:56 ` [Openvpn-devel] [PATCH 1/2] show correct default for plugin dir in configure help David Sommerseth
  1 sibling, 1 reply; 23+ messages in thread
From: Christian Hesse @ 2016-11-28 16:16 UTC (permalink / raw)
  To: openvpn-devel; +Cc: Christian Hesse <mail@

From: Christian Hesse <mail@...1798...>

For plugin lookup (give relative path to plugin directory in
configuration) we had to configure with something like this:

CFLAGS="$CFLAGS -DPLUGIN_LIBDIR=\\\"/usr/lib/openvpn/plugins\\\"" ./configure

This allows to pass --enable-plugin-lookup to configure to achieve the
same. As a bonus we can be sure that install path and lookup path in
openvpn binary are the same.

Signed-off-by: Christian Hesse <mail@...1798...>
---
 configure.ac            | 8 ++++++++
 src/openvpn/Makefile.am | 4 ++++
 2 files changed, 12 insertions(+)

diff --git a/configure.ac b/configure.ac
index d0fe889..193b5f0 100644
--- a/configure.ac
+++ b/configure.ac
@@ -308,6 +308,14 @@ AC_ARG_WITH(
 	[with_plugindir="\$(libdir)/openvpn/plugins"]
 )
 
+AC_ARG_ENABLE(
+	[plugin-lookup],
+	[AS_HELP_STRING([--enable-plugin-lookup], [enable plugin lookup in plugin directory @<:@default=no@:>@])],
+	[enable_plugin_lookup="$enableval"],
+	[enable_plugin_lookup="no"]
+)
+AM_CONDITIONAL([ENABLE_PLUGIN_LOOKUP], [test x$enable_plugin_lookup = xyes])
+
 
 AC_DEFINE_UNQUOTED([TARGET_ALIAS], ["${host}"], [A string representing our host])
 case "$host" in
diff --git a/src/openvpn/Makefile.am b/src/openvpn/Makefile.am
index 4c18449..46afc9a 100644
--- a/src/openvpn/Makefile.am
+++ b/src/openvpn/Makefile.am
@@ -33,6 +33,10 @@ if WIN32
 AM_CFLAGS += -municode -UUNICODE
 endif
 
+if ENABLE_PLUGIN_LOOKUP
+AM_CFLAGS += -DPLUGIN_LIBDIR=\"$(plugindir)\"
+endif
+
 sbin_PROGRAMS = openvpn
 
 openvpn_SOURCES = \
-- 
2.10.2



^ permalink raw reply related	[flat|nested] 23+ messages in thread

* Re: [Openvpn-devel] [PATCH 2/2] allow to enable plugin lookup with configure argument
  2016-11-28 16:16 ` [Openvpn-devel] [PATCH 2/2] allow to enable plugin lookup with configure argument Christian Hesse
@ 2016-11-28 23:47   ` David Sommerseth
  2016-11-29 11:05     ` Christian Hesse
  0 siblings, 1 reply; 23+ messages in thread
From: David Sommerseth @ 2016-11-28 23:47 UTC (permalink / raw)
  To: Christian Hesse <list@; +Cc: Christian Hesse <mail@


[-- Attachment #1.1: Type: text/plain, Size: 2843 bytes --]

On 28/11/16 17:16, Christian Hesse wrote:
> From: Christian Hesse <mail@...1798...>
> 
> For plugin lookup (give relative path to plugin directory in
> configuration) we had to configure with something like this:
> 
> CFLAGS="$CFLAGS -DPLUGIN_LIBDIR=\\\"/usr/lib/openvpn/plugins\\\"" ./configure
> 
> This allows to pass --enable-plugin-lookup to configure to achieve the
> same. As a bonus we can be sure that install path and lookup path in
> openvpn binary are the same.


Thank you for your patch.  Unfortunately I'm not convinced this is the
proper way to do it.

First of all, to achieve what I believe is your goal, you need to flip
things around:

  ./configure CFLAGS="$CFLAGS
-DPLUGIN_LIBDIR=\\\"/usr/lib/openvpn/plugins\\\""

This will ensure that whenever 'make' decides to re-run ./configure
automatically it will keep all variables provided to the command line.


Secondly, I believe the proper way to configure PLUGIN_LIBDIR without
going via CFLAGS is to use a similar approach to what is used by
IFCONFIG, ROUTE, IPROUTE and NETSTAT.  They are configured via AC_ARG_VAR.

I'd recommend just adding these two lines to configure.ac instead:

AC_ARG_VAR([PLUGINDIR], [Path of default plug-in search directory])
AC_DEFINE_UNQUOTED([PLUGIN_LIBDIR], ["$PLUGINDIR"])

(these lines are not tested, but that should give some pointer towards a
better direction.

With these lines in place, it is expected that you can do:

  ./configure PLUGINDIR=/usr/lib/openvpn/plugins

Which should result in defining PLUGIN_LIBDIR in config.h.


-- 
kind regards,

David Sommerseth
OpenVPN Technologies, Inc



> ---
>  configure.ac            | 8 ++++++++
>  src/openvpn/Makefile.am | 4 ++++
>  2 files changed, 12 insertions(+)
> 
> diff --git a/configure.ac b/configure.ac
> index d0fe889..193b5f0 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -308,6 +308,14 @@ AC_ARG_WITH(
>  	[with_plugindir="\$(libdir)/openvpn/plugins"]
>  )
>  
> +AC_ARG_ENABLE(
> +	[plugin-lookup],
> +	[AS_HELP_STRING([--enable-plugin-lookup], [enable plugin lookup in plugin directory @<:@default=no@:>@])],
> +	[enable_plugin_lookup="$enableval"],
> +	[enable_plugin_lookup="no"]
> +)
> +AM_CONDITIONAL([ENABLE_PLUGIN_LOOKUP], [test x$enable_plugin_lookup = xyes])
> +
>  
>  AC_DEFINE_UNQUOTED([TARGET_ALIAS], ["${host}"], [A string representing our host])
>  case "$host" in
> diff --git a/src/openvpn/Makefile.am b/src/openvpn/Makefile.am
> index 4c18449..46afc9a 100644
> --- a/src/openvpn/Makefile.am
> +++ b/src/openvpn/Makefile.am
> @@ -33,6 +33,10 @@ if WIN32
>  AM_CFLAGS += -municode -UUNICODE
>  endif
>  
> +if ENABLE_PLUGIN_LOOKUP
> +AM_CFLAGS += -DPLUGIN_LIBDIR=\"$(plugindir)\"
> +endif
> +
>  sbin_PROGRAMS = openvpn
>  
>  openvpn_SOURCES = \
> 



[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [Openvpn-devel] [PATCH 1/2] show correct default for plugin dir in configure help
  2016-11-28 16:16 [Openvpn-devel] [PATCH 1/2] show correct default for plugin dir in configure help Christian Hesse
  2016-11-28 16:16 ` [Openvpn-devel] [PATCH 2/2] allow to enable plugin lookup with configure argument Christian Hesse
@ 2016-11-28 23:56 ` David Sommerseth
  1 sibling, 0 replies; 23+ messages in thread
From: David Sommerseth @ 2016-11-28 23:56 UTC (permalink / raw)
  To: Christian Hesse <list@; +Cc: Christian Hesse <mail@


[-- Attachment #1.1: Type: text/plain, Size: 1111 bytes --]

On 28/11/16 17:16, Christian Hesse wrote:
> From: Christian Hesse <mail@...1798...>
> 
> Signed-off-by: Christian Hesse <mail@...1798...>
> ---
>  configure.ac | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/configure.ac b/configure.ac
> index f4073d0..d0fe889 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -303,7 +303,7 @@ AC_ARG_WITH(
>  
>  AC_ARG_WITH(
>  	[plugindir],
> -	[AS_HELP_STRING([--with-plugindir], [plugin directory @<:@default=LIBDIR/openvpn@:>@])],
> +	[AS_HELP_STRING([--with-plugindir], [plugin directory @<:@default=LIBDIR/openvpn/plugins@:>@])],
>  	,
>  	[with_plugindir="\$(libdir)/openvpn/plugins"]
>  )

I think all this --with-pluigndir should be kicked right out and use
PLUGINDIR environment variables instead, as setting this variable in
this way will preserve it better when ./configure is automatically
re-run by make.

This is more likely some left-over clean-up which never happened earlier
on when we had the last big autotools overhaul.


-- 
kind regards,

David Sommerseth
OpenVPN Technologies, Inc



[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [Openvpn-devel] [PATCH 2/2] allow to enable plugin lookup with configure argument
  2016-11-28 23:47   ` David Sommerseth
@ 2016-11-29 11:05     ` Christian Hesse
  2016-11-29 11:07       ` [Openvpn-devel] [PATCH 1/1] Clean up plugin path handling Christian Hesse
  0 siblings, 1 reply; 23+ messages in thread
From: Christian Hesse @ 2016-11-29 11:05 UTC (permalink / raw)
  To: David Sommerseth <openvpn@; +Cc: Christian Hesse <mail@

[-- Attachment #1: Type: text/plain, Size: 2411 bytes --]

David Sommerseth <openvpn@...2080...> on Tue, 2016/11/29 00:47:
> On 28/11/16 17:16, Christian Hesse wrote:
> > From: Christian Hesse <mail@...1798...>
> > 
> > For plugin lookup (give relative path to plugin directory in
> > configuration) we had to configure with something like this:
> > 
> > CFLAGS="$CFLAGS
> > -DPLUGIN_LIBDIR=\\\"/usr/lib/openvpn/plugins\\\"" ./configure
> > 
> > This allows to pass --enable-plugin-lookup to configure to achieve the
> > same. As a bonus we can be sure that install path and lookup path in
> > openvpn binary are the same.  
> 
> 
> Thank you for your patch.  Unfortunately I'm not convinced this is the
> proper way to do it.
> 
> First of all, to achieve what I believe is your goal, you need to flip
> things around:
> 
>   ./configure CFLAGS="$CFLAGS
> -DPLUGIN_LIBDIR=\\\"/usr/lib/openvpn/plugins\\\""
> 
> This will ensure that whenever 'make' decides to re-run ./configure
> automatically it will keep all variables provided to the command line.

Ah, right...
I used this to build a binary package, so configure is run only once and it
works for this case. :D

> Secondly, I believe the proper way to configure PLUGIN_LIBDIR without
> going via CFLAGS is to use a similar approach to what is used by
> IFCONFIG, ROUTE, IPROUTE and NETSTAT.  They are configured via AC_ARG_VAR.
> 
> I'd recommend just adding these two lines to configure.ac instead:
> 
> AC_ARG_VAR([PLUGINDIR], [Path of default plug-in search directory])
> AC_DEFINE_UNQUOTED([PLUGIN_LIBDIR], ["$PLUGINDIR"])
> 
> (these lines are not tested, but that should give some pointer towards a
> better direction.
> 
> With these lines in place, it is expected that you can do:
> 
>   ./configure PLUGINDIR=/usr/lib/openvpn/plugins
> 
> Which should result in defining PLUGIN_LIBDIR in config.h.

I decided to go another way... Wanted to make the plugin search work out of
the box. Or do we want to keep that optional?

(AC_DEFINE_UNQUOTED() fails if PLUGINDIR is not defined and you try
${libdir}/openvpn/plugins instead. That evaluates to
"${exec_prefix}/lib/openvpn/plugins" and breaks the path in config.h.)
-- 
main(a){char*c=/*    Schoene Gruesse                         */"B?IJj;MEH"
"CX:;",b;for(a/*    Best regards             my address:    */=0;b=c[a++];)
putchar(b-1/(/*    Chris            cc -ox -xc - && ./x    */b/42*2-3)*42);}

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 23+ messages in thread

* [Openvpn-devel] [PATCH 1/1] Clean up plugin path handling
  2016-11-29 11:05     ` Christian Hesse
@ 2016-11-29 11:07       ` Christian Hesse
  2016-11-29 13:47         ` Christian Hesse
                           ` (2 more replies)
  0 siblings, 3 replies; 23+ messages in thread
From: Christian Hesse @ 2016-11-29 11:07 UTC (permalink / raw)
  To: openvpn-devel; +Cc: Christian Hesse <mail@

From: Christian Hesse <mail@...1798...>

Drop --with-plugindir, instead use an environment variable PLUGINDIR
to specify the plugin directory.

This always defines PLUGIN_LIBDIR and enables plugin search path.

Signed-off-by: Christian Hesse <mail@...1798...>
---
 configure.ac            | 14 ++++++--------
 src/openvpn/Makefile.am |  3 ++-
 2 files changed, 8 insertions(+), 9 deletions(-)

diff --git a/configure.ac b/configure.ac
index f4073d0..5fe652e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -301,13 +301,12 @@ AC_ARG_WITH(
 	[with_crypto_library="openssl"]
 )
 
-AC_ARG_WITH(
-	[plugindir],
-	[AS_HELP_STRING([--with-plugindir], [plugin directory @<:@default=LIBDIR/openvpn@:>@])],
-	,
-	[with_plugindir="\$(libdir)/openvpn/plugins"]
-)
-
+AC_ARG_VAR([PLUGINDIR], [Path of plug-in directory @<:@default=LIBDIR/openvpn/plugins@:>@])
+if test -n "${PLUGINDIR}"; then
+	plugindir="${PLUGINDIR}"
+else
+	plugindir="\${libdir}/openvpn/plugins"
+fi
 
 AC_DEFINE_UNQUOTED([TARGET_ALIAS], ["${host}"], [A string representing our host])
 case "$host" in
@@ -1245,7 +1244,6 @@ AM_CONDITIONAL([ENABLE_PLUGIN_AUTH_PAM], [test "${enable_plugin_auth_pam}" = "ye
 AM_CONDITIONAL([ENABLE_PLUGIN_DOWN_ROOT], [test "${enable_plugin_down_root}" = "yes"])
 AM_CONDITIONAL([ENABLE_CRYPTO], [test "${enable_crypto}" = "yes"])
 
-plugindir="${with_plugindir}"
 sampledir="\$(docdir)/sample"
 AC_SUBST([plugindir])
 AC_SUBST([sampledir])
diff --git a/src/openvpn/Makefile.am b/src/openvpn/Makefile.am
index 4c18449..188834a 100644
--- a/src/openvpn/Makefile.am
+++ b/src/openvpn/Makefile.am
@@ -27,7 +27,8 @@ AM_CFLAGS = \
 	$(OPTIONAL_CRYPTO_CFLAGS) \
 	$(OPTIONAL_LZO_CFLAGS) \
 	$(OPTIONAL_LZ4_CFLAGS) \
-	$(OPTIONAL_PKCS11_HELPER_CFLAGS)
+	$(OPTIONAL_PKCS11_HELPER_CFLAGS) \
+	-DPLUGIN_LIBDIR=\"${plugindir}\"
 if WIN32
 # we want unicode entry point but not the macro
 AM_CFLAGS += -municode -UUNICODE
-- 
2.10.2



^ permalink raw reply related	[flat|nested] 23+ messages in thread

* Re: [Openvpn-devel] [PATCH 1/1] Clean up plugin path handling
  2016-11-29 11:07       ` [Openvpn-devel] [PATCH 1/1] Clean up plugin path handling Christian Hesse
@ 2016-11-29 13:47         ` Christian Hesse
  2016-12-09 21:37         ` David Sommerseth
  2016-12-27 22:24         ` [Openvpn-devel] [PATCH v2 " Christian Hesse
  2 siblings, 0 replies; 23+ messages in thread
From: Christian Hesse @ 2016-11-29 13:47 UTC (permalink / raw)
  To: openvpn-devel; +Cc: Christian Hesse <mail@

[-- Attachment #1: Type: text/plain, Size: 3732 bytes --]

Christian Hesse <list@...1798...> on Tue, 2016/11/29 12:07:
> From: Christian Hesse <mail@...1798...>
> 
> Drop --with-plugindir, instead use an environment variable PLUGINDIR
> to specify the plugin directory.
> 
> This always defines PLUGIN_LIBDIR and enables plugin search path.
> 
> Signed-off-by: Christian Hesse <mail@...1798...>
> ---
>  configure.ac            | 14 ++++++--------
>  src/openvpn/Makefile.am |  3 ++-
>  2 files changed, 8 insertions(+), 9 deletions(-)
> 
> diff --git a/configure.ac b/configure.ac
> index f4073d0..5fe652e 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -301,13 +301,12 @@ AC_ARG_WITH(
>  	[with_crypto_library="openssl"]
>  )
>  
> -AC_ARG_WITH(
> -	[plugindir],
> -	[AS_HELP_STRING([--with-plugindir], [plugin directory
> @<:@default=LIBDIR/openvpn@:>@])],
> -	,
> -	[with_plugindir="\$(libdir)/openvpn/plugins"]
> -)
> -
> +AC_ARG_VAR([PLUGINDIR], [Path of plug-in directory
> @<:@default=LIBDIR/openvpn/plugins@:>@]) +if test -n "${PLUGINDIR}"; then
> +	plugindir="${PLUGINDIR}"
> +else
> +	plugindir="\${libdir}/openvpn/plugins"
> +fi
>  
>  AC_DEFINE_UNQUOTED([TARGET_ALIAS], ["${host}"], [A string representing our
> host]) case "$host" in
> @@ -1245,7 +1244,6 @@ AM_CONDITIONAL([ENABLE_PLUGIN_AUTH_PAM], [test
> "${enable_plugin_auth_pam}" = "ye AM_CONDITIONAL([ENABLE_PLUGIN_DOWN_ROOT],
> [test "${enable_plugin_down_root}" = "yes"])
> AM_CONDITIONAL([ENABLE_CRYPTO], [test "${enable_crypto}" = "yes"]) 
> -plugindir="${with_plugindir}"
>  sampledir="\$(docdir)/sample"
>  AC_SUBST([plugindir])
>  AC_SUBST([sampledir])
> diff --git a/src/openvpn/Makefile.am b/src/openvpn/Makefile.am
> index 4c18449..188834a 100644
> --- a/src/openvpn/Makefile.am
> +++ b/src/openvpn/Makefile.am
> @@ -27,7 +27,8 @@ AM_CFLAGS = \
>  	$(OPTIONAL_CRYPTO_CFLAGS) \
>  	$(OPTIONAL_LZO_CFLAGS) \
>  	$(OPTIONAL_LZ4_CFLAGS) \
> -	$(OPTIONAL_PKCS11_HELPER_CFLAGS)
> +	$(OPTIONAL_PKCS11_HELPER_CFLAGS) \
> +	-DPLUGIN_LIBDIR=\"${plugindir}\"
>  if WIN32
>  # we want unicode entry point but not the macro
>  AM_CFLAGS += -municode -UUNICODE

The alternative would look something like this:

--- a/configure.ac
+++ b/configure.ac
@@ -301,13 +301,13 @@ AC_ARG_WITH(
 	[with_crypto_library="openssl"]
 )
 
-AC_ARG_WITH(
-	[plugindir],
-	[AS_HELP_STRING([--with-plugindir], [plugin directory @<:@default=LIBDIR/openvpn@:>@])],
-	,
-	[with_plugindir="\$(libdir)/openvpn/plugins"]
-)
-
+AC_ARG_VAR([PLUGINDIR], [Path of plug-in directory @<:@default=LIBDIR/openvpn/plugins@:>@])
+if test -n "${PLUGINDIR}"; then
+	plugindir="${PLUGINDIR}"
+	AC_DEFINE_UNQUOTED([PLUGIN_LIBDIR], ["${PLUGINDIR}"], [Path of plug-in search directory])
+else
+	plugindir="\${libdir}/openvpn/plugins"
+fi
 
 AC_DEFINE_UNQUOTED([TARGET_ALIAS], ["${host}"], [A string representing our host])
 case "$host" in
@@ -1245,7 +1245,6 @@ AM_CONDITIONAL([ENABLE_PLUGIN_AUTH_PAM], [test "${enable_plugin_auth_pam}" = "ye
 AM_CONDITIONAL([ENABLE_PLUGIN_DOWN_ROOT], [test "${enable_plugin_down_root}" = "yes"])
 AM_CONDITIONAL([ENABLE_CRYPTO], [test "${enable_crypto}" = "yes"])
 
-plugindir="${with_plugindir}"
 sampledir="\$(docdir)/sample"
 AC_SUBST([plugindir])
 AC_SUBST([sampledir])

However you *have* to give PLUGINDIR this way to enable the search path. I
would like to avoid that. And I did not find a way to move
AC_DEFINE_UNQUOTED() below the condition due to the nested variables in
$libdir.
-- 
main(a){char*c=/*    Schoene Gruesse                         */"B?IJj;MEH"
"CX:;",b;for(a/*    Best regards             my address:    */=0;b=c[a++];)
putchar(b-1/(/*    Chris            cc -ox -xc - && ./x    */b/42*2-3)*42);}

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [Openvpn-devel] [PATCH 1/1] Clean up plugin path handling
  2016-11-29 11:07       ` [Openvpn-devel] [PATCH 1/1] Clean up plugin path handling Christian Hesse
  2016-11-29 13:47         ` Christian Hesse
@ 2016-12-09 21:37         ` David Sommerseth
  2016-12-09 21:54           ` Christian Hesse
  2016-12-27 22:24         ` [Openvpn-devel] [PATCH v2 " Christian Hesse
  2 siblings, 1 reply; 23+ messages in thread
From: David Sommerseth @ 2016-12-09 21:37 UTC (permalink / raw)
  To: Christian Hesse <list@; +Cc: Christian Hesse <mail@


[-- Attachment #1.1: Type: text/plain, Size: 1849 bytes --]

On 29/11/16 12:07, Christian Hesse wrote:
> From: Christian Hesse <mail@...1798...>
> 
> Drop --with-plugindir, instead use an environment variable PLUGINDIR
> to specify the plugin directory.
> 
> This always defines PLUGIN_LIBDIR and enables plugin search path.
> 
> Signed-off-by: Christian Hesse <mail@...1798...>
> ---
>  configure.ac            | 14 ++++++--------
>  src/openvpn/Makefile.am |  3 ++-
>  2 files changed, 8 insertions(+), 9 deletions(-)
> 
> diff --git a/configure.ac b/configure.ac
> index f4073d0..5fe652e 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -301,13 +301,12 @@ AC_ARG_WITH(
>  	[with_crypto_library="openssl"]
>  )
>  
> -AC_ARG_WITH(
> -	[plugindir],
> -	[AS_HELP_STRING([--with-plugindir], [plugin directory @<:@default=LIBDIR/openvpn@:>@])],
> -	,
> -	[with_plugindir="\$(libdir)/openvpn/plugins"]
> -)
> -
> +AC_ARG_VAR([PLUGINDIR], [Path of plug-in directory @<:@default=LIBDIR/openvpn/plugins@:>@])
> +if test -n "${PLUGINDIR}"; then
> +	plugindir="${PLUGINDIR}"
> +else
> +	plugindir="\${libdir}/openvpn/plugins"
> +fi

Finally had some time to dig into this one.  I like the idea here, I
think it makes sense.  But I'm not sure ${libdir} is correct by default.
 I think that should be /usr/local/lib64 by default on a 64bit system.

My google-foo isn't helpful for me today ... This is somewhat related,
especially towards the end of this doc page:
<https://www.gnu.org/software/autoconf/manual/autoconf-2.69/html_node/Site-Defaults.html>

But I believe there are better ways to do this.

I haven't checked this in detail what happens with 'make install'.  We
should ensure that the plug-ins we ship (./src/plugins) which are built
are installed as well into this directory.


-- 
kind regards,

David Sommerseth
OpenVPN Technologies, Inc



[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [Openvpn-devel] [PATCH 1/1] Clean up plugin path handling
  2016-12-09 21:37         ` David Sommerseth
@ 2016-12-09 21:54           ` Christian Hesse
  2016-12-09 22:40             ` David Sommerseth
  0 siblings, 1 reply; 23+ messages in thread
From: Christian Hesse @ 2016-12-09 21:54 UTC (permalink / raw)
  To: David Sommerseth <openvpn@; +Cc: Christian Hesse <mail@

[-- Attachment #1: Type: text/plain, Size: 2482 bytes --]

David Sommerseth <openvpn@...2080...> on Fri, 2016/12/09 22:37:
> On 29/11/16 12:07, Christian Hesse wrote:
> > From: Christian Hesse <mail@...1798...>
> > 
> > Drop --with-plugindir, instead use an environment variable PLUGINDIR
> > to specify the plugin directory.
> > 
> > This always defines PLUGIN_LIBDIR and enables plugin search path.
> > 
> > Signed-off-by: Christian Hesse <mail@...1798...>
> > ---
> >  configure.ac            | 14 ++++++--------
> >  src/openvpn/Makefile.am |  3 ++-
> >  2 files changed, 8 insertions(+), 9 deletions(-)
> > 
> > diff --git a/configure.ac b/configure.ac
> > index f4073d0..5fe652e 100644
> > --- a/configure.ac
> > +++ b/configure.ac
> > @@ -301,13 +301,12 @@ AC_ARG_WITH(
> >  	[with_crypto_library="openssl"]
> >  )
> >  
> > -AC_ARG_WITH(
> > -	[plugindir],
> > -	[AS_HELP_STRING([--with-plugindir], [plugin directory
> > @<:@default=LIBDIR/openvpn@:>@])],
> > -	,
> > -	[with_plugindir="\$(libdir)/openvpn/plugins"]
> > -)
> > -
> > +AC_ARG_VAR([PLUGINDIR], [Path of plug-in directory
> > @<:@default=LIBDIR/openvpn/plugins@:>@]) +if test -n "${PLUGINDIR}"; then
> > +	plugindir="${PLUGINDIR}"
> > +else
> > +	plugindir="\${libdir}/openvpn/plugins"
> > +fi  
> 
> Finally had some time to dig into this one.  I like the idea here, I
> think it makes sense.  But I'm not sure ${libdir} is correct by default.
>  I think that should be /usr/local/lib64 by default on a 64bit system.
> 
> My google-foo isn't helpful for me today ... This is somewhat related,
> especially towards the end of this doc page:
> <https://www.gnu.org/software/autoconf/manual/autoconf-2.69/html_node/Site-Defaults.html>
> 
> But I believe there are better ways to do this.
> 
> I haven't checked this in detail what happens with 'make install'.  We
> should ensure that the plug-ins we ship (./src/plugins) which are built
> are installed as well into this directory.

${libdir} is where plugins are installed to... That's why I choose it. ;)

Installing anything to $prefix/lib64/ does not make sense imho. Never.

32bit systems install to $prefix/lib/, 64bit system install to $prefix/lib/.
The only valid extra is $prefix/lib32/ for multilib on 64bit systemd.
-- 
main(a){char*c=/*    Schoene Gruesse                         */"B?IJj;MEH"
"CX:;",b;for(a/*    Best regards             my address:    */=0;b=c[a++];)
putchar(b-1/(/*    Chris            cc -ox -xc - && ./x    */b/42*2-3)*42);}

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [Openvpn-devel] [PATCH 1/1] Clean up plugin path handling
  2016-12-09 21:54           ` Christian Hesse
@ 2016-12-09 22:40             ` David Sommerseth
  2016-12-09 23:30               ` Christian Hesse
  0 siblings, 1 reply; 23+ messages in thread
From: David Sommerseth @ 2016-12-09 22:40 UTC (permalink / raw)
  To: Christian Hesse <list@; +Cc: Christian Hesse <mail@


[-- Attachment #1.1: Type: text/plain, Size: 2773 bytes --]

On 09/12/16 22:54, Christian Hesse wrote:
> David Sommerseth <openvpn@...2080...> on Fri, 2016/12/09 22:37:
>> On 29/11/16 12:07, Christian Hesse wrote:
>>> From: Christian Hesse <mail@...1798...>
>>>
>>> Drop --with-plugindir, instead use an environment variable PLUGINDIR
>>> to specify the plugin directory.
>>>
>>> This always defines PLUGIN_LIBDIR and enables plugin search path.
>>>
>>> Signed-off-by: Christian Hesse <mail@...1798...>
>>> ---
>>>  configure.ac            | 14 ++++++--------
>>>  src/openvpn/Makefile.am |  3 ++-
>>>  2 files changed, 8 insertions(+), 9 deletions(-)
>>>
>>> diff --git a/configure.ac b/configure.ac
>>> index f4073d0..5fe652e 100644
>>> --- a/configure.ac
>>> +++ b/configure.ac
>>> @@ -301,13 +301,12 @@ AC_ARG_WITH(
>>>  	[with_crypto_library="openssl"]
>>>  )
>>>  
>>> -AC_ARG_WITH(
>>> -	[plugindir],
>>> -	[AS_HELP_STRING([--with-plugindir], [plugin directory
>>> @<:@default=LIBDIR/openvpn@:>@])],
>>> -	,
>>> -	[with_plugindir="\$(libdir)/openvpn/plugins"]
>>> -)
>>> -
>>> +AC_ARG_VAR([PLUGINDIR], [Path of plug-in directory
>>> @<:@default=LIBDIR/openvpn/plugins@:>@]) +if test -n "${PLUGINDIR}"; then
>>> +	plugindir="${PLUGINDIR}"
>>> +else
>>> +	plugindir="\${libdir}/openvpn/plugins"
>>> +fi  
>>
>> Finally had some time to dig into this one.  I like the idea here, I
>> think it makes sense.  But I'm not sure ${libdir} is correct by default.
>>  I think that should be /usr/local/lib64 by default on a 64bit system.
>>
>> My google-foo isn't helpful for me today ... This is somewhat related,
>> especially towards the end of this doc page:
>> <https://www.gnu.org/software/autoconf/manual/autoconf-2.69/html_node/Site-Defaults.html>
>>
>> But I believe there are better ways to do this.
>>
>> I haven't checked this in detail what happens with 'make install'.  We
>> should ensure that the plug-ins we ship (./src/plugins) which are built
>> are installed as well into this directory.
> 
> ${libdir} is where plugins are installed to... That's why I choose it. ;)
> 
> Installing anything to $prefix/lib64/ does not make sense imho. Never.

Well, that is the default for Fedora/RHEL families.  32bit systems uses
/usr/lib, 64bit uses /usr/lib64.

$ uname -m
x86_64
$ cat /etc/redhat-release
Red Hat Enterprise Linux Server release 7.3 (Maipo)
$ rpm --eval '%{_libdir}'
/usr/lib64

I've tested this on Fedora 24 and Scientific Linux 6 and 7 as well, with
the same result.

And you'll find the same in openSUSE too:
<https://en.opensuse.org/openSUSE:Packaging_Conventions_RPM_Macros#.25_lib>

Unless it has changed in Debian/Ubuntu, it is a similar policy there too.


-- 
kind regards,

David Sommerseth
OpenVPN Technologies, Inc



[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [Openvpn-devel] [PATCH 1/1] Clean up plugin path handling
  2016-12-09 22:40             ` David Sommerseth
@ 2016-12-09 23:30               ` Christian Hesse
  0 siblings, 0 replies; 23+ messages in thread
From: Christian Hesse @ 2016-12-09 23:30 UTC (permalink / raw)
  To: David Sommerseth <openvpn@; +Cc: Christian Hesse <mail@

[-- Attachment #1: Type: text/plain, Size: 3393 bytes --]

David Sommerseth <openvpn@...2080...> on Fri, 2016/12/09 23:40:
> On 09/12/16 22:54, Christian Hesse wrote:
> > David Sommerseth <openvpn@...2080...> on Fri, 2016/12/09
> > 22:37:  
> >> On 29/11/16 12:07, Christian Hesse wrote:  
> >>> From: Christian Hesse <mail@...1798...>
> >>>
> >>> Drop --with-plugindir, instead use an environment variable PLUGINDIR
> >>> to specify the plugin directory.
> >>>
> >>> This always defines PLUGIN_LIBDIR and enables plugin search path.
> >>>
> >>> Signed-off-by: Christian Hesse <mail@...1798...>
> >>> ---
> >>>  configure.ac            | 14 ++++++--------
> >>>  src/openvpn/Makefile.am |  3 ++-
> >>>  2 files changed, 8 insertions(+), 9 deletions(-)
> >>>
> >>> diff --git a/configure.ac b/configure.ac
> >>> index f4073d0..5fe652e 100644
> >>> --- a/configure.ac
> >>> +++ b/configure.ac
> >>> @@ -301,13 +301,12 @@ AC_ARG_WITH(
> >>>  	[with_crypto_library="openssl"]
> >>>  )
> >>>  
> >>> -AC_ARG_WITH(
> >>> -	[plugindir],
> >>> -	[AS_HELP_STRING([--with-plugindir], [plugin directory
> >>> @<:@default=LIBDIR/openvpn@:>@])],
> >>> -	,
> >>> -	[with_plugindir="\$(libdir)/openvpn/plugins"]
> >>> -)
> >>> -
> >>> +AC_ARG_VAR([PLUGINDIR], [Path of plug-in directory
> >>> @<:@default=LIBDIR/openvpn/plugins@:>@]) +if test -n "${PLUGINDIR}";
> >>> then
> >>> +	plugindir="${PLUGINDIR}"
> >>> +else
> >>> +	plugindir="\${libdir}/openvpn/plugins"
> >>> +fi    
> >>
> >> Finally had some time to dig into this one.  I like the idea here, I
> >> think it makes sense.  But I'm not sure ${libdir} is correct by default.
> >>  I think that should be /usr/local/lib64 by default on a 64bit system.
> >>
> >> My google-foo isn't helpful for me today ... This is somewhat related,
> >> especially towards the end of this doc page:
> >> <https://www.gnu.org/software/autoconf/manual/autoconf-2.69/html_node/Site-Defaults.html>
> >>
> >> But I believe there are better ways to do this.
> >>
> >> I haven't checked this in detail what happens with 'make install'.  We
> >> should ensure that the plug-ins we ship (./src/plugins) which are built
> >> are installed as well into this directory.  
> > 
> > ${libdir} is where plugins are installed to... That's why I choose it. ;)
> > 
> > Installing anything to $prefix/lib64/ does not make sense imho. Never.  
> 
> Well, that is the default for Fedora/RHEL families.  32bit systems uses
> /usr/lib, 64bit uses /usr/lib64.
> 
> $ uname -m
> x86_64
> $ cat /etc/redhat-release
> Red Hat Enterprise Linux Server release 7.3 (Maipo)
> $ rpm --eval '%{_libdir}'
> /usr/lib64
> 
> I've tested this on Fedora 24 and Scientific Linux 6 and 7 as well, with
> the same result.
> 
> And you'll find the same in openSUSE too:
> <https://en.opensuse.org/openSUSE:Packaging_Conventions_RPM_Macros#.25_lib>
> 
> Unless it has changed in Debian/Ubuntu, it is a similar policy there too.

Uh, interesting... Probably I did not look at these distributions for too
long... (And/or relied on the package manager.)

For Arch Linux we use /usr/lib/, though /usr/lib64/ is provided by a symlink
to lib nowadays.
-- 
main(a){char*c=/*    Schoene Gruesse                         */"B?IJj;MEH"
"CX:;",b;for(a/*    Best regards             my address:    */=0;b=c[a++];)
putchar(b-1/(/*    Chris            cc -ox -xc - && ./x    */b/42*2-3)*42);}

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 23+ messages in thread

* [Openvpn-devel] [PATCH v2 1/1] Clean up plugin path handling
  2016-11-29 11:07       ` [Openvpn-devel] [PATCH 1/1] Clean up plugin path handling Christian Hesse
  2016-11-29 13:47         ` Christian Hesse
  2016-12-09 21:37         ` David Sommerseth
@ 2016-12-27 22:24         ` Christian Hesse
  2017-01-25 16:04           ` [Openvpn-devel] [PATCH v3 " Christian Hesse
  2 siblings, 1 reply; 23+ messages in thread
From: Christian Hesse @ 2016-12-27 22:24 UTC (permalink / raw)
  To: OpenVPN Development; +Cc: Christian Hesse <mail@

From: Christian Hesse <mail@...1798...>

Drop --with-plugindir, instead use an environment variable PLUGINDIR
to specify the plugin directory.

This generates a header file src/openvpn/plugindir.h which contains a
define for the plugindir.

v2: The configure script can not evaluate the final $libdir path. So
    use make to create a header file on the containing the final path.

Signed-off-by: Christian Hesse <mail@...1798...>
---
 configure.ac               | 14 ++++++--------
 src/openvpn/.gitignore     |  1 +
 src/openvpn/Makefile.am    | 12 ++++++++++--
 src/openvpn/plugin.c       |  1 +
 src/openvpn/plugindir.h.in | 34 ++++++++++++++++++++++++++++++++++
 5 files changed, 52 insertions(+), 10 deletions(-)
 create mode 100644 src/openvpn/.gitignore
 create mode 100644 src/openvpn/plugindir.h.in

diff --git a/configure.ac b/configure.ac
index 43487b0..182ea21 100644
--- a/configure.ac
+++ b/configure.ac
@@ -301,13 +301,12 @@ AC_ARG_WITH(
 	[with_crypto_library="openssl"]
 )
 
-AC_ARG_WITH(
-	[plugindir],
-	[AS_HELP_STRING([--with-plugindir], [plugin directory @<:@default=LIBDIR/openvpn@:>@])],
-	,
-	[with_plugindir="\$(libdir)/openvpn/plugins"]
-)
-
+AC_ARG_VAR([PLUGINDIR], [Path of plug-in directory @<:@default=LIBDIR/openvpn/plugins@:>@])
+if test -n "${PLUGINDIR}"; then
+	plugindir="${PLUGINDIR}"
+else
+	plugindir="\${libdir}/openvpn/plugins"
+fi
 
 AC_DEFINE_UNQUOTED([TARGET_ALIAS], ["${host}"], [A string representing our host])
 case "$host" in
@@ -1245,7 +1244,6 @@ AM_CONDITIONAL([ENABLE_PLUGIN_AUTH_PAM], [test "${enable_plugin_auth_pam}" = "ye
 AM_CONDITIONAL([ENABLE_PLUGIN_DOWN_ROOT], [test "${enable_plugin_down_root}" = "yes"])
 AM_CONDITIONAL([ENABLE_CRYPTO], [test "${enable_crypto}" = "yes"])
 
-plugindir="${with_plugindir}"
 sampledir="\$(docdir)/sample"
 AC_SUBST([plugindir])
 AC_SUBST([sampledir])
diff --git a/src/openvpn/.gitignore b/src/openvpn/.gitignore
new file mode 100644
index 0000000..450575a
--- /dev/null
+++ b/src/openvpn/.gitignore
@@ -0,0 +1 @@
+plugindir.h
\ No newline at end of file
diff --git a/src/openvpn/Makefile.am b/src/openvpn/Makefile.am
index bea294b..11854b6 100644
--- a/src/openvpn/Makefile.am
+++ b/src/openvpn/Makefile.am
@@ -11,12 +11,19 @@
 
 include $(top_srcdir)/build/ltrc.inc
 
+plugindir.h: plugindir.h.in Makefile
+	$(AM_V_GEN)sed -e 's|\@PLUGINDIR\@|$(plugindir)|' \
+		$< > $@.tmp && mv $@.tmp $@
+
+plugin.c: plugindir.h
+
 MAINTAINERCLEANFILES = \
 	$(srcdir)/Makefile.in
 
 EXTRA_DIST = \
 	openvpn.vcxproj \
-	openvpn.vcxproj.filters
+	openvpn.vcxproj.filters \
+	plugindir.h.in
 
 AM_CPPFLAGS = \
 	-I$(top_srcdir)/include \
@@ -89,7 +96,7 @@ openvpn_SOURCES = \
 	perf.c perf.h \
 	pf.c pf.h pf-inline.h \
 	ping.c ping.h ping-inline.h \
-	plugin.c plugin.h \
+	plugin.c plugin.h plugindir.h \
 	pool.c pool.h \
 	proto.c proto.h \
 	proxy.c proxy.h \
@@ -131,3 +138,4 @@ if WIN32
 openvpn_SOURCES += openvpn_win32_resources.rc block_dns.c block_dns.h
 openvpn_LDADD += -lgdi32 -lws2_32 -lwininet -lcrypt32 -liphlpapi -lwinmm -lfwpuclnt -lrpcrt4
 endif
+
diff --git a/src/openvpn/plugin.c b/src/openvpn/plugin.c
index 17eb2d8..a891ef4 100644
--- a/src/openvpn/plugin.c
+++ b/src/openvpn/plugin.c
@@ -43,6 +43,7 @@
 #include "error.h"
 #include "misc.h"
 #include "plugin.h"
+#include "plugindir.h"
 #include "ssl_backend.h"
 #include "win32.h"
 #include "memdbg.h"
diff --git a/src/openvpn/plugindir.h.in b/src/openvpn/plugindir.h.in
new file mode 100644
index 0000000..6fa7b3e
--- /dev/null
+++ b/src/openvpn/plugindir.h.in
@@ -0,0 +1,34 @@
+/*
+ *  OpenVPN -- An application to securely tunnel IP networks
+ *             over a single TCP/UDP port, with support for SSL/TLS-based
+ *             session authentication and key exchange,
+ *             packet encryption, packet authentication, and
+ *             packet compression.
+ *
+ *  Copyright (C) 2017 OpenVPN Technologies, Inc. <sales@...515...>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License version 2
+ *  as published by the Free Software Foundation.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program (see the file COPYING included with this
+ *  distribution); if not, write to the Free Software Foundation, Inc.,
+ *  59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+/*
+ * define the plugin directory
+ */
+
+#ifndef OPENVPN_PLUGINDIR_H
+#define OPENVPN_PLUGINDIR_H
+
+#define PLUGIN_LIBDIR "@PLUGINDIR@"
+
+#endif /* OPENVPN_PLUGINDIR_H */
-- 
2.11.0



^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [Openvpn-devel] [PATCH v3 1/1] Clean up plugin path handling
  2016-12-27 22:24         ` [Openvpn-devel] [PATCH v2 " Christian Hesse
@ 2017-01-25 16:04           ` Christian Hesse
  2017-01-25 17:06             ` David Sommerseth
  0 siblings, 1 reply; 23+ messages in thread
From: Christian Hesse @ 2017-01-25 16:04 UTC (permalink / raw)
  To: OpenVPN Development; +Cc: Christian Hesse <mail@

From: Christian Hesse <mail@...1798...>

Drop --with-plugindir, instead use an environment variable PLUGINDIR
to specify the plugin directory.

This generates a header file src/openvpn/plugindir.h which contains a
define file the plugindir.

v2: The configure script can not evaluate the final $libdir path. So
    use make to create a header file on the containing the final path.

v3: Fix whitespace errors and gitignore location.

Signed-off-by: Christian Hesse <mail@...1798...>
---
 .gitignore                 |  1 +
 configure.ac               | 14 ++++++--------
 src/openvpn/Makefile.am    | 11 +++++++++--
 src/openvpn/plugin.c       |  1 +
 src/openvpn/plugindir.h.in | 34 ++++++++++++++++++++++++++++++++++
 5 files changed, 51 insertions(+), 10 deletions(-)
 create mode 100644 src/openvpn/plugindir.h.in

diff --git a/.gitignore b/.gitignore
index e6da21c..28df0f8 100644
--- a/.gitignore
+++ b/.gitignore
@@ -62,6 +62,7 @@ t_client_ips.rc
 tests/unit_tests/**/*_testdriver
 
 src/openvpn/openvpn
+src/openvpn/plugindir.h
 include/openvpn-plugin.h
 config-version.h
 nbproject
diff --git a/configure.ac b/configure.ac
index 8783109..f4c6bda 100644
--- a/configure.ac
+++ b/configure.ac
@@ -301,13 +301,12 @@ AC_ARG_WITH(
 	[with_crypto_library="openssl"]
 )
 
-AC_ARG_WITH(
-	[plugindir],
-	[AS_HELP_STRING([--with-plugindir], [plugin directory @<:@default=LIBDIR/openvpn@:>@])],
-	,
-	[with_plugindir="\$(libdir)/openvpn/plugins"]
-)
-
+AC_ARG_VAR([PLUGINDIR], [Path of plug-in directory @<:@default=LIBDIR/openvpn/plugins@:>@])
+if test -n "${PLUGINDIR}"; then
+	plugindir="${PLUGINDIR}"
+else
+	plugindir="\${libdir}/openvpn/plugins"
+fi
 
 AC_DEFINE_UNQUOTED([TARGET_ALIAS], ["${host}"], [A string representing our host])
 case "$host" in
@@ -1270,7 +1269,6 @@ AM_CONDITIONAL([ENABLE_PLUGIN_DOWN_ROOT], [test "${enable_plugin_down_root}" = "
 AM_CONDITIONAL([ENABLE_CRYPTO], [test "${enable_crypto}" = "yes"])
 AM_CONDITIONAL([HAVE_LD_WRAP_SUPPORT], [test "${have_ld_wrap_support}" = "yes"])
 
-plugindir="${with_plugindir}"
 sampledir="\$(docdir)/sample"
 AC_SUBST([plugindir])
 AC_SUBST([sampledir])
diff --git a/src/openvpn/Makefile.am b/src/openvpn/Makefile.am
index bea294b..53f4676 100644
--- a/src/openvpn/Makefile.am
+++ b/src/openvpn/Makefile.am
@@ -11,12 +11,19 @@
 
 include $(top_srcdir)/build/ltrc.inc
 
+plugindir.h: plugindir.h.in Makefile
+	$(AM_V_GEN)sed -e 's|\@PLUGINDIR\@|$(plugindir)|' \
+		$< > $@.tmp && mv $@.tmp $@
+
+plugin.c: plugindir.h
+
 MAINTAINERCLEANFILES = \
 	$(srcdir)/Makefile.in
 
 EXTRA_DIST = \
 	openvpn.vcxproj \
-	openvpn.vcxproj.filters
+	openvpn.vcxproj.filters \
+	plugindir.h.in
 
 AM_CPPFLAGS = \
 	-I$(top_srcdir)/include \
@@ -89,7 +96,7 @@ openvpn_SOURCES = \
 	perf.c perf.h \
 	pf.c pf.h pf-inline.h \
 	ping.c ping.h ping-inline.h \
-	plugin.c plugin.h \
+	plugin.c plugin.h plugindir.h \
 	pool.c pool.h \
 	proto.c proto.h \
 	proxy.c proxy.h \
diff --git a/src/openvpn/plugin.c b/src/openvpn/plugin.c
index e530c0c..5af6d1e 100644
--- a/src/openvpn/plugin.c
+++ b/src/openvpn/plugin.c
@@ -43,6 +43,7 @@
 #include "error.h"
 #include "misc.h"
 #include "plugin.h"
+#include "plugindir.h"
 #include "ssl_backend.h"
 #include "win32.h"
 #include "memdbg.h"
diff --git a/src/openvpn/plugindir.h.in b/src/openvpn/plugindir.h.in
new file mode 100644
index 0000000..6fa7b3e
--- /dev/null
+++ b/src/openvpn/plugindir.h.in
@@ -0,0 +1,34 @@
+/*
+ *  OpenVPN -- An application to securely tunnel IP networks
+ *             over a single TCP/UDP port, with support for SSL/TLS-based
+ *             session authentication and key exchange,
+ *             packet encryption, packet authentication, and
+ *             packet compression.
+ *
+ *  Copyright (C) 2017 OpenVPN Technologies, Inc. <sales@...515...>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License version 2
+ *  as published by the Free Software Foundation.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program (see the file COPYING included with this
+ *  distribution); if not, write to the Free Software Foundation, Inc.,
+ *  59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+/*
+ * define plugindir
+ */
+
+#ifndef OPENVPN_PLUGINDIR_H
+#define OPENVPN_PLUGINDIR_H
+
+#define PLUGIN_LIBDIR "@PLUGINDIR@"
+
+#endif /* OPENVPN_PLUGINDIR_H */
-- 
2.11.0



^ permalink raw reply related	[flat|nested] 23+ messages in thread

* Re: [Openvpn-devel] [PATCH v3 1/1] Clean up plugin path handling
  2017-01-25 16:04           ` [Openvpn-devel] [PATCH v3 " Christian Hesse
@ 2017-01-25 17:06             ` David Sommerseth
  2017-01-25 17:37               ` Gert Doering
  2017-01-25 18:57               ` Christian Hesse
  0 siblings, 2 replies; 23+ messages in thread
From: David Sommerseth @ 2017-01-25 17:06 UTC (permalink / raw)
  To: Christian Hesse <list@; +Cc: Christian Hesse <mail@


[-- Attachment #1.1: Type: text/plain, Size: 2073 bytes --]

On 25/01/17 17:04, Christian Hesse wrote:
> From: Christian Hesse <mail@...1798...>
> 
> Drop --with-plugindir, instead use an environment variable PLUGINDIR
> to specify the plugin directory.
> 
> This generates a header file src/openvpn/plugindir.h which contains a
> define file the plugindir.
> 
> v2: The configure script can not evaluate the final $libdir path. So
>     use make to create a header file on the containing the final path.
> 
> v3: Fix whitespace errors and gitignore location.
> 
> Signed-off-by: Christian Hesse <mail@...1798...>
> ---
>  .gitignore                 |  1 +
>  configure.ac               | 14 ++++++--------
>  src/openvpn/Makefile.am    | 11 +++++++++--
>  src/openvpn/plugin.c       |  1 +
>  src/openvpn/plugindir.h.in | 34 ++++++++++++++++++++++++++++++++++
>  5 files changed, 51 insertions(+), 10 deletions(-)
>  create mode 100644 src/openvpn/plugindir.h.in


Okay, some more feedback to this thread :)

As I've said, I think this makes sense.  It provides a predictable
plug-in directory which is easily accessible within the C code ... and
it will always be set.  So, Feature-ACK.

But I am wondering about the rationale of adding another header file
(plugindir.h).  Why not just add this information to
openvpn-plugin.h.in, which results into openvpn-plugin.h ... and which
plugin.c already includes via plugin.h ...  I actually think this path
can be quite useful for third-party plug-ins, being built outside of the
openvpn source tree.

Further, we should then also kick out the #ifdef PLUGIN_LIBDIR in
plugin_init_item() [plugin.c:237].  And we need to check what the
#if defined(ENABLE_PLUGIN_SEARCH) is all about ... I do not see any
possibilities to define the ENABLE_PLUGIN_SEARCH macro without changing
a .c/.h file.  Does this block even make sense to enable at all?

So, as this patch got "clean-up" and "plugin path handling" in the
subject, lets cover a few more aspects of this clean-up :)


-- 
kind regards,

David Sommerseth
OpenVPN Technologies, Inc



[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [Openvpn-devel] [PATCH v3 1/1] Clean up plugin path handling
  2017-01-25 17:06             ` David Sommerseth
@ 2017-01-25 17:37               ` Gert Doering
  2017-01-25 18:57               ` Christian Hesse
  1 sibling, 0 replies; 23+ messages in thread
From: Gert Doering @ 2017-01-25 17:37 UTC (permalink / raw)
  To: openvpn-devel; +Cc: Christian Hesse <mail@

[-- Attachment #1: Type: text/plain, Size: 736 bytes --]

Hi,

On Wed, Jan 25, 2017 at 06:06:19PM +0100, David Sommerseth wrote:
> But I am wondering about the rationale of adding another header file
> (plugindir.h).  Why not just add this information to
> openvpn-plugin.h.in, which results into openvpn-plugin.h ... and which
> plugin.c already includes via plugin.h ...  I actually think this path
> can be quite useful for third-party plug-ins, being built outside of the
> openvpn source tree.

+1

gert

-- 
USENET is *not* the non-clickable part of WWW!
                                                           //www.muc.de/~gert/
Gert Doering - Munich, Germany                             gert@...1296...
fax: +49-89-35655025                        gert@...1297...

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 630 bytes --]

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [Openvpn-devel] [PATCH v3 1/1] Clean up plugin path handling
  2017-01-25 17:06             ` David Sommerseth
  2017-01-25 17:37               ` Gert Doering
@ 2017-01-25 18:57               ` Christian Hesse
  2017-01-25 19:37                 ` [Openvpn-devel] [PATCH v4 " Christian Hesse
  1 sibling, 1 reply; 23+ messages in thread
From: Christian Hesse @ 2017-01-25 18:57 UTC (permalink / raw)
  To: David Sommerseth <openvpn@; +Cc: Christian Hesse <mail@

[-- Attachment #1: Type: text/plain, Size: 2008 bytes --]

David Sommerseth <openvpn@...2080...> on Wed, 2017/01/25 18:06:
> On 25/01/17 17:04, Christian Hesse wrote:
> > From: Christian Hesse <mail@...1798...>
> > 
> > Drop --with-plugindir, instead use an environment variable PLUGINDIR
> > to specify the plugin directory.
> > 
> > This generates a header file src/openvpn/plugindir.h which contains a
> > define file the plugindir.
> > 
> > v2: The configure script can not evaluate the final $libdir path. So
> >     use make to create a header file on the containing the final path.
> > 
> > v3: Fix whitespace errors and gitignore location.
> > 
> > Signed-off-by: Christian Hesse <mail@...1798...>
> > ---
> >  .gitignore                 |  1 +
> >  configure.ac               | 14 ++++++--------
> >  src/openvpn/Makefile.am    | 11 +++++++++--
> >  src/openvpn/plugin.c       |  1 +
> >  src/openvpn/plugindir.h.in | 34 ++++++++++++++++++++++++++++++++++
> >  5 files changed, 51 insertions(+), 10 deletions(-)
> >  create mode 100644 src/openvpn/plugindir.h.in  
> 
> 
> Okay, some more feedback to this thread :)
> 
> As I've said, I think this makes sense.  It provides a predictable
> plug-in directory which is easily accessible within the C code ... and
> it will always be set.  So, Feature-ACK.
> 
> But I am wondering about the rationale of adding another header file
> (plugindir.h).  Why not just add this information to
> openvpn-plugin.h.in, which results into openvpn-plugin.h ... and which
> plugin.c already includes via plugin.h ...  I actually think this path
> can be quite useful for third-party plug-ins, being built outside of the
> openvpn source tree.

I did not want to be too intrusive. ;) Happy to hear that... About to
prepare a new patch, stay tuned!
-- 
main(a){char*c=/*    Schoene Gruesse                         */"B?IJj;MEH"
"CX:;",b;for(a/*    Best regards             my address:    */=0;b=c[a++];)
putchar(b-1/(/*    Chris            cc -ox -xc - && ./x    */b/42*2-3)*42);}

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 23+ messages in thread

* [Openvpn-devel] [PATCH v4 1/1] Clean up plugin path handling
  2017-01-25 18:57               ` Christian Hesse
@ 2017-01-25 19:37                 ` Christian Hesse
  2017-01-25 20:19                   ` [Openvpn-devel] [PATCH v5 " Christian Hesse
  0 siblings, 1 reply; 23+ messages in thread
From: Christian Hesse @ 2017-01-25 19:37 UTC (permalink / raw)
  To: openvpn-devel; +Cc: Christian Hesse <mail@

From: Christian Hesse <mail@...1798...>

Drop --with-plugindir, instead use an environment variable PLUGINDIR
to specify the plugin directory.

This makes src/openvpn/plugin.h a template (moved the file to
src/openvpn/plugin.h.in). The real header file is generated on the fly,
including a define for the plugin path.
As the path is always available remove the compile time condition (and
dead code) from src/openvpn/plugin.c.

v2: The configure script can not evaluate the final $libdir path. So
    use make to create a header file on the containing the final path.

v3: Fix whitespace errors and gitignore location.

v4: No extra header file, generate src/openvpn/plugin.h on the fly.
    Remove condition and dead code.

Signed-off-by: Christian Hesse <mail@...1798...>
---
 .gitignore                            |  1 +
 configure.ac                          | 14 ++++++--------
 src/openvpn/Makefile.am               |  7 ++++++-
 src/openvpn/plugin.c                  | 10 +---------
 src/openvpn/{plugin.h => plugin.h.in} |  2 ++
 5 files changed, 16 insertions(+), 18 deletions(-)
 rename src/openvpn/{plugin.h => plugin.h.in} (99%)

diff --git a/.gitignore b/.gitignore
index 30e289b..780be68 100644
--- a/.gitignore
+++ b/.gitignore
@@ -63,6 +63,7 @@ t_client_ips.rc
 tests/unit_tests/**/*_testdriver
 
 src/openvpn/openvpn
+src/openvpn/plugin.h
 include/openvpn-plugin.h
 config-version.h
 nbproject
diff --git a/configure.ac b/configure.ac
index 79fb1ba..b29f8b4 100644
--- a/configure.ac
+++ b/configure.ac
@@ -301,13 +301,12 @@ AC_ARG_WITH(
 	[with_crypto_library="openssl"]
 )
 
-AC_ARG_WITH(
-	[plugindir],
-	[AS_HELP_STRING([--with-plugindir], [plugin directory @<:@default=LIBDIR/openvpn@:>@])],
-	,
-	[with_plugindir="\$(libdir)/openvpn/plugins"]
-)
-
+AC_ARG_VAR([PLUGINDIR], [Path of plug-in directory @<:@default=LIBDIR/openvpn/plugins@:>@])
+if test -n "${PLUGINDIR}"; then
+	plugindir="${PLUGINDIR}"
+else
+	plugindir="\${libdir}/openvpn/plugins"
+fi
 
 AC_DEFINE_UNQUOTED([TARGET_ALIAS], ["${host}"], [A string representing our host])
 case "$host" in
@@ -1284,7 +1283,6 @@ AM_CONDITIONAL([ENABLE_PLUGIN_DOWN_ROOT], [test "${enable_plugin_down_root}" = "
 AM_CONDITIONAL([ENABLE_CRYPTO], [test "${enable_crypto}" = "yes"])
 AM_CONDITIONAL([HAVE_LD_WRAP_SUPPORT], [test "${have_ld_wrap_support}" = "yes"])
 
-plugindir="${with_plugindir}"
 sampledir="\$(docdir)/sample"
 AC_SUBST([plugindir])
 AC_SUBST([sampledir])
diff --git a/src/openvpn/Makefile.am b/src/openvpn/Makefile.am
index bea294b..4f8a315 100644
--- a/src/openvpn/Makefile.am
+++ b/src/openvpn/Makefile.am
@@ -11,12 +11,17 @@
 
 include $(top_srcdir)/build/ltrc.inc
 
+plugin.h: plugin.h.in Makefile
+	$(AM_V_GEN)sed -e 's|\@PLUGINDIR\@|$(plugindir)|' \
+		$< > $@.tmp && mv $@.tmp $@
+
 MAINTAINERCLEANFILES = \
 	$(srcdir)/Makefile.in
 
 EXTRA_DIST = \
 	openvpn.vcxproj \
-	openvpn.vcxproj.filters
+	openvpn.vcxproj.filters \
+	plugin.h.in
 
 AM_CPPFLAGS = \
 	-I$(top_srcdir)/include \
diff --git a/src/openvpn/plugin.c b/src/openvpn/plugin.c
index e530c0c..f777027 100644
--- a/src/openvpn/plugin.c
+++ b/src/openvpn/plugin.c
@@ -234,23 +234,15 @@ plugin_init_item(struct plugin *p, const struct plugin_option *o)
 #ifndef _WIN32
 
     p->handle = NULL;
-#if defined(PLUGIN_LIBDIR)
+
     if (!absolute_pathname(p->so_pathname))
     {
         char full[PATH_MAX];
 
         openvpn_snprintf(full, sizeof(full), "%s/%s", PLUGIN_LIBDIR, p->so_pathname);
         p->handle = dlopen(full, RTLD_NOW);
-#if defined(ENABLE_PLUGIN_SEARCH)
-        if (!p->handle)
-        {
-            rel = true;
-            p->handle = dlopen(p->so_pathname, RTLD_NOW);
-        }
-#endif
     }
     else
-#endif
     {
         rel = !absolute_pathname(p->so_pathname);
         p->handle = dlopen(p->so_pathname, RTLD_NOW);
diff --git a/src/openvpn/plugin.h b/src/openvpn/plugin.h.in
similarity index 99%
rename from src/openvpn/plugin.h
rename to src/openvpn/plugin.h.in
index 4ded529..3d6e312 100644
--- a/src/openvpn/plugin.h
+++ b/src/openvpn/plugin.h.in
@@ -43,6 +43,8 @@
 
 #define MAX_PLUGINS 16
 
+#define PLUGIN_LIBDIR "@PLUGINDIR@"
+
 struct plugin_option {
     const char *so_pathname;
     const char **argv;
-- 
2.11.0



^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [Openvpn-devel] [PATCH v5 1/1] Clean up plugin path handling
  2017-01-25 19:37                 ` [Openvpn-devel] [PATCH v4 " Christian Hesse
@ 2017-01-25 20:19                   ` Christian Hesse
  2017-01-25 21:16                     ` [Openvpn-devel] [PATCH applied] " David Sommerseth
  0 siblings, 1 reply; 23+ messages in thread
From: Christian Hesse @ 2017-01-25 20:19 UTC (permalink / raw)
  To: openvpn-devel; +Cc: Christian Hesse <mail@

From: Christian Hesse <mail@...1798...>

Drop --with-plugindir, instead use an environment variable PLUGINDIR
to specify the plugin directory.

This puts a define into include/openvpn-plugin.h.in which has the plugin
directory.
The configure script does not know about the final plugin path. Thus we
have to make make generate the final header file for us.

As the path is always available remove the compile time condition (and
dead code) from src/openvpn/plugin.c.

v2: The configure script can not evaluate the final $libdir path. So
    use make to create a header file on the containing the final path.

v3: Fix whitespace errors and gitignore location.

v4: No extra header file, generate src/openvpn/plugin.h on the fly.
    Remove condition and dead code.

v5: Move the define to include/openvpn-plugin.h.in and let make generate
    the final header file.

Signed-off-by: Christian Hesse <mail@...1798...>
---
 configure.ac                | 16 +++++++---------
 include/Makefile.am         |  7 +++++++
 include/openvpn-plugin.h.in |  2 ++
 src/openvpn/plugin.c        | 10 +---------
 4 files changed, 17 insertions(+), 18 deletions(-)

diff --git a/configure.ac b/configure.ac
index 79fb1ba..f305c54 100644
--- a/configure.ac
+++ b/configure.ac
@@ -38,7 +38,7 @@ AC_DEFINE([OPENVPN_VERSION_MINOR], [PRODUCT_VERSION_MINOR], [OpenVPN minor versi
 AC_DEFINE([OPENVPN_VERSION_PATCH], ["PRODUCT_VERSION_PATCH"], [OpenVPN patch level - may be a string or integer])
 
 AC_CONFIG_AUX_DIR([.])
-AC_CONFIG_HEADERS([config.h include/openvpn-plugin.h])
+AC_CONFIG_HEADERS([config.h])
 AC_CONFIG_SRCDIR([src/openvpn/syshead.h])
 AC_CONFIG_MACRO_DIR([m4])
 
@@ -301,13 +301,12 @@ AC_ARG_WITH(
 	[with_crypto_library="openssl"]
 )
 
-AC_ARG_WITH(
-	[plugindir],
-	[AS_HELP_STRING([--with-plugindir], [plugin directory @<:@default=LIBDIR/openvpn@:>@])],
-	,
-	[with_plugindir="\$(libdir)/openvpn/plugins"]
-)
-
+AC_ARG_VAR([PLUGINDIR], [Path of plug-in directory @<:@default=LIBDIR/openvpn/plugins@:>@])
+if test -n "${PLUGINDIR}"; then
+	plugindir="${PLUGINDIR}"
+else
+	plugindir="\${libdir}/openvpn/plugins"
+fi
 
 AC_DEFINE_UNQUOTED([TARGET_ALIAS], ["${host}"], [A string representing our host])
 case "$host" in
@@ -1284,7 +1283,6 @@ AM_CONDITIONAL([ENABLE_PLUGIN_DOWN_ROOT], [test "${enable_plugin_down_root}" = "
 AM_CONDITIONAL([ENABLE_CRYPTO], [test "${enable_crypto}" = "yes"])
 AM_CONDITIONAL([HAVE_LD_WRAP_SUPPORT], [test "${have_ld_wrap_support}" = "yes"])
 
-plugindir="${with_plugindir}"
 sampledir="\$(docdir)/sample"
 AC_SUBST([plugindir])
 AC_SUBST([sampledir])
diff --git a/include/Makefile.am b/include/Makefile.am
index a52c427..37962a6 100644
--- a/include/Makefile.am
+++ b/include/Makefile.am
@@ -16,3 +16,10 @@ MAINTAINERCLEANFILES = \
 include_HEADERS = \
 	openvpn-plugin.h \
 	openvpn-msg.h
+
+openvpn-plugin.h: openvpn-plugin.h.in Makefile
+	$(AM_V_GEN)sed -e 's|\@PLUGINDIR\@|$(plugindir)|' \
+		-e 's|\@OPENVPN_VERSION_MAJOR\@|$(OPENVPN_VERSION_MAJOR)|' \
+		-e 's|\@OPENVPN_VERSION_MINOR\@|$(OPENVPN_VERSION_MINOR)|' \
+		-e 's|\@OPENVPN_VERSION_PATCH\@|$(OPENVPN_VERSION_PATCH)|' \
+               $< > $@.tmp && mv $@.tmp $@
diff --git a/include/openvpn-plugin.h.in b/include/openvpn-plugin.h.in
index 0b30352..a084fc1 100644
--- a/include/openvpn-plugin.h.in
+++ b/include/openvpn-plugin.h.in
@@ -27,6 +27,8 @@
 
 #define OPENVPN_PLUGIN_VERSION 3
 
+#define PLUGIN_LIBDIR "@PLUGINDIR@"
+
 #ifdef ENABLE_CRYPTO
 #ifdef ENABLE_CRYPTO_MBEDTLS
 #include <mbedtls/x509_crt.h>
diff --git a/src/openvpn/plugin.c b/src/openvpn/plugin.c
index e530c0c..f777027 100644
--- a/src/openvpn/plugin.c
+++ b/src/openvpn/plugin.c
@@ -234,23 +234,15 @@ plugin_init_item(struct plugin *p, const struct plugin_option *o)
 #ifndef _WIN32
 
     p->handle = NULL;
-#if defined(PLUGIN_LIBDIR)
+
     if (!absolute_pathname(p->so_pathname))
     {
         char full[PATH_MAX];
 
         openvpn_snprintf(full, sizeof(full), "%s/%s", PLUGIN_LIBDIR, p->so_pathname);
         p->handle = dlopen(full, RTLD_NOW);
-#if defined(ENABLE_PLUGIN_SEARCH)
-        if (!p->handle)
-        {
-            rel = true;
-            p->handle = dlopen(p->so_pathname, RTLD_NOW);
-        }
-#endif
     }
     else
-#endif
     {
         rel = !absolute_pathname(p->so_pathname);
         p->handle = dlopen(p->so_pathname, RTLD_NOW);
-- 
2.11.0



^ permalink raw reply related	[flat|nested] 23+ messages in thread

* Re: [Openvpn-devel] [PATCH applied] Clean up plugin path handling
  2017-01-25 20:19                   ` [Openvpn-devel] [PATCH v5 " Christian Hesse
@ 2017-01-25 21:16                     ` David Sommerseth
  2017-01-26  8:05                       ` Gert Doering
  0 siblings, 1 reply; 23+ messages in thread
From: David Sommerseth @ 2017-01-25 21:16 UTC (permalink / raw)
  To: mail@; +Cc: openvpn-devel

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

ACK.  This have been through enough rounds, and I currently don't
see a better approach to the openvpn-plugin.h generation either.  If
we find better ways later on, lets fix it then.

I've tested this using gdb and investigating which code paths are
used in different circumstances (--plugin with and without absolute path)
and the expected plug-ins are loaded.

Your patch has been applied to the following branches

commit 4590c3831d0400096fab08aa1ed7f909da870ced  (master)
commit 05baa0ecf841852fbf29ef39ee9cd1d4cac990cf  (release/2.4)
Author: Christian Hesse
Date:   Wed Jan 25 21:19:47 2017 +0100

     Clean up plugin path handling

     Signed-off-by: Christian Hesse <mail@...1798...>
     Acked-by: David Sommerseth <davids@...515...>
     Message-Id: <20170125201947.17197-1-list@...1798...>
     URL: http://www.mail-archive.com/search?l=mid&q=20170125201947.17197-1-list@...1798...
     Signed-off-by: David Sommerseth <davids@...515...>


- --
kind regards,

David Sommerseth

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.22 (GNU/Linux)

iQIcBAEBAgAGBQJYiRWlAAoJEIbPlEyWcf3yQGEP/269/VKw/dW5KU/XrLIfwgT+
N5qzzKvalVnvlb8ki2GE4YaMp0dfjElup28iQi7wCbmAfHYiX9inc0KtQK7ggMHQ
6EMzgRnJla0mTVyKnFecSCVNFuDERcLc1a+K/Qq4JeiRUK3eyHbKZCA766xd3C+G
/7x2SMPdXAqpAexuxO74Nz+GWuu7KLBY+F3LHYHAC4GiTHtd84pi2GpDveaod4K2
ttRqvnnZRn5JiuVl89To20faU1iw9RHvqFqZMOZfEq4fkRTK+0tJiMhJ5NcH1khm
OiS/4x/HQtL79GqjrUkOCr3vyjoMRWd13Lz49eK6U4GFlcsivH09IL8toHfcdMjX
DimgaYNHNo0+rxHOV53Jp6ADd97E93580Xe1drk6CUo7Sf0f4C25dtFzQJm67pkV
L/45suNEL6jq2UvqCj/KR9AnawEVaGkhI9ikEkEJsDFgxi2fXWthuhe8SOXNugPA
j+lyViB9vmTb2OVukEJKartAYBiOKd7dcTUUoE3U/XvEbNKMS7IsBMIDTinTUOlt
la9Vu7DucKGXOeEIhbHHYuNV6Mff1eWNr8l7bx42mE1hSDHba5DwF0r0x2oTDZyn
esew8w+R/ALVqeXCMx5bzwtdBngqAY0W90ePeuK2FyNFRsy83lZYbS6DVhmkXplQ
OpS/rxQtFMDJI09cT+wz
=KBA6
-----END PGP SIGNATURE-----


^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [Openvpn-devel] [PATCH applied] Clean up plugin path handling
  2017-01-25 21:16                     ` [Openvpn-devel] [PATCH applied] " David Sommerseth
@ 2017-01-26  8:05                       ` Gert Doering
  2017-01-27  8:49                         ` [Openvpn-devel] [PATCH 1/1] remove GNUism and fix out-of-tree build Christian Hesse
  0 siblings, 1 reply; 23+ messages in thread
From: Gert Doering @ 2017-01-26  8:05 UTC (permalink / raw)
  To: David Sommerseth <davids@; +Cc: mail@

[-- Attachment #1: Type: text/plain, Size: 1262 bytes --]

Hi,

On Wed, Jan 25, 2017 at 10:16:23PM +0100, David Sommerseth wrote:
> ACK.  This have been through enough rounds, and I currently don't
> see a better approach to the openvpn-plugin.h generation either.  If
> we find better ways later on, lets fix it then.

This needs a bit of polishing... as you've undoubtly already seen,
this change broke building on everything that is not Linux or MacOS...

Since we'll see this more often if developers cannot test on "other
platforms", I'm happy to offer accounts on my FreeBSD 10.3 buildslave
to regular contributors that want to test their patches on at least
one BSD system to ensure there is no hidden bashism or GNU Make-ism
(which seems to be the problem here).

Thinking of you and Christian here :-) - so if interested, please mail me 
a ssh pubkey and a static source IPv4/IPv6 network so I can create an 
account and open the ACLs (the buildslaves have fairly restricted network 
access and reachability).

gert


-- 
USENET is *not* the non-clickable part of WWW!
                                                           //www.muc.de/~gert/
Gert Doering - Munich, Germany                             gert@...1296...
fax: +49-89-35655025                        gert@...1297...

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 630 bytes --]

^ permalink raw reply	[flat|nested] 23+ messages in thread

* [Openvpn-devel] [PATCH 1/1] remove GNUism and fix out-of-tree build
  2017-01-26  8:05                       ` Gert Doering
@ 2017-01-27  8:49                         ` Christian Hesse
  2017-01-27  9:55                           ` Gert Doering
  2017-01-27 14:50                           ` [Openvpn-devel] [PATCH applied] plugin: Remove GNUism in openvpn-plugin.h generation David Sommerseth
  0 siblings, 2 replies; 23+ messages in thread
From: Christian Hesse @ 2017-01-27  8:49 UTC (permalink / raw)
  To: openvpn-devel; +Cc: Christian Hesse <mail@

From: Christian Hesse <mail@...1798...>

The plugin path handling cleanup (4590c383) introduced GNUism and broke
out-of-tree builds.

Revert back to let configure generate the header file. Instead let make
add an extra CFLAG that defines PLUGIN_LIBDIR.

Signed-off-by: Christian Hesse <mail@...1798...>
---
 configure.ac                | 2 +-
 include/Makefile.am         | 7 -------
 include/openvpn-plugin.h.in | 2 --
 src/openvpn/Makefile.am     | 4 +++-
 4 files changed, 4 insertions(+), 11 deletions(-)

diff --git a/configure.ac b/configure.ac
index f305c54..b29f8b4 100644
--- a/configure.ac
+++ b/configure.ac
@@ -38,7 +38,7 @@ AC_DEFINE([OPENVPN_VERSION_MINOR], [PRODUCT_VERSION_MINOR], [OpenVPN minor versi
 AC_DEFINE([OPENVPN_VERSION_PATCH], ["PRODUCT_VERSION_PATCH"], [OpenVPN patch level - may be a string or integer])
 
 AC_CONFIG_AUX_DIR([.])
-AC_CONFIG_HEADERS([config.h])
+AC_CONFIG_HEADERS([config.h include/openvpn-plugin.h])
 AC_CONFIG_SRCDIR([src/openvpn/syshead.h])
 AC_CONFIG_MACRO_DIR([m4])
 
diff --git a/include/Makefile.am b/include/Makefile.am
index 37962a6..a52c427 100644
--- a/include/Makefile.am
+++ b/include/Makefile.am
@@ -16,10 +16,3 @@ MAINTAINERCLEANFILES = \
 include_HEADERS = \
 	openvpn-plugin.h \
 	openvpn-msg.h
-
-openvpn-plugin.h: openvpn-plugin.h.in Makefile
-	$(AM_V_GEN)sed -e 's|\@PLUGINDIR\@|$(plugindir)|' \
-		-e 's|\@OPENVPN_VERSION_MAJOR\@|$(OPENVPN_VERSION_MAJOR)|' \
-		-e 's|\@OPENVPN_VERSION_MINOR\@|$(OPENVPN_VERSION_MINOR)|' \
-		-e 's|\@OPENVPN_VERSION_PATCH\@|$(OPENVPN_VERSION_PATCH)|' \
-               $< > $@.tmp && mv $@.tmp $@
diff --git a/include/openvpn-plugin.h.in b/include/openvpn-plugin.h.in
index a084fc1..0b30352 100644
--- a/include/openvpn-plugin.h.in
+++ b/include/openvpn-plugin.h.in
@@ -27,8 +27,6 @@
 
 #define OPENVPN_PLUGIN_VERSION 3
 
-#define PLUGIN_LIBDIR "@PLUGINDIR@"
-
 #ifdef ENABLE_CRYPTO
 #ifdef ENABLE_CRYPTO_MBEDTLS
 #include <mbedtls/x509_crt.h>
diff --git a/src/openvpn/Makefile.am b/src/openvpn/Makefile.am
index bea294b..3f97855 100644
--- a/src/openvpn/Makefile.am
+++ b/src/openvpn/Makefile.am
@@ -27,7 +27,9 @@ AM_CFLAGS = \
 	$(OPTIONAL_CRYPTO_CFLAGS) \
 	$(OPTIONAL_LZO_CFLAGS) \
 	$(OPTIONAL_LZ4_CFLAGS) \
-	$(OPTIONAL_PKCS11_HELPER_CFLAGS)
+	$(OPTIONAL_PKCS11_HELPER_CFLAGS) \
+	-DPLUGIN_LIBDIR=\"${plugindir}\"
+
 if WIN32
 # we want unicode entry point but not the macro
 AM_CFLAGS += -municode -UUNICODE
-- 
2.11.0



^ permalink raw reply related	[flat|nested] 23+ messages in thread

* Re: [Openvpn-devel] [PATCH 1/1] remove GNUism and fix out-of-tree build
  2017-01-27  8:49                         ` [Openvpn-devel] [PATCH 1/1] remove GNUism and fix out-of-tree build Christian Hesse
@ 2017-01-27  9:55                           ` Gert Doering
  2017-01-27 14:50                           ` [Openvpn-devel] [PATCH applied] plugin: Remove GNUism in openvpn-plugin.h generation David Sommerseth
  1 sibling, 0 replies; 23+ messages in thread
From: Gert Doering @ 2017-01-27  9:55 UTC (permalink / raw)
  To: Christian Hesse <list@; +Cc: openvpn-devel, Christian Hesse <mail@

[-- Attachment #1: Type: text/plain, Size: 1030 bytes --]

Hi,

On Fri, Jan 27, 2017 at 09:49:27AM +0100, Christian Hesse wrote:
> From: Christian Hesse <mail@...1798...>
> 
> The plugin path handling cleanup (4590c383) introduced GNUism and broke
> out-of-tree builds.
> 
> Revert back to let configure generate the header file. Instead let make
> add an extra CFLAG that defines PLUGIN_LIBDIR.
> 
> Signed-off-by: Christian Hesse <mail@...1798...>

ACK.  Gets the job done and fixes the fallout :-)

Tested on FreeBSD 10.3, OpenBSD 6.0 and OpenSolaris 11 - so I blatantly
assume it will also work on all the rest of the zoo.

For a v7 of this... we might consider whether to print out the plugin
search path at "--help" or "--version" time (we already print the whole
autoconf sermon)...

gert
-- 
USENET is *not* the non-clickable part of WWW!
                                                           //www.muc.de/~gert/
Gert Doering - Munich, Germany                             gert@...1296...
fax: +49-89-35655025                        gert@...1297...

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 630 bytes --]

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [Openvpn-devel] [PATCH applied] plugin: Remove GNUism in openvpn-plugin.h generation
  2017-01-27  8:49                         ` [Openvpn-devel] [PATCH 1/1] remove GNUism and fix out-of-tree build Christian Hesse
  2017-01-27  9:55                           ` Gert Doering
@ 2017-01-27 14:50                           ` David Sommerseth
  1 sibling, 0 replies; 23+ messages in thread
From: David Sommerseth @ 2017-01-27 14:50 UTC (permalink / raw)
  To: mail@; +Cc: openvpn-devel

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1


I reworded the commit message slightly, as this isn't strictly
bound to out-of-tree builds (which the original commit message
stated), but related to GNU extensions in the Makefile which fails
on non-GNU Make.

Your patch has been applied to the following branches

commit 631812fe29c69d0034628ab8321cb4016cb4fc2d  (master)
commit cb17255b1f7600b3255d1e018cfc426b40da4044  (release/2.4)
Author: Christian Hesse
Date:   Fri Jan 27 09:49:27 2017 +0100

     plugin: Remove GNUism in openvpn-plugin.h generation

     Signed-off-by: Christian Hesse <mail@...1798...>
     Acked-by: Gert Doering <gert@...1296...>
     Message-Id: <20170127084927.21040-1-list@...1798...>
     URL: http://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg13966.html
     Signed-off-by: David Sommerseth <davids@...515...>


- --
kind regards,

David Sommerseth

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.22 (GNU/Linux)

iQIcBAEBAgAGBQJYi14UAAoJEIbPlEyWcf3y/ccP/j6RXkfFqxHC6aG19WyVPu9g
91N9RvrVFfDQZ6QULWkLzL98At+x35P+iOjs6qQRKWmnKv+U4LGjJbdS+t1AzABM
Yhbovsa+0jcs+SfE1Du8asODt/5222aNtqjRO04edq3BBNoMi4u3AnxJ2ExyGXGF
QCQ/ZpWaRu9eBCUZU3/9Cf9G8aMTg2xKGlswdvkUjvyEkj5x+YwVCM+htFYshEWD
JFIVeVPfgBh60Sv6kpBP8C+2LrdMsY/n7s3EoCH+riwDO/J5ZrfNmUFrWRZ86V7M
EomUn8DF2FOVKBfu59O2Ka4X9oLlHdik+YGjCbnRiSTIT1eezdUXgIzUpwBwg7eb
klwPtkeDnNR0XUeuyqaXxC1THuQHi7qJQTcdbKTBBuabtIoAfBT3H2COC8dJOmMU
MY1Ih5uf8K/kfG9AZMxfFr3IEt+yo/c+iEIg9sHZwfQNXDXnRH3zyyPApe1H5Sgi
9ubh7lK9+5gv+DJY8XNKS42xZYiVaHFb820dh8MMkhJ/j1Vzgcst7HiKo24ntxsa
/nx0fyArFa5anYy3hoD36iOmDiZwnC0J1SkzgXqLCpXnO19kP96GBymFBHXrGF59
SrZOllkAeoldrsvp94ArLdMFQe4NSUS+KrPo+ACqAISxndNPUaQsHSSjYmptermN
JnNGw9dRuxhuU83DwPko
=/dLr
-----END PGP SIGNATURE-----


^ permalink raw reply	[flat|nested] 23+ messages in thread

end of thread, other threads:[~2017-01-27 14:50 UTC | newest]

Thread overview: 23+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-11-28 16:16 [Openvpn-devel] [PATCH 1/2] show correct default for plugin dir in configure help Christian Hesse
2016-11-28 16:16 ` [Openvpn-devel] [PATCH 2/2] allow to enable plugin lookup with configure argument Christian Hesse
2016-11-28 23:47   ` David Sommerseth
2016-11-29 11:05     ` Christian Hesse
2016-11-29 11:07       ` [Openvpn-devel] [PATCH 1/1] Clean up plugin path handling Christian Hesse
2016-11-29 13:47         ` Christian Hesse
2016-12-09 21:37         ` David Sommerseth
2016-12-09 21:54           ` Christian Hesse
2016-12-09 22:40             ` David Sommerseth
2016-12-09 23:30               ` Christian Hesse
2016-12-27 22:24         ` [Openvpn-devel] [PATCH v2 " Christian Hesse
2017-01-25 16:04           ` [Openvpn-devel] [PATCH v3 " Christian Hesse
2017-01-25 17:06             ` David Sommerseth
2017-01-25 17:37               ` Gert Doering
2017-01-25 18:57               ` Christian Hesse
2017-01-25 19:37                 ` [Openvpn-devel] [PATCH v4 " Christian Hesse
2017-01-25 20:19                   ` [Openvpn-devel] [PATCH v5 " Christian Hesse
2017-01-25 21:16                     ` [Openvpn-devel] [PATCH applied] " David Sommerseth
2017-01-26  8:05                       ` Gert Doering
2017-01-27  8:49                         ` [Openvpn-devel] [PATCH 1/1] remove GNUism and fix out-of-tree build Christian Hesse
2017-01-27  9:55                           ` Gert Doering
2017-01-27 14:50                           ` [Openvpn-devel] [PATCH applied] plugin: Remove GNUism in openvpn-plugin.h generation David Sommerseth
2016-11-28 23:56 ` [Openvpn-devel] [PATCH 1/2] show correct default for plugin dir in configure help David Sommerseth

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.