diff options
Diffstat (limited to 'nest')
-rw-r--r-- | nest/a-set.c | 4 | ||||
-rw-r--r-- | nest/cli.c | 36 | ||||
-rw-r--r-- | nest/cli.h | 2 | ||||
-rw-r--r-- | nest/cmds.c | 1 | ||||
-rw-r--r-- | nest/rt-attr.c | 6 |
5 files changed, 28 insertions, 21 deletions
diff --git a/nest/a-set.c b/nest/a-set.c index 505c0e5..fad4481 100644 --- a/nest/a-set.c +++ b/nest/a-set.c @@ -34,9 +34,7 @@ int_set_format(struct adata *set, int way, byte *buf, unsigned int size) if (way) buf += bsprintf(buf, "(%d,%d)", *z >> 16, *z & 0xffff); else - buf += bsprintf(buf, "%d.%d.%d.%d", - (*z >> 24) & 0xff, (*z >> 16) & 0xff, - (*z >> 8) & 0xff, *z & 0xff); + buf += bsprintf(buf, "%R", *z); z++; sp = 0; @@ -47,6 +47,20 @@ * The @this_cli variable points to a &cli structure of the session being * currently parsed, but it's of course available only in command handlers * not entered using the @cont hook. + * + * TX buffer management works as follows: At cli.tx_buf there is a + * list of TX buffers (struct cli_out), cli.tx_write is the buffer + * currently used by the producer (cli_printf(), cli_alloc_out()) and + * cli.tx_pos is the buffer currently used by the consumer + * (cli_write(), in system dependent code). The producer uses + * cli_out.wpos ptr as the current write position and the consumer + * uses cli_out.outpos ptr as the current read position. When the + * producer produces something, it calls cli_write_trigger(). If there + * is not enough space in the current buffer, the producer allocates + * the new one. When the consumer processes everything in the buffer + * queue, it calls cli_written(), tha frees all buffers (except the + * first one) and schedules cli.event . + * */ #include "nest/bird.h" @@ -196,6 +210,14 @@ cli_free_out(cli *c) c->async_msg_size = 0; } +void +cli_written(cli *c) +{ + cli_free_out(c); + ev_schedule(c->event); +} + + static byte *cli_rh_pos; static unsigned int cli_rh_len; static int cli_rh_trick_flag; @@ -263,11 +285,8 @@ cli_event(void *data) else cli_command(c); } - if (cli_write(c)) - { - cli_free_out(c); - ev_schedule(c->event); - } + + cli_write_trigger(c); } cli * @@ -296,13 +315,6 @@ cli_kick(cli *c) ev_schedule(c->event); } -void -cli_written(cli *c) -{ - cli_free_out(c); - ev_schedule(c->event); -} - static list cli_log_hooks; static int cli_log_inited; @@ -62,7 +62,7 @@ void cli_echo(unsigned int class, byte *msg); /* Functions provided by sysdep layer */ -int cli_write(cli *); +void cli_write_trigger(cli *); int cli_get_command(cli *); #endif diff --git a/nest/cmds.c b/nest/cmds.c index ac537c8..faed870 100644 --- a/nest/cmds.c +++ b/nest/cmds.c @@ -19,6 +19,7 @@ cmd_show_status(void) cli_msg(-1000, "BIRD " BIRD_VERSION); tm_format_datetime(tim, now); + cli_msg(-1011, "Router ID is %R", config->router_id); cli_msg(-1011, "Current server time is %s", tim); tm_format_datetime(tim, boot_time); cli_msg(-1011, "Last reboot on %s", tim); diff --git a/nest/rt-attr.c b/nest/rt-attr.c index 2318f80..de63198 100644 --- a/nest/rt-attr.c +++ b/nest/rt-attr.c @@ -419,11 +419,7 @@ ea_format(eattr *e, byte *buf) bsprintf(buf, "%I", *(ip_addr *) ad->data); break; case EAF_TYPE_ROUTER_ID: - bsprintf(buf, "%d.%d.%d.%d", - (e->u.data >> 24) & 0xff, - (e->u.data >> 16) & 0xff, - (e->u.data >> 8) & 0xff, - e->u.data & 0xff); + bsprintf(buf, "%R", e->u.data); break; case EAF_TYPE_AS_PATH: as_path_format(ad, buf, end - buf); |