aboutsummaryrefslogtreecommitdiffstats
path: root/src/pluto/kernel.c
diff options
context:
space:
mode:
authorTobias Brunner <tobias@strongswan.org>2010-07-29 10:46:45 +0200
committerTobias Brunner <tobias@strongswan.org>2010-09-02 19:04:20 +0200
commitdeea15f04e5bed6bfb4525e6bc286ccaaf2ae1c6 (patch)
treeaedf78a27356d84d68c65d9d92fcebef769536c6 /src/pluto/kernel.c
parent230aa11fb41c45816ba48a36eeeceb13386290d5 (diff)
downloadstrongswan-deea15f04e5bed6bfb4525e6bc286ccaaf2ae1c6.tar.bz2
strongswan-deea15f04e5bed6bfb4525e6bc286ccaaf2ae1c6.tar.xz
pluto: Added a function to create a traffic_selector_t from an ip_subnet.
Diffstat (limited to 'src/pluto/kernel.c')
-rw-r--r--src/pluto/kernel.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/pluto/kernel.c b/src/pluto/kernel.c
index 552a63d49..cd6b399fb 100644
--- a/src/pluto/kernel.c
+++ b/src/pluto/kernel.c
@@ -177,6 +177,20 @@ static const struct pfkey_proto_info null_proto_info[2] = {
}
};
+/**
+ * Helper function that converts an ip_subnet to a traffic_selector_t.
+ */
+static traffic_selector_t *traffic_selector_from_subnet(const ip_subnet *client,
+ const u_int8_t proto)
+{
+ traffic_selector_t *ts;
+ host_t *net;
+ net = host_create_from_sockaddr((sockaddr_t*)&client->addr);
+ ts = traffic_selector_create_from_subnet(net, client->maskbits, proto,
+ portof(&client->addr));
+ return ts;
+}
+
void record_and_initiate_opportunistic(const ip_subnet *ours,
const ip_subnet *his,
int transport_proto, const char *why)