Skip to content
  • Vincent Bernat's avatar
    ip6: fix PMTU discovery when using /127 subnets · ccdb2d17
    Vincent Bernat authored
    The definition of an "anycast destination address" has been tweaked as a
    side-effect of commit 2647a9b0 ("ipv6: Remove external dependency on
    rt6i_gateway and RTF_ANYCAST"). The first address of a point-to-point
    /127 subnet is now considered as an anycast address. This prevents
    ICMPv6 errors to be returned to a sender of such a subnet and breaks
    PMTU discovery.
    
    This can be reproduced with:
    
        ip link add name out6 type veth peer name in6
        ip link add name out7 type veth peer name in7
        ip link set mtu 1400 dev out7
        ip link set mtu 1400 dev in7
        ip netns add next-hop
        ip netns add next-next-hop
        ip link set netns next-hop dev in6
        ip link set netns next-hop dev out7
        ip link set netns next-next-hop dev in7
        ip link set up dev out6
        ip addr add 2001:db8:1::12/127 dev out6
        ip netns exec next-hop ip link set up dev in6
        ip netns exec next-hop ip link set up dev out7
        ip netns exec next-hop ip addr add 2001:db8:1::13/127 dev in6
        ip netns exec next-hop ip addr add 2001:db8:1::14/127 dev out7
        ip netns exec next-hop ip route add default via 2001:db8:1::15
        ip netns exec next-hop sysctl -qw net.ipv6.conf.all.forwarding=1
        ip netns exec next-next-hop ip link set up dev in7
        ip netns exec next-next-hop ip addr add 2001:db8:1::15/127 dev in7
        ip netns exec next-next-hop ip addr add 2001:db8:1::50/128 dev in7
        ip netns exec next-next-hop ip route add default via 2001:db8:1::14
        ip netns exec next-next-hop sysctl -qw net.ipv6.conf.all.forwarding=1
        ip route add 2001:db8:1::48/123 via 2001:db8:1::13
        sleep 4
        ping -M do -s 1452 -c 3 2001:db8:1::50 || true
        ip route get 2001:db8:1::50
    
    Before the patch, we get:
    
        2001:db8:1::50 from :: via 2001:db8:1::13 dev out6 src 2001:db8:1::12 metric 1024  pref medium
    
    After the patch, we get:
    
        2001:db8:1::50 via 2001:db8:1::13 dev out6 src 2001:db8:1::12 metric 0
            cache  expires 578sec mtu 1400 pref medium
    
    Fixes: 2647a9b0
    
     ("ipv6: Remove external dependency on rt6i_gateway and RTF_ANYCAST")
    Signed-off-by: default avatarVincent Bernat <vincent@bernat.im>
    Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
    ccdb2d17