This commit is contained in:
Alexander Kolenaty 2026-05-28 10:04:55 +02:00 committed by GitHub
commit 9e2b8fcf6a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 17 additions and 6 deletions

View file

@ -120,14 +120,23 @@ class VipSettingsController extends ApiMutableModelControllerBase
Config::getInstance()->lock();
$node = $this->getModel()->getNodeByReference('vip.' . $uuid);
$validations = [];
$post_subnet = '';
$post_interface = '';
$post_subnet = null;
$post_interface = null;
if (isset($_POST['vip'])) {
$post_subnet = !empty($_POST['vip']['network']) ? explode('/', $_POST['vip']['network'])[0] : '';
$post_interface = !empty($_POST['vip']['interface']) ? $_POST['vip']['interface'] : '';
if (!empty($_POST['vip']['network'])) {
$post_subnet = explode('/', $_POST['vip']['network'])[0];
} elseif (isset($_POST['vip']['subnet'])) {
$post_subnet = $_POST['vip']['subnet'];
}
if (isset($_POST['vip']['interface'])) {
$post_interface = $_POST['vip']['interface'];
}
}
if ($node != null && $post_subnet != (string)$node->subnet) {
$subnet_changed = $post_subnet !== null && $post_subnet != (string)$node?->subnet;
$interface_changed = $post_interface !== null && $post_interface != (string)$node?->interface;
if ($node != null && $subnet_changed) {
$validations = $this->getModel()->whereUsed((string)$node->subnet);
if (!empty($validations)) {
// XXX a bit unpractical, but we can not validate previous values from the model so
@ -140,7 +149,7 @@ class VipSettingsController extends ApiMutableModelControllerBase
];
}
}
if ($node != null && ($post_subnet != (string)$node->subnet || $post_interface != (string)$node->interface)) {
if ($node != null && ($subnet_changed || $interface_changed)) {
$addr = (string)$node->subnet;
if (Util::isLinkLocal($addr)) {
$addr .= "@{$node->interface}";

View file

@ -78,6 +78,8 @@ foreach (glob("/tmp/delete_vip_*.todo") as $filename) {
}
if (isset($addresses[$address])) {
legacy_interface_deladdress($addresses[$address]['if'], $address, is_ipaddrv6($address) ? 6 : 4);
// keep snapshot in sync so the re-add loop below sees the address as missing
unset($addresses[$address]);
} else {
// not found, likely proxy arp
$proxyarp = true;