It doesn't really seem to make sense to try to link groups on different places, if they're only usable for pf which is always reloaded when new interfaces are connected.
The new ifgroup_setup() synchonizes attached interfaces for all configured groups, only rename and delete are still being served from the management pages (to avoid dropping static groups like openvpn).
Currently the API has a strange behavior when we try to add or delete in parallel several addresses in the same alias
For example, while we want to delete multiple address (1 request = 1 address) all the request returns a 200 OK {"status": "done »}, but some address stay in the alias content
The same logic apply for the alias_utils/add endpoint
This behavior can be reproduced with this python script
import os
import subprocess
addr_list = ["10.1.0.0", "10.1.0.1", "10.1.0.2", "10.1.0.3", "10.1.0.4",
"10.1.0.5", "10.1.0.6", "10.1.0.7", "10.1.0.8", "10.1.0.9", "10.1.0.10"]
secret = ""
key = ""
host = ""
existing_alias = ""
for addr in addr_list:
subprocess.Popen(
["curl --header \"Content-Type: application/json\" --basic --user \"" + secret + ":" + key + "\" --request POST --data '{\"address\":\"" + addr + "\"}' http://" + host + "/api/firewall/alias_util/add/" + existing_alias], shell=True, stdin=None, stdout=None, stderr=None, close_fds=True)
With this fix, adding and removing addresses works correctly in parallel
A minor change, previously we requested microtime() twice which always lead to a small difference in revision and backup. If we sync these two timestamps, it's easier to find the previous sitation updated.time matches /conf/backup/config-[updated.time].xml
Internally the object model looks like this:
ArrayField - [
ContainerField - [
TextField
EmailField
....
]
ContainerField - [
{same types as first row}
]
]
uuid's are attached to the ContainerField types by the ArrayField (or on load by BaseModel)
ref: https://github.com/opnsense/plugins/issues/1720
Conceptually there are two types containers in our model, the standard one (ContainerField), which only acts as a placeholder without logic and the ArrayField type, which understands repetitive structures and comes with its own uuid reference per item and methods supporting addition and removal of entries.
With the application specific field types it can be practical if you could extend this container type as well, so you can add additional methods on a more logical spot in the code tree.
ref https://github.com/opnsense/plugins/issues/1720
Side affect of this change is that testDependConstraintNok seemed to be missing a back reference, which is being added in this commit as well (TestModel.xml).
Catched while working on https://github.com/opnsense/plugins/issues/1720
This is too much valid translation bounce noise and will not help.
This is better explained in detail in a documentation page if
users really read it, that is.