Package: systemd
Version: 232-25+deb9u1
Severity: important
Tags: patch ipv6

Hi,

A customer of mine reported a regression by switching from jessie to
stretch: /etc/systemd/network/eth.network is configured to only set up
IPv4, and systemd in jessie used to do only that, and not to touch IPv6
at all:
| [Match]
| Name=eth0
| [Network]
| Address=192.168.42.202/24
| Gateway=192.168.42.1
| DNS=192.168.42.200

Anyway: accept_ra_mtu defaults to true, is set to true on the target
system, but systemd doesn't honour MTU settings, and defaults to the
interface's MTU for the IPv6 routes it sets up.

This is fixed upstream between 232 and 233:
| commit d6fceaf1f7ff765bdc3b135f3d3676ec689da312
| Author: Susant Sahani <ssah...@users.noreply.github.com>
| Date:   Thu Nov 24 03:02:19 2016 +0530
| 
|     networkd: handle MTU field in IPv6 RA (#4719)
|     
|     This patch handles the custom MTU field in IPv6 RA.
|     
|     fixes RFE #4464

I haven't checked that the Debian packages in buster/unstable indeed
avoid running into this issue, but I've confirmed that cherry-picking
this patch on top of the stretch package fixes this issue. I'm attaching
the source debdiff which was successfully tested.

Thanks for considering a fix through stretch-proposed-updates.

Cheers,
-- 
Cyril Brulebois -- Debian Consultant @ DEBAMAX -- https://debamax.com/
diff -Nru systemd-232/debian/changelog systemd-232/debian/changelog
--- systemd-232/debian/changelog	2017-07-05 20:31:25.000000000 +0000
+++ systemd-232/debian/changelog	2017-10-10 15:07:14.000000000 +0000
@@ -1,3 +1,10 @@
+systemd (232-25+deb9u2) stretch; urgency=medium
+
+  * networkd-handle-MTU-field-in-IPv6-RA-4719.patch: Cherry-pick commit
+    d6fceaf1f7 to handle MTU field in IPv6 RA.
+
+ -- Cyril Brulebois <cy...@debamax.com>  Tue, 10 Oct 2017 15:07:14 +0000
+
 systemd (232-25+deb9u1) stretch; urgency=medium
 
   [ Dimitri John Ledkov ]
diff -Nru systemd-232/debian/patches/networkd-handle-MTU-field-in-IPv6-RA-4719.patch systemd-232/debian/patches/networkd-handle-MTU-field-in-IPv6-RA-4719.patch
--- systemd-232/debian/patches/networkd-handle-MTU-field-in-IPv6-RA-4719.patch	1970-01-01 00:00:00.000000000 +0000
+++ systemd-232/debian/patches/networkd-handle-MTU-field-in-IPv6-RA-4719.patch	2017-10-10 15:04:02.000000000 +0000
@@ -0,0 +1,133 @@
+From d6fceaf1f7ff765bdc3b135f3d3676ec689da312 Mon Sep 17 00:00:00 2001
+From: Susant Sahani <ssah...@users.noreply.github.com>
+Date: Thu, 24 Nov 2016 03:02:19 +0530
+Subject: [PATCH] networkd: handle MTU field in IPv6 RA (#4719)
+
+This patch handles the custom MTU field in IPv6 RA.
+
+fixes RFE #4464
+---
+ src/libsystemd/sd-netlink/netlink-types.c | 27 ++++++++++++++++++++++++---
+ src/network/networkd-ndisc.c              |  8 ++++++++
+ src/network/networkd-route.c              | 14 ++++++++++++++
+ src/network/networkd-route.h              |  1 +
+ 4 files changed, 47 insertions(+), 3 deletions(-)
+
+diff --git a/src/libsystemd/sd-netlink/netlink-types.c b/src/libsystemd/sd-netlink/netlink-types.c
+index 1c10dd55a..0f8b0cc70 100644
+--- a/src/libsystemd/sd-netlink/netlink-types.c
++++ b/src/libsystemd/sd-netlink/netlink-types.c
+@@ -500,6 +500,28 @@ static const NLTypeSystem rtnl_address_type_system = {
+         .types = rtnl_address_types,
+ };
+ 
++/* RTM_METRICS --- array of struct rtattr with types of RTAX_* */
++
++static const NLType rtnl_route_metrics_types[] = {
++        [RTAX_MTU]               = { .type = NETLINK_TYPE_U32 },
++        [RTAX_WINDOW]            = { .type = NETLINK_TYPE_U32 },
++        [RTAX_RTT]               = { .type = NETLINK_TYPE_U32 },
++        [RTAX_RTTVAR]            = { .type = NETLINK_TYPE_U32 },
++        [RTAX_SSTHRESH]          = { .type = NETLINK_TYPE_U32 },
++        [RTAX_CWND]              = { .type = NETLINK_TYPE_U32 },
++        [RTAX_ADVMSS]            = { .type = NETLINK_TYPE_U32 },
++        [RTAX_REORDERING]        = { .type = NETLINK_TYPE_U32 },
++        [RTAX_HOPLIMIT]          = { .type = NETLINK_TYPE_U32 },
++        [RTAX_INITCWND]          = { .type = NETLINK_TYPE_U32 },
++        [RTAX_FEATURES]          = { .type = NETLINK_TYPE_U32 },
++        [RTAX_RTO_MIN]           = { .type = NETLINK_TYPE_U32 },
++};
++
++static const NLTypeSystem rtnl_route_metrics_type_system = {
++        .count = ELEMENTSOF(rtnl_route_metrics_types),
++        .types = rtnl_route_metrics_types,
++};
++
+ static const NLType rtnl_route_types[] = {
+         [RTA_DST]               = { .type = NETLINK_TYPE_IN_ADDR }, /* 6? */
+         [RTA_SRC]               = { .type = NETLINK_TYPE_IN_ADDR }, /* 6? */
+@@ -508,9 +530,8 @@ static const NLType rtnl_route_types[] = {
+         [RTA_GATEWAY]           = { .type = NETLINK_TYPE_IN_ADDR },
+         [RTA_PRIORITY]          = { .type = NETLINK_TYPE_U32 },
+         [RTA_PREFSRC]           = { .type = NETLINK_TYPE_IN_ADDR }, /* 6? */
+-/*
+-        [RTA_METRICS]           = { .type = NETLINK_TYPE_NESTED },
+-        [RTA_MULTIPATH]         = { .len = sizeof(struct rtnexthop) },
++        [RTA_METRICS]           = { .type = NETLINK_TYPE_NESTED, .type_system = &rtnl_route_metrics_type_system},
++/*      [RTA_MULTIPATH]         = { .len = sizeof(struct rtnexthop) },
+ */
+         [RTA_FLOW]              = { .type = NETLINK_TYPE_U32 }, /* 6? */
+ /*
+diff --git a/src/network/networkd-ndisc.c b/src/network/networkd-ndisc.c
+index 70283e534..5320592f7 100644
+--- a/src/network/networkd-ndisc.c
++++ b/src/network/networkd-ndisc.c
+@@ -56,6 +56,7 @@ static void ndisc_router_process_default(Link *link, sd_ndisc_router *rt) {
+         struct in6_addr gateway;
+         uint16_t lifetime;
+         unsigned preference;
++        uint32_t mtu;
+         usec_t time_now;
+         int r;
+         Address *address;
+@@ -116,6 +117,12 @@ static void ndisc_router_process_default(Link *link, sd_ndisc_router *rt) {
+                 return;
+         }
+ 
++        r = sd_ndisc_router_get_mtu(rt, &mtu);
++        if (r < 0) {
++                log_link_warning_errno(link, r, "Failed to get default router MTU from RA: %m");
++                return;
++        }
++
+         r = route_new(&route);
+         if (r < 0) {
+                 log_link_error_errno(link, r, "Could not allocate route: %m");
+@@ -128,6 +135,7 @@ static void ndisc_router_process_default(Link *link, sd_ndisc_router *rt) {
+         route->pref = preference;
+         route->gw.in6 = gateway;
+         route->lifetime = time_now + lifetime * USEC_PER_SEC;
++        route->mtu = mtu;
+ 
+         r = route_configure(route, link, ndisc_netlink_handler);
+         if (r < 0) {
+diff --git a/src/network/networkd-route.c b/src/network/networkd-route.c
+index f78e10699..bde26a42d 100644
+--- a/src/network/networkd-route.c
++++ b/src/network/networkd-route.c
+@@ -605,6 +605,20 @@ int route_configure(
+         if (r < 0)
+                 return log_error_errno(r, "Could not append RTA_OIF attribute: %m");
+ 
++        r = sd_netlink_message_open_container(req, RTA_METRICS);
++        if (r < 0)
++                return log_error_errno(r, "Could not append RTA_METRICS attribute: %m");
++
++        if (route->mtu > 0) {
++                r = sd_netlink_message_append_u32(req, RTAX_MTU, route->mtu);
++                if (r < 0)
++                        return log_error_errno(r, "Could not append RTAX_MTU attribute: %m");
++        }
++
++        r = sd_netlink_message_close_container(req);
++        if (r < 0)
++                return log_error_errno(r, "Could not append RTA_METRICS attribute: %m");
++
+         r = sd_netlink_call_async(link->manager->rtnl, req, callback, link, 0, NULL);
+         if (r < 0)
+                 return log_error_errno(r, "Could not send rtnetlink message: %m");
+diff --git a/src/network/networkd-route.h b/src/network/networkd-route.h
+index d4e4dbac0..02f0b2767 100644
+--- a/src/network/networkd-route.h
++++ b/src/network/networkd-route.h
+@@ -37,6 +37,7 @@ struct Route {
+         unsigned char tos;
+         uint32_t priority; /* note that ip(8) calls this 'metric' */
+         uint32_t table;
++        uint32_t mtu;
+         unsigned char pref;
+         unsigned flags;
+ 
+-- 
+2.11.0
+
diff -Nru systemd-232/debian/patches/series systemd-232/debian/patches/series
--- systemd-232/debian/patches/series	2017-07-05 20:31:25.000000000 +0000
+++ systemd-232/debian/patches/series	2017-10-10 15:04:13.000000000 +0000
@@ -97,3 +97,4 @@
 debian/Let-graphical-session-pre.target-be-manually-started.patch
 debian/Add-env-variable-for-machine-ID-path.patch
 cryptsetup-generator-run-cryptsetup-service-before-swap-u.patch
+networkd-handle-MTU-field-in-IPv6-RA-4719.patch
_______________________________________________
Pkg-systemd-maintainers mailing list
Pkg-systemd-maintainers@lists.alioth.debian.org
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-systemd-maintainers

Reply via email to