@@ -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