kernel-iph: Add a stub for a Windows IP Helper based networking backend
This commit is contained in:
parent
b934929804
commit
00780f0238
|
@ -204,6 +204,7 @@ ARG_ENABL_SET([kernel-pfkey], [enable the PF_KEY kernel interface.])
|
|||
ARG_ENABL_SET([kernel-pfroute], [enable the PF_ROUTE kernel interface.])
|
||||
ARG_ENABL_SET([kernel-klips], [enable the KLIPS kernel interface.])
|
||||
ARG_ENABL_SET([kernel-libipsec],[enable the libipsec kernel interface.])
|
||||
ARG_ENABL_SET([kernel-iph], [enable the Windows IP Helper based networking backend.])
|
||||
ARG_ENABL_SET([kernel-wfp], [enable the Windows Filtering Platform IPsec backend.])
|
||||
ARG_DISBL_SET([socket-default], [disable default socket implementation for charon.])
|
||||
ARG_ENABL_SET([socket-dynamic], [enable dynamic socket implementation for charon])
|
||||
|
@ -1211,6 +1212,7 @@ ADD_PLUGIN([attr-sql], [h charon])
|
|||
ADD_PLUGIN([load-tester], [c charon])
|
||||
ADD_PLUGIN([kernel-libipsec], [c charon cmd])
|
||||
ADD_PLUGIN([kernel-wfp], [c charon])
|
||||
ADD_PLUGIN([kernel-iph], [c charon])
|
||||
ADD_PLUGIN([kernel-pfkey], [h charon starter nm cmd])
|
||||
ADD_PLUGIN([kernel-pfroute], [h charon starter nm cmd])
|
||||
ADD_PLUGIN([kernel-klips], [h charon starter])
|
||||
|
@ -1371,6 +1373,7 @@ AM_CONDITIONAL(USE_LOAD_TESTER, test x$load_tester = xtrue)
|
|||
AM_CONDITIONAL(USE_HA, test x$ha = xtrue)
|
||||
AM_CONDITIONAL(USE_KERNEL_LIBIPSEC, test x$kernel_libipsec = xtrue)
|
||||
AM_CONDITIONAL(USE_KERNEL_WFP, test x$kernel_wfp = xtrue)
|
||||
AM_CONDITIONAL(USE_KERNEL_IPH, test x$kernel_iph = xtrue)
|
||||
AM_CONDITIONAL(USE_WHITELIST, test x$whitelist = xtrue)
|
||||
AM_CONDITIONAL(USE_LOOKIP, test x$lookip = xtrue)
|
||||
AM_CONDITIONAL(USE_ERROR_NOTIFY, test x$error_notify = xtrue)
|
||||
|
@ -1666,6 +1669,7 @@ AC_CONFIG_FILES([
|
|||
src/libcharon/plugins/ha/Makefile
|
||||
src/libcharon/plugins/kernel_libipsec/Makefile
|
||||
src/libcharon/plugins/kernel_wfp/Makefile
|
||||
src/libcharon/plugins/kernel_iph/Makefile
|
||||
src/libcharon/plugins/whitelist/Makefile
|
||||
src/libcharon/plugins/lookip/Makefile
|
||||
src/libcharon/plugins/error_notify/Makefile
|
||||
|
|
|
@ -496,6 +496,13 @@ if MONOLITHIC
|
|||
endif
|
||||
endif
|
||||
|
||||
if USE_KERNEL_IPH
|
||||
SUBDIRS += plugins/kernel_iph
|
||||
if MONOLITHIC
|
||||
libcharon_la_LIBADD += plugins/kernel_iph/libstrongswan-kernel-iph.la
|
||||
endif
|
||||
endif
|
||||
|
||||
if USE_WHITELIST
|
||||
SUBDIRS += plugins/whitelist
|
||||
if MONOLITHIC
|
||||
|
|
|
@ -0,0 +1,20 @@
|
|||
AM_CPPFLAGS = \
|
||||
-I$(top_srcdir)/src/libstrongswan \
|
||||
-I$(top_srcdir)/src/libhydra \
|
||||
-I$(top_srcdir)/src/libcharon
|
||||
|
||||
AM_CFLAGS = \
|
||||
$(PLUGIN_CFLAGS)
|
||||
|
||||
if MONOLITHIC
|
||||
noinst_LTLIBRARIES = libstrongswan-kernel-iph.la
|
||||
else
|
||||
plugin_LTLIBRARIES = libstrongswan-kernel-iph.la
|
||||
endif
|
||||
|
||||
libstrongswan_kernel_iph_la_SOURCES = \
|
||||
kernel_iph_plugin.h kernel_iph_plugin.c \
|
||||
kernel_iph_net.h kernel_iph_net.c
|
||||
|
||||
libstrongswan_kernel_iph_la_LDFLAGS = -module -avoid-version
|
||||
libstrongswan_kernel_iph_la_LIBADD = -liphlpapi
|
|
@ -0,0 +1,115 @@
|
|||
/*
|
||||
* Copyright (C) 2013 Martin Willi
|
||||
* Copyright (C) 2013 revosec AG
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the
|
||||
* Free Software Foundation; either version 2 of the License, or (at your
|
||||
* option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#include "kernel_iph_net.h"
|
||||
|
||||
#include <hydra.h>
|
||||
|
||||
typedef struct private_kernel_iph_net_t private_kernel_iph_net_t;
|
||||
|
||||
/**
|
||||
* Private data of kernel_iph_net implementation.
|
||||
*/
|
||||
struct private_kernel_iph_net_t {
|
||||
|
||||
/**
|
||||
* Public interface.
|
||||
*/
|
||||
kernel_iph_net_t public;
|
||||
};
|
||||
|
||||
METHOD(kernel_net_t, get_interface_name, bool,
|
||||
private_kernel_iph_net_t *this, host_t* ip, char **name)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
METHOD(kernel_net_t, create_address_enumerator, enumerator_t*,
|
||||
private_kernel_iph_net_t *this, kernel_address_type_t which)
|
||||
{
|
||||
return enumerator_create_empty();
|
||||
}
|
||||
|
||||
METHOD(kernel_net_t, get_source_addr, host_t*,
|
||||
private_kernel_iph_net_t *this, host_t *dest, host_t *src)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
METHOD(kernel_net_t, get_nexthop, host_t*,
|
||||
private_kernel_iph_net_t *this, host_t *dest, host_t *src)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
METHOD(kernel_net_t, add_ip, status_t,
|
||||
private_kernel_iph_net_t *this, host_t *virtual_ip, int prefix,
|
||||
char *iface_name)
|
||||
{
|
||||
return NOT_SUPPORTED;
|
||||
}
|
||||
|
||||
METHOD(kernel_net_t, del_ip, status_t,
|
||||
private_kernel_iph_net_t *this, host_t *virtual_ip, int prefix,
|
||||
bool wait)
|
||||
{
|
||||
return NOT_SUPPORTED;
|
||||
}
|
||||
|
||||
METHOD(kernel_net_t, add_route, status_t,
|
||||
private_kernel_iph_net_t *this, chunk_t dst_net, u_int8_t prefixlen,
|
||||
host_t *gateway, host_t *src_ip, char *if_name)
|
||||
{
|
||||
return NOT_SUPPORTED;
|
||||
}
|
||||
|
||||
METHOD(kernel_net_t, del_route, status_t,
|
||||
private_kernel_iph_net_t *this, chunk_t dst_net, u_int8_t prefixlen,
|
||||
host_t *gateway, host_t *src_ip, char *if_name)
|
||||
{
|
||||
return NOT_SUPPORTED;
|
||||
}
|
||||
|
||||
METHOD(kernel_net_t, destroy, void,
|
||||
private_kernel_iph_net_t *this)
|
||||
{
|
||||
free(this);
|
||||
}
|
||||
|
||||
/*
|
||||
* Described in header.
|
||||
*/
|
||||
kernel_iph_net_t *kernel_iph_net_create()
|
||||
{
|
||||
private_kernel_iph_net_t *this;
|
||||
|
||||
INIT(this,
|
||||
.public = {
|
||||
.interface = {
|
||||
.get_interface = _get_interface_name,
|
||||
.create_address_enumerator = _create_address_enumerator,
|
||||
.get_source_addr = _get_source_addr,
|
||||
.get_nexthop = _get_nexthop,
|
||||
.add_ip = _add_ip,
|
||||
.del_ip = _del_ip,
|
||||
.add_route = _add_route,
|
||||
.del_route = _del_route,
|
||||
.destroy = _destroy,
|
||||
},
|
||||
},
|
||||
);
|
||||
|
||||
return &this->public;
|
||||
}
|
|
@ -0,0 +1,46 @@
|
|||
/*
|
||||
* Copyright (C) 2013 Martin Willi
|
||||
* Copyright (C) 2013 revosec AG
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the
|
||||
* Free Software Foundation; either version 2 of the License, or (at your
|
||||
* option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @defgroup kernel_iph_net_i kernel_iph_net
|
||||
* @{ @ingroup kernel_iph
|
||||
*/
|
||||
|
||||
#ifndef KERNEL_IPH_NET_H_
|
||||
#define KERNEL_IPH_NET_H_
|
||||
|
||||
#include <kernel/kernel_net.h>
|
||||
|
||||
typedef struct kernel_iph_net_t kernel_iph_net_t;
|
||||
|
||||
/**
|
||||
* Implementation of the kernel network interface using Windows IP Helper.
|
||||
*/
|
||||
struct kernel_iph_net_t {
|
||||
|
||||
/**
|
||||
* Implements kernel_net_t interface
|
||||
*/
|
||||
kernel_net_t interface;
|
||||
};
|
||||
|
||||
/**
|
||||
* Create IP Helper network backend instance.
|
||||
*
|
||||
* @return kernel_iph_net_t instance
|
||||
*/
|
||||
kernel_iph_net_t *kernel_iph_net_create();
|
||||
|
||||
#endif /** KERNEL_IPH_NET_H_ @}*/
|
|
@ -0,0 +1,76 @@
|
|||
/*
|
||||
* Copyright (C) 2013 Martin Willi
|
||||
* Copyright (C) 2013 revosec AG
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the
|
||||
* Free Software Foundation; either version 2 of the License, or (at your
|
||||
* option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
|
||||
#include "kernel_iph_plugin.h"
|
||||
#include "kernel_iph_net.h"
|
||||
|
||||
#include <hydra.h>
|
||||
|
||||
typedef struct private_kernel_iph_plugin_t private_kernel_iph_plugin_t;
|
||||
|
||||
/**
|
||||
* Private data of kernel iph plugin
|
||||
*/
|
||||
struct private_kernel_iph_plugin_t {
|
||||
|
||||
/**
|
||||
* Implements plugin interface
|
||||
*/
|
||||
kernel_iph_plugin_t public;
|
||||
};
|
||||
|
||||
METHOD(plugin_t, get_name, char*,
|
||||
private_kernel_iph_plugin_t *this)
|
||||
{
|
||||
return "kernel-iph";
|
||||
}
|
||||
|
||||
METHOD(plugin_t, get_features, int,
|
||||
private_kernel_iph_plugin_t *this, plugin_feature_t *features[])
|
||||
{
|
||||
static plugin_feature_t f[] = {
|
||||
PLUGIN_CALLBACK(kernel_net_register, kernel_iph_net_create),
|
||||
PLUGIN_PROVIDE(CUSTOM, "kernel-net"),
|
||||
};
|
||||
*features = f;
|
||||
return countof(f);
|
||||
}
|
||||
|
||||
METHOD(plugin_t, destroy, void,
|
||||
private_kernel_iph_plugin_t *this)
|
||||
{
|
||||
free(this);
|
||||
}
|
||||
|
||||
/*
|
||||
* See header file
|
||||
*/
|
||||
plugin_t *kernel_iph_plugin_create()
|
||||
{
|
||||
private_kernel_iph_plugin_t *this;
|
||||
|
||||
INIT(this,
|
||||
.public = {
|
||||
.plugin = {
|
||||
.get_name = _get_name,
|
||||
.get_features = _get_features,
|
||||
.destroy = _destroy,
|
||||
},
|
||||
},
|
||||
);
|
||||
|
||||
return &this->public.plugin;
|
||||
}
|
|
@ -0,0 +1,42 @@
|
|||
/*
|
||||
* Copyright (C) 2013 Martin Willi
|
||||
* Copyright (C) 2013 revosec AG
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the
|
||||
* Free Software Foundation; either version 2 of the License, or (at your
|
||||
* option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @defgroup kernel_iph kernel_iph
|
||||
* @ingroup cplugins
|
||||
*
|
||||
* @defgroup kernel_iph_plugin kernel_iph_plugin
|
||||
* @{ @ingroup kernel_iph
|
||||
*/
|
||||
|
||||
#ifndef KERNEL_IPH_PLUGIN_H_
|
||||
#define KERNEL_IPH_PLUGIN_H_
|
||||
|
||||
#include <plugins/plugin.h>
|
||||
|
||||
typedef struct kernel_iph_plugin_t kernel_iph_plugin_t;
|
||||
|
||||
/**
|
||||
* Windows IP Helper API based networking backend.
|
||||
*/
|
||||
struct kernel_iph_plugin_t {
|
||||
|
||||
/**
|
||||
* Implements plugin interface.
|
||||
*/
|
||||
plugin_t plugin;
|
||||
};
|
||||
|
||||
#endif /** KERNEL_IPH_PLUGIN_H_ @}*/
|
Loading…
Reference in New Issue