]>
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/protocol.h"
11 #include "nest/route.h"
13 #include "conf/conf.h"
14 #include "nest/cmds.h"
15 #include "lib/string.h"
16 #include "lib/resource.h"
17 #include "filter/filter.h"
19 extern int shutting_down
;
20 extern int configuring
;
25 byte tim
[TM_DATETIME_BUFFER_SIZE
];
27 cli_msg(-1000, "BIRD " BIRD_VERSION
);
28 tm_format_datetime(tim
, &config
->tf_base
, now
);
29 cli_msg(-1011, "Router ID is %R", config
->router_id
);
30 cli_msg(-1011, "Current server time is %s", tim
);
31 tm_format_datetime(tim
, &config
->tf_base
, boot_time
);
32 cli_msg(-1011, "Last reboot on %s", tim
);
33 tm_format_datetime(tim
, &config
->tf_base
, config
->load_time
);
34 cli_msg(-1011, "Last reconfiguration on %s", tim
);
36 graceful_restart_show_status();
39 cli_msg(13, "Shutdown in progress");
41 cli_msg(13, "Reconfiguration in progress");
43 cli_msg(13, "Daemon is up and running");
47 cmd_show_symbols(struct sym_show_data
*sd
)
50 cli_msg(1010, "%-8s\t%s", sd
->sym
->name
, cf_symbol_class_name(sd
->sym
));
53 HASH_WALK(config
->sym_hash
, next
, sym
)
55 if (!sym
->scope
->active
)
58 if (sd
->type
&& (sym
->class != sd
->type
))
61 cli_msg(-1010, "%-8s\t%s", sym
->name
, cf_symbol_class_name(sym
));
70 print_size(char *dsc
, size_t val
)
74 while ((val
>= 10000) && (i
< 3))
76 val
= (val
+ 512) / 1024;
80 cli_msg(-1018, "%-17s %4u %cB", dsc
, (unsigned) val
, px
[i
]);
83 extern pool
*rt_table_pool
;
84 extern pool
*rta_pool
;
85 extern pool
*roa_pool
;
86 extern pool
*proto_pool
;
91 cli_msg(-1018, "BIRD memory usage");
92 print_size("Routing tables:", rmemsize(rt_table_pool
));
93 print_size("Route attributes:", rmemsize(rta_pool
));
94 print_size("ROA tables:", rmemsize(roa_pool
));
95 print_size("Protocols:", rmemsize(proto_pool
));
96 print_size("Total:", rmemsize(&root_pool
));
101 cmd_eval(struct f_inst
*expr
)
103 struct f_val v
= f_eval(expr
, this_cli
->parser_pool
);
105 if (v
.type
== T_RETURN
)
107 cli_msg(8008, "runtime error");
112 LOG_BUFFER_INIT(buf
);
114 cli_msg(23, "%s", buf
.start
);