There also seems to be another bug for ipv6 only; the sysctl setting of
mtu happens before the ip link set dev up; which means, at up time, the
interface gets the default mtu which clobbers the ipv6 mtu.

/sbin/sysctl -q -e -w net.ipv6.conf.ens8.autoconf=0
/sbin/sysctl -q -e -w net.ipv6.conf.ens8.mtu=1480
/bin/ip link set dev ens8  up
/bin/ip -6 addr add fd0d:ffe0:5771::1:0:0/64  dev ens8 


I'm testing this post-up hook which I think covers all of the cases.

# cat /etc/network/if-up.d/mtuipv6 
#!/bin/sh

[ "$IFACE" != "lo" ] || exit 0

# Trigger only if MTU configured
[ -n "$IF_MTU" ] || exit 0

# Target ipv6 MTU settings only
[ "$ADDRFAM" = "inet6" ] || exit 0

# We need to check the underlying interface MTU and
# raise it if the IPV6 mtu is larger
CUR_DEV_MTU=$(/bin/cat /sys/class/net/$IFACE/mtu)
if [ $CUR_DEV_MTU -lt $IF_MTU ]; then
    /bin/ip link set $IFACE mtu $IF_MTU
fi
/sbin/sysctl -q -e -w net.ipv6.conf.$IFACE.mtu=$IF_MTU


Thoughts?

-- 
You received this bug notification because you are a member of Ubuntu
Touch seeded packages, which is subscribed to ifupdown in Ubuntu.
https://bugs.launchpad.net/bugs/1609367

Title:
  ifupdown does not set ipv6-only large mtu

Status in ifupdown package in Ubuntu:
  Incomplete

Bug description:
  ifupdown changes a device's mtu differently, between "inet" section
  mtu and "inet6" section mtu.  For "inet", ifupdown changes the
  device's mtu, using 'ip link set DEV mtu NNN'.  However for "inet6",
  ifupdown changes the interface's IPv6 mtu, using 'sysctl -q -e -w
  net.ipv6.conf.DEV.mtu=NNN'.

  The problem is that a device's ipv6 mtu cannot be larger than the
  device mtu.  Normally this is not a problem; the main reason a device
  needs a separate ipv6 mtu is to support ipv6 tunneling inside ipv4
  (e.g. 6in4 or 6rd), so ifupdown would also have a ipv4 "inet" section
  that contained a larger mtu (or, the ipv6 section would have a lower-
  than-default mtu).

  But, in the case of an interface that is configured only for ipv6
  *and* large frames (e.g. 9000 mtu), there is only an "inet6" section
  in the ifupdown config, and so ifupdown fails to set the device's mtu,
  which causes its attempt to set the ipv6 mtu to fail.

  I believe the correct behavior is for ifupdown to check if there is
  any "inet" config section for the same device as the "inet6" section,
  and if there is not then it should change the device mtu as well as
  the ipv6 mtu.  Additionally, the "inet6" configuration must be done
  after the "inet" configuration for the same device, since the ipv6 mtu
  can't be higher than the device mtu.

  I don't see any easy way to add that logic to inet6.defn, however...

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/ifupdown/+bug/1609367/+subscriptions

-- 
Mailing list: https://launchpad.net/~touch-packages
Post to     : touch-packages@lists.launchpad.net
Unsubscribe : https://launchpad.net/~touch-packages
More help   : https://help.launchpad.net/ListHelp

Reply via email to