Skip to content

Commit 547eff4

Browse files
committed
core:services:cable_guy: Fix _execute_route interface source
* Make sure _execute_route use settings as source of the interface object to avoid fetching from system and overriding existing settings
1 parent 9bd5eea commit 547eff4

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

core/services/cable_guy/api/manager.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -635,6 +635,14 @@ def remove_route(self, interface_name: str, route: Route) -> None:
635635
self._execute_route("del", interface_name, route)
636636

637637
def _execute_route(self, action: str, interface_name: str, route: Route) -> None:
638+
if not self.is_valid_interface_name(interface_name, filter_wifi=True):
639+
logger.debug(f"Ignoring route action '{action}' for forbidden interface '{interface_name}'.")
640+
return
641+
642+
current_interface = self.get_saved_interface_by_name(interface_name)
643+
if not current_interface:
644+
raise ValueError(f"Interface {interface_name} not found")
645+
638646
try:
639647
interface_index = self._get_interface_index(interface_name)
640648
gateway = self.__class__._normalize_gateway(route.destination_parsed, route.next_hop_parsed)
@@ -662,7 +670,7 @@ def _execute_route(self, action: str, interface_name: str, route: Route) -> None
662670
raise
663671

664672
# Update settings
665-
current_interface = self.get_interface_by_name(interface_name, include_dhcp_markers=True)
673+
current_interface.routes = list(self.get_routes(interface_name, ignore_unmanaged=False))
666674
for current_route in current_interface.routes:
667675
if current_route.destination_parsed == route.destination_parsed and current_route.gateway == route.gateway:
668676
current_route.managed = route.managed

0 commit comments

Comments
 (0)