Page MenuHomeVyOS Platform

Disallow saving when there are non-committed changes in the session
Open, NormalPublicBUG

Description

If create or replace bgp neighbor and don't set remote-as for him.
After reboot % BGP instance not found

To create this bug:

vyos@uplink# show protocols | commands 
set bgp 65111 neighbor 10.88.57.1 remote-as '65001'
set bgp 65111 neighbor 10.88.57.3 remote-as '65001'
[edit]
vyos@uplink#
vyos@uplink:~$ sh ip bgp sum

Neighbor        V         AS MsgRcvd MsgSent   TblVer  InQ OutQ  Up/Down State/PfxRcd
10.88.57.1      4      65001       8       9        0    0    0 00:05:16            0
10.88.57.3      4      65001       9       9        0    0    0 00:05:16            1

Delete one peer and create new without remote-as

delete protocols  bgp 65111 neighbor 10.88.57.1
set protocols bgp 65111 neighbor 10.88.57.254
vyos@uplink# commit
[ protocols bgp 65111 ]
[ protocols bgp 65111 neighbor 10.88.57.254 ]
  must set remote-as or peer-group with remote-as defined

[edit]
vyos@uplink# save
Saving configuration to '/config/config.boot'...
Done
[edit]
vyos@uplink# exit
vyos@uplink:~$ reboot

After reboot:

vyos@uplink:~$ sh ip bgp sum
% BGP instance not found

Show protocols:

vyos@uplink# show protocols 
 bgp 65111 {
     neighbor 10.88.57.3 {
         remote-as 65001
     }
     neighbor 10.88.57.254 {
     }
 }
[edit]
vyos@uplink#

This bug I create on 2 versions

vyos@uplink# run show version 
Version:          VyOS 1.2.3
Built by:         Sentrium S.L.
Built on:         Fri 13 Sep 2019 11:15 UTC
Build UUID:       bb328444-2f89-4d39-8dab-068278c09194
Build Commit ID:  24f1a74bc88f3a

Latest rolling:

vyos@uplink# run show version 
Version:          VyOS 1.2-rolling-201910230349
Built by:         [email protected]
Built on:         Wed 23 Oct 2019 03:49 UTC
Build UUID:       737647df-a3d3-431c-b2e4-4ef8e0b78421
Build Commit ID:  25bb74bc51f7ee

Is it possible to make protection against "command save" if something wrong with commit?

Details

Version
VyOS 1.2-rolling-201910230349
Is it a breaking change?
Behavior change
Issue type
Feature (new functionality)

Event Timeline

Viacheslav renamed this task from Bgp instence not found after save/reboot to Bgp instance not found after save/reboot.Oct 23 2019, 1:14 PM

Whats happening here is that the non-commit-able session is saved to disk. because of this BGP will fail on reload because of illegal configuration on the peer. What needs to be done here is to disallow the save command when there are non-commited work in the session.. or at least give a clear warning about this with a [y/N] answer. is this possible to incorporate into vbash? @dmbaturin

syncer triaged this task as Normal priority.
syncer edited projects, added VyOS 1.3 Equuleus; removed VyOS 1.2 Crux.
erkin set Issue type to Bug (incorrect behavior).Aug 31 2021, 6:27 PM
dmbaturin renamed this task from Bgp instance not found after save/reboot to Disallow saving when there are non-committed changes in the session.Nov 9 2021, 5:05 AM
dmbaturin changed Is it a breaking change? from Unspecified (possibly destroys the router) to Behavior change.
dmbaturin changed Issue type from Bug (incorrect behavior) to improvement.
dmbaturin set Issue type to Feature (new functionality).Nov 8 2024, 10:50 AM

If this could be assigned to me, I am working on a patch that will prompt with ask_yes_no when session_changed() is true of the config, warning the user that the configuration has uncommitted changes and saving it may result in failure to load config on boot.

syncer subscribed.

Hey @insignia96
Give it a try and come back if you have questions or doubts
@Viacheslav @dmbaturin can you take a look and suggest if the approach suggested by @insignia96 is ok?

Thank you, this is my first actual contribution so please feel free let me know if this approach isn't the way you want to do it. If you point me in the right direction, I will implement it however you suggest. I mostly searched the source for other situations where VyOS asks this type of question and copied the idea.

Upon review, I don't think that this is still an issue any longer in the current rolling release. When saving the config, the effective/running config tree is fetched instead of the session config, and so the incomplete session configuration is not written to disk. The vyatta-bash package also provides a "Warning: you have uncommitted changes that will not be saved." message now when the session has non-committed configuration.