Date: Wed, 23 Oct 2013 23:51:40 +0000 (UTC) From: "Andrey V. Elsukov" <ae@FreeBSD.org> To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r257023 - user/ae/inet6/sys/netinet6 Message-ID: <201310232351.r9NNpeom004859@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: ae Date: Wed Oct 23 23:51:39 2013 New Revision: 257023 URL: http://svnweb.freebsd.org/changeset/base/257023 Log: Change the type of the argument of the function nd6_is_addr_neighbor() from sockaddr_in6* to in6_addr*. Modified: user/ae/inet6/sys/netinet6/icmp6.c user/ae/inet6/sys/netinet6/nd6.c user/ae/inet6/sys/netinet6/nd6.h user/ae/inet6/sys/netinet6/nd6_nbr.c Modified: user/ae/inet6/sys/netinet6/icmp6.c ============================================================================== --- user/ae/inet6/sys/netinet6/icmp6.c Wed Oct 23 23:40:49 2013 (r257022) +++ user/ae/inet6/sys/netinet6/icmp6.c Wed Oct 23 23:51:39 2013 (r257023) @@ -2466,7 +2466,6 @@ icmp6_redirect_output(struct mbuf *m0, s struct llentry *ln = NULL; size_t maxlen; u_char *p; - struct sockaddr_in6 src_sa; icmp6_errcount(ND_REDIRECT, 0); @@ -2485,11 +2484,7 @@ icmp6_redirect_output(struct mbuf *m0, s * [RFC 2461, sec 8.2] */ sip6 = mtod(m0, struct ip6_hdr *); - bzero(&src_sa, sizeof(src_sa)); - src_sa.sin6_family = AF_INET6; - src_sa.sin6_len = sizeof(src_sa); - src_sa.sin6_addr = sip6->ip6_src; - if (nd6_is_addr_neighbor(&src_sa, ifp) == 0) + if (nd6_is_addr_neighbor(&sip6->ip6_src, ifp) == 0) goto fail; if (IN6_IS_ADDR_MULTICAST(&sip6->ip6_dst)) goto fail; /* what should we do here? */ Modified: user/ae/inet6/sys/netinet6/nd6.c ============================================================================== --- user/ae/inet6/sys/netinet6/nd6.c Wed Oct 23 23:40:49 2013 (r257022) +++ user/ae/inet6/sys/netinet6/nd6.c Wed Oct 23 23:51:39 2013 (r257023) @@ -125,8 +125,7 @@ VNET_DEFINE(int, nd6_recalc_reachtm_inte int (*send_sendso_input_hook)(struct mbuf *, struct ifnet *, int, int); -static int nd6_is_new_addr_neighbor(struct sockaddr_in6 *, - struct ifnet *); +static int nd6_is_new_addr_neighbor(struct in6_addr *, struct ifnet *); static void nd6_setmtu0(struct ifnet *, struct nd_ifinfo *); static void nd6_slowtimo(void *); static int regen_tmpaddr(struct in6_ifaddr *); @@ -871,7 +870,7 @@ nd6_lookup(struct in6_addr *addr6, int f * to not reenter the routing code from within itself. */ static int -nd6_is_new_addr_neighbor(struct sockaddr_in6 *addr, struct ifnet *ifp) +nd6_is_new_addr_neighbor(struct in6_addr *addr, struct ifnet *ifp) { struct nd_prefix *pr; struct in6_ifaddr *ia6; @@ -879,13 +878,13 @@ nd6_is_new_addr_neighbor(struct sockaddr /* * A link-local address is always a neighbor. */ - if (IN6_IS_ADDR_LINKLOCAL(&addr->sin6_addr)) + if (IN6_IS_ADDR_LINKLOCAL(addr)) return (1); /* * If the address matches one of our addresses, * it should be a neighbor. */ - if (in6_localip(&addr->sin6_addr)) + if (in6_localip(addr)) return (1); /* * If the address matches one of our on-link prefixes, it should be a @@ -922,7 +921,7 @@ nd6_is_new_addr_neighbor(struct sockaddr } if (IN6_ARE_MASKED_ADDR_EQUAL(&pr->ndpr_prefix.sin6_addr, - &addr->sin6_addr, &pr->ndpr_mask)) + addr, &pr->ndpr_mask)) return (1); } @@ -930,7 +929,7 @@ nd6_is_new_addr_neighbor(struct sockaddr * If the address is assigned on the node of the other side of * a p2p interface, the address should be a neighbor. */ - ia6 = in6ifa_ifpwithdstaddr(ifp, &addr->sin6_addr); + ia6 = in6ifa_ifpwithdstaddr(ifp, addr); if (ia6 != NULL) { ifa_free(&ia6->ia_ifa); return (1); @@ -955,7 +954,7 @@ nd6_is_new_addr_neighbor(struct sockaddr * XXX: should take care of the destination of a p2p link? */ int -nd6_is_addr_neighbor(struct sockaddr_in6 *addr, struct ifnet *ifp) +nd6_is_addr_neighbor(struct in6_addr *addr, struct ifnet *ifp) { struct llentry *lle; int rc = 0; @@ -969,7 +968,7 @@ nd6_is_addr_neighbor(struct sockaddr_in6 * in the neighbor cache. */ IF_AFDATA_RLOCK(ifp); - if ((lle = nd6_lookup(&addr->sin6_addr, 0, ifp)) != NULL) { + if ((lle = nd6_lookup(addr, 0, ifp)) != NULL) { LLE_RUNLOCK(lle); rc = 1; } @@ -1869,7 +1868,7 @@ nd6_output_lle(struct ifnet *ifp, struct IF_AFDATA_LOCK(ifp); ln = lla_lookup(LLTABLE6(ifp), flags, (struct sockaddr *)dst); IF_AFDATA_UNLOCK(ifp); - if ((ln == NULL) && nd6_is_addr_neighbor(dst, ifp)) { + if (ln == NULL &&nd6_is_addr_neighbor(&dst->sin6_addr, ifp)) { /* * Since nd6_is_addr_neighbor() internally calls nd6_lookup(), * the condition below is not very efficient. But we believe Modified: user/ae/inet6/sys/netinet6/nd6.h ============================================================================== --- user/ae/inet6/sys/netinet6/nd6.h Wed Oct 23 23:40:49 2013 (r257022) +++ user/ae/inet6/sys/netinet6/nd6.h Wed Oct 23 23:51:39 2013 (r257023) @@ -391,7 +391,7 @@ void nd6_destroy(void); #endif struct nd_ifinfo *nd6_ifattach(struct ifnet *); void nd6_ifdetach(struct nd_ifinfo *); -int nd6_is_addr_neighbor(struct sockaddr_in6 *, struct ifnet *); +int nd6_is_addr_neighbor(struct in6_addr *, struct ifnet *); void nd6_option_init(void *, int, union nd_opts *); struct nd_opt_hdr *nd6_option(union nd_opts *); int nd6_options(union nd_opts *); Modified: user/ae/inet6/sys/netinet6/nd6_nbr.c ============================================================================== --- user/ae/inet6/sys/netinet6/nd6_nbr.c Wed Oct 23 23:40:49 2013 (r257022) +++ user/ae/inet6/sys/netinet6/nd6_nbr.c Wed Oct 23 23:51:39 2013 (r257023) @@ -159,19 +159,13 @@ nd6_ns_input(struct mbuf *m, int off, in goto bad; } } else if (!V_nd6_onlink_ns_rfc4861) { - struct sockaddr_in6 src_sa6; - /* * According to recent IETF discussions, it is not a good idea * to accept a NS from an address which would not be deemed * to be a neighbor otherwise. This point is expected to be * clarified in future revisions of the specification. */ - bzero(&src_sa6, sizeof(src_sa6)); - src_sa6.sin6_family = AF_INET6; - src_sa6.sin6_len = sizeof(src_sa6); - src_sa6.sin6_addr = saddr6; - if (nd6_is_addr_neighbor(&src_sa6, ifp) == 0) { + if (nd6_is_addr_neighbor(&saddr6, ifp) == 0) { nd6log((LOG_INFO, "nd6_ns_input: " "NS packet from non-neighbor\n")); goto bad;
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201310232351.r9NNpeom004859>