Second try: retain attribute values as sibling nodes with
a name up front. If the sibling does not exist fail silently
like before. At least from testing this no longer produces
any shift in the config.xml between string nodes with attributes.
Test XML:
<?xml version="1.0"?>
<opnsense>
<staticroutes version="1.0.0"/>
<someotherthing version="1.0.0">
<foo/>
</someotherthing>
<thing version="1.0.0"></thing>
<alias version="1.0.0"/>
<doesthisdoit></doesthisdoit>
</opnsense>
Test PHP:
<?php
require_once 'config.inc';
OPNsense\Core\Config::getInstance()->fromArray(load_config_from_file('foo.xml'));
print_r(OPNsense\Core\Config::getInstance()->__toString());
Result XML:
<?xml version="1.0"?>
<opnsense>
<staticroutes version="1.0.0"/>
<someotherthing version="1.0.0">
<foo/>
</someotherthing>
<thing version="1.0.0"/>
<alias version="1.0.0"/>
<doesthisdoit/>
</opnsense>
We need to make sure both the local and the remote IP belong to
the same CIDR range, which might not be the case if we just
calculate the subnet size required by their direct distance.
Rewrite find_smallest_cidr() to take an array of IPs to calculate
their smallest shared subnet mask. Code is actually pretty simple
and fast. However, we are not going to account for network and
broadcast address reservation unless that turns out to be an issue.
In the IPv6 case assume that /64 is a good approximation of the
result.
Remove code cruft in utilities while at it also replacing a simple
function only called once in setaddr.sh.
commit 9da181580631e305cf194688479eb311d74dda9d
Author: Ad Schellevis <ad@opnsense.org>
Date: Tue Aug 31 13:22:39 2021 +0200
CARP: small cleanups after https://github.com/opnsense/core/pull/5184
commit 9875b53e98aeed173e1603182251b8e2165cabbb
Author: vnxme <46669194+vnxme@users.noreply.github.com>
Date: Sun Aug 29 22:28:03 2021 +0300
CARP: Fix fetching VIP status
Implement array safeguards after e44fd48
commit 9c6ff1717741ec7f21a1b88127c57ff3d849085d
Author: vnxme <46669194+vnxme@users.noreply.github.com>
Date: Sun Aug 29 22:23:25 2021 +0300
CARP: Fix fetching VIP status
Simplify code after e44fd48
commit 52ffd6ee3d471c09a69599a8fdd02f6e6ea6f2c6
Author: vnxme <46669194+vnxme@users.noreply.github.com>
Date: Sun Aug 29 22:19:26 2021 +0300
CARP: Fix fetching VIP status
Simplify code after e44fd48
commit d5ae42623e31138daa29debedc36088fa7ba4811
Author: vnxme <46669194+vnxme@users.noreply.github.com>
Date: Sun Aug 29 22:13:57 2021 +0300
CARP: Fix fetching VIP status
Simplify code after e44fd48
commit df99ba8106233a34732bb0cb39f6134d7697e4a4
Author: vnxme <46669194+vnxme@users.noreply.github.com>
Date: Sun Aug 29 16:39:57 2021 +0300
CARP: Fix fetching VIP status
Take into account translation issues
commit 45eddeb399b64e631e7d81be8ac29dc2cad97bf2
Author: vnxme <46669194+vnxme@users.noreply.github.com>
Date: Sun Aug 29 16:35:04 2021 +0300
CARP: Fix fetching VIP status
Take into account translation issues
commit a068f10cd0a4402e648a09027a6b48b90670e60a
Author: vnxme <46669194+vnxme@users.noreply.github.com>
Date: Sun Aug 29 15:08:51 2021 +0300
CARP: Fix fetching VIP status
Whitespace cleanup
commit aa958e1d04938b084a5582dd4080988aef240eaa
Author: vnxme <46669194+vnxme@users.noreply.github.com>
Date: Sun Aug 29 15:05:12 2021 +0300
CARP: Fix fetching VIP status
Remove unnecessary require_once call
Co-authored-by: Franco Fichtner <franco@lastsummer.de>
commit 5966d1c834fe5c69845a675f0f829ec6efcabc2f
Author: vnxme <46669194+vnxme@users.noreply.github.com>
Date: Sun Aug 29 15:04:47 2021 +0300
CARP: Fix fetching VIP status
Remove unnecessary require_once call
Co-authored-by: Franco Fichtner <franco@lastsummer.de>
commit 38d6d952084ed2db4ae2d81aa583850a38f2f7b2
Author: vnxme <46669194+vnxme@users.noreply.github.com>
Date: Sun Aug 29 15:03:57 2021 +0300
CARP: Fix fetching VIP status
Remove unnecessary require_once call
Co-authored-by: Franco Fichtner <franco@lastsummer.de>
commit 3ae8a2f960310b4f373fbae3e77e2eea2b7ced8a
Author: vnxme <46669194+vnxme@users.noreply.github.com>
Date: Sun Aug 29 14:49:46 2021 +0300
CARP: Fix fetching VIP status
Eliminate calling get_carp_interface_status() by openvpn.inc
commit bf195f3a66ad6a1ec5c62ecb589e32681eeb86dc
Author: vnxme <46669194+vnxme@users.noreply.github.com>
Date: Sun Aug 29 14:04:16 2021 +0300
CARP: Fix fetching VIP status
Refactor the widget to call ifconfig once
commit 26bfe2036a846824b9d163d9c3c8aafd2be3ac36
Author: vnxme <46669194+vnxme@users.noreply.github.com>
Date: Sun Aug 29 13:58:20 2021 +0300
CARP: Fix fetching VIP status
Refactor the status page to call ifconfig once
commit 7cdc8eca63acfb9db8da9cf621780c30454df132
Author: vnxme <46669194+vnxme@users.noreply.github.com>
Date: Sun Aug 29 10:22:05 2021 +0300
CARP: Fix fetching VIP status
Add a space after vhid to make grep more precise
since the indexes themselves aren't used, it should be safe to change the current list interpretation into a named one, this would ease operations like https://github.com/opnsense/core/pull/5184
* Remove the unset-after-write-before-redirect logic of dhcpd on
WAN that practically does nothing.
* At least since b6b3a5ad1d6c41 interface_bring_down() does not
tamper with down flag of the interface avoiding the need to
set the up flag to fix "VLAN" (multiple times).
* Remove debug output that I have never seen before. The function
call below will throw an error too if that is even possible.