Added network range collapse for split-tunnel definitions
This commit is contained in:
parent
09354e9ae6
commit
bade50dad3
@ -209,12 +209,12 @@ class Config:
|
||||
route.get("Family") == 2
|
||||
and route.get("ScopeString") == "link"
|
||||
and route.get("ProtocolString") == "kernel"
|
||||
and route.get("TableString") == "main"
|
||||
):
|
||||
self.write_exclusion(
|
||||
dir,
|
||||
self.split_tunnel_exclusions.append(
|
||||
ipaddress.IPv4Network(
|
||||
f"{'.'.join(str(octet) for octet in route.get('Destination', [255, 255, 255, 255]))}/{route.get('DestinationPrefixLength', 32)}"
|
||||
),
|
||||
)
|
||||
)
|
||||
|
||||
async def write_config(self, path: Path, manager: ProxyInterface):
|
||||
@ -272,11 +272,18 @@ class Config:
|
||||
else:
|
||||
dir.mkdir()
|
||||
self._route_id = 0
|
||||
if self.vpnd_allow_local_net:
|
||||
await self.create_localnet_exclusions(dir, manager)
|
||||
# Collapse the address ranges to reduce routing rules and increase network performance
|
||||
self.split_tunnel_exclusions = ipaddress.collapse_addresses(
|
||||
self.split_tunnel_exclusions
|
||||
)
|
||||
self.split_tunnel_inclusions = ipaddress.collapse_addresses(
|
||||
self.split_tunnel_inclusions
|
||||
)
|
||||
if self.vpnd_enforce_split_tunnel:
|
||||
for net in self.split_tunnel_exclusions:
|
||||
self.write_exclusion(dir, net)
|
||||
if self.vpnd_allow_local_net:
|
||||
await self.create_localnet_exclusions(dir, manager)
|
||||
for net in self.split_tunnel_inclusions:
|
||||
self.write_route(dir, net)
|
||||
stream.close()
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user