Skip to content

Commit ae878ae

Browse files
zenczykowskidavem330
authored andcommitted
net: Fix IPv6 PMTU disc. w/ asymmetric routes
Signed-off-by: Maciej Żenczykowski <maze@google.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 173e79f commit ae878ae

1 file changed

Lines changed: 24 additions & 4 deletions

File tree

‎net/ipv6/route.c‎

Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1556,14 +1556,13 @@ void rt6_redirect(struct in6_addr *dest, struct in6_addr *src,
15561556
* i.e. Path MTU discovery
15571557
*/
15581558

1559-
void rt6_pmtu_discovery(struct in6_addr *daddr, struct in6_addr *saddr,
1560-
struct net_device *dev, u32 pmtu)
1559+
static void rt6_do_pmtu_disc(struct in6_addr *daddr, struct in6_addr *saddr,
1560+
struct net *net, u32 pmtu, int ifindex)
15611561
{
15621562
struct rt6_info *rt, *nrt;
1563-
struct net *net = dev_net(dev);
15641563
int allfrag = 0;
15651564

1566-
rt = rt6_lookup(net, daddr, saddr, dev->ifindex, 0);
1565+
rt = rt6_lookup(net, daddr, saddr, ifindex, 0);
15671566
if (rt == NULL)
15681567
return;
15691568

@@ -1631,6 +1630,27 @@ void rt6_pmtu_discovery(struct in6_addr *daddr, struct in6_addr *saddr,
16311630
dst_release(&rt->dst);
16321631
}
16331632

1633+
void rt6_pmtu_discovery(struct in6_addr *daddr, struct in6_addr *saddr,
1634+
struct net_device *dev, u32 pmtu)
1635+
{
1636+
struct net *net = dev_net(dev);
1637+
1638+
/*
1639+
* RFC 1981 states that a node "MUST reduce the size of the packets it
1640+
* is sending along the path" that caused the Packet Too Big message.
1641+
* Since it's not possible in the general case to determine which
1642+
* interface was used to send the original packet, we update the MTU
1643+
* on the interface that will be used to send future packets. We also
1644+
* update the MTU on the interface that received the Packet Too Big in
1645+
* case the original packet was forced out that interface with
1646+
* SO_BINDTODEVICE or similar. This is the next best thing to the
1647+
* correct behaviour, which would be to update the MTU on all
1648+
* interfaces.
1649+
*/
1650+
rt6_do_pmtu_disc(daddr, saddr, net, pmtu, 0);
1651+
rt6_do_pmtu_disc(daddr, saddr, net, pmtu, dev->ifindex);
1652+
}
1653+
16341654
/*
16351655
* Misc support functions
16361656
*/

0 commit comments

Comments
 (0)