Deleted Added
sdiff udiff text old ( 166619 ) new ( 169664 )
full compact
1/* $FreeBSD: head/sys/netinet6/icmp6.c 166619 2007-02-10 12:25:19Z bms $ */
2/* $KAME: icmp6.c,v 1.211 2001/04/04 05:56:20 itojun Exp $ */
3
4/*-
5 * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
6 * All rights reserved.
7 *
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions

--- 651 unchanged lines hidden (view full) ---

661 if (n)
662 n = ni6_input(n, off);
663 /* XXX meaningless if n == NULL */
664 noff = sizeof(struct ip6_hdr);
665 } else {
666 u_char *p;
667 int maxlen, maxhlen;
668
669 if ((icmp6_nodeinfo & 5) != 5)
670 break;
671
672 if (code != 0)
673 goto badcode;
674 maxlen = sizeof(*nip6) + sizeof(*nicmp6) + 4;
675 if (maxlen >= MCLBYTES) {
676 /* Give up remote */

--- 502 unchanged lines hidden (view full) ---

1179 IP6_EXTHDR_GET(ni6, struct icmp6_nodeinfo *, m, off, sizeof(*ni6));
1180 if (ni6 == NULL) {
1181 /* m is already reclaimed */
1182 return (NULL);
1183 }
1184#endif
1185
1186 /*
1187 * Validate IPv6 destination address.
1188 *
1189 * The Responder must discard the Query without further processing
1190 * unless it is one of the Responder's unicast or anycast addresses, or
1191 * a link-local scope multicast address which the Responder has joined.
1192 * [icmp-name-lookups-08, Section 4.]
1193 */
1194 if (IN6_IS_ADDR_MULTICAST(&ip6->ip6_dst)) {
1195 if (!IN6_IS_ADDR_MC_LINKLOCAL(&ip6->ip6_dst))
1196 goto bad;
1197 /* else it's a link-local multicast, fine */
1198 } else { /* unicast or anycast */
1199 if ((ia6 = ip6_getdstifaddr(m)) == NULL)
1200 goto bad; /* XXX impossible */
1201
1202 if ((ia6->ia6_flags & IN6_IFF_TEMPORARY) &&
1203 !(icmp6_nodeinfo & 4)) {
1204 nd6log((LOG_DEBUG, "ni6_input: ignore node info to "
1205 "a temporary address in %s:%d",
1206 __FILE__, __LINE__));
1207 goto bad;
1208 }
1209 }
1210
1211 /* validate query Subject field. */

--- 98 unchanged lines hidden (view full) ---

1310 goto bad;
1311 }
1312 break;
1313 }
1314
1315 /* refuse based on configuration. XXX ICMP6_NI_REFUSED? */
1316 switch (qtype) {
1317 case NI_QTYPE_FQDN:
1318 if ((icmp6_nodeinfo & 1) == 0)
1319 goto bad;
1320 break;
1321 case NI_QTYPE_NODEADDR:
1322 case NI_QTYPE_IPV4ADDR:
1323 if ((icmp6_nodeinfo & 2) == 0)
1324 goto bad;
1325 break;
1326 }
1327
1328 /* guess reply length */
1329 switch (qtype) {
1330 case NI_QTYPE_NOOP:
1331 break; /* no reply data */

--- 361 unchanged lines hidden (view full) ---

1693 /*
1694 * check if anycast is okay.
1695 * XXX: just experimental. not in the spec.
1696 */
1697 if ((ifa6->ia6_flags & IN6_IFF_ANYCAST) != 0 &&
1698 (niflags & NI_NODEADDR_FLAG_ANYCAST) == 0)
1699 continue; /* we need only unicast addresses */
1700 if ((ifa6->ia6_flags & IN6_IFF_TEMPORARY) != 0 &&
1701 (icmp6_nodeinfo & 4) == 0) {
1702 continue;
1703 }
1704 addrsofif++; /* count the address */
1705 }
1706 if (iffound) {
1707 *ifpp = ifp;
1708 IFNET_RUNLOCK();
1709 return (addrsofif);

--- 71 unchanged lines hidden (view full) ---

1781 /*
1782 * check if anycast is okay.
1783 * XXX: just experimental. not in the spec.
1784 */
1785 if ((ifa6->ia6_flags & IN6_IFF_ANYCAST) != 0 &&
1786 (niflags & NI_NODEADDR_FLAG_ANYCAST) == 0)
1787 continue;
1788 if ((ifa6->ia6_flags & IN6_IFF_TEMPORARY) != 0 &&
1789 (icmp6_nodeinfo & 4) == 0) {
1790 continue;
1791 }
1792
1793 /* now we can copy the address */
1794 if (resid < sizeof(struct in6_addr) +
1795 sizeof(u_int32_t)) {
1796 /*
1797 * We give up much more copy.

--- 998 unchanged lines hidden ---