svn commit: r292412 - in projects/sendfile: crypto/openssh sys/arm64/include sys/cddl/dev/dtrace sys/cddl/dev/systrace sys/conf sys/dev/drm2/i915 sys/dev/if_ndis sys/dev/ofw sys/kern sys/net sys/ne...

Gleb Smirnoff glebius at FreeBSD.org
Thu Dec 17 23:13:08 UTC 2015


Author: glebius
Date: Thu Dec 17 23:13:04 2015
New Revision: 292412
URL: https://svnweb.freebsd.org/changeset/base/292412

Log:
  Merge head r261119 through r292411.

Added:
  projects/sendfile/sys/riscv/
     - copied from r292411, head/sys/riscv/
Modified:
  projects/sendfile/crypto/openssh/digest-libc.c
  projects/sendfile/sys/arm64/include/ofw_machdep.h
  projects/sendfile/sys/cddl/dev/dtrace/dtrace_cddl.h
  projects/sendfile/sys/cddl/dev/systrace/systrace.c
  projects/sendfile/sys/conf/kmod.mk
  projects/sendfile/sys/dev/drm2/i915/intel_iic.c
  projects/sendfile/sys/dev/if_ndis/if_ndis_pci.c
  projects/sendfile/sys/dev/ofw/ofw_bus_subr.c
  projects/sendfile/sys/kern/subr_syscall.c
  projects/sendfile/sys/net/if.c
  projects/sendfile/sys/net/if_lagg.c
  projects/sendfile/sys/net/if_lagg.h
  projects/sendfile/sys/net/if_var.h
  projects/sendfile/sys/netinet/if_ether.c
  projects/sendfile/sys/netinet/if_ether.h
  projects/sendfile/sys/netinet/in_var.h
  projects/sendfile/sys/netinet/ip_carp.c
  projects/sendfile/sys/netinet6/in6.c
  projects/sendfile/sys/netinet6/in6_var.h
  projects/sendfile/sys/netinet6/nd6.c
  projects/sendfile/sys/netinet6/nd6.h
  projects/sendfile/sys/netinet6/nd6_nbr.c
  projects/sendfile/sys/sys/sysent.h
  projects/sendfile/sys/vm/device_pager.c
  projects/sendfile/sys/vm/sg_pager.c
  projects/sendfile/sys/vm/vm_page.h
  projects/sendfile/usr.bin/calendar/calendars/calendar.freebsd
  projects/sendfile/usr.bin/netstat/ipsec.c
  projects/sendfile/usr.bin/netstat/main.c
  projects/sendfile/usr.sbin/boot0cfg/boot0cfg.c
Directory Properties:
  projects/sendfile/   (props changed)
  projects/sendfile/crypto/openssh/   (props changed)
  projects/sendfile/sys/   (props changed)
  projects/sendfile/sys/conf/   (props changed)
  projects/sendfile/usr.bin/calendar/   (props changed)

Modified: projects/sendfile/crypto/openssh/digest-libc.c
==============================================================================
--- projects/sendfile/crypto/openssh/digest-libc.c	Thu Dec 17 21:01:19 2015	(r292411)
+++ projects/sendfile/crypto/openssh/digest-libc.c	Thu Dec 17 23:13:04 2015	(r292412)
@@ -147,7 +147,7 @@ ssh_digest_start(int alg)
 	const struct ssh_digest *digest = ssh_digest_by_alg(alg);
 	struct ssh_digest_ctx *ret;
 
