]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
networkd: route add MPLS TTL propagate 12586/head
authorSusant Sahani <ssahani@gmail.com>
Thu, 16 May 2019 09:49:08 +0000 (15:19 +0530)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Sat, 18 May 2019 01:30:41 +0000 (10:30 +0900)
man/systemd.network.xml
src/network/networkd-network-gperf.gperf
src/network/networkd-route.c
src/network/networkd-route.h
test/fuzz/fuzz-network-parser/directives.network

index dd0535a06ee1b5471d751d2c16436ae60e201439..4279326bc27bce8fdb89802d0760cc748193b671 100644 (file)
             </para>
           </listitem>
         </varlistentry>
+        <varlistentry>
+          <term><varname>TTLPropagate=</varname></term>
+          <listitem>
+            <para>Takes a boolean. When true enables TTL propagation at Label Switched Path (LSP) egress.
+            When unset, the kernel's default will be used.
+            </para>
+          </listitem>
+        </varlistentry>
         <varlistentry>
         <term><varname>MTUBytes=</varname></term>
         <listitem>
index 825fbf603a038a86e32703236f89e3720390202d..4d2f41fe400a1674a98cf9e3c8bdff0ca356f5ed 100644 (file)
@@ -130,6 +130,7 @@ Route.InitialCongestionWindow,          config_parse_tcp_window,
 Route.InitialAdvertisedReceiveWindow,   config_parse_tcp_window,                         0,                             0
 Route.QuickAck,                         config_parse_quickack,                           0,                             0
 Route.FastOpenNoCookie,                 config_parse_fast_open_no_cookie,                0,                             0
+Route.TTLPropagate,                     config_parse_route_ttl_propagate,                0,                             0
 DHCP.ClientIdentifier,                  config_parse_dhcp_client_identifier,             0,                             offsetof(Network, dhcp_client_identifier)
 DHCP.UseDNS,                            config_parse_bool,                               0,                             offsetof(Network, dhcp_use_dns)
 DHCP.UseNTP,                            config_parse_bool,                               0,                             offsetof(Network, dhcp_use_ntp)
index 24ef5b46bc728e3c393f4bfa4de5cc30f17312f1..b21e7dfd86f2a2c3be846b402111ba7b86a8204e 100644 (file)
@@ -61,6 +61,7 @@ int route_new(Route **ret) {
                 .quickack = -1,
                 .fast_open_no_cookie = -1,
                 .gateway_onlink = -1,
+                .ttl_propagate = -1,
         };
 
         *ret = TAKE_PTR(route);
@@ -617,6 +618,12 @@ int route_configure(
                         return log_link_error_errno(link, r, "Could not append RTA_OIF attribute: %m");
         }
 
+        if (route->ttl_propagate >= 0) {
+                r = sd_netlink_message_append_u8(req, RTA_TTL_PROPAGATE, route->ttl_propagate);
+                if (r < 0)
+                        return log_link_error_errno(link, r, "Could not append RTA_TTL_PROPAGATE attribute: %m");
+        }
+
         r = sd_netlink_message_open_container(req, RTA_METRICS);
         if (r < 0)
                 return log_link_error_errno(link, r, "Could not append RTA_METRICS attribute: %m");
@@ -1300,6 +1307,45 @@ int config_parse_route_mtu(
         return 0;
 }
 
+int config_parse_route_ttl_propagate(
+                const char *unit,
+                const char *filename,
+                unsigned line,
+                const char *section,
+                unsigned section_line,
+                const char *lvalue,
+                int ltype,
+                const char *rvalue,
+                void *data,
+                void *userdata) {
+
+        Network *network = userdata;
+        _cleanup_(route_free_or_set_invalidp) Route *n = NULL;
+        int r, k;
+
+        assert(filename);
+        assert(section);
+        assert(lvalue);
+        assert(rvalue);
+        assert(data);
+
+        r = route_new_static(network, filename, section_line, &n);
+        if (r < 0)
+                return r;
+
+        k = parse_boolean(rvalue);
+        if (k < 0) {
+                log_syntax(unit, LOG_ERR, filename, line, k,
+                           "Failed to parse TTLPropagate= value, ignoring: %s", rvalue);
+                return 0;
+        }
+
+        n->ttl_propagate = k;
+
+        TAKE_PTR(n);
+        return 0;
+}
+
 int route_section_verify(Route *route, Network *network) {
         if (section_is_invalid(route->section))
                 return -EINVAL;
index 4643f7785478cd265ffabeb9e376ff3fa77968c6..3c0ac896aea5a26961c11dea9cae0a6cd331fb2d 100644 (file)
@@ -18,6 +18,7 @@ struct Route {
         int family;
         int quickack;
         int fast_open_no_cookie;
+        int ttl_propagate;
 
         unsigned char dst_prefixlen;
         unsigned char src_prefixlen;
@@ -77,4 +78,5 @@ CONFIG_PARSER_PROTOTYPE(config_parse_route_type);
 CONFIG_PARSER_PROTOTYPE(config_parse_tcp_window);
 CONFIG_PARSER_PROTOTYPE(config_parse_quickack);
 CONFIG_PARSER_PROTOTYPE(config_parse_fast_open_no_cookie);
+CONFIG_PARSER_PROTOTYPE(config_parse_route_ttl_propagate);
 CONFIG_PARSER_PROTOTYPE(config_parse_route_mtu);
index 5861c41e757c42fa21f4df1a70c255ce02732f38..c905be0bcca05a44ccb05241d81b806cd21fc2b6 100644 (file)
@@ -83,6 +83,7 @@ QuickAck=
 FastOpenNoCookie=
 Source=
 Metric=
+TTLPropagate=
 [Network]
 IPv6DuplicateAddressDetection=
 IPMasquerade=