Skip to content

Commit

Permalink
not reply an ICMPv6 Error message for a packet from an obvious anycas…
Browse files Browse the repository at this point in the history
…t address
  • Loading branch information
suz committed Jan 15, 2006
1 parent f86cd3a commit d5edda1
Show file tree
Hide file tree
Showing 4 changed files with 49 additions and 5 deletions.
6 changes: 5 additions & 1 deletion CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
CHANGELOG for KAME kit
$KAME: CHANGELOG,v 1.2810 2006/01/09 01:59:03 jinmei Exp $
$KAME: CHANGELOG,v 1.2811 2006/01/15 12:26:56 suz Exp $

<200601>
2006-01-15 SUZUKI, Shinsuke <suz@alaxala.net>
* kame/sys/netinet6/{icmp6.c, in6.[ch]}: not reply an ICMPv6 Error
message for a packet from an obvious anycast address.

2006-01-09 JINMEI, Tatuya <jinmei@isl.rdc.toshiba.co.jp>
* freebsd5/sys/netinet6/in6_pcb.c (in6_{set,peer}sockaddr):
converted embedded scope zone IDs into the sin6_scope_id field
Expand Down
5 changes: 3 additions & 2 deletions kame/sys/netinet6/icmp6.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* $KAME: icmp6.c,v 1.410 2005/08/09 08:20:11 jinmei Exp $ */
/* $KAME: icmp6.c,v 1.411 2006/01/15 12:26:57 suz Exp $ */

/*
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
Expand Down Expand Up @@ -421,7 +421,8 @@ icmp6_error(m, type, code, param)
* XXX: the case of anycast source?
*/
if (IN6_IS_ADDR_UNSPECIFIED(&oip6->ip6_src) ||
IN6_IS_ADDR_MULTICAST(&oip6->ip6_src))
IN6_IS_ADDR_MULTICAST(&oip6->ip6_src) ||
in6_is_addr_anycast(&oip6->ip6_src))
goto freeit;

/*
Expand Down
40 changes: 39 additions & 1 deletion kame/sys/netinet6/in6.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* $KAME: in6.c,v 1.402 2006/01/02 09:06:06 jinmei Exp $ */
/* $KAME: in6.c,v 1.403 2006/01/15 12:26:57 suz Exp $ */

/*
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
Expand Down Expand Up @@ -2156,6 +2156,44 @@ in6_localaddr(in6)
}
#endif

/*
* The definition of anycast address in this function is
* 1) an interface address with IN6_IFF_ANYCAST bit on
* 2) a subnet router anycast address regarding a prefix of an interface
* address
* Other anycast address is not checked here, since it is impossible to judge
* it within a node.
*/
int
in6_is_addr_anycast(in6)
struct in6_addr *in6;
{
struct in6_ifaddr *ia;

for (ia = in6_ifaddr; ia; ia = ia->ia_next) {
struct in6_addr anycast, mask;

/* case 1. an interface address with IN6_IFF_ANYCAST */
if (ia->ia6_flags & IN6_IFF_ANYCAST) {
if (IN6_ARE_ADDR_EQUAL(in6, &ia->ia_addr.sin6_addr))
return (1);
continue;
}

/* case 2. a subnet router anycast address */
anycast = ia->ia_addr.sin6_addr;
mask = ia->ia_prefixmask.sin6_addr;
anycast.s6_addr32[0] &= mask.s6_addr32[0];
anycast.s6_addr32[1] &= mask.s6_addr32[1];
anycast.s6_addr32[2] &= mask.s6_addr32[2];
anycast.s6_addr32[3] &= mask.s6_addr32[3];
if (IN6_ARE_ADDR_EQUAL(in6, &anycast))
return (1);
}

return (0);
}

/*
* return length of part which dst and src are equal
* hard coding...
Expand Down
3 changes: 2 additions & 1 deletion kame/sys/netinet6/in6.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* $KAME: in6.h,v 1.162 2005/10/21 01:20:16 keiichi Exp $ */
/* $KAME: in6.h,v 1.163 2006/01/15 12:26:57 suz Exp $ */

/*
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
Expand Down Expand Up @@ -875,6 +875,7 @@ int in6_cksum __P((struct mbuf *, u_int8_t, u_int32_t, u_int32_t));
#if defined(__FreeBSD__) || defined(__NetBSD__)
int in6_localaddr __P((struct in6_addr *));
#endif
int in6_is_addr_anycast __P((struct in6_addr *));
int in6_addrscope __P((struct in6_addr *));
struct in6_ifaddr *in6_ifawithifp __P((struct ifnet *, struct in6_addr *));
extern void in6_if_up __P((struct ifnet *));
Expand Down

0 comments on commit d5edda1

Please sign in to comment.