summaryrefslogtreecommitdiff
path: root/lib/command.c
diff options
context:
space:
mode:
authorDonald Lee <dlqs@gmx.com>2021-06-14 16:23:28 +0800
committerDonald Lee <dlqs@gmx.com>2021-06-22 05:02:12 +0800
commitbdc1085d7b84514f978e2752352c6ddd34bb88e0 (patch)
tree2af3319a66c8b9aa1b62320ef03d86f287a19181 /lib/command.c
parent3a3cfe4762753dbd5744acaa02153c49f6c73fe1 (diff)
lib: Update script SCRIPT command
Can now test out script by modifying a prefix Signed-off-by: Donald Lee <dlqs@gmx.com>
Diffstat (limited to 'lib/command.c')
-rw-r--r--lib/command.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/command.c b/lib/command.c
index 7be54907ed..d098c15211 100644
--- a/lib/command.c
+++ b/lib/command.c
@@ -2393,14 +2393,16 @@ DEFUN(script,
struct prefix p;
(void)str2prefix("1.2.3.4/24", &p);
-
struct frrscript *fs = frrscript_load(argv[1]->arg, NULL);
if (fs == NULL) {
vty_out(vty, "Script '/etc/frr/scripts/%s.lua' not found\n",
argv[1]->arg);
} else {
- int ret = frrscript_call(fs, NULL);
+ int ret = frrscript_call(fs, ("p", &p));
+ char buf[40];
+ prefix2str(&p, buf, sizeof(buf));
+ vty_out(vty, "p: %s\n", buf);
vty_out(vty, "Script result: %d\n", ret);
}