From cf7f911397d01c2ac590d118b6deb11801a2e846 Mon Sep 17 00:00:00 2001 From: Sergey Abramchuk Date: Fri, 19 May 2017 23:52:30 +0300 Subject: [PATCH] Provide nil if gateway value empty or "UNSPEC" --- OpenVPN Adapter/OpenVPNClient.mm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/OpenVPN Adapter/OpenVPNClient.mm b/OpenVPN Adapter/OpenVPNClient.mm index 95fabe0..8347722 100644 --- a/OpenVPN Adapter/OpenVPNClient.mm +++ b/OpenVPN Adapter/OpenVPNClient.mm @@ -26,7 +26,7 @@ bool OpenVPNClient::tun_builder_set_remote_address(const std::string &address, b bool OpenVPNClient::tun_builder_add_address(const std::string &address, int prefix_length, const std::string &gateway, bool ipv6, bool net30) { NSString *localAddress = [NSString stringWithUTF8String:address.c_str()]; - NSString *gatewayAddress = [NSString stringWithUTF8String:gateway.c_str()]; + NSString *gatewayAddress = !gateway.empty() && gateway.compare("UNSPEC") != 0 ? [NSString stringWithUTF8String:gateway.c_str()] : nil; return [(__bridge OpenVPNAdapter *)adapter addLocalAddress:localAddress prefixLength:@(prefix_length) gateway:gatewayAddress isIPv6:ipv6]; }