]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
networkd: type support for "throw" in [Route] section
authorHui Yiqun <i@huiyiqun.me>
Sat, 13 Oct 2018 06:01:47 +0000 (14:01 +0800)
committerLennart Poettering <lennart@poettering.net>
Tue, 16 Oct 2018 15:09:21 +0000 (17:09 +0200)
man/systemd.network.xml
src/network/networkd-route.c

index def6ad231549b25c46cf2203e8598f0b498eb5a8..2d18064e333f28f86b97972db9ea996ccab6770d 100644 (file)
             <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>
index f0b72c78f4ef95d22d4b65ec00d44070bd3364ad..e8a0efd076b869ffa91da01a3be95812d28c9c4e 100644 (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;