0
0
mirror of https://gitlab.nic.cz/labs/bird.git synced 2024-12-22 09:41:54 +00:00

Merge commit '231c6385' into thread-next-iface

This commit is contained in:
Maria Matejka 2023-04-14 14:00:54 +02:00
commit dc75d3e305
6 changed files with 24 additions and 28 deletions

View File

@ -1155,14 +1155,16 @@ This argument can be omitted if there exists only a single instance.
Show the list of symbols defined in the configuration (names of
protocols, routing tables etc.).
<tag><label id="cli-show-route">show route [[for] <m/prefix/|<m/IP/] [table (<m/t/ | all)] [(import|export) table <m/p/.<m/c/] [filter <m/f/|where <m/c/] [(export|preexport|noexport) <m/p/] [protocol <m/p/] [(stats|count)] [<m/options/]</tag>
<tag><label id="cli-show-route">show route [[(for|in)] <m/prefix/|for <m/IP/] [table (<m/t/|all)] [(import|export) table <m/p/.<m/c/] [filter <m/f/|where <m/cond/] [(export|preexport|noexport) <m/p/] [protocol <m/p/] [(stats|count)] [<m/options/]</tag>
Show contents of specified routing tables, that is routes, their metrics
and (in case the <cf/all/ switch is given) all their attributes.
<p>You can specify a <m/prefix/ if you want to print routes for a
specific network. If you use <cf>for <m/prefix or IP/</cf>, you'll get
the entry which will be used for forwarding of packets to the given
destination. By default, all routes for each network are printed with
destination. Finally, if you use <cf>in <m/prefix/</cf>, you get all
prefixes covered by the given prefix.
By default, all routes for each network are printed with
the selected one at the top, unless <cf/primary/ is given in which case
only the selected route is shown.

View File

@ -57,6 +57,19 @@ const u16 net_max_text_length[] = {
[NET_MPLS] = 7, /* "1048575" */
};
/* There should be no implicit padding in net_addr structures */
STATIC_ASSERT(sizeof(net_addr) == 24);
STATIC_ASSERT(sizeof(net_addr_ip4) == 8);
STATIC_ASSERT(sizeof(net_addr_ip6) == 20);
STATIC_ASSERT(sizeof(net_addr_vpn4) == 16);
STATIC_ASSERT(sizeof(net_addr_vpn6) == 32);
STATIC_ASSERT(sizeof(net_addr_roa4) == 16);
STATIC_ASSERT(sizeof(net_addr_roa6) == 28);
STATIC_ASSERT(sizeof(net_addr_flow4) == 8);
STATIC_ASSERT(sizeof(net_addr_flow6) == 20);
STATIC_ASSERT(sizeof(net_addr_ip6_sadr) == 40);
STATIC_ASSERT(sizeof(net_addr_mpls) == 8);
int
rd_format(const u64 rd, char *buf, int buflen)
@ -310,22 +323,3 @@ net_in_netX(const net_addr *a, const net_addr *n)
return (net_pxlen(n) <= net_pxlen(a)) && ipa_in_netX(net_prefix(a), n);
}
#define CHECK_NET(T,S) \
({ if (sizeof(T) != S) die("sizeof %s is %d/%d", #T, (int) sizeof(T), S); })
void
net_init(void)
{
CHECK_NET(net_addr, 24);
CHECK_NET(net_addr_ip4, 8);
CHECK_NET(net_addr_ip6, 20);
CHECK_NET(net_addr_vpn4, 16);
CHECK_NET(net_addr_vpn6, 32);
CHECK_NET(net_addr_roa4, 16);
CHECK_NET(net_addr_roa6, 28);
CHECK_NET(net_addr_flow4, 8);
CHECK_NET(net_addr_flow6, 20);
CHECK_NET(net_addr_ip6_sadr, 40);
CHECK_NET(net_addr_mpls, 8);
}

View File

@ -620,6 +620,4 @@ static inline int net_in_net_src_ip6_sadr(const net_addr_ip6_sadr *a, const net_
int ipa_in_netX(const ip_addr A, const net_addr *N);
int net_in_netX(const net_addr *A, const net_addr *N);
void net_init(void);
#endif

View File

@ -32,11 +32,14 @@ t_simple(void)
BSPRINTF(1, "@", buf, "@", 64);
BSPRINTF(1, "\xff", buf, "%c", 0xff);
errno = 5;
BSPRINTF(18, "Input/output error", buf, "%m");
const char *io_error_str = lp_strdup(tmp_linpool, strerror(EIO));
const int io_error_len = strlen(io_error_str);
errno = EIO;
BSPRINTF(io_error_len, io_error_str, buf, "%m");
errno = 0;
BSPRINTF(18, "Input/output error", buf, "%M", 5);
BSPRINTF(io_error_len, io_error_str, buf, "%M", EIO);
BSPRINTF(11, "TeSt%StRiNg", buf, "%s", "TeSt%StRiNg");

View File

@ -656,7 +656,7 @@ CF_CLI(SHOW INTERFACES SUMMARY,,, [[Show summary of network interfaces]])
{ if_show_summary(); } ;
CF_CLI_HELP(SHOW ROUTE, ..., [[Show routing table]])
CF_CLI(SHOW ROUTE, r_args, [[[<prefix>|for <prefix>|for <ip>] [table <t>] [(import|export) table <p>.<c>] [filter <f>|where <cond>] [all] [primary] [filtered] [(export|preexport|noexport) <p>] [protocol <p>] [stats|count]]], [[Show routing table]])
CF_CLI(SHOW ROUTE, r_args, [[[<prefix>|for <prefix>|for <ip>|in <prefix>] [table <t>] [(import|export) table <p>.<c>] [filter <f>|where <cond>] [all] [primary] [filtered] [(export|preexport|noexport) <p>] [protocol <p>] [stats|count]]], [[Show routing table]])
{ rt_show($3); } ;
r_args:

View File

@ -900,7 +900,6 @@ main(int argc, char **argv)
the_bird_lock();
random_init();
net_init();
resource_init();
birdloop_init();
olock_init();