updown: Add PLUTO_IPCOMP to indicate if IPComp was negotiated
authorTobias Brunner <tobias@strongswan.org>
Thu, 7 Nov 2013 16:48:40 +0000 (17:48 +0100)
committerTobias Brunner <tobias@strongswan.org>
Thu, 23 Jan 2014 09:27:12 +0000 (10:27 +0100)
src/_updown/_updown.in
src/libcharon/plugins/updown/updown_listener.c

index c68c23d..36bf64c 100644 (file)
@@ -50,6 +50,9 @@
 #       PLUTO_PROTO
 #              is the negotiated IPsec protocol, ah|esp
 #
+#       PLUTO_IPCOMP
+#              is not empty if IPComp was negotiated
+#
 #       PLUTO_UNIQUEID
 #              is the unique identifier of the associated IKE_SA
 #
index 81adfdb..e623097 100644 (file)
@@ -1,4 +1,5 @@
 /*
+ * Copyright (C) 2013 Tobias Brunner
  * Copyright (C) 2008 Martin Willi
  * Hochschule fuer Technik Rapperswil
  *
@@ -223,7 +224,7 @@ METHOD(listener_t, child_updown, bool,
                u_int8_t my_client_mask, other_client_mask;
                char *virtual_ip, *iface, *mark_in, *mark_out, *udp_enc, *dns, *xauth;
                mark_t mark;
-               bool is_host, is_ipv6;
+               bool is_host, is_ipv6, use_ipcomp;
                FILE *shell;
 
                my_ts->to_subnet(my_ts, &my_client, &my_client_mask);
@@ -322,6 +323,9 @@ METHOD(listener_t, child_updown, bool,
 
                dns = make_dns_vars(this, ike_sa);
 
+               /* check for IPComp */
+               use_ipcomp = child_sa->get_ipcomp(child_sa) != IPCOMP_NONE;
+
                /* determine IPv4/IPv6 and client/host situation */
                is_host = my_ts->is_host(my_ts, me);
                is_ipv6 = is_host ? (me->get_family(me) == AF_INET6) :
@@ -355,6 +359,7 @@ METHOD(listener_t, child_updown, bool,
                                "%s"
                                "%s"
                                "%s"
+                               "%s"
                                "%s",
                                 up ? "up" : "down",
                                 is_host ? "-host" : "-client",
@@ -377,6 +382,7 @@ METHOD(listener_t, child_updown, bool,
                                 mark_in,
                                 mark_out,
                                 udp_enc,
+                                use_ipcomp ? "PLUTO_IPCOMP='1' " : "",
                                 config->get_hostaccess(config) ? "PLUTO_HOST_ACCESS='1' " : "",
                                 dns,
                                 script);