openvpn/sample/sample-plugins/Makefile.plugins
Gert Doering 94cebf8261 Add demo plugin that excercises "CLIENT_CONNECT" and "CLIENT_CONNECT_V2" paths
This is a new "samples" plugin which does not do many useful things,
besides
 - show how a plugin is programmed
 - how the various messages get dispatched
 - how to pass back information from a client-connect/v2 plugin
 - how to do async-cc plugins  [not yet implemented]

the operation of the plugin is controlled by UV_WANT_* environment
variables
controlled by the client ("--setenv UV_WANT_CC_FAIL 1 --push-peer-info"),
to "fail CLIENT_CONNECT" or "use async-cc for CLIENT_CONNECT_V2" or
"send 'disable' back from ...") - which is useful for automated testing
of server success/defer/fail code paths for the CLIENT_CONNECT_* functions.

See samples/sample-plugins/client-connect/README for details how to do
this.

v2:
  - implement async / deferred operation both for CLIENT_CONNECT and
    CLIENT_CONNECT_V2 plugin calls
  - implement returning openvpn-controlled (setenv) config snippets
    (so the client side can verify in automated testing that the plugin
    operated correctly, without hard-coding something in the plugin code)

v3:
  - remove -Wno-unused-variable from Makefile
  - remove unused "char ** argv" (commented out, but kept as reference)

v4:
  - upgrade to use the build infra brought by commit 0b5141d8f9
  - remove local Makefile
  - include "config.h" to get what is needed to get rid of the strdup()
    warning
Acked-by: David Sommerseth <davids@openvpn.net>
Message-Id: <20200917161909.11573-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg21047.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
2020-09-18 07:54:10 +02:00

37 lines
977 B
Makefile

# SPDX-License-Identifier: GPL-2.0-only
#
# Copyright (C) 2020 OpenVPN Inc <sales@openvpn.net>
#
#
# Plug-ins to build - listed entries should not carry any extensions
#
PLUGINS = \
defer/simple \
keying-material-exporter-demo/keyingmaterialexporter \
log/log log/log_v3 \
simple/base64 \
simple/simple \
client-connect/sample-client-connect
# All the plugins to build - rewritten with .so extension
all : $(foreach var, $(PLUGINS), $(var).so)
# Do not automatically remove object files
# This is a special Make setting, to avoid adding an implicit
# 'rm' command on object files - due to the .c.o/%.so rules below
.PRECIOUS: %.o
# Compile step
.c.o :
test -d `dirname $@` || $(MKDIR_P) `dirname $@`; \
$(CC) -c -o $@ $(CFLAGS) $(AM_CPPFLAGS) -fPIC $<
# Link step
%.so : %.o
$(CC) $(LDFLAGS) -shared -fPIC -o $@ $<
# Clean up all build object and shared object files
clean :
rm -f $(foreach var, $(PLUGINS), $(var).o) \
$(foreach var, $(PLUGINS), $(var).so)