Commit 8de3351e6e0a1081fbf6864ae37839e327699a08

Authored by YOSHIFUJI Hideaki
1 parent 58c4fb86ea

[IPV6]: Try not to send icmp to anycast address.

Signed-off-by: YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>

Showing 1 changed file with 14 additions and 2 deletions Side-by-side Diff

... ... @@ -328,8 +328,10 @@
328 328 iif = skb->dev->ifindex;
329 329  
330 330 /*
331   - * Must not send if we know that source is Anycast also.
332   - * for now we don't know that.
  331 + * Must not send error if the source does not uniquely
  332 + * identify a single node (RFC2463 Section 2.4).
  333 + * We check unspecified / multicast addresses here,
  334 + * and anycast addresses will be checked later.
333 335 */
334 336 if ((addr_type == IPV6_ADDR_ANY) || (addr_type & IPV6_ADDR_MULTICAST)) {
335 337 LIMIT_NETDEBUG(KERN_DEBUG "icmpv6_send: addr_any/mcast source\n");
... ... @@ -373,6 +375,16 @@
373 375 err = ip6_dst_lookup(sk, &dst, &fl);
374 376 if (err)
375 377 goto out;
  378 +
  379 + /*
  380 + * We won't send icmp if the destination is known
  381 + * anycast.
  382 + */
  383 + if (((struct rt6_info *)dst)->rt6i_flags & RTF_ANYCAST) {
  384 + LIMIT_NETDEBUG(KERN_DEBUG "icmpv6_send: acast source\n");
  385 + goto out_dst_release;
  386 + }
  387 +
376 388 if ((err = xfrm_lookup(&dst, &fl, sk, 0)) < 0)
377 389 goto out;
378 390