-
Notifications
You must be signed in to change notification settings - Fork 37
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
What do router_defaults and Nvrams refer to?and how to run test.c? #1
Comments
The prototype for the TABLE macro is on nvram.c#L25. Essentially, some firmware have a global symbol that provide a key-value pair list of default values, which is why it is declared as an external weak symbol. This is also discussed on pg. 7 of the paper. The test file isn't super usable, but you can compile it as follows. It's a little invasive at runtime though, it'll assume that the mount point
|
Recently, I have used the Also, I came across an issue: some values in Lines 571 to 595 in 68ad8e9
The order of call to In my case, I changed the order of call to
#define NATIVE(a, b) \
if (!system(a)) { \
PRINT_MSG("Executing native call to built-in function: %s (%p) = %d!\n", #b, b, b); \
}
#define TABLE(a) \
PRINT_MSG("Checking for symbol \"%s\"...\n", #a); \
if (a) { \
PRINT_MSG("Loading from native built-in table: %s (%p) = %d!\n", #a, a, nvram_set_default_table(a)); \
}
#define PATH(a) \
if (!access(a, R_OK)) { \
PRINT_MSG("Loading from default configuration file: %s = %d!\n", a, foreach_nvram_from(a, (void (*)(const char *, const char *, void *)) nvram_set, NULL)); \
}
NVRAM_DEFAULTS_PATH
#undef PATH
#undef NATIVE
#undef TABLE
// move it to here
PRINT_MSG("Loading built-in default values = %d!\n", nvram_set_default_builtin()); |
Yeah I think the assumption behind that ordering was that the device-specific default symbols should be preferred over any generic pre-defined defaults from the config file. However, they should all be less preferable than the overrides, which are set last. |
Hello,I want to know how to emulate a hardware NVRAM peripheral and i get two questions after reading the libnvram's code:
1: in config.h
#def NVRAM_DEFAULTS_PATH
TABLE (router_defaults)
TABLE (Nvrams)
What do router_defaults and Nvrams refer to? I did not find their definitions.
2: how to run test.c in libnvram
Thanks for the answer
The text was updated successfully, but these errors were encountered: