Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 03 Sep 2019 14:06:01 -0000
From:      Enji Cooper <ngie@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-projects@freebsd.org
Subject:   svn commit: r345746 - in projects/capsicum-test: libexec/rc/rc.d libexec/save-entropy sys/compat/freebsd32 sys/net sys/netinet6
Message-ID:  <201903310516.x2V5GRIW001851@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: ngie
Date: Sun Mar 31 05:16:27 2019
New Revision: 345746
URL: https://svnweb.freebsd.org/changeset/base/345746

Log:
  MFhead@r345745

Modified:
  projects/capsicum-test/libexec/rc/rc.d/random
  projects/capsicum-test/libexec/save-entropy/save-entropy.sh
  projects/capsicum-test/sys/compat/freebsd32/freebsd32_misc.c
  projects/capsicum-test/sys/net/if_stf.c
  projects/capsicum-test/sys/netinet6/in6.c
  projects/capsicum-test/sys/netinet6/in6_ifattach.c
  projects/capsicum-test/sys/netinet6/nd6.c
Directory Properties:
  projects/capsicum-test/   (props changed)

Modified: projects/capsicum-test/libexec/rc/rc.d/random
==============================================================================
--- projects/capsicum-test/libexec/rc/rc.d/random	Sun Mar 31 05:15:32 2019	(r345745)
+++ projects/capsicum-test/libexec/rc/rc.d/random	Sun Mar 31 05:16:27 2019	(r345746)
@@ -25,7 +25,8 @@ save_dev_random()
 	for f ; do
 		debug "saving entropy to $f"
 		dd if=/dev/random of="$f" bs=4096 count=1 status=none &&
-			chmod 600 "$f"
+			chmod 600 "$f" &&
+			fsync "$f" "$(dirname "$f")"
 	done
 	umask ${oumask}
 }
@@ -120,6 +121,9 @@ random_stop()
 			dd if=/dev/random of=${entropy_file_confirmed} \
 			    bs=4096 count=1 2> /dev/null ||
 			    warn 'write failed (unwriteable file or full fs?)'
+			fsync "${entropy_file_confirmed}" \
+			    "$(dirname "${entropy_file_confirmed}")" \
+			    2> /dev/null
 			echo '.'
 			;;
 		esac
@@ -145,6 +149,9 @@ random_stop()
 			dd if=/dev/random of=${entropy_boot_file_confirmed} \
 			    bs=4096 count=1 2> /dev/null ||
 			    warn 'write failed (unwriteable file or full fs?)'
+			fsync "${entropy_boot_file_confirmed}" \
+			    "$(dirname "${entropy_boot_file_confirmed}")" \
+			    2> /dev/null
 			echo '.'
 			;;
 		esac

Modified: projects/capsicum-test/libexec/save-entropy/save-entropy.sh
==============================================================================
--- projects/capsicum-test/libexec/save-entropy/save-entropy.sh	Sun Mar 31 05:15:32 2019	(r345745)
+++ projects/capsicum-test/libexec/save-entropy/save-entropy.sh	Sun Mar 31 05:16:27 2019	(r345746)
@@ -90,5 +90,6 @@ while [ ${n} -ge 1 ]; do
 done
 
 dd if=/dev/random of=saved-entropy.1 bs=${entropy_save_sz} count=1 2>/dev/null
+fsync saved-entropy.1 "."
 
 exit 0

Modified: projects/capsicum-test/sys/compat/freebsd32/freebsd32_misc.c
==============================================================================
--- projects/capsicum-test/sys/compat/freebsd32/freebsd32_misc.c	Sun Mar 31 05:15:32 2019	(r345745)
+++ projects/capsicum-test/sys/compat/freebsd32/freebsd32_misc.c	Sun Mar 31 05:16:27 2019	(r345746)
@@ -1160,8 +1160,8 @@ freebsd32_copy_msg_out(struct msghdr *msg, struct mbuf
 				cm = NULL;
 			}
 
-			msg->msg_controllen += FREEBSD32_ALIGN(sizeof(*cm)) +
-			    datalen_out;
+			msg->msg_controllen +=
+			    FREEBSD32_CMSG_SPACE(datalen_out);
 		}
 	}
 	if (len == 0 && m != NULL) {

Modified: projects/capsicum-test/sys/net/if_stf.c
==============================================================================
--- projects/capsicum-test/sys/net/if_stf.c	Sun Mar 31 05:15:32 2019	(r345745)
+++ projects/capsicum-test/sys/net/if_stf.c	Sun Mar 31 05:16:27 2019	(r345746)
@@ -724,6 +724,7 @@ stf_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data)
 		}
 
 		ifp->if_flags |= IFF_UP;
