icmp6.c (108143) | icmp6.c (108172) |
---|---|
1/* $FreeBSD: head/sys/netinet6/icmp6.c 108143 2002-12-20 23:57:22Z sam $ */ | 1/* $FreeBSD: head/sys/netinet6/icmp6.c 108172 2002-12-22 05:35:03Z hsu $ */ |
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 --- 1657 unchanged lines hidden (view full) --- 1667 /* 1668 * XXX: we only support IPv6 subject address for 1669 * this Qtype. 1670 */ 1671 return(0); 1672 } 1673 } 1674 | 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 --- 1657 unchanged lines hidden (view full) --- 1667 /* 1668 * XXX: we only support IPv6 subject address for 1669 * this Qtype. 1670 */ 1671 return(0); 1672 } 1673 } 1674 |
1675 IFNET_RLOCK(); |
|
1675 for (ifp = TAILQ_FIRST(&ifnet); ifp; ifp = TAILQ_NEXT(ifp, if_list)) 1676 { 1677 addrsofif = 0; 1678 TAILQ_FOREACH(ifa, &ifp->if_addrlist, ifa_list) 1679 { 1680 if (ifa->ifa_addr->sa_family != AF_INET6) 1681 continue; 1682 ifa6 = (struct in6_ifaddr *)ifa; --- 41 unchanged lines hidden (view full) --- 1724 if ((ifa6->ia6_flags & IN6_IFF_TEMPORARY) != 0 && 1725 (icmp6_nodeinfo & 4) == 0) { 1726 continue; 1727 } 1728 addrsofif++; /* count the address */ 1729 } 1730 if (iffound) { 1731 *ifpp = ifp; | 1676 for (ifp = TAILQ_FIRST(&ifnet); ifp; ifp = TAILQ_NEXT(ifp, if_list)) 1677 { 1678 addrsofif = 0; 1679 TAILQ_FOREACH(ifa, &ifp->if_addrlist, ifa_list) 1680 { 1681 if (ifa->ifa_addr->sa_family != AF_INET6) 1682 continue; 1683 ifa6 = (struct in6_ifaddr *)ifa; --- 41 unchanged lines hidden (view full) --- 1725 if ((ifa6->ia6_flags & IN6_IFF_TEMPORARY) != 0 && 1726 (icmp6_nodeinfo & 4) == 0) { 1727 continue; 1728 } 1729 addrsofif++; /* count the address */ 1730 } 1731 if (iffound) { 1732 *ifpp = ifp; |
1733 IFNET_RUNLOCK(); |
|
1732 return(addrsofif); 1733 } 1734 1735 addrs += addrsofif; 1736 } | 1734 return(addrsofif); 1735 } 1736 1737 addrs += addrsofif; 1738 } |
1739 IFNET_RUNLOCK(); |
|
1737 1738 return(addrs); 1739} 1740 1741static int 1742ni6_store_addrs(ni6, nni6, ifp0, resid) 1743 struct icmp6_nodeinfo *ni6, *nni6; 1744 struct ifnet *ifp0; --- 5 unchanged lines hidden (view full) --- 1750 struct ifnet *ifp_dep = NULL; 1751 int copied = 0, allow_deprecated = 0; 1752 u_char *cp = (u_char *)(nni6 + 1); 1753 int niflags = ni6->ni_flags; 1754 u_int32_t ltime; 1755 1756 if (ifp0 == NULL && !(niflags & NI_NODEADDR_FLAG_ALL)) 1757 return(0); /* needless to copy */ | 1740 1741 return(addrs); 1742} 1743 1744static int 1745ni6_store_addrs(ni6, nni6, ifp0, resid) 1746 struct icmp6_nodeinfo *ni6, *nni6; 1747 struct ifnet *ifp0; --- 5 unchanged lines hidden (view full) --- 1753 struct ifnet *ifp_dep = NULL; 1754 int copied = 0, allow_deprecated = 0; 1755 u_char *cp = (u_char *)(nni6 + 1); 1756 int niflags = ni6->ni_flags; 1757 u_int32_t ltime; 1758 1759 if (ifp0 == NULL && !(niflags & NI_NODEADDR_FLAG_ALL)) 1760 return(0); /* needless to copy */ |
1758 | 1761 1762 IFNET_RLOCK(); |
1759 again: | 1763 again: |
1760 | |
1761 for (; ifp; ifp = TAILQ_NEXT(ifp, if_list)) 1762 { 1763 for (ifa = ifp->if_addrlist.tqh_first; ifa; 1764 ifa = ifa->ifa_list.tqe_next) 1765 { 1766 if (ifa->ifa_addr->sa_family != AF_INET6) 1767 continue; 1768 ifa6 = (struct in6_ifaddr *)ifa; --- 49 unchanged lines hidden (view full) --- 1818 if (resid < sizeof(struct in6_addr) + 1819 sizeof(u_int32_t)) { 1820 /* 1821 * We give up much more copy. 1822 * Set the truncate flag and return. 1823 */ 1824 nni6->ni_flags |= 1825 NI_NODEADDR_FLAG_TRUNCATE; | 1764 for (; ifp; ifp = TAILQ_NEXT(ifp, if_list)) 1765 { 1766 for (ifa = ifp->if_addrlist.tqh_first; ifa; 1767 ifa = ifa->ifa_list.tqe_next) 1768 { 1769 if (ifa->ifa_addr->sa_family != AF_INET6) 1770 continue; 1771 ifa6 = (struct in6_ifaddr *)ifa; --- 49 unchanged lines hidden (view full) --- 1821 if (resid < sizeof(struct in6_addr) + 1822 sizeof(u_int32_t)) { 1823 /* 1824 * We give up much more copy. 1825 * Set the truncate flag and return. 1826 */ 1827 nni6->ni_flags |= 1828 NI_NODEADDR_FLAG_TRUNCATE; |
1829 IFNET_RUNLOCK(); |
|
1826 return(copied); 1827 } 1828 1829 /* 1830 * Set the TTL of the address. 1831 * The TTL value should be one of the following 1832 * according to the specification: 1833 * --- 38 unchanged lines hidden (view full) --- 1872 1873 if (allow_deprecated == 0 && ifp_dep != NULL) { 1874 ifp = ifp_dep; 1875 allow_deprecated = 1; 1876 1877 goto again; 1878 } 1879 | 1830 return(copied); 1831 } 1832 1833 /* 1834 * Set the TTL of the address. 1835 * The TTL value should be one of the following 1836 * according to the specification: 1837 * --- 38 unchanged lines hidden (view full) --- 1876 1877 if (allow_deprecated == 0 && ifp_dep != NULL) { 1878 ifp = ifp_dep; 1879 allow_deprecated = 1; 1880 1881 goto again; 1882 } 1883 |
1884 IFNET_RUNLOCK(); 1885 |
|
1880 return(copied); 1881} 1882 1883/* 1884 * XXX almost dup'ed code with rip6_input. 1885 */ 1886static int 1887icmp6_rip6_input(mp, off) --- 981 unchanged lines hidden --- | 1886 return(copied); 1887} 1888 1889/* 1890 * XXX almost dup'ed code with rip6_input. 1891 */ 1892static int 1893icmp6_rip6_input(mp, off) --- 981 unchanged lines hidden --- |