From: Andreas Steffen Date: Thu, 17 Dec 2009 16:28:11 +0000 (+0100) Subject: fixed updown plugin for mixed IPv4/IPv6 tunnels X-Git-Tag: 4.3.6~100 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=9789d3a9b9ebd16cf14bc15738e74bee1341e69c;p=thirdparty%2Fstrongswan.git fixed updown plugin for mixed IPv4/IPv6 tunnels --- diff --git a/src/charon/plugins/updown/updown_listener.c b/src/charon/plugins/updown/updown_listener.c index 10a94726a7..b4399c5460 100644 --- a/src/charon/plugins/updown/updown_listener.c +++ b/src/charon/plugins/updown/updown_listener.c @@ -118,6 +118,7 @@ static void updown(private_updown_listener_t *this, ike_sa_t *ike_sa, char command[1024]; char *my_client, *other_client, *my_client_mask, *other_client_mask; char *pos, *virtual_ip, *iface; + bool is_host, is_ipv6; FILE *shell; /* get subnet/bits from string */ @@ -175,6 +176,11 @@ static void updown(private_updown_listener_t *this, ike_sa_t *ike_sa, iface = uncache_iface(this, child_sa->get_reqid(child_sa)); } + /* 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) : + (my_ts->get_type(my_ts) == TS_IPV6_ADDR_RANGE); + /* build the command with all env variables. * TODO: PLUTO_PEER_CA and PLUTO_NEXT_HOP are currently missing */ @@ -203,8 +209,8 @@ static void updown(private_updown_listener_t *this, ike_sa_t *ike_sa, "%s" "%s", up ? "up" : "down", - my_ts->is_host(my_ts, me) ? "-host" : "-client", - me->get_family(me) == AF_INET ? "" : "-v6", + is_host ? "-host" : "-client", + is_ipv6 ? "-v6" : "", config->get_name(config), iface ? iface : "unknown", child_sa->get_reqid(child_sa),