]>
git.ipfire.org Git - thirdparty/bird.git/blob - nest/cmds.c
2 * BIRD Internet Routing Daemon -- CLI Commands Which Don't Fit Anywhere Else
4 * (c) 2000 Martin Mares <mj@ucw.cz>
6 * Can be freely distributed and used under the terms of the GNU GPL.
10 #include "nest/route.h"
12 #include "conf/conf.h"
13 #include "nest/cmds.h"
14 #include "lib/string.h"
15 #include "lib/resource.h"
16 #include "filter/filter.h"
18 extern int shutting_down
;
19 extern int configuring
;
24 byte tim
[TM_DATETIME_BUFFER_SIZE
];
26 cli_msg(-1000, "BIRD " BIRD_VERSION
);
27 tm_format_datetime(tim
, &config
->tf_base
, now
);
28 cli_msg(-1011, "Router ID is %R", config
->router_id
);
29 cli_msg(-1011, "Current server time is %s", tim
);
30 tm_format_datetime(tim
, &config
->tf_base
, boot_time
);
31 cli_msg(-1011, "Last reboot on %s", tim
);
32 tm_format_datetime(tim
, &config
->tf_base
, config
->load_time
);
33 cli_msg(-1011, "Last reconfiguration on %s", tim
);
36 cli_msg(13, "Shutdown in progress");
38 cli_msg(13, "Reconfiguration in progress");
40 cli_msg(13, "Daemon is up and running");
44 cmd_show_symbols(struct sym_show_data
*sd
)
47 struct symbol
*sym
= sd
->sym
;
50 cli_msg(1010, "%-8s\t%s", sym
->name
, cf_symbol_class_name(sym
));
53 while (sym
= cf_walk_symbols(config
, sym
, &pos
))
55 if (sd
->type
&& (sym
->class != sd
->type
))
58 cli_msg(-1010, "%-8s\t%s", sym
->name
, cf_symbol_class_name(sym
));
65 print_size(char *dsc
, size_t val
)
69 while ((val
>= 10000) && (i
< 3))
71 val
= (val
+ 512) / 1024;
75 cli_msg(-1018, "%-17s %4u %cB", dsc
, (unsigned) val
, px
[i
]);
78 extern pool
*rt_table_pool
;
79 extern pool
*rta_pool
;
80 extern pool
*roa_pool
;
81 extern pool
*proto_pool
;
86 cli_msg(-1018, "BIRD memory usage");
87 print_size("Routing tables:", rmemsize(rt_table_pool
));
88 print_size("Route attributes:", rmemsize(rta_pool
));
89 print_size("ROA tables:", rmemsize(roa_pool
));
90 print_size("Protocols:", rmemsize(proto_pool
));
91 print_size("Total:", rmemsize(&root_pool
));
96 cmd_eval(struct f_inst
*expr
)
98 struct f_val v
= f_eval(expr
, this_cli
->parser_pool
);
100 if (v
.type
== T_RETURN
)
102 cli_msg(8008, "runtime error");
107 LOG_BUFFER_INIT(buf
);
109 cli_msg(23, "%s", buf
.start
);