Skip to content

Commit 5e2f793

Browse files
authored
Merge pull request #399 from codewithtamim/bugfix/wireguard-ipv6-not-working
Bug Fix : Wireguard ipv6 not working
2 parents 86d01bd + f19b3da commit 5e2f793

1 file changed

Lines changed: 7 additions & 3 deletions

File tree

core/src/main/java/net/ivpn/core/vpn/wireguard/ConfigManager.kt

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,7 @@ class ConfigManager @Inject constructor(
260260
val peer = Peer().also {
261261
// uses same AllowedIPs for both single-hop and multi-hop to disable wg's internal firewall
262262
// Android VPN service handles routing, so we need to disable WireGuard's firewall
263-
it.setAllowedIPsString("128.0.0.0/1, 0.0.0.0/1")
263+
it.setAllowedIPsString("0.0.0.0/0, ::/0")
264264
it.setEndpointString(endpoint)
265265
it.publicKey = peerHost.publicKey
266266
}
@@ -297,8 +297,12 @@ class ConfigManager @Inject constructor(
297297

298298
val entryHost = hosts[0]
299299
val localIPv6AddressForEntry = entryHost.ipv6.local_ip
300-
config.getInterface()
301-
.setAddressString("$ipAddress,${localIPv6AddressForEntry}")
300+
val ipv4OnlyAddress = ipAddress?.split("/")?.get(0) ?: ipAddress
301+
val ipv6Prefix = localIPv6AddressForEntry?.split("/")?.get(0) ?: ""
302+
val combinedAddresses = "$ipAddress/32,${ipv6Prefix}${ipv4OnlyAddress}/128"
303+
304+
LOGGER.info("Setting IPv6 addresses: $combinedAddresses")
305+
config.getInterface().setAddressString(combinedAddresses)
302306
}
303307

304308
private fun getDNS(host: Host): String {

0 commit comments

Comments
 (0)