From 47ae8457f9e9c2bb0f5c1e8f28822e1bbc16c196 Mon Sep 17 00:00:00 2001 From: james Date: Wed, 4 Jun 2008 05:16:44 +0000 Subject: Incremented version to 2.1_rc7d. Support asynchronous authentication by plugins by allowing OPENVPN_PLUGIN_AUTH_USER_PASS_VERIFY to return OPENVPN_PLUGIN_FUNC_DEFERRED. See comments in openvpn-plugin.h for documentation. Enabled by ENABLE_DEF_AUTH. Added a simple packet filter functionality that can be driven by a plugin. See comments in openvpn-plugin.h for documentation. Enabled by ENABLE_PF. See openvpn/plugin/defer/simple.c for examples of ENABLE_DEF_AUTH and ENABLE_PF. "TLS Error: local/remote TLS keys are out of sync" is no longer a fatal error for TCP-based sessions, since the error can arise normally in the course of deferred authentication. In a related change, allow packet-id sequence to begin at some number n > 0 for TCP sessions, rather than strictly requiring sequence to begin at 1. Added a test to configure.ac for LoadLibrary function on Windows. Modified "make dist" function to include all files from install-win32 so that ./domake-win can be run from a tarball-expanded directory. setenv and setenv-safe directives may now omit a value argument which defaults to "". git-svn-id: http://svn.openvpn.net/projects/openvpn/branches/BETA21/openvpn@2978 e7ae566f-a301-0410-adde-c780ea21d3b5 --- pf.h | 103 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 103 insertions(+) create mode 100644 pf.h (limited to 'pf.h') diff --git a/pf.h b/pf.h new file mode 100644 index 0000000..754db8a --- /dev/null +++ b/pf.h @@ -0,0 +1,103 @@ +/* + * 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) 2002-2005 OpenVPN Solutions LLC + * + * 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 + */ + +/* packet filter functions */ + +#if defined(ENABLE_PF) && !defined(OPENVPN_PF_H) +#define OPENVPN_PF_H + +#include "list.h" +#include "mroute.h" + +#define PF_DEBUG 0 + +struct context; + +struct ipv4_subnet { + bool exclude; + in_addr_t network; + in_addr_t netmask; +}; + +struct pf_subnet { + struct pf_subnet *next; + struct ipv4_subnet rule; +}; + +struct pf_subnet_set { + bool default_allow; + struct pf_subnet *list; +}; + +struct pf_cn { + bool exclude; + char *cn; +}; + +struct pf_cn_elem { + struct pf_cn_elem *next; + struct pf_cn rule; +}; + +struct pf_cn_set { + bool default_allow; + struct pf_cn_elem *list; + struct hash *hash_table; +}; + +struct pf_set { + bool kill; + struct pf_subnet_set sns; + struct pf_cn_set cns; +}; + +struct pf_context { + char *filename; + time_t file_last_mod; + unsigned int n_check_reload; + struct event_timeout reload; + struct pf_set *pfs; +}; + +void pf_init_context (struct context *c); + +void pf_destroy_context (struct pf_context *pfc); + +void pf_check_reload (struct context *c); + +bool pf_c2c_test (const struct context *src, const struct context *dest); + +bool pf_addr_test (const struct context *src, const struct mroute_addr *dest); + +static inline bool +pf_kill_test (const struct pf_set *pfs) +{ + return pfs->kill; +} + +#if PF_DEBUG >= 1 +void pf_context_print (const struct pf_context *pfc, const char *prefix, const int lev); +#endif + +#endif -- cgit v1.2.3