settings backup conversion tool?

Post new topic   Reply to topic    DD-WRT Forum Index -> Broadcom SoC based Hardware
Goto page 1, 2  Next
Author Message
yugiohdan6
DD-WRT Novice


Joined: 23 Sep 2007
Posts: 19

PostPosted: Mon Jun 09, 2008 22:24    Post subject: settings backup conversion tool? Reply with quote
since the setting backup files can't be restored from version to version how about a conversion tool?

i'd imagine it can't be THAT hard to make... (this coming from someone who generally sucks at programming in anything other than vb.net)
Sponsor
niconet
DD-WRT User


Joined: 29 Apr 2008
Posts: 74
Location: Sangolqui, Ecuador

PostPosted: Tue Jun 10, 2008 0:26    Post subject: Re: settings backup conversion tool? Reply with quote
yugiohdan6 wrote:
since the setting backup files can't be restored from version to version how about a conversion tool?

i'd imagine it can't be THAT hard to make... (this coming from someone who generally sucks at programming in anything other than vb.net)


Yeah... File format is simple... File header is "DD-WRT" then two bytes which is short int and means number of saved records, after that records of saved parameters from NVRAM, format is next:

1. one byte (binary) - length of parameter name
2. parameter name - ASCII text, name its self
3. two bytes (binary) - length of parameter value
4. parameters' value - always ASCII text

