Rmerlin, after resetting my router to default and loading the saved config, my clock settings were *not* restored:
admin@RT-AC68U:/tmp/home/root# nvram show | fgrep clk
clkfreq=800,666
I had to manually set them in nvram again. Are you sure all nvram settings get saved in the config dump?
Absolutely positive, I even looked at the actual code tonight. In this particular case, the clkfreq setting does not get restored because it doesn't exist in the list of default values I mentioned and which gets checked at restore time. This is because there's no global default value for clkfreq, it varies for each models, so the default value comes from the CFE at the time you do a factory default reset.
When you do a factory default reset, two things happen:
1) A set of default, hardware-specific, values are applied to nvram
2) When the firmware boots, it applies its own set of default values on top of it
Secondly, command definitions in Cisco rarely change in what they actually do. I'm not familiar with using the web-based GUI because I always use the IOS CLI, if that's what you mean by user-facing API. On start up, you can always see if a particular command is depreciated or not supported in the version of IOS you're running. In the case something isn't working correctly, you can always search the release notes for that IOS version. I've been working with high-end Cisco routers for 15 years. I would disagree 100% that it's messier.
A friend told me how between two different IOS releases, one of his colleague got bit by the command he was previously using, who had suddenly become a shorthand for "shutdown interface" in an ew IOS release. The router required someone to go on-site to do a manual power cycle.
As to nvram, I'm not advocating not using it, what I'm advocating is not storing nvram settings in a configuration file that combines settings parameters entered in the configuration GUI. Save them to a different file so that you can actually use the restore procedure. Or like I said, set a bit in the configuration so that when the configuration is restored, any settings existing in nvram override those found in saved/restored configuration. That's an extremely simple thing to do and it prevents the very people you refer to from ending up with nvram device settings from older configs that jack with the new, default values set in newer FW releases.
It's not so simple when there are many hundreds of different settings. Quick count (which includes the instanced settings and temporary ones as well):
Code:
admin@Stargate87:/tmp/home/root# nvram show | wc -l
size: 54826 bytes (10710 left)
2155
Trying to be too clever with so many settings will lead to other bugs. That's where the KISS principle should apply.
So why did the bugs and weirdness go away after the reset and config restoration? And why didn't the clock settings get restored?
It depends on the cause of your specific issue. If you have an RT-AC68U (based on this thread's model), then you might have needed the new CFE value that came with the 1.0.2.0 CFE upgrade that happened with 376.3626, for instance.
As for clkfreq, I explained what happened to that particular setting.
What happens when a new nvram setting gets added to the firmware that doesn't exist in the saved config?
You end up with the default value, coming from either the CFE (if it's a new CFE setting) or from the shared/defaults.c list of default values (if it's a new firmware-level setting).