Skip to content

Commit

Permalink
net: Fix IPv6 PMTU disc. w/ asymmetric routes
Browse files Browse the repository at this point in the history
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Maciej Żenczykowski authored and David S. Miller committed Oct 3, 2010
1 parent 173e79f commit ae878ae
Showing 1 changed file with 24 additions and 4 deletions.
28 changes: 24 additions & 4 deletions net/ipv6/route.c
Original file line number Diff line number Diff line change
Expand Up @@ -1556,14 +1556,13 @@ void rt6_redirect(struct in6_addr *dest, struct in6_addr *src,
* i.e. Path MTU discovery
*/

void rt6_pmtu_discovery(struct in6_addr *daddr, struct in6_addr *saddr,
struct net_device *dev, u32 pmtu)
static void rt6_do_pmtu_disc(struct in6_addr *daddr, struct in6_addr *saddr,
struct net *net, u32 pmtu, int ifindex)
{
struct rt6_info *rt, *nrt;
struct net *net = dev_net(dev);
int allfrag = 0;

rt = rt6_lookup(net, daddr, saddr, dev->ifindex, 0);
rt = rt6_lookup(net, daddr, saddr, ifindex, 0);
if (rt == NULL)
return;

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

void rt6_pmtu_discovery(struct in6_addr *daddr, struct in6_addr *saddr,
struct net_device *dev, u32 pmtu)
{
struct net *net = dev_net(dev);

/*
* RFC 1981 states that a node "MUST reduce the size of the packets it
* is sending along the path" that caused the Packet Too Big message.
* Since it's not possible in the general case to determine which
* interface was used to send the original packet, we update the MTU
* on the interface that will be used to send future packets. We also
* update the MTU on the interface that received the Packet Too Big in
* case the original packet was forced out that interface with
* SO_BINDTODEVICE or similar. This is the next best thing to the
* correct behaviour, which would be to update the MTU on all
* interfaces.
*/
rt6_do_pmtu_disc(daddr, saddr, net, pmtu, 0);
rt6_do_pmtu_disc(daddr, saddr, net, pmtu, dev->ifindex);
}

/*
* Misc support functions
*/
Expand Down

0 comments on commit ae878ae

Please sign in to comment.