Note: if not value exists, then field 3 will be 0x00 0x00 and field 4 will not be exist (sure, because it's zero length).

So, format has not been changed during all of the versions because it is just simple ANSY C style array class save method.

Difference between versions (as well between builds as mini, standard, VoIP, VPN, etc) is data it's self - NVRAM parameters. So, if you prety sure about list of NVRAM parameters and difference between versions you may make this converter in VB as well ;)

But, really I see unusable to make converter between mini and standard or v23 and v24... Any where should be counted dependencies of build and revision features...

Yes, during upgrade it is reasonable but here is question as well - for what? I have upgraded wrt from v23SP2 to v24RC7 and did not have any issues when left "Don't reset parameters"...

_________________
WRT54G v8.2 x 1, WRT54GL v1.1 x 3, WAP54G v3.1 x 6
DD-WRT v24 build 11296M NEWD Eko
ChilliSpot,FreeRADIUS
redhawk0
DD-WRT Guru


Joined: 04 Jan 2007
Posts: 11563
Location: Wherever the wind blows- North America

PostPosted: Tue Jun 10, 2008 0:53    Post subject: Re: settings backup conversion tool? Reply with quote
yugiohdan6 wrote:
since the setting backup files can't be restored from version to version how about a conversion tool?

i'd imagine it can't be THAT hard to make... (this coming from someone who generally sucks at programming in anything other than vb.net)


Unfortunately, it is that hard to make. From RC to RC build there were different nvram variables....from V23, v23 sp1, v23 sp2 and v23 sp3 then to v24 there were different nvram variables....it is impossible to come up with every combination of build to build for an nvram conversion.

It has been policy and still remains policy that if you are upgrading/downgrading firmware.....hard reset before and after each firmware load to clear the nvram variables before configuring.

It only takes an extra 3 minutes to clear them out (90 seconds before and 90 seconds after) to ensure you have a good firmware flash.

redhawk

_________________
The only stupid question....is the unasked one.
digidax
DD-WRT Novice


Joined: 16 Jun 2008
Posts: 7

PostPosted: Tue Jun 17, 2008 14:42    Post subject: Reply with quote
Yes, a simple tool to convert nvram parameters to a csv file would be open a great amount of ways to compare it between the different versions.
mbellot
DD-WRT User


Joined: 13 Jun 2006
Posts: 64

PostPosted: Tue Jun 17, 2008 20:58    Post subject: Re: settings backup conversion tool? Reply with quote
redhawk0 wrote:
It only takes an extra 3 minutes to clear them out (90 seconds before and 90 seconds after) to ensure you have a good firmware flash.


Its not the time to do the hard reset, its the time required to reconfigure all the settings and making sure you have remembered all of them (for those of us who keep poor records).

Just having a way to convert the settings file to simple readable text would be helpful to use as a roadmap when going through the configuration, so I think I'm going to try to whip one out.

_________________
WRT54GL modded to 32MB DRAM and 16MB Flash. Very Happy
mbellot
DD-WRT User


Joined: 13 Jun 2006
Posts: 64

PostPosted: Wed Jun 18, 2008 4:29    Post subject: Reply with quote
Here's a first cut (alpha release would be overly generous).

At niconet's suggestion, it's been written in VB6. :lol:

I can guarantee it has issues with multi-line values (such as scripts stored in rc_startup). The info is all there, its just not real pretty.



dd-wrt_nvram2csv.zip
 Description:
NVRAM to CSV converter, use at your own risk!

Download
 Filename:  dd-wrt_nvram2csv.zip
 Filesize:  4.77 KB
 Downloaded:  2081 Time(s)


_________________
WRT54GL modded to 32MB DRAM and 16MB Flash. Very Happy
digidax
DD-WRT Novice


Joined: 16 Jun 2008
Posts: 7

PostPosted: Wed Jun 18, 2008 8:42    Post subject: Reply with quote
Congratulation AND THANKS A LOT, great Tool and nice working.
If someone gets an error msg during starting the prog (Win2kSP4) about missing COMDLG32.OCX, do the following:

1. download attaced file
2. extract comdlg32.ocx to %Systemroot%\System32 folder
3. type the following command from Start, Run dialog:

Code:
regsvr32  %Systemroot%\System32\comdlg32.ocx


You should see the following message:

DllRegisterServer in C:\WINDOWS\System32 \comdlg32.ocx succeeded.



Comdlg32.zip
 Description:

Download
 Filename:  Comdlg32.zip
 Filesize:  57.66 KB
 Downloaded:  1568 Time(s)

mbellot
DD-WRT User


Joined: 13 Jun 2006
Posts: 64

PostPosted: Wed Jun 18, 2008 18:44    Post subject: Reply with quote
Here's a quick update to fix some minor problems (settings longer than 1024 characters were being truncated) and a couple new features.

1. Multi-line settings (like rc_startup) have line feeds replaced by a caret (^) in the CSV file, both for readability and editing (see #2)
2. I've added routines to convert a CSV back to a bin file.

In theory, you should be able to:

1. Backup your existing settings
2. Convert them to CSV
3. Upgrade to a new version
4. Create a new (default) NVRAM backup to capture all the variable names and make a new CSV.
5. Using a text editor cut and paste important settings from your old CSV to the new CSV
6. Convert the new CSV back to a bin file, upload it to your router and have your pre-upgrade settings recovered.

I have NOT tested this completely, but (with my one bin file) I have verified round trip conversion (bin->csv->bin) results in an identical bin file to what came off the router.

Proceed with caution since there has been only minimal testing done and let me know if you find anything that breaks it.



dd-wrt_nvram2csv.zip
 Description:
Version 1.1 adds bin file creation from a CSV file

Download
 Filename:  dd-wrt_nvram2csv.zip
 Filesize:  7.1 KB
 Downloaded:  1913 Time(s)


_________________
WRT54GL modded to 32MB DRAM and 16MB Flash. Very Happy
digidax
DD-WRT Novice


Joined: 16 Jun 2008
Posts: 7

PostPosted: Wed Jun 18, 2008 20:48    Post subject: Reply with quote
So I will do test it tomorrorw. Thanks.
Here a quick idea: How do you think about a 2nd vertical window, to compare two loaded configurations inside the tool and scroll it down parallel? If the parameter lines are identical, the background color should be light green. If this parameter in one configuration missed or not set, the background color should be light yellow and finally if the parameters are different, e.g. different IP adresses, the background color should be light red. So it should be possibel to compare changed parameters between two different backuped settings in changed firmewares. The next advance: If someone administrate a whole pool of WRT's, he can make very easy some clones, only changeging the target parameters like IP addresses.

best regards
Frank
mbellot
DD-WRT User


Joined: 13 Jun 2006
Posts: 64

PostPosted: Thu Jun 19, 2008 2:00    Post subject: Reply with quote
AZ - "Not Set" is indicative of nico's statement:

Quote:
Note: if not value exists, then field 3 will be 0x00 0x00 and field 4 will not be exist (sure, because it's zero length).


So, for example, if you are on a cable modem with DHCP you (probably) wouldn't have a ppoe_username valuein your NVRAM settings.

The variable will be defined, but it will have a null value.

So, if a variable has field three (length of setting) set to 0x0000 (zero length, not defined) then field four (the actual value for the variable) does not exist. I flag this case with the "Not Set" since there is no value present.

A "default" value is not necessarily "Not Set" (ie. "chilli_interface" defaults to "wan" even if chilli is disabled).

Adding a comparison feature could easily be beyond my pitiful skills, not to mention VB6's data manipulation capacity.

Not to mention, I have but one WRT54 so comparisons are going to come up with minimal differences. Still, we'll see what comes to pass.

_________________
WRT54GL modded to 32MB DRAM and 16MB Flash. Very Happy
mbellot
DD-WRT User


Joined: 13 Jun 2006
Posts: 64

PostPosted: Thu Jun 19, 2008 13:05    Post subject: Reply with quote
AZImmortal wrote:
Thanks for clearing that up. I guess my question was whether or not "Not Set" indicated that that particular parameter was at its default (null) value, which from your explanation sounds like it is, but please correct me if I'm wrong. Also, for the fields that are completely blank (without "Not Set"), then are those values null as well?


"Not Set" means there is no value.

If the default (for example, static dhcp clients)is null (no static clients) then the variable will be "Not Set".

If the default (for example, snmpd_enable) is something (disabled in this case) then there will be a value in the CSV file for the variable (0 in this case, since 0 denotes disabled).

Does that make sense?

_________________
WRT54GL modded to 32MB DRAM and 16MB Flash. Very Happy
digidax
DD-WRT Novice


Joined: 16 Jun 2008
Posts: 7

PostPosted: Sat Jul 05, 2008 21:52    Post subject: Reply with quote
@mbellot:

did you had any time to implement the compare and highlight tools?

best
Frank
00diabolic
DD-WRT User


Joined: 17 Aug 2011
Posts: 78

PostPosted: Thu Apr 22, 2021 15:56    Post subject: Thread back from the Dead Reply with quote
Hi all,

I was hoping this tread could be revived but in any case I plan to use this tool with beyond compare, so I can find what setting I'm missing in my config that breaks something I need. Anyway try beyond compare with the CSV converted and you should be able to see what setting you forgot to set.

Update: Comparing via beyond compare wont work because the lines move between builds so its impossible to get a good comparision of what is really different. Sad

Update 2: I may have found a way to re-align the differences in the CSV, in beyond compare there is a setting under rules alignment and you can match by closeness. It takes the lines and matches them back up. I am checking to see if I can then copy from one side to the other without messing up the file. Will see.
yoyoma2
DD-WRT User


Joined: 24 Sep 2016
Posts: 371

PostPosted: Sun Apr 25, 2021 4:37    Post subject: Reply with quote
You could look into the nvram-save utility which is included with easyddup. It creates human readable/editable text backups. Full or partial settings can be restored.
00diabolic
DD-WRT User


Joined: 17 Aug 2011
Posts: 78

PostPosted: Wed Apr 28, 2021 17:20    Post subject: Reply with quote
yoyoma2 wrote:
You could look into the nvram-save utility which is included with easyddup. It creates human readable/editable text backups. Full or partial settings can be restored.


WOW ill check it out.. THANKS
Goto page 1, 2  Next Display posts from previous:    Page 1 of 2
Post new topic   Reply to topic    DD-WRT Forum Index -> Broadcom SoC based Hardware All times are GMT

Navigation

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum