fixed updown plugin for mixed IPv4/IPv6 tunnels
This commit is contained in:
@@ -118,6 +118,7 @@ static void updown(private_updown_listener_t *this, ike_sa_t *ike_sa,
|
|||||||
char command[1024];
|
char command[1024];
|
||||||
char *my_client, *other_client, *my_client_mask, *other_client_mask;
|
char *my_client, *other_client, *my_client_mask, *other_client_mask;
|
||||||
char *pos, *virtual_ip, *iface;
|
char *pos, *virtual_ip, *iface;
|
||||||
|
bool is_host, is_ipv6;
|
||||||
FILE *shell;
|
FILE *shell;
|
||||||
|
|
||||||
/* get subnet/bits from string */
|
/* 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));
|
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.
|
/* build the command with all env variables.
|
||||||
* TODO: PLUTO_PEER_CA and PLUTO_NEXT_HOP are currently missing
|
* 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"
|
||||||
"%s",
|
"%s",
|
||||||
up ? "up" : "down",
|
up ? "up" : "down",
|
||||||
my_ts->is_host(my_ts, me) ? "-host" : "-client",
|
is_host ? "-host" : "-client",
|
||||||
me->get_family(me) == AF_INET ? "" : "-v6",
|
is_ipv6 ? "-v6" : "",
|
||||||
config->get_name(config),
|
config->get_name(config),
|
||||||
iface ? iface : "unknown",
|
iface ? iface : "unknown",
|
||||||
child_sa->get_reqid(child_sa),
|
child_sa->get_reqid(child_sa),
|
||||||
|
|||||||
Reference in New Issue
Block a user