|
48 | 48 | from vyos.utils.network import get_interface_namespace |
49 | 49 | from vyos.utils.network import get_vrf_tableid |
50 | 50 | from vyos.utils.network import is_netns_interface |
| 51 | +from vyos.utils.network import is_carrier_up |
51 | 52 | from vyos.utils.process import is_systemd_service_active |
52 | 53 | from vyos.utils.process import run |
53 | 54 | from vyos.utils.file import read_file |
@@ -1525,7 +1526,9 @@ def set_dhcp(self, enable: bool, vrf_changed: bool=False): |
1525 | 1526 | # the old lease is released a new one is acquired (T4203). We will |
1526 | 1527 | # only restart DHCP client if it's option changed, or if it's not |
1527 | 1528 | # running, but it should be running (e.g. on system startup) |
1528 | | - if (vrf_changed or |
| 1529 | + # |
| 1530 | + # T7557 - Add carrier check, netplug hook will start it |
| 1531 | + if is_carrier_up(self.ifname) and (vrf_changed or |
1529 | 1532 | ('dhcp_options_changed' in self.config) or |
1530 | 1533 | (not is_systemd_service_active(systemd_service))): |
1531 | 1534 | return self._cmd(f'systemctl restart {systemd_service}') |
@@ -1582,7 +1585,9 @@ def set_dhcpv6(self, enable: bool, vrf_changed: bool=False): |
1582 | 1585 |
|
1583 | 1586 | # We must ignore any return codes. This is required to enable |
1584 | 1587 | # DHCPv6-PD for interfaces which are yet not up and running. |
1585 | | - if (vrf_changed or |
| 1588 | + # |
| 1589 | + # T7557 - Add carrier check, netplug hook will start it |
| 1590 | + if is_carrier_up(self.ifname) and (vrf_changed or |
1586 | 1591 | ('dhcpv6_options_changed' in self.config) or |
1587 | 1592 | (not is_systemd_service_active(systemd_service))): |
1588 | 1593 | return self._popen(f'systemctl restart {systemd_service}') |
|
0 commit comments