File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -666,3 +666,11 @@ def is_valid_ipv6_address_or_range(addr: str) -> bool:
666666 return ip_network (addr ).version == 6
667667 except :
668668 return False
669+
670+ def is_carrier_up (ifname : str ) -> bool | None :
671+ try :
672+ carrier_path = f'/sys/class/net/{ ifname } /carrier'
673+ with open (carrier_path , 'r' ) as f :
674+ return f .read ().strip () == '1'
675+ except :
676+ return None
Original file line number Diff line number Diff line change @@ -22,6 +22,7 @@ from time import sleep
2222from vyos .config import Config
2323from vyos .ifconfig import Section
2424from vyos .utils .boot import boot_configuration_complete
25+ from vyos .utils .network import is_carrier_up
2526from vyos .utils .process import cmd
2627from vyos .utils .process import is_systemd_service_active
2728from vyos .utils .commit import commit_in_progress
@@ -49,7 +50,8 @@ interface_path = ['interfaces'] + Section.get_config_path(interface).split()
4950
5051systemdV4_service = f'dhclient@{ interface } .service'
5152systemdV6_service = f'dhcp6c@{ interface } .service'
52- if in_out == 'out' :
53+ # T7557 - Check the interface is still down at time of script
54+ if in_out == 'out' and not is_carrier_up (interface ):
5355 # Interface moved state to down
5456 if is_systemd_service_active (systemdV4_service ):
5557 cmd (f'systemctl stop { systemdV4_service } ' )
You can’t perform that action at this time.
0 commit comments