summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--man/systemd.network.xml4
-rw-r--r--src/network/networkd-route.c29
-rw-r--r--src/network/networkd-route.h2
3 files changed, 30 insertions, 5 deletions
diff --git a/man/systemd.network.xml b/man/systemd.network.xml
index c9d6fd4d72..712de7d718 100644
--- a/man/systemd.network.xml
+++ b/man/systemd.network.xml
@@ -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>
diff --git a/src/network/networkd-route.c b/src/network/networkd-route.c
index ddc0fe279f..a4b56ab46b 100644
--- a/src/network/networkd-route.c
+++ b/src/network/networkd-route.c
@@ -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
diff --git a/src/network/networkd-route.h b/src/network/networkd-route.h
index 86a7a82617..fda7ddedfa 100644
--- a/src/network/networkd-route.h
+++ b/src/network/networkd-route.h
@@ -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);