From d9f32726b46665165b9004797aebd58c7f2b03f4 Mon Sep 17 00:00:00 2001 From: Michael Brown Date: Mon, 4 Dec 2006 23:40:35 +0000 Subject: [PATCH] Added quick and dirty commands for testing the new NVO code. --- src/commandline/commands/nvo_cmd.c | 68 ++++++++++++++++++++++++++++++ src/core/main.c | 2 +- src/core/nvo.c | 9 +++- src/include/cmdlist.h | 6 ++- 4 files changed, 81 insertions(+), 4 deletions(-) create mode 100644 src/commandline/commands/nvo_cmd.c diff --git a/src/commandline/commands/nvo_cmd.c b/src/commandline/commands/nvo_cmd.c new file mode 100644 index 00000000..3eb0059e --- /dev/null +++ b/src/commandline/commands/nvo_cmd.c @@ -0,0 +1,68 @@ +#include +#include +#include +#include +#include +#include +#include +#include + +void nvo_cmd_req() {} + +extern struct nvo_block *ugly_nvo_hack; + +static int show_exec ( int argc, char **argv ) { + + if ( ! ugly_nvo_hack ) { + printf ( "No non-volatile option storage available\n" ); + return 1; + } + + hex_dump ( ugly_nvo_hack->options->data, + ugly_nvo_hack->options->len ); +} + +struct command show_command __command = { + .name = "show", + .usage = "show\n", + .desc = "Show stored options", + .exec = show_exec, +}; + +static int set_exec ( int argc, char **argv ) { + unsigned long tag; + struct dhcp_option *option; + + if ( ! ugly_nvo_hack ) { + printf ( "No non-volatile option storage available\n" ); + return 1; + } + + if ( argc != 3 ) { + printf ( "Syntax: %s