Skip to content

Commit 052a374

Browse files
authored
Cleanup HA/CARP safety checks for PPP links patch
Proper indentation and better comment for HA/CARP safety checks for PPP links
1 parent 517671c commit 052a374

1 file changed

Lines changed: 23 additions & 23 deletions

File tree

src/etc/inc/interfaces.inc

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1339,36 +1339,36 @@ EOD;
13391339
}
13401340

13411341
/*
1342-
* HA/CARP safety for PPP links:
1343-
* If "Disconnect dialup interfaces" is enabled, only allow PPP startup
1344-
* when at least one underlying parent interface is currently CARP MASTER.
1342+
* In HA mode with disconnectppps enabled, only start PPP when at least
1343+
* one underlying parent interface is currently CARP MASTER.
13451344
*
1346-
* This prevents a rebooted BACKUP node from starting PPPoE later in boot
1347-
* after the CARP hook has already tried (too early) to suspend it.
1345+
* During boot, the CARP hook may already have processed a BACKUP event
1346+
* before the PPP pseudo-interface exists. Without this guard, the later
1347+
* normal startup path can still start PPP on a BACKUP node.
13481348
*/
13491349
if (!empty($config['hasync']['disconnectppps'])) {
1350-
$carp_master = false;
1350+
$carp_master = false;
13511351

1352-
foreach ($ports as $port) {
1353-
$ifconfig_out = shell_exec('/sbin/ifconfig ' . escapeshellarg($port) . ' 2>/dev/null');
1354-
if (!is_string($ifconfig_out)) {
1355-
continue;
1356-
}
1352+
foreach ($ports as $port) {
1353+
$ifconfig_out = shell_exec('/sbin/ifconfig ' . escapeshellarg($port) . ' 2>/dev/null');
1354+
if (!is_string($ifconfig_out)) {
1355+
continue;
1356+
}
13571357

1358-
if (preg_match('/\bcarp:\s+MASTER\b/m', $ifconfig_out)) {
1359-
$carp_master = true;
1360-
break;
1358+
if (preg_match('/\bcarp:\s+MASTER\b/m', $ifconfig_out)) {
1359+
$carp_master = true;
1360+
break;
1361+
}
13611362
}
1362-
}
13631363

1364-
if (!$carp_master) {
1365-
log_msg(
1366-
"interface_ppps_configure() skipped for {$interface} " .
1367-
"(disconnectppps enabled, no parent interface is CARP MASTER)",
1368-
LOG_NOTICE
1369-
);
1370-
return;
1371-
}
1364+
if (!$carp_master) {
1365+
log_msg(
1366+
"interface_ppps_configure() skipped for {$interface} " .
1367+
"(disconnectppps enabled, no parent interface is CARP MASTER)",
1368+
LOG_NOTICE
1369+
);
1370+
return;
1371+
}
13721372
}
13731373

13741374
/* precaution for post-start 'up' check */

0 commit comments

Comments
 (0)