-	if (digest == NULL || (ret = calloc(1, sizeof(ret))) == NULL)
+	if (digest == NULL || (ret = calloc(1, sizeof(*ret))) == NULL)
 		return NULL;
 	if ((ret->mdctx = calloc(1, digest->ctx_len)) == NULL) {
 		free(ret);

Modified: projects/sendfile/sys/arm64/include/ofw_machdep.h
==============================================================================
--- projects/sendfile/sys/arm64/include/ofw_machdep.h	Thu Dec 17 21:01:19 2015	(r292411)
+++ projects/sendfile/sys/arm64/include/ofw_machdep.h	Thu Dec 17 23:13:04 2015	(r292412)
@@ -41,4 +41,7 @@ struct mem_region {
 	vm_size_t	mr_size;
 };
 
+/* FDT follows ePAPR */
+#define	OFW_EPAPR
+
 #endif /* _MACHINE_OFW_MACHDEP_H_ */

Modified: projects/sendfile/sys/cddl/dev/dtrace/dtrace_cddl.h
==============================================================================
--- projects/sendfile/sys/cddl/dev/dtrace/dtrace_cddl.h	Thu Dec 17 21:01:19 2015	(r292411)
+++ projects/sendfile/sys/cddl/dev/dtrace/dtrace_cddl.h	Thu Dec 17 23:13:04 2015	(r292412)
@@ -83,8 +83,8 @@ typedef struct kdtrace_thread {
 	uintptr_t	td_dtrace_regv;
 #endif
 	u_int64_t	td_hrtime;	/* Last time on cpu. */
-	int		td_errno;	/* Syscall return value. */
 	void		*td_dtrace_sscr; /* Saved scratch space location. */
+	void		*td_systrace_args; /* syscall probe arguments. */
 } kdtrace_thread_t;
 
 /*
@@ -110,6 +110,7 @@ typedef struct kdtrace_thread {
 #define	t_dtrace_astpc	td_dtrace->td_dtrace_astpc
 #define	t_dtrace_regv	td_dtrace->td_dtrace_regv
 #define	t_dtrace_sscr	td_dtrace->td_dtrace_sscr
+#define	t_dtrace_systrace_args	td_dtrace->td_systrace_args
 #define	p_dtrace_helpers	p_dtrace->p_dtrace_helpers
 #define	p_dtrace_count	p_dtrace->p_dtrace_count
 #define	p_dtrace_probes	p_dtrace->p_dtrace_probes

Modified: projects/sendfile/sys/cddl/dev/systrace/systrace.c
==============================================================================
--- projects/sendfile/sys/cddl/dev/systrace/systrace.c	Thu Dec 17 21:01:19 2015	(r292411)
+++ projects/sendfile/sys/cddl/dev/systrace/systrace.c	Thu Dec 17 23:13:04 2015	(r292412)
@@ -33,6 +33,7 @@ __FBSDID("$FreeBSD$");
 #include <sys/systm.h>
 #include <sys/conf.h>
 #include <sys/cpuvar.h>
+#include <sys/dtrace.h>
 #include <sys/fcntl.h>
 #include <sys/filio.h>
 #include <sys/kdb.h>
@@ -53,9 +54,10 @@ __FBSDID("$FreeBSD$");
 #include <sys/sysproto.h>
 #include <sys/uio.h>
 #include <sys/unistd.h>
-#include <machine/stdarg.h>
 
-#include <sys/dtrace.h>
+#include <cddl/dev/dtrace/dtrace_cddl.h>
+
+#include <machine/stdarg.h>
 
 #ifdef LINUX_SYSTRACE
 #if defined(__amd64__)
@@ -138,6 +140,7 @@ static void	systrace_unload(void *);
 
 static void	systrace_getargdesc(void *, dtrace_id_t, void *,
 		    dtrace_argdesc_t *);
+static uint64_t	systrace_getargval(void *, dtrace_id_t, void *, int, int);
 static void	systrace_provide(void *, dtrace_probedesc_t *);
 static void	systrace_destroy(void *, dtrace_id_t, void *);
 static void	systrace_enable(void *, dtrace_id_t, void *);
@@ -164,16 +167,13 @@ static dtrace_pops_t systrace_pops = {
 	NULL,
 	NULL,
 	systrace_getargdesc,
-	NULL,
+	systrace_getargval,
 	NULL,
 	systrace_destroy
 };
 
 static dtrace_provider_id_t	systrace_id;
 
-typedef void (*systrace_dtrace_probe_t)(dtrace_id_t, uintptr_t, uintptr_t,
-    uintptr_t, uintptr_t, uintptr_t, uintptr_t, uintptr_t, uintptr_t);
-
 #ifdef NATIVE_ABI
 /*
  * Probe callback function.
@@ -183,48 +183,48 @@ typedef void (*systrace_dtrace_probe_t)(
  *       compat syscall from something like Linux.
  */
 static void
-systrace_probe(uint32_t id, int sysnum, struct sysent *sysent, void *params,
-    int ret)
+systrace_probe(struct syscall_args *sa, enum systrace_probe_t type, int retval)
 {
-	uint64_t uargs[8];
-	systrace_dtrace_probe_t probe;
-	int n_args = 0;
+	uint64_t uargs[nitems(sa->args)];
+	dtrace_id_t id;
+	int n_args, sysnum;
 
+	sysnum = sa->code;
 	memset(uargs, 0, sizeof(uargs));
 
-	/*
-	 * Check if this syscall has an argument conversion function
-	 * registered.
-	 */
-	if (params != NULL && sysent->sy_systrace_args_func != NULL) {
-		/*
-		 * Convert the syscall parameters using the registered
-		 * function.
-		 */
-		(*sysent->sy_systrace_args_func)(sysnum, params, uargs,
-		    &n_args);
-	} else if (params != NULL) {
+	if (type == SYSTRACE_ENTRY) {
+		id = sa->callp->sy_entry;
+
+		if (sa->callp->sy_systrace_args_func != NULL)
+			/*
+			 * Convert the syscall parameters using the registered
+			 * function.
+			 */
+			(*sa->callp->sy_systrace_args_func)(sysnum, sa->args,
+			    uargs, &n_args);
+		else
+			/*
+			 * Use the built-in system call argument conversion
+			 * function to translate the syscall structure fields
+			 * into the array of 64-bit values that DTrace expects.
+			 */
+			systrace_args(sysnum, sa->args, uargs, &n_args);
 		/*
-		 * Use the built-in system call argument conversion
-		 * function to translate the syscall structure fields
-		 * into the array of 64-bit values that DTrace
-		 * expects.
+		 * Save probe arguments now so that we can retrieve them if
+		 * the getargval method is called from further down the stack.
 		 */
-		systrace_args(sysnum, params, uargs, &n_args);
+		curthread->t_dtrace_systrace_args = uargs;
 	} else {
-		/*
-		 * Since params is NULL, this is a 'return' probe.
-		 * Set arg0 and arg1 as the return value of this syscall.
-		 */
-		uargs[0] = uargs[1] = ret;
+		id = sa->callp->sy_return;
+
+		curthread->t_dtrace_systrace_args = NULL;
+		/* Set arg0 and arg1 as the return value of this syscall. */
+		uargs[0] = uargs[1] = retval;
 	}
 
 	/* Process the probe using the converted argments. */
-	probe = (systrace_dtrace_probe_t)dtrace_probe;
-	probe(id, uargs[0], uargs[1], uargs[2], uargs[3], uargs[4], uargs[5],
-	    uargs[6], uargs[7]);
+	dtrace_probe(id, uargs[0], uargs[1], uargs[2], uargs[3], uargs[4]);
 }
-
 #endif
 
 static void
@@ -244,6 +244,21 @@ systrace_getargdesc(void *arg, dtrace_id
 		desc->dtargd_ndx = DTRACE_ARGNONE;
 }
 
+static uint64_t
+systrace_getargval(void *arg __unused, dtrace_id_t id __unused,
+    void *parg __unused, int argno, int aframes __unused)
+{
+	uint64_t *uargs;
+
+	uargs = curthread->t_dtrace_systrace_args;
+	if (uargs == NULL)
+		/* This is a return probe. */
+		return (0);
+	if (argno >= nitems(((struct syscall_args *)NULL)->args))
+		return (0);
+	return (uargs[argno]);
+}
+
 static void
 systrace_provide(void *arg, dtrace_probedesc_t *desc)
 {

Modified: projects/sendfile/sys/conf/kmod.mk
==============================================================================
--- projects/sendfile/sys/conf/kmod.mk	Thu Dec 17 21:01:19 2015	(r292411)
+++ projects/sendfile/sys/conf/kmod.mk	Thu Dec 17 23:13:04 2015	(r292412)
@@ -225,7 +225,7 @@ ${FULLPROG}: ${OBJS}
 .else
 	grep -v '^#' < ${EXPORT_SYMS} > export_syms
 .endif
-	awk -f ${SYSDIR}/conf/kmod_syms.awk ${.TARGET} \
+	${AWK} -f ${SYSDIR}/conf/kmod_syms.awk ${.TARGET} \
 	    export_syms | xargs -J% ${OBJCOPY} % ${.TARGET}
 .endif
 .endif

Modified: projects/sendfile/sys/dev/drm2/i915/intel_iic.c
==============================================================================
--- projects/sendfile/sys/dev/drm2/i915/intel_iic.c	Thu Dec 17 21:01:19 2015	(r292411)
+++ projects/sendfile/sys/dev/drm2/i915/intel_iic.c	Thu Dec 17 23:13:04 2015	(r292412)
@@ -456,7 +456,7 @@ timeout:
 
 	/* Hardware may not support GMBUS over these pins? Try GPIO bitbanging instead. */
 	sc->force_bit_dev = true;
-	error = -IICBUS_TRANSFER(adapter, msgs, num);
+	error = -IICBUS_TRANSFER(dev_priv->bbbus[unit], msgs, num);
 
 out:
 	sx_xunlock(&dev_priv->gmbus_sx);

Modified: projects/sendfile/sys/dev/if_ndis/if_ndis_pci.c
==============================================================================
--- projects/sendfile/sys/dev/if_ndis/if_ndis_pci.c	Thu Dec 17 21:01:19 2015	(r292411)
+++ projects/sendfile/sys/dev/if_ndis/if_ndis_pci.c	Thu Dec 17 23:13:04 2015	(r292412)
@@ -298,8 +298,7 @@ ndis_attach_pci(dev)
 			BUS_SPACE_MAXADDR_32BIT,/* lowaddr */
                         BUS_SPACE_MAXADDR,	/* highaddr */
 			NULL, NULL,		/* filter, filterarg */
-			BUS_SPACE_MAXSIZE_32BIT, /* maxsize */
-			NDIS_NSEG_NEW,		/* nsegments */
+			DFLTPHYS, NDIS_NSEG_NEW,/* maxsize, nsegments */
 			BUS_SPACE_MAXSIZE_32BIT,/* maxsegsize */
 			BUS_DMA_ALLOCNOW,       /* flags */
 			NULL, NULL,		/* lockfunc, lockarg */

Modified: projects/sendfile/sys/dev/ofw/ofw_bus_subr.c
==============================================================================
--- projects/sendfile/sys/dev/ofw/ofw_bus_subr.c	Thu Dec 17 21:01:19 2015	(r292411)
+++ projects/sendfile/sys/dev/ofw/ofw_bus_subr.c	Thu Dec 17 23:13:04 2015	(r292412)
@@ -341,6 +341,7 @@ ofw_bus_search_intrmap(void *intr, int i
 	uint8_t *uiregs = regs;
 	uint8_t *uiimapmsk = imapmsk;
 	uint8_t *mptr;
+	pcell_t paddrsz;
 	pcell_t pintrsz;
 	int i, rsz, tsz;
 
@@ -357,19 +358,31 @@ ofw_bus_search_intrmap(void *intr, int i
 
 	mptr = imap;
 	i = imapsz;
+	paddrsz = 0;
 	while (i > 0) {
 		bcopy(mptr + physsz + intrsz, &parent, sizeof(parent));
+#ifdef OFW_EPAPR
+		/*
+		 * Find if we need to read the parent address data. Sparc64
+		 * uses a different encoding that doesn't include this data.
+		 */
+		if (OF_getencprop(OF_node_from_xref(parent),
+		    "#address-cells", &paddrsz, sizeof(paddrsz)) == -1)
+			paddrsz = 0;	/* default */
+		paddrsz *= sizeof(pcell_t);
+#endif
+
 		if (OF_searchencprop(OF_node_from_xref(parent),
 		    "#interrupt-cells", &pintrsz, sizeof(pintrsz)) == -1)
 			pintrsz = 1;	/* default */
 		pintrsz *= sizeof(pcell_t);
 
 		/* Compute the map stride size. */
-		tsz = physsz + intrsz + sizeof(phandle_t) + pintrsz;
+		tsz = physsz + intrsz + sizeof(phandle_t) + paddrsz + pintrsz;
 		KASSERT(i >= tsz, ("ofw_bus_search_intrmap: truncated map"));
 
 		if (bcmp(ref, mptr, physsz + intrsz) == 0) {
-			bcopy(mptr + physsz + intrsz + sizeof(parent),
+			bcopy(mptr + physsz + intrsz + sizeof(parent) + paddrsz,
 			    result, MIN(rintrsz, pintrsz));
 
 			if (iparent != NULL)

Modified: projects/sendfile/sys/kern/subr_syscall.c
==============================================================================
--- projects/sendfile/sys/kern/subr_syscall.c	Thu Dec 17 21:01:19 2015	(r292411)
+++ projects/sendfile/sys/kern/subr_syscall.c	Thu Dec 17 23:13:04 2015	(r292412)
@@ -126,14 +126,9 @@ syscallenter(struct thread *td, struct s
 			goto retval;
 
 #ifdef KDTRACE_HOOKS
-		/*
-		 * If the systrace module has registered it's probe
-		 * callback and if there is a probe active for the
-		 * syscall 'entry', process the probe.
-		 */
+		/* Give the syscall:::entry DTrace probe a chance to fire. */
 		if (systrace_probe_func != NULL && sa->callp->sy_entry != 0)
-			(*systrace_probe_func)(sa->callp->sy_entry, sa->code,
-			    sa->callp, sa->args, 0);
+			(*systrace_probe_func)(sa, SYSTRACE_ENTRY, 0);
 #endif
 
 		AUDIT_SYSCALL_ENTER(sa->code, td);
@@ -145,14 +140,10 @@ syscallenter(struct thread *td, struct s
 			td->td_errno = error;
 
 #ifdef KDTRACE_HOOKS
-		/*
-		 * If the systrace module has registered it's probe
-		 * callback and if there is a probe active for the
-		 * syscall 'return', process the probe.
-		 */
+		/* Give the syscall:::return DTrace probe a chance to fire. */
 		if (systrace_probe_func != NULL && sa->callp->sy_return != 0)
-			(*systrace_probe_func)(sa->callp->sy_return, sa->code,
-			    sa->callp, NULL, (error) ? -1 : td->td_retval[0]);
+			(*systrace_probe_func)(sa, SYSTRACE_RETURN,
+			    error ? -1 : td->td_retval[0]);
 #endif
 		syscall_thread_exit(td, sa->callp);
 	}

Modified: projects/sendfile/sys/net/if.c
==============================================================================
--- projects/sendfile/sys/net/if.c	Thu Dec 17 21:01:19 2015	(r292411)
+++ projects/sendfile/sys/net/if.c	Thu Dec 17 23:13:04 2015	(r292412)
@@ -126,7 +126,7 @@ SX_SYSINIT(ifdescr_sx, &ifdescr_sx, "ifn
 
 void	(*bridge_linkstate_p)(struct ifnet *ifp);
 void	(*ng_ether_link_state_p)(struct ifnet *ifp, int state);
-void	(*lagg_linkstate_p)(struct ifnet *ifp);
+void	(*lagg_linkstate_p)(struct ifnet *ifp, int state);
 /* These are external hooks for CARP. */
 void	(*carp_linkstate_p)(struct ifnet *ifp);
 void	(*carp_demote_adj_p)(int, char *);
@@ -1984,8 +1984,6 @@ if_unroute(struct ifnet *ifp, int flag, 
 
 	if (ifp->if_carp)
 		(*carp_linkstate_p)(ifp);
-	if (ifp->if_lagg)
-		(*lagg_linkstate_p)(ifp);
 	rt_ifmsg(ifp);
 }
 
@@ -2007,8 +2005,6 @@ if_route(struct ifnet *ifp, int flag, in
 			pfctlinput(PRC_IFUP, ifa->ifa_addr);
 	if (ifp->if_carp)
 		(*carp_linkstate_p)(ifp);
-	if (ifp->if_lagg)
-		(*lagg_linkstate_p)(ifp);
 	rt_ifmsg(ifp);
 #ifdef INET6
 	in6_if_up(ifp);
@@ -2023,27 +2019,17 @@ int	(*vlan_tag_p)(struct ifnet *, uint16
 int	(*vlan_setcookie_p)(struct ifnet *, void *);
 void	*(*vlan_cookie_p)(struct ifnet *);
 
-void
-if_link_state_change(struct ifnet *ifp, int link_state)
-{
-
-	return if_link_state_change_cond(ifp, link_state, 0);
-}
-
 /*
  * Handle a change in the interface link state. To avoid LORs
  * between driver lock and upper layer locks, as well as possible
  * recursions, we post event to taskqueue, and all job
  * is done in static do_link_state_change().
- *
- * If the current link state matches link_state and force isn't
- * specified no action is taken.
  */
 void
-if_link_state_change_cond(struct ifnet *ifp, int link_state, int force)
+if_link_state_change(struct ifnet *ifp, int link_state)
 {
-
-	if (ifp->if_link_state == link_state && !force)
+	/* Return if state hasn't changed. */
+	if (ifp->if_link_state == link_state)
 		return;
 
 	ifp->if_link_state = link_state;
@@ -2071,7 +2057,7 @@ do_link_state_change(void *arg, int pend
 	if (ifp->if_bridge)
 		(*bridge_linkstate_p)(ifp);
 	if (ifp->if_lagg)
-		(*lagg_linkstate_p)(ifp);
+		(*lagg_linkstate_p)(ifp, link_state);
 
 	if (IS_DEFAULT_VNET(curvnet))
 		devctl_notify("IFNET", ifp->if_xname,

Modified: projects/sendfile/sys/net/if_lagg.c
==============================================================================
--- projects/sendfile/sys/net/if_lagg.c	Thu Dec 17 21:01:19 2015	(r292411)
+++ projects/sendfile/sys/net/if_lagg.c	Thu Dec 17 23:13:04 2015	(r292412)
@@ -106,7 +106,7 @@ static int	lagg_port_create(struct lagg_
 static int	lagg_port_destroy(struct lagg_port *, int);
 static struct mbuf *lagg_input(struct ifnet *, struct mbuf *);
 static void	lagg_linkstate(struct lagg_softc *);
-static void	lagg_port_state(struct ifnet *);
+static void	lagg_port_state(struct ifnet *, int);
 static int	lagg_port_ioctl(struct ifnet *, u_long, caddr_t);
 static int	lagg_port_output(struct ifnet *, struct mbuf *,
 		    const struct sockaddr *, struct route *);
@@ -1774,12 +1774,7 @@ lagg_linkstate(struct lagg_softc *sc)
 			break;
 		}
 	}
-
-	/*
-	 * Force state change to ensure ifnet_link_event is generated allowing
-	 * protocols to notify other nodes of potential address move.
-	 */
-	if_link_state_change_cond(sc->sc_ifp, new_link, 1);
+	if_link_state_change(sc->sc_ifp, new_link);
 
 	/* Update if_baudrate to reflect the max possible speed */
 	switch (sc->sc_proto) {
@@ -1802,7 +1797,7 @@ lagg_linkstate(struct lagg_softc *sc)
 }
 
 static void
-lagg_port_state(struct ifnet *ifp)
+lagg_port_state(struct ifnet *ifp, int state)
 {
 	struct lagg_port *lp = (struct lagg_port *)ifp->if_lagg;
 	struct lagg_softc *sc = NULL;
@@ -1818,7 +1813,7 @@ lagg_port_state(struct ifnet *ifp)
 	LAGG_WUNLOCK(sc);
 }
 
-static struct lagg_port *
+struct lagg_port *
 lagg_link_active(struct lagg_softc *sc, struct lagg_port *lp)
 {
 	struct lagg_port *lp_next, *rval = NULL;

Modified: projects/sendfile/sys/net/if_lagg.h
==============================================================================
--- projects/sendfile/sys/net/if_lagg.h	Thu Dec 17 21:01:19 2015	(r292411)
+++ projects/sendfile/sys/net/if_lagg.h	Thu Dec 17 23:13:04 2015	(r292412)
@@ -281,7 +281,7 @@ struct lagg_port {
 #define	LAGG_UNLOCK_ASSERT(_sc)	rm_assert(&(_sc)->sc_mtx, RA_UNLOCKED)
 
 extern struct mbuf *(*lagg_input_p)(struct ifnet *, struct mbuf *);
-extern void	(*lagg_linkstate_p)(struct ifnet *);
+extern void	(*lagg_linkstate_p)(struct ifnet *, int );
 
 int		lagg_enqueue(struct ifnet *, struct mbuf *);
 

Modified: projects/sendfile/sys/net/if_var.h
==============================================================================
--- projects/sendfile/sys/net/if_var.h	Thu Dec 17 21:01:19 2015	(r292411)
+++ projects/sendfile/sys/net/if_var.h	Thu Dec 17 23:13:04 2015	(r292412)
@@ -500,7 +500,6 @@ struct ifmultiaddr *
 void	if_free(struct ifnet *);
 void	if_initname(struct ifnet *, const char *, int);
 void	if_link_state_change(struct ifnet *, int);
-void	if_link_state_change_cond(struct ifnet *, int, int);
 int	if_printf(struct ifnet *, const char *, ...) __printflike(2, 3);
 void	if_ref(struct ifnet *);
 void	if_rele(struct ifnet *);

Modified: projects/sendfile/sys/netinet/if_ether.c
==============================================================================
--- projects/sendfile/sys/netinet/if_ether.c	Thu Dec 17 21:01:19 2015	(r292411)
+++ projects/sendfile/sys/netinet/if_ether.c	Thu Dec 17 23:13:04 2015	(r292412)
@@ -107,7 +107,6 @@ VNET_PCPUSTAT_SYSUNINIT(arpstat);
 #endif /* VIMAGE */
 
 static VNET_DEFINE(int, arp_maxhold) = 1;
-static VNET_DEFINE(int, arp_on_link) = 1;
 
 #define	V_arpt_keep		VNET(arpt_keep)
 #define	V_arpt_down		VNET(arpt_down)
@@ -115,7 +114,6 @@ static VNET_DEFINE(int, arp_on_link) = 1
 #define	V_arp_maxtries		VNET(arp_maxtries)
 #define	V_arp_proxyall		VNET(arp_proxyall)
 #define	V_arp_maxhold		VNET(arp_maxhold)
-#define	V_arp_on_link		VNET(arp_on_link)
 
 SYSCTL_INT(_net_link_ether_inet, OID_AUTO, max_age, CTLFLAG_VNET | CTLFLAG_RW,
 	&VNET_NAME(arpt_keep), 0,
@@ -138,9 +136,6 @@ SYSCTL_INT(_net_link_ether_inet, OID_AUT
 	CTLFLAG_RW, &arp_maxpps, 0,
 	"Maximum number of remotely triggered ARP messages that can be "
 	"logged per second");
-SYSCTL_INT(_net_link_ether_inet, OID_AUTO, arp_on_link, CTLFLAG_VNET | CTLFLAG_RW,
-	&VNET_NAME(arp_on_link), 0,
-	"Send gratuitous ARP's on interface link up events");
 
 #define	ARP_LOG(pri, ...)	do {					\
 	if (ppsratecheck(&arp_lastlog, &arp_curpps, arp_maxpps))	\
@@ -161,7 +156,6 @@ static void arp_mark_lle_reachable(struc
 static void arp_iflladdr(void *arg __unused, struct ifnet *ifp);
 
 static eventhandler_tag iflladdr_tag;
-static eventhandler_tag ifnet_link_event_tag;
 
 static const struct netisr_handler arp_nh = {
 	.nh_name = "arp",
@@ -1190,99 +1184,43 @@ arp_ifinit(struct ifnet *ifp, struct ifa
 
 	if (ntohl(dst_in->sin_addr.s_addr) == INADDR_ANY)
 		return;
-	arp_announce_addr(ifp, &dst_in->sin_addr, IF_LLADDR(ifp));
+	arp_announce_ifaddr(ifp, dst_in->sin_addr, IF_LLADDR(ifp));
 
 	arp_add_ifa_lle(ifp, dst);
 }
 
-void __noinline
-arp_announce_addr(struct ifnet *ifp, const struct in_addr *addr, u_char *enaddr)
+void
+arp_announce_ifaddr(struct ifnet *ifp, struct in_addr addr, u_char *enaddr)
 {
 
-	if (ntohl(addr->s_addr) != INADDR_ANY)
-		arprequest(ifp, addr, addr, enaddr);
+	if (ntohl(addr.s_addr) != INADDR_ANY)
+		arprequest(ifp, &addr, &addr, enaddr);
 }
 
 /*
- * Send gratuitous ARPs for all interfaces addresses to notify other nodes of
- * changes.
- *
- * This is a noop if the interface isn't up or has been flagged for no ARP.
+ * Sends gratuitous ARPs for each ifaddr to notify other
+ * nodes about the address change.
  */
-void __noinline
-arp_announce(struct ifnet *ifp)
+static __noinline void
+arp_handle_ifllchange(struct ifnet *ifp)
 {
-	int i, cnt, entries;
-	u_char *lladdr;
 	struct ifaddr *ifa;
-	struct in_addr *addr, *head;
 
-	if (!(ifp->if_flags & IFF_UP) || (ifp->if_flags & IFF_NOARP) ||
-	    ifp->if_addr == NULL)
-		return;
-
-	entries = 8;
-	cnt = 0;
-	head = malloc(sizeof(*addr) * entries, M_TEMP, M_NOWAIT);
-	if (head == NULL) {
-		log(LOG_INFO, "arp_announce: malloc %d entries failed\n",
-		    entries);
-		return;
-	}
-
-	/* Take a copy then process to avoid locking issues. */
-	IF_ADDR_RLOCK(ifp);
 	TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) {
-		if (ifa->ifa_addr->sa_family != AF_INET)
-			continue;
-
-		if (cnt == entries) {
-			addr = (struct in_addr *)realloc(head, sizeof(*addr) *
-			    (entries + 8), M_TEMP, M_NOWAIT);
-			if (addr == NULL) {
-				log(LOG_INFO, "arp_announce: realloc to %d "
-				    "entries failed\n", entries + 8);
-				/* Process what we have. */
-				break;
-			}
-			entries += 8;
-			head = addr;
-		}
-
-		addr = head + cnt;
-		bcopy(IFA_IN(ifa), addr, sizeof(*addr));
-		cnt++;
+		if (ifa->ifa_addr->sa_family == AF_INET)
+			arp_ifinit(ifp, ifa);
 	}
-	IF_ADDR_RUNLOCK(ifp);
-
-	if (cnt > 0) {
-		lladdr = IF_LLADDR(ifp);
-		for (i = 0; i < cnt; i++) {
-			arp_announce_addr(ifp, head + i, lladdr);
-		}
-	}
-	free(head, M_TEMP);
 }
 
 /*
- * A handler for interface linkstate change events.
- */
-static void
-arp_ifnet_link_event(void *arg __unused, struct ifnet *ifp, int linkstate)
-{
-
-	if (linkstate == LINK_STATE_UP && V_arp_on_link)
-		arp_announce(ifp);
-}
-
-/*
- * A handler for interface link layer address change events.
+ * A handler for interface link layer address change event.
  */
 static __noinline void
 arp_iflladdr(void *arg __unused, struct ifnet *ifp)
 {
 
-	arp_announce(ifp);
+	if ((ifp->if_flags & IFF_UP) != 0)
+		arp_handle_ifllchange(ifp);
 }
 
 static void
@@ -1290,12 +1228,8 @@ arp_init(void)
 {
 
 	netisr_register(&arp_nh);
-
-	if (IS_DEFAULT_VNET(curvnet)) {
+	if (IS_DEFAULT_VNET(curvnet))
 		iflladdr_tag = EVENTHANDLER_REGISTER(iflladdr_event,
 		    arp_iflladdr, NULL, EVENTHANDLER_PRI_ANY);
-		ifnet_link_event_tag = EVENTHANDLER_REGISTER(ifnet_link_event,
-		    arp_ifnet_link_event, 0, EVENTHANDLER_PRI_ANY);
-	}
 }
 SYSINIT(arp, SI_SUB_PROTO_DOMAIN, SI_ORDER_ANY, arp_init, 0);

Modified: projects/sendfile/sys/netinet/if_ether.h
==============================================================================
--- projects/sendfile/sys/netinet/if_ether.h	Thu Dec 17 21:01:19 2015	(r292411)
+++ projects/sendfile/sys/netinet/if_ether.h	Thu Dec 17 23:13:04 2015	(r292412)
@@ -119,8 +119,7 @@ int	arpresolve(struct ifnet *ifp, int is
 void	arprequest(struct ifnet *, const struct in_addr *,
 	    const struct in_addr *, u_char *);
 void	arp_ifinit(struct ifnet *, struct ifaddr *);
-void	arp_announce(struct ifnet *);
-void	arp_announce_addr(struct ifnet *, const struct in_addr *addr, u_char *);
+void	arp_announce_ifaddr(struct ifnet *, struct in_addr addr, u_char *);
 #endif
 
 #endif

Modified: projects/sendfile/sys/netinet/in_var.h
==============================================================================
--- projects/sendfile/sys/netinet/in_var.h	Thu Dec 17 21:01:19 2015	(r292411)
+++ projects/sendfile/sys/netinet/in_var.h	Thu Dec 17 23:13:04 2015	(r292412)
@@ -129,9 +129,6 @@ extern	struct rmlock in_ifaddr_lock;
 #define	IN_IFADDR_WLOCK_ASSERT()	rm_assert(&in_ifaddr_lock, RA_WLOCKED)
 #define	IN_IFADDR_WUNLOCK()	rm_wunlock(&in_ifaddr_lock)
 
-#define	IFA_IN(ifa) \
-	(&((struct sockaddr_in *)ifa->ifa_addr)->sin_addr)
-
 /*
  * Macro for finding the internet address structure (in_ifaddr)
  * corresponding to one of our IP addresses (in_addr).

Modified: projects/sendfile/sys/netinet/ip_carp.c
==============================================================================
--- projects/sendfile/sys/netinet/ip_carp.c	Thu Dec 17 21:01:19 2015	(r292411)
+++ projects/sendfile/sys/netinet/ip_carp.c	Thu Dec 17 23:13:04 2015	(r292412)
@@ -1009,12 +1009,13 @@ static void
 carp_send_arp(struct carp_softc *sc)
 {
 	struct ifaddr *ifa;
+	struct in_addr addr;
 
 	CARP_FOREACH_IFA(sc, ifa) {
 		if (ifa->ifa_addr->sa_family != AF_INET)
 			continue;
-		arp_announce_addr(sc->sc_carpdev, IFA_IN(ifa),
-		    LLADDR(&sc->sc_addr));
+		addr = ((struct sockaddr_in *)ifa->ifa_addr)->sin_addr;
+		arp_announce_ifaddr(sc->sc_carpdev, addr, LLADDR(&sc->sc_addr));
 	}
 }
 
@@ -1036,16 +1037,18 @@ carp_iamatch(struct ifaddr *ifa, uint8_t
 static void
 carp_send_na(struct carp_softc *sc)
 {
+	static struct in6_addr mcast = IN6ADDR_LINKLOCAL_ALLNODES_INIT;
 	struct ifaddr *ifa;
+	struct in6_addr *in6;
 
 	CARP_FOREACH_IFA(sc, ifa) {
-		if (ifa->ifa_addr->sa_family != AF_INET6 ||
-		    IFA_ND6_NA_UNSOLICITED_SKIP(ifa))
+		if (ifa->ifa_addr->sa_family != AF_INET6)
 			continue;
 
-		nd6_na_output_unsolicited_addr(sc->sc_carpdev, IFA_IN6(ifa),
-		    IFA_ND6_NA_BASE_FLAGS(sc->sc_carpdev, ifa));
-		DELAY(nd6_na_unsolicited_addr_delay(ifa));
+		in6 = IFA_IN6(ifa);
+		nd6_na_output(sc->sc_carpdev, &mcast, in6,
+		    ND_NA_FLAG_OVERRIDE, 1, NULL);
+		DELAY(1000);	/* XXX */
 	}
 }
 

Modified: projects/sendfile/sys/netinet6/in6.c
==============================================================================
--- projects/sendfile/sys/netinet6/in6.c	Thu Dec 17 21:01:19 2015	(r292411)
+++ projects/sendfile/sys/netinet6/in6.c	Thu Dec 17 23:13:04 2015	(r292412)
@@ -114,7 +114,7 @@ VNET_DECLARE(int, icmp6_nodeinfo_oldmcpr
 #define V_icmp6_nodeinfo_oldmcprefix	VNET(icmp6_nodeinfo_oldmcprefix)
 
 /*
- * Definitions of some constant IP6 addresses.
+ * Definitions of some costant IP6 addresses.
  */
 const struct in6_addr in6addr_any = IN6ADDR_ANY_INIT;
 const struct in6_addr in6addr_loopback = IN6ADDR_LOOPBACK_INIT;

Modified: projects/sendfile/sys/netinet6/in6_var.h
==============================================================================
--- projects/sendfile/sys/netinet6/in6_var.h	Thu Dec 17 21:01:19 2015	(r292411)
+++ projects/sendfile/sys/netinet6/in6_var.h	Thu Dec 17 23:13:04 2015	(r292412)
@@ -399,16 +399,6 @@ struct	in6_rrenumreq {
 #define IA6_SIN6(ia)	(&((ia)->ia_addr))
 #define IA6_DSTSIN6(ia)	(&((ia)->ia_dstaddr))
 #define IFA_IN6(x)	(&((struct sockaddr_in6 *)((x)->ifa_addr))->sin6_addr)
-#define IFA_IN6_FLAGS(ifa)	((struct in6_ifaddr *)ifa)->ia6_flags
-#define IFA_ND6_NA_BASE_FLAGS(ifp, ifa)			\
-    (IFA_IN6_FLAGS(ifa) & IN6_IFF_ANYCAST ? 0 : ND_NA_FLAG_OVERRIDE) | \
-    ((V_ip6_forwarding && !(ND_IFINFO(ifp)->flags & ND6_IFF_ACCEPT_RTADV && \
-    V_ip6_norbit_raif)) ? ND_NA_FLAG_ROUTER : 0)
-#define IFA_ND6_NA_UNSOLICITED_SKIP(ifa)		\
-    (IFA_IN6_FLAGS(ifa) & (IN6_IFF_DUPLICATED | IN6_IFF_DEPRECATED | \
-    IN6_IFF_TENTATIVE)) != 0
-#define IN6_MAX_ANYCAST_DELAY_TIME_MS 1000000
-#define IN6_BROADCAST_DELAY_TIME_MS 1000
 #define IFA_DSTIN6(x)	(&((struct sockaddr_in6 *)((x)->ifa_dstaddr))->sin6_addr)
 
 #define IFPR_IN6(x)	(&((struct sockaddr_in6 *)((x)->ifpr_prefix))->sin6_addr)

Modified: projects/sendfile/sys/netinet6/nd6.c
==============================================================================
--- projects/sendfile/sys/netinet6/nd6.c	Thu Dec 17 21:01:19 2015	(r292411)
+++ projects/sendfile/sys/netinet6/nd6.c	Thu Dec 17 23:13:04 2015	(r292412)
@@ -38,7 +38,6 @@ __FBSDID("$FreeBSD$");
 #include <sys/param.h>
 #include <sys/systm.h>
 #include <sys/callout.h>
-#include <sys/random.h>
 #include <sys/malloc.h>
 #include <sys/mbuf.h>
 #include <sys/socket.h>
@@ -103,12 +102,8 @@ VNET_DEFINE(int, nd6_maxnudhint) = 0;	/*
 					 * layer hints */
 static VNET_DEFINE(int, nd6_maxqueuelen) = 1; /* max pkts cached in unresolved
 					 * ND entries */
-
-static VNET_DEFINE(int, nd6_on_link) = 1; /* Send unsolicited ND's on link up */
-
 #define	V_nd6_maxndopt			VNET(nd6_maxndopt)
 #define	V_nd6_maxqueuelen		VNET(nd6_maxqueuelen)
-#define	V_nd6_on_link			VNET(nd6_on_link)
 
 #ifdef ND6_DEBUG
 VNET_DEFINE(int, nd6_debug) = 1;
@@ -117,7 +112,6 @@ VNET_DEFINE(int, nd6_debug) = 0;
 #endif
 
 static eventhandler_tag lle_event_eh;
-static eventhandler_tag ifnet_link_event_eh;
 
 /* for debugging? */
 #if 0
@@ -202,14 +196,6 @@ nd6_lle_event(void *arg __unused, struct
 	    type == RTM_ADD ? RTF_UP: 0), 0, RT_DEFAULT_FIB);
 }
 
-static void
-nd6_ifnet_link_event(void *arg __unused, struct ifnet *ifp, int linkstate)
-{
-
-	if (linkstate == LINK_STATE_UP && V_nd6_on_link)
-		nd6_na_output_unsolicited(ifp);
-}
-
 void
 nd6_init(void)
 {
@@ -225,12 +211,9 @@ nd6_init(void)
 	    nd6_slowtimo, curvnet);
 
 	nd6_dad_init();
-	if (IS_DEFAULT_VNET(curvnet)) {
+	if (IS_DEFAULT_VNET(curvnet))
 		lle_event_eh = EVENTHANDLER_REGISTER(lle_event, nd6_lle_event,
 		    NULL, EVENTHANDLER_PRI_ANY);
-		ifnet_link_event_eh = EVENTHANDLER_REGISTER(ifnet_link_event,
-		    nd6_ifnet_link_event, NULL, EVENTHANDLER_PRI_ANY);
-	}
 }
 
 #ifdef VIMAGE
@@ -240,10 +223,8 @@ nd6_destroy()
 
 	callout_drain(&V_nd6_slowtimo_ch);
 	callout_drain(&V_nd6_timer_ch);
-	if (IS_DEFAULT_VNET(curvnet)) {
+	if (IS_DEFAULT_VNET(curvnet))
 		EVENTHANDLER_DEREGISTER(lle_event, lle_event_eh);
-		EVENTHANDLER_DEREGISTER(ifnet_link_event, ifnet_link_event_eh);
-	}
 }
 #endif
 
@@ -2476,18 +2457,13 @@ static int nd6_sysctl_prlist(SYSCTL_HAND
 SYSCTL_DECL(_net_inet6_icmp6);
 #endif
 SYSCTL_NODE(_net_inet6_icmp6, ICMPV6CTL_ND6_DRLIST, nd6_drlist,
-    CTLFLAG_RD, nd6_sysctl_drlist, "List default routers");
+	CTLFLAG_RD, nd6_sysctl_drlist, "");
 SYSCTL_NODE(_net_inet6_icmp6, ICMPV6CTL_ND6_PRLIST, nd6_prlist,
-    CTLFLAG_RD, nd6_sysctl_prlist, "List prefixes");
+	CTLFLAG_RD, nd6_sysctl_prlist, "");
 SYSCTL_INT(_net_inet6_icmp6, ICMPV6CTL_ND6_MAXQLEN, nd6_maxqueuelen,
-    CTLFLAG_VNET | CTLFLAG_RW, &VNET_NAME(nd6_maxqueuelen), 1,
-    "Max packets cached in unresolved ND entries");
+	CTLFLAG_VNET | CTLFLAG_RW, &VNET_NAME(nd6_maxqueuelen), 1, "");
 SYSCTL_INT(_net_inet6_icmp6, OID_AUTO, nd6_gctimer,
-    CTLFLAG_VNET | CTLFLAG_RW, &VNET_NAME(nd6_gctimer), (60 * 60 * 24),
-    "Interface in seconds between garbage collection passes");
-SYSCTL_INT(_net_inet6_icmp6, OID_AUTO, nd6_on_link, CTLFLAG_VNET | CTLFLAG_RW,
-    &VNET_NAME(nd6_on_link), 0,
-    "Send unsolicited neighbor discovery on interface link up events");
+	CTLFLAG_VNET | CTLFLAG_RW, &VNET_NAME(nd6_gctimer), (60 * 60 * 24), "");
 
 static int
 nd6_sysctl_drlist(SYSCTL_HANDLER_ARGS)

Modified: projects/sendfile/sys/netinet6/nd6.h
==============================================================================
--- projects/sendfile/sys/netinet6/nd6.h	Thu Dec 17 21:01:19 2015	(r292411)
+++ projects/sendfile/sys/netinet6/nd6.h	Thu Dec 17 23:13:04 2015	(r292412)
@@ -398,10 +398,6 @@ void nd6_init(void);
 #ifdef VIMAGE
 void nd6_destroy(void);
 #endif
-void nd6_na_output_unsolicited(struct ifnet *);
-void nd6_na_output_unsolicited_addr(struct ifnet *, const struct in6_addr *,
-    u_long);
-int nd6_na_unsolicited_addr_delay(struct ifaddr *);
 struct nd_ifinfo *nd6_ifattach(struct ifnet *);
 void nd6_ifdetach(struct nd_ifinfo *);
 int nd6_is_addr_neighbor(const struct sockaddr_in6 *, struct ifnet *);

Modified: projects/sendfile/sys/netinet6/nd6_nbr.c
==============================================================================
--- projects/sendfile/sys/netinet6/nd6_nbr.c	Thu Dec 17 21:01:19 2015	(r292411)
+++ projects/sendfile/sys/netinet6/nd6_nbr.c	Thu Dec 17 23:13:04 2015	(r292412)
@@ -124,16 +124,20 @@ nd6_ns_input(struct mbuf *m, int off, in
 	struct in6_addr saddr6 = ip6->ip6_src;
 	struct in6_addr daddr6 = ip6->ip6_dst;
 	struct in6_addr taddr6;
+	struct in6_addr myaddr6;
 	char *lladdr = NULL;
 	struct ifaddr *ifa = NULL;
-	u_long flags;
 	int lladdrlen = 0;
-	int proxy = 0;
+	int anycast = 0, proxy = 0, tentative = 0;
 	int tlladdr;
+	int rflag;
 	union nd_opts ndopts;
 	struct sockaddr_dl proxydl;
 	char ip6bufs[INET6_ADDRSTRLEN], ip6bufd[INET6_ADDRSTRLEN];
 
+	rflag = (V_ip6_forwarding) ? ND_NA_FLAG_ROUTER : 0;
+	if (ND_IFINFO(ifp)->flags & ND6_IFF_ACCEPT_RTADV && V_ip6_norbit_raif)
+		rflag = 0;
 #ifndef PULLDOWN_TEST
 	IP6_EXTHDR_CHECK(m, off, icmp6len,);
 	nd_ns = (struct nd_neighbor_solicit *)((caddr_t)ip6 + off);
@@ -225,7 +229,10 @@ nd6_ns_input(struct mbuf *m, int off, in
 	 * In implementation, we add target link-layer address by default.
 	 * We do not add one in MUST NOT cases.
 	 */
-	tlladdr = !IN6_IS_ADDR_MULTICAST(&daddr6);
+	if (!IN6_IS_ADDR_MULTICAST(&daddr6))
+		tlladdr = 0;
+	else
+		tlladdr = 1;
 
 	/*
 	 * Target address (taddr6) must be either:
@@ -282,6 +289,9 @@ nd6_ns_input(struct mbuf *m, int off, in
 		 */
 		goto freeit;
 	}
+	myaddr6 = *IFA_IN6(ifa);
+	anycast = ((struct in6_ifaddr *)ifa)->ia6_flags & IN6_IFF_ANYCAST;
+	tentative = ((struct in6_ifaddr *)ifa)->ia6_flags & IN6_IFF_TENTATIVE;
 	if (((struct in6_ifaddr *)ifa)->ia6_flags & IN6_IFF_DUPLICATED)
 		goto freeit;
 
@@ -293,7 +303,7 @@ nd6_ns_input(struct mbuf *m, int off, in
 		goto bad;
 	}
 
-	if (IN6_ARE_ADDR_EQUAL(IFA_IN6(ifa), &saddr6)) {
+	if (IN6_ARE_ADDR_EQUAL(&myaddr6, &saddr6)) {
 		nd6log((LOG_INFO, "nd6_ns_input: duplicate IP6 address %s\n",
 		    ip6_sprintf(ip6bufs, &saddr6)));
 		goto freeit;
@@ -311,7 +321,7 @@ nd6_ns_input(struct mbuf *m, int off, in
 	 *
 	 * The processing is defined in RFC 2462.
 	 */
-	if (IFA_IN6_FLAGS(ifa) & IN6_IFF_TENTATIVE) {
+	if (tentative) {
 		/*
 		 * If source address is unspecified address, it is for
 		 * duplicate address detection.
@@ -325,10 +335,6 @@ nd6_ns_input(struct mbuf *m, int off, in
 		goto freeit;
 	}
 
-	flags = IFA_ND6_NA_BASE_FLAGS(ifp, ifa);
-	if (proxy || !tlladdr)
-		flags &= ~ND_NA_FLAG_OVERRIDE;
-
 	/*
 	 * If the source address is unspecified address, entries must not
 	 * be created or updated.
@@ -343,16 +349,20 @@ nd6_ns_input(struct mbuf *m, int off, in
 		in6_all = in6addr_linklocal_allnodes;
 		if (in6_setscope(&in6_all, ifp, NULL) != 0)
 			goto bad;
-		nd6_na_output_fib(ifp, &in6_all, &taddr6, flags, tlladdr,
-		    proxy ? (struct sockaddr *)&proxydl : NULL, M_GETFIB(m));
+		nd6_na_output_fib(ifp, &in6_all, &taddr6,
+		    ((anycast || proxy || !tlladdr) ? 0 : ND_NA_FLAG_OVERRIDE) |
+		    rflag, tlladdr, proxy ? (struct sockaddr *)&proxydl : NULL,
+		    M_GETFIB(m));
 		goto freeit;
 	}
 
 	nd6_cache_lladdr(ifp, &saddr6, lladdr, lladdrlen,
 	    ND_NEIGHBOR_SOLICIT, 0);
 
-	nd6_na_output_fib(ifp, &saddr6, &taddr6, flags | ND_NA_FLAG_SOLICITED,
-	    tlladdr, proxy ? (struct sockaddr *)&proxydl : NULL, M_GETFIB(m));
+	nd6_na_output_fib(ifp, &saddr6, &taddr6,
+	    ((anycast || proxy || !tlladdr) ? 0 : ND_NA_FLAG_OVERRIDE) |
+	    rflag | ND_NA_FLAG_SOLICITED, tlladdr,
+	    proxy ? (struct sockaddr *)&proxydl : NULL, M_GETFIB(m));
  freeit:
 	if (ifa != NULL)
 		ifa_free(ifa);
@@ -1587,111 +1597,3 @@ nd6_dad_na_input(struct ifaddr *ifa)
 		nd6_dad_rele(dp);
 	}
 }
-
-/*
- * Send unsolicited neighbor advertisements for all interface addresses to
- * notify other nodes of changes.
- *
- * This is a noop if the interface isn't up.
- */
-void __noinline
-nd6_na_output_unsolicited(struct ifnet *ifp)
-{
-	int i, cnt, entries;
-	struct ifaddr *ifa;
-	struct ann {
-		struct in6_addr addr;
-		u_long flags;
-		int delay;
-	} *ann1, *head;
-
-	if (!(ifp->if_flags & IFF_UP))
-		return;
-
-	entries = 8;
-	cnt = 0;
-	head = malloc(sizeof(struct ann) * entries, M_TEMP, M_WAITOK);
-
-	/* Take a copy then process to avoid locking issues. */
-	IF_ADDR_RLOCK(ifp);
-	TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) {
-		if (ifa->ifa_addr->sa_family != AF_INET6 ||
-		    IFA_ND6_NA_UNSOLICITED_SKIP(ifa))
-			continue;
-
-		if (cnt == entries) {
-			ann1 = (struct ann*)realloc(head, sizeof(struct ann) *
-			    (entries + 8), M_TEMP, M_NOWAIT);
-			if (ann1 == NULL) {
-				log(LOG_INFO, "nd6_announce: realloc to %d "
-				    "entries failed\n", entries + 8);
-				/* Process what we have. */
-				break;
-			}
-			entries += 8;
-			head = ann1;
-		}
-
-		ann1 = head + cnt;
-		bcopy(IFA_IN6(ifa), &ann1->addr, sizeof(ann1->addr));
-		ann1->flags = IFA_ND6_NA_BASE_FLAGS(ifp, ifa);
-		ann1->delay = nd6_na_unsolicited_addr_delay(ifa);
-		cnt++;
-	}
-	IF_ADDR_RUNLOCK(ifp);
-
-	for (i = 0; i < cnt;) {
-		ann1 = head + i;
-		nd6_na_output_unsolicited_addr(ifp, &ann1->addr, ann1->flags);
-		i++;
-		if (i == cnt)
-			break;
-		/* XXX DELAY needs to be done in taskqueue to avoid stalling. */
-		//DELAY(ann1->delay);
-	}
-	free(head, M_TEMP);
-}
-
-/*
- * Return the delay required for announcements of the address as per RFC 4861.
- */
-int
-nd6_na_unsolicited_addr_delay(struct ifaddr *ifa)
-{
-
-	if (IFA_IN6_FLAGS(ifa) & IN6_IFF_ANYCAST) {
-		/*
-		 * Random value between 0 and MAX_ANYCAST_DELAY_TIME
-		 * as per section 7.2.7.
-		 */
-		return (random() % IN6_MAX_ANYCAST_DELAY_TIME_MS);
-	}
-
-	/* Small delay as per section 7.2.6. */
-	return (IN6_BROADCAST_DELAY_TIME_MS);
-}
-
-/*
- * Send an unsolicited neighbor advertisement for an address to notify other
- * nodes of changes.

*** DIFF OUTPUT TRUNCATED AT 1000 LINES ***


More information about the svn-src-projects mailing list