networkd: type support for "throw" in [Route] section

This commit is contained in:
Hui Yiqun 2018-10-13 14:01:47 +08:00 committed by Lennart Poettering
parent a53f90ca24
commit 2d53f310de
2 changed files with 8 additions and 3 deletions

View File

@ -1091,7 +1091,10 @@
<literal>blackhole</literal> packets are discarded silently,
<literal>unreachable</literal> packets are discarded and the ICMP message host unreachable is generated,
<literal>prohibit</literal> packets are discarded and the ICMP message communication administratively
prohibited is generated. Defaults to <literal>unicast</literal>.
prohibited is generated,
if <literal>throw</literal> the lookup in current routing table will fail and routing selection process
will returns to Routing Policy Database.
Defaults to <literal>unicast</literal>.
</para>
</listitem>
</varlistentry>

View File

@ -433,7 +433,7 @@ int route_remove(Route *route, Link *link,
if (r < 0)
return log_error_errno(r, "Could not append RTA_PRIORITY attribute: %m");
if (!IN_SET(route->type, RTN_UNREACHABLE, RTN_PROHIBIT, RTN_BLACKHOLE)) {
if (!IN_SET(route->type, RTN_UNREACHABLE, RTN_PROHIBIT, RTN_BLACKHOLE, RTN_THROW)) {
r = sd_netlink_message_append_u32(req, RTA_OIF, link->ifindex);
if (r < 0)
return log_error_errno(r, "Could not append RTA_OIF attribute: %m");
@ -582,7 +582,7 @@ int route_configure(
if (r < 0)
return log_error_errno(r, "Could not set route type: %m");
if (!IN_SET(route->type, RTN_UNREACHABLE, RTN_PROHIBIT, RTN_BLACKHOLE)) {
if (!IN_SET(route->type, RTN_UNREACHABLE, RTN_PROHIBIT, RTN_BLACKHOLE, RTN_THROW)) {
r = sd_netlink_message_append_u32(req, RTA_OIF, link->ifindex);
if (r < 0)
return log_error_errno(r, "Could not append RTA_OIF attribute: %m");
@ -1045,6 +1045,8 @@ int config_parse_route_type(
n->type = RTN_UNREACHABLE;
else if (streq(rvalue, "prohibit"))
n->type = RTN_PROHIBIT;
else if (streq(rvalue, "throw"))
n->type = RTN_THROW;
else {
log_syntax(unit, LOG_ERR, filename, line, r, "Could not parse route type \"%s\", ignoring assignment: %m", rvalue);
return 0;