mirror of
https://github.com/systemd/systemd.git
synced 2025-02-24 17:57:34 +03:00
network: show known route protocol name nicely in debugging logs
This commit is contained in:
parent
eebaa72446
commit
ca420b6201
@ -1225,8 +1225,8 @@
|
||||
<term><varname>Protocol=</varname></term>
|
||||
<listitem>
|
||||
<para>The protocol identifier for the route. Takes a number between 0 and 255 or the special values
|
||||
<literal>kernel</literal>, <literal>boot</literal> and <literal>static</literal>. Defaults to
|
||||
<literal>static</literal>.
|
||||
<literal>kernel</literal>, <literal>boot</literal>, <literal>static</literal>,
|
||||
<literal>ra</literal> and <literal>dhcp</literal>. Defaults to <literal>static</literal>.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
@ -848,13 +848,38 @@ static const char * const route_protocol_table[] = {
|
||||
[RTPROT_STATIC] = "static",
|
||||
};
|
||||
|
||||
DEFINE_PRIVATE_STRING_TABLE_LOOKUP(route_protocol, int);
|
||||
DEFINE_PRIVATE_STRING_TABLE_LOOKUP_FROM_STRING(route_protocol, int);
|
||||
|
||||
static const char * const route_protocol_full_table[] = {
|
||||
[RTPROT_REDIRECT] = "redirect",
|
||||
[RTPROT_KERNEL] = "kernel",
|
||||
[RTPROT_BOOT] = "boot",
|
||||
[RTPROT_STATIC] = "static",
|
||||
[RTPROT_GATED] = "gated",
|
||||
[RTPROT_RA] = "ra",
|
||||
[RTPROT_MRT] = "mrt",
|
||||
[RTPROT_ZEBRA] = "zebra",
|
||||
[RTPROT_BIRD] = "bird",
|
||||
[RTPROT_DNROUTED] = "dnrouted",
|
||||
[RTPROT_XORP] = "xorp",
|
||||
[RTPROT_NTK] = "ntk",
|
||||
[RTPROT_DHCP] = "dhcp",
|
||||
[RTPROT_MROUTED] = "mrouted",
|
||||
[RTPROT_BABEL] = "babel",
|
||||
[RTPROT_BGP] = "bgp",
|
||||
[RTPROT_ISIS] = "isis",
|
||||
[RTPROT_OSPF] = "ospf",
|
||||
[RTPROT_RIP] = "rip",
|
||||
[RTPROT_EIGRP] = "eigrp",
|
||||
};
|
||||
|
||||
DEFINE_PRIVATE_STRING_TABLE_LOOKUP_TO_STRING(route_protocol_full, int);
|
||||
|
||||
const char *format_route_protocol(int protocol, char *buf, size_t size) {
|
||||
const char *s;
|
||||
char *p = buf;
|
||||
|
||||
s = route_protocol_to_string(protocol);
|
||||
s = route_protocol_full_to_string(protocol);
|
||||
if (s)
|
||||
strpcpy(&p, size, s);
|
||||
else
|
||||
|
@ -77,7 +77,7 @@ const char *format_route_scope(int scope, char *buf, size_t size);
|
||||
#define ROUTE_TABLE_STR_MAX CONST_MAX(DECIMAL_STR_MAX(int), STRLEN("default") + 1)
|
||||
const char *format_route_table(int table, char *buf, size_t size);
|
||||
|
||||
#define ROUTE_PROTOCOL_STR_MAX CONST_MAX(DECIMAL_STR_MAX(int), STRLEN("kernel") + 1)
|
||||
#define ROUTE_PROTOCOL_STR_MAX CONST_MAX(DECIMAL_STR_MAX(int), STRLEN("redirect") + 1)
|
||||
const char *format_route_protocol(int protocol, char *buf, size_t size);
|
||||
|
||||
CONFIG_PARSER_PROTOTYPE(config_parse_gateway);
|
||||
|
Loading…
x
Reference in New Issue
Block a user