-
Notifications
You must be signed in to change notification settings - Fork 830
net/frr: add manual config #5521
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
Monviech
wants to merge
11
commits into
master
Choose a base branch
from
frr-manual-config
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 6 commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
c5c70b1
net/frr: Manual configuration override, WIP
Monviech d0b02d6
net/frr: Typo in previous
Monviech 78f2965
net/frr: Typo in previous
Monviech 8ecb91e
net/frr: Some options are in the rc file, some in zebra. Distinguish …
Monviech fd8327a
net/frr: Make manual config banner text better
Monviech c344ee3
make sweep
Monviech c1ca8d8
net/frr: Reflect the individual daemon enabled sections into the gene…
Monviech 9493df7
not needed here
Monviech 3ed50d8
net/frr: Simplify hiding logic in general.volt, make sweep
Monviech bc38525
net/frr: Hide daemon specific menu entries when manual_config is enabled
Monviech 2e2abac
net/frr: Better force a migration for manual_config to ensure its alw…
Monviech File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
57 changes: 57 additions & 0 deletions
57
net/frr/src/opnsense/mvc/app/library/OPNsense/System/Status/FrrManualConfigStatus.php
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,57 @@ | ||
| <?php | ||
|
|
||
| /* | ||
| * Copyright (C) 2026 Deciso B.V. | ||
| * All rights reserved. | ||
| * | ||
| * Redistribution and use in source and binary forms, with or without | ||
| * modification, are permitted provided that the following conditions are met: | ||
| * | ||
| * 1. Redistributions of source code must retain the above copyright notice, | ||
| * this list of conditions and the following disclaimer. | ||
| * | ||
| * 2. Redistributions in binary form must reproduce the above copyright | ||
| * notice, this list of conditions in the documentation and/or other | ||
| * materials provided with the distribution. | ||
| * | ||
| * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, | ||
| * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY | ||
| * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE | ||
| * AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, | ||
| * OR CONSEQUENTIAL DAMAGES INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | ||
| * SUBSTITUTE GOODS OR SERVICES, LOSS OF USE, DATA, OR PROFITS, OR BUSINESS | ||
| * INTERRUPTION HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | ||
| * CONTRACT, STRICT LIABILITY, OR TORT INCLUDING NEGLIGENCE OR OTHERWISE | ||
| * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | ||
| * POSSIBILITY OF SUCH DAMAGE. | ||
| */ | ||
|
|
||
| namespace OPNsense\System\Status; | ||
|
|
||
| use OPNsense\Quagga\General; | ||
| use OPNsense\System\AbstractStatus; | ||
| use OPNsense\System\SystemStatusCode; | ||
|
|
||
| class FrrManualConfigStatus extends AbstractStatus | ||
| { | ||
| public function __construct() | ||
| { | ||
| $this->internalPriority = 2; | ||
| $this->internalPersistent = true; | ||
| $this->internalIsBanner = true; | ||
| $this->internalTitle = gettext('FRR manual configuration'); | ||
| $this->internalScope = [ | ||
| '/ui/quagga/*' | ||
| ]; | ||
| } | ||
|
|
||
| public function collectStatus() | ||
| { | ||
| if (!(new General())->manual_config->isEmpty()) { | ||
| $this->internalMessage = gettext( | ||
| 'Manual FRR configuration is enabled. Configuration file generation is disabled. Settings configured here may no longer affect the active FRR configuration.' | ||
| ); | ||
| $this->internalStatus = SystemStatusCode::NOTICE; | ||
| } | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 0 additions & 1 deletion
1
net/frr/src/opnsense/service/templates/OPNsense/Quagga/+TARGETS
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
net/frr/src/opnsense/service/templates/OPNsense/Quagga/rc_conf_d/+TARGETS
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| frr:/etc/rc.conf.d/frr |
File renamed without changes.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it would be better to hide configuration entries in the menu when manual mode is selected, we have options for that now and it avoids throwing messages on each page one can't use anyway.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought the same but the issue is each daemon has its on model with its own "enabled" key. So we either have to reflect these or do lots of javascript magic to hide everything except enabled on every page.
This here definitely needs some more thought.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wasn't planning in hiding options in the forms, I was thinking of hiding these options in the menu when their not used. We just need to move some glue to the menu system in order to support that, but I think we have all we need already.
When I have a bit of time, I can give it a shot.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Dont we have to reflect all enabled keys inside the frr general model as volatile fields? If the whole daemon specific menu items hide completely there is no way for the user to change these anymore as they are still owned by the rc.d script which is still regenerated by the template system here:
plugins/net/frr/src/opnsense/service/templates/OPNsense/Quagga/frr
Line 10 in b9f5689
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We probably have to think this through before committing anything, I assume the intention of the general "use manual config" option is to not write any configurations at all anymore, which the template system isn't very helpful in achieving due to some different spots flushing them out (e.g. boot).
For KEA this was rather easy as it's not bound to the template system, but our current template generation language doesn't really offer the flexibility yet which we would need in this particular case.
Logically, we would like to have some "break" on the template generation to skip it when not specifically requested and have the menu system cope with the options that are not relevant when in manual mode (effectively making the service boilerplate only responsible for the usual rc stuff).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I do think that's what the PR mostly offers by splitting the rc.conf template into a subdirectory. It's pretty effective although we have more boilerplate in the plugin backend to pull this off, but it's also not different from Kea or other legacy services.
A more unified template approach would be nice to have as an additional stage in the reconfigureAction() but it requires a bit of preparation and unification between services that should to use it. There are already a few.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If I'm not mistaken, a bootup will still regenerate the
frr.confandvtysh.conffiles, which is likely unintended when the user manages its own set of settings.We could smarten the
+TARGETSconstruction a bit to bail-out of the "generate all unconditional" option to solve that part of the puzzle, using the subdirectory for the rc part is indeed a practical boundary to use for splitting the functions.Just need to think about this for a bit, as a general pattern, I think it makes sense to have some easy glue to support this scenario.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, thank you. No rush here at all. I'll leave this open until there is a good way forward.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fair point. There are a number of ways to deal with this :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think "make upgrade" of a plugin also regenerates all templates unconditionally. I don't know if that's the same path as boot.