+		ifp->if_drv_flags |= IFF_DRV_RUNNING;
 		break;
 
 	case SIOCADDMULTI:

Modified: projects/capsicum-test/sys/netinet6/in6.c
==============================================================================
--- projects/capsicum-test/sys/netinet6/in6.c	Sun Mar 31 05:15:32 2019	(r345745)
+++ projects/capsicum-test/sys/netinet6/in6.c	Sun Mar 31 05:16:27 2019	(r345746)
@@ -1951,26 +1951,14 @@ in6_if_up(struct ifnet *ifp)
 int
 in6if_do_dad(struct ifnet *ifp)
 {
+
 	if ((ifp->if_flags & IFF_LOOPBACK) != 0)
 		return (0);
-
-	if ((ND_IFINFO(ifp)->flags & ND6_IFF_IFDISABLED) ||
-	    (ND_IFINFO(ifp)->flags & ND6_IFF_NO_DAD))
+	if ((ifp->if_flags & IFF_MULTICAST) == 0)
 		return (0);
-
-	/*
-	 * Our DAD routine requires the interface up and running.
-	 * However, some interfaces can be up before the RUNNING
-	 * status.  Additionally, users may try to assign addresses
-	 * before the interface becomes up (or running).
-	 * This function returns EAGAIN in that case.
-	 * The caller should mark "tentative" on the address instead of
-	 * performing DAD immediately.
-	 */
-	if (!((ifp->if_flags & IFF_UP) &&
-	    (ifp->if_drv_flags & IFF_DRV_RUNNING)))
-		return (EAGAIN);
-
+	if ((ND_IFINFO(ifp)->flags &
+	    (ND6_IFF_IFDISABLED | ND6_IFF_NO_DAD)) != 0)
+		return (0);
 	return (1);
 }
 

Modified: projects/capsicum-test/sys/netinet6/in6_ifattach.c
==============================================================================
--- projects/capsicum-test/sys/netinet6/in6_ifattach.c	Sun Mar 31 05:15:32 2019	(r345745)
+++ projects/capsicum-test/sys/netinet6/in6_ifattach.c	Sun Mar 31 05:16:27 2019	(r345746)
@@ -692,6 +692,7 @@ in6_ifattach(struct ifnet *ifp, struct ifnet *altifp)
 		 * it is rather harmful to have one.
 		 */
 		ND_IFINFO(ifp)->flags &= ~ND6_IFF_AUTO_LINKLOCAL;
+		ND_IFINFO(ifp)->flags |= ND6_IFF_NO_DAD;
 		break;
 	default:
 		break;

Modified: projects/capsicum-test/sys/netinet6/nd6.c
==============================================================================
--- projects/capsicum-test/sys/netinet6/nd6.c	Sun Mar 31 05:15:32 2019	(r345745)
+++ projects/capsicum-test/sys/netinet6/nd6.c	Sun Mar 31 05:16:27 2019	(r345746)
@@ -900,6 +900,7 @@ nd6_timer(void *arg)
 	struct nd_prhead prl;
 	struct nd_defrouter *dr, *ndr;
 	struct nd_prefix *pr, *npr;
+	struct ifnet *ifp;
 	struct in6_ifaddr *ia6, *nia6;
 	uint64_t genid;
 
@@ -996,14 +997,15 @@ nd6_timer(void *arg)
 			 * Check status of the interface.  If it is down,
 			 * mark the address as tentative for future DAD.
 			 */
-			if ((ia6->ia_ifp->if_flags & IFF_UP) == 0 ||
-			    (ia6->ia_ifp->if_drv_flags & IFF_DRV_RUNNING)
-				== 0 ||
-			    (ND_IFINFO(ia6->ia_ifp)->flags &
-				ND6_IFF_IFDISABLED) != 0) {
+			ifp = ia6->ia_ifp;
+			if ((ND_IFINFO(ifp)->flags & ND6_IFF_NO_DAD) == 0 &&
+			    ((ifp->if_flags & IFF_UP) == 0 ||
+			    (ifp->if_drv_flags & IFF_DRV_RUNNING) == 0 ||
+			    (ND_IFINFO(ifp)->flags & ND6_IFF_IFDISABLED) != 0)){
 				ia6->ia6_flags &= ~IN6_IFF_DUPLICATED;
 				ia6->ia6_flags |= IN6_IFF_TENTATIVE;
 			}
+
 			/*
 			 * A new RA might have made a deprecated address
 			 * preferred.





Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201903310516.x2V5GRIW001851>