Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 17 Aug 2008 14:06:50 GMT
From:      Ed Schouten <ed@FreeBSD.org>
To:        Perforce Change Reviews <perforce@FreeBSD.org>
Subject:   PERFORCE change 147649 for review
Message-ID:  <200808171406.m7HE6oK3027467@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=147649

Change 147649 by ed@ed_dull on 2008/08/17 14:06:36

	(Very small) IFC.

Affected files ...

.. //depot/projects/mpsafetty/share/man/man4/tcp.4#2 integrate
.. //depot/projects/mpsafetty/sys/cam/scsi/scsi_all.c#3 integrate
.. //depot/projects/mpsafetty/sys/dev/pci/pci_pci.c#3 integrate
.. //depot/projects/mpsafetty/sys/dev/pci/pcib_private.h#2 integrate
.. //depot/projects/mpsafetty/sys/i386/i386/swtch.s#2 integrate
.. //depot/projects/mpsafetty/sys/kern/vfs_cache.c#3 integrate
.. //depot/projects/mpsafetty/sys/net/if_bridge.c#2 integrate
.. //depot/projects/mpsafetty/usr.bin/units/units.c#2 integrate
.. //depot/projects/mpsafetty/usr.bin/units/units.lib#3 integrate
.. //depot/projects/mpsafetty/usr.sbin/pw/pw_user.c#2 integrate

Differences ...

==== //depot/projects/mpsafetty/share/man/man4/tcp.4#2 (text+ko) ====

@@ -30,9 +30,9 @@
 .\" SUCH DAMAGE.
 .\"
 .\"     From: @(#)tcp.4	8.1 (Berkeley) 6/5/93
-.\" $FreeBSD: src/share/man/man4/tcp.4,v 1.59 2007/04/03 18:57:09 ru Exp $
+.\" $FreeBSD: src/share/man/man4/tcp.4,v 1.60 2008/08/16 21:12:25 rpaulo Exp $
 .\"
-.Dd February 28, 2007
+.Dd August 16, 2008
 .Dt TCP 4
 .Os
 .Sh NAME
@@ -514,6 +514,14 @@
 .Dv FIN_WAIT_2
 connections.
 Defaults to 60 seconds.
+.It Va ecn.enable
+Enable support for TCP Explicit Congestion Notification (ECN).
+ECN allows a TCP sender to reduce the transmission rate in order to
+avoid packet drops.
+.It Va ecn.maxretries
+Number of retries (SYN or SYN/ACK retransmits) before disabling ECN on a
+specific connection. This is needed to help with connection establishment
+when a broken firewall is in the network path.
 .El
 .Sh ERRORS
 A socket operation may fail with one of the following errors returned:
@@ -568,6 +576,13 @@
 .%T "Protection of BGP Sessions via the TCP MD5 Signature Option"
 .%O "RFC 2385"
 .Re
+.Rs
+.%A "K. Ramakrishnan"
+.%A "S. Floyd"
+.%A "D. Black"
+.%T "The Addition of Explicit Congestion Notification (ECN) to IP"
+.%O "RFC 3168"
+.Re
 .Sh HISTORY
 The
 .Tn TCP

==== //depot/projects/mpsafetty/sys/cam/scsi/scsi_all.c#3 (text+ko) ====

@@ -28,7 +28,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/cam/scsi/scsi_all.c,v 1.52 2008/08/07 17:25:05 jkim Exp $");
+__FBSDID("$FreeBSD: src/sys/cam/scsi/scsi_all.c,v 1.53 2008/08/16 21:26:58 ken Exp $");
 
 #include <sys/param.h>
 
@@ -65,7 +65,7 @@
 #endif /* !_KERNEL */
 
 /*
- * This is the default number of seconds we wait for devices to settle
+ * This is the default number of milliseconds we wait for devices to settle
  * after a SCSI bus reset.
  */
 #ifndef SCSI_DELAY

==== //depot/projects/mpsafetty/sys/dev/pci/pci_pci.c#3 (text+ko) ====

@@ -29,7 +29,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/dev/pci/pci_pci.c,v 1.51 2008/07/23 09:44:36 luoqi Exp $");
+__FBSDID("$FreeBSD: src/sys/dev/pci/pci_pci.c,v 1.53 2008/08/16 21:51:54 imp Exp $");
 
 /*
  * PCI:PCI bridge support.
@@ -139,6 +139,8 @@
 {
     struct pcib_softc	*sc;
     uint8_t		iolow;
+    struct sysctl_ctx_list *sctx;
+    struct sysctl_oid	*soid;
 
     sc = device_get_softc(dev);
     sc->dev = dev;
@@ -148,6 +150,7 @@
      */
     sc->command   = pci_read_config(dev, PCIR_COMMAND, 1);
     sc->domain    = pci_get_domain(dev);
+    sc->pribus    = pci_read_config(dev, PCIR_PRIBUS_1, 1);
     sc->secbus    = pci_read_config(dev, PCIR_SECBUS_1, 1);
     sc->subbus    = pci_read_config(dev, PCIR_SUBBUS_1, 1);
     sc->secstat   = pci_read_config(dev, PCIR_SECSTAT_1, 2);
@@ -155,6 +158,20 @@
     sc->seclat    = pci_read_config(dev, PCIR_SECLAT_1, 1);
 
     /*
+     * Setup sysctl reporting nodes
+     */
+    sctx = device_get_sysctl_ctx(dev);
+    soid = device_get_sysctl_tree(dev);
+    SYSCTL_ADD_UINT(sctx, SYSCTL_CHILDREN(soid), OID_AUTO, "domain",
+	CTLFLAG_RD, &sc->domain, 0, "Domain number");
+    SYSCTL_ADD_UINT(sctx, SYSCTL_CHILDREN(soid), OID_AUTO, "pribus",
+	CTLFLAG_RD, &sc->pribus, 0, "Primary bus number");
+    SYSCTL_ADD_UINT(sctx, SYSCTL_CHILDREN(soid), OID_AUTO, "secbus",
+	CTLFLAG_RD, &sc->secbus, 0, "Secondary bus number");
+    SYSCTL_ADD_UINT(sctx, SYSCTL_CHILDREN(soid), OID_AUTO, "subbus",
+	CTLFLAG_RD, &sc->subbus, 0, "Subordinate bus number");
+
+    /*
      * Determine current I/O decode.
      */
     if (sc->command & PCIM_CMD_PORTEN) {
@@ -447,7 +464,6 @@
 			}
 		} else if (!ok) {
 			ok = 1;	/* subtractive bridge: always ok */
-#if 1
 			if (pcib_is_nonprefetch_open(sc)) {
 				if (start < sc->membase && end > sc->memlimit) {
 					start = sc->membase;
@@ -460,7 +476,6 @@
 					end = sc->pmemlimit;
 				}
 			}
-#endif
 		}
 		if (end < start) {
 			device_printf(dev, "memory: end (%lx) < start (%lx)\n",

==== //depot/projects/mpsafetty/sys/dev/pci/pcib_private.h#2 (text+ko) ====

@@ -27,7 +27,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- * $FreeBSD: src/sys/dev/pci/pcib_private.h,v 1.13 2007/09/30 11:05:15 marius Exp $
+ * $FreeBSD: src/sys/dev/pci/pcib_private.h,v 1.14 2008/08/16 20:18:40 imp Exp $
  */
 
 #ifndef __PCIB_PRIVATE_H__
@@ -48,9 +48,10 @@
 #define	PCIB_SUBTRACTIVE	0x1
 #define	PCIB_DISABLE_MSI	0x2
     uint16_t	command;	/* command register */
-    uint32_t	domain;		/* domain number */
-    uint8_t	secbus;		/* secondary bus number */
-    uint8_t	subbus;		/* subordinate bus number */
+    u_int	domain;		/* domain number */
+    u_int	pribus;		/* primary bus number */
+    u_int	secbus;		/* secondary bus number */
+    u_int	subbus;		/* subordinate bus number */
     pci_addr_t	pmembase;	/* base address of prefetchable memory */
     pci_addr_t	pmemlimit;	/* topmost address of prefetchable memory */
     pci_addr_t	membase;	/* base address of memory window */

==== //depot/projects/mpsafetty/sys/i386/i386/swtch.s#2 (text+ko) ====

@@ -29,7 +29,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- * $FreeBSD: src/sys/i386/i386/swtch.s,v 1.156 2007/08/22 05:06:14 jkoshy Exp $
+ * $FreeBSD: src/sys/i386/i386/swtch.s,v 1.157 2008/08/16 21:38:46 kmacy Exp $
  */
 
 #include "opt_npx.h"
@@ -88,7 +88,7 @@
 	movl	8(%esp),%ecx			/* New thread */
 	movl	TD_PCB(%ecx),%edx
 	movl	PCB_CR3(%edx),%eax
-	movl	%eax,%cr3			/* new address space */
+	LOAD_CR3(%eax)
 	/* set bit in new pm_active */
 	movl	TD_PROC(%ecx),%eax
 	movl	P_VMSPACE(%eax), %ebx
@@ -181,10 +181,10 @@
 	cmpl	%eax,IdlePTD			/* Kernel address space? */
 #endif
 	je	sw0
-	movl	%cr3,%ebx			/* The same address space? */
+	READ_CR3(%ebx)				/* The same address space? */
 	cmpl	%ebx,%eax
 	je	sw0
-	movl	%eax,%cr3			/* new address space */
+	LOAD_CR3(%eax)				/* new address space */
 	movl	%esi,%eax
 	movl	PCPU(CPUID),%esi
 	SETOP	%eax,TD_LOCK(%edi)		/* Switchout td_lock */
@@ -211,6 +211,18 @@
 	SETOP	%esi,TD_LOCK(%edi)		/* Switchout td_lock */
 sw1:
 	BLOCK_SPIN(%ecx)
+#ifdef XEN
+	pushl	%eax
+	pushl	%ecx
+	pushl	%edx
+	call	xen_handle_thread_switch
+	popl	%edx
+	popl	%ecx
+	popl	%eax
+	/*
+	 * XXX set IOPL
+	 */
+#else		
 	/*
 	 * At this point, we've switched address spaces and are ready
 	 * to load up the rest of the next context.
@@ -259,7 +271,7 @@
 	movl	12(%esi), %ebx
 	movl	%eax, 8(%edi)
 	movl	%ebx, 12(%edi)
-
+#endif
 	/* Restore context. */
 	movl	PCB_EBX(%edx),%ebx
 	movl	PCB_ESP(%edx),%esp
@@ -285,7 +297,7 @@
 	movl	_default_ldt,%eax
 	cmpl	PCPU(CURRENTLDT),%eax
 	je	2f
-	lldt	_default_ldt
+	LLDT(_default_ldt)
 	movl	%eax,PCPU(CURRENTLDT)
 	jmp	2f
 1:
@@ -389,7 +401,7 @@
 	 * parent's npx state for forks by forgetting to reload.
 	 */
 	pushfl
-	cli
+	CLI
 	movl	PCPU(FPCURTHREAD),%eax
 	testl	%eax,%eax
 	je	1f

==== //depot/projects/mpsafetty/sys/kern/vfs_cache.c#3 (text+ko) ====

@@ -33,7 +33,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/kern/vfs_cache.c,v 1.122 2008/07/31 16:57:41 csjp Exp $");
+__FBSDID("$FreeBSD: src/sys/kern/vfs_cache.c,v 1.123 2008/08/16 21:48:10 alfred Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -199,10 +199,12 @@
 
 	/* Scan hash tables for applicable entries */
 	for (ncpp = nchashtbl; n_nchash > 0; n_nchash--, ncpp++) {
+		CACHE_LOCK();
 		count = 0;
 		LIST_FOREACH(ncp, ncpp, nc_hash) {
 			count++;
 		}
+		CACHE_UNLOCK();
 		error = SYSCTL_OUT(req, &count, sizeof(count));
 		if (error)
 			return (error);
@@ -231,9 +233,11 @@
 	/* Scan hash tables for applicable entries */
 	for (ncpp = nchashtbl; n_nchash > 0; n_nchash--, ncpp++) {
 		count = 0;
+		CACHE_LOCK();
 		LIST_FOREACH(ncp, ncpp, nc_hash) {
 			count++;
 		}
+		CACHE_UNLOCK();
 		if (count)
 			used++;
 		if (maxlength < count)

==== //depot/projects/mpsafetty/sys/net/if_bridge.c#2 (text+ko) ====

@@ -75,7 +75,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/net/if_bridge.c,v 1.114 2008/07/03 15:58:30 thompsa Exp $");
+__FBSDID("$FreeBSD: src/sys/net/if_bridge.c,v 1.115 2008/08/16 23:59:17 thompsa Exp $");
 
 #include "opt_inet.h"
 #include "opt_inet6.h"
@@ -166,10 +166,6 @@
  * List of capabilities to possibly mask on the member interface.
  */
 #define	BRIDGE_IFCAPS_MASK		(IFCAP_TOE|IFCAP_TSO|IFCAP_TXCSUM)
-/*
- * List of capabilities to disable on the member interface.
- */
-#define	BRIDGE_IFCAPS_STRIP		IFCAP_LRO
 
 /*
  * Bridge interface list entry.
@@ -798,10 +794,15 @@
 
 	LIST_FOREACH(bif, &sc->sc_iflist, bif_next) {
 		enabled = bif->bif_ifp->if_capenable;
-		enabled &= ~BRIDGE_IFCAPS_STRIP;
 		/* strip off mask bits and enable them again if allowed */
 		enabled &= ~BRIDGE_IFCAPS_MASK;
 		enabled |= mask;
+		/*
+		 * Receive offload can only be enabled if all members also
+		 * support send offload.
+		 */
+		if ((enabled & IFCAP_TSO) == 0)
+			enabled &= ~IFCAP_LRO;
 
 		bridge_set_ifcap(sc, bif, enabled);
 	}

==== //depot/projects/mpsafetty/usr.bin/units/units.c#2 (text+ko) ====

@@ -17,7 +17,7 @@
 
 #ifndef lint
 static const char rcsid[] =
-  "$FreeBSD: src/usr.bin/units/units.c,v 1.10 2002/07/28 16:23:28 dwmalone Exp $";
+  "$FreeBSD: src/usr.bin/units/units.c,v 1.11 2008/08/16 16:27:41 dwmalone Exp $";
 #endif /* not lint */
 
 #include <ctype.h>
@@ -53,6 +53,8 @@
 	char *numerator[MAXSUBUNITS];
 	char *denominator[MAXSUBUNITS];
 	double factor;
+	double offset;
+	int quantity;
 };
 
 struct {
@@ -78,7 +80,7 @@
 int	 addsubunit(char *product[], char *toadd);
 void	 showunit(struct unittype * theunit);
 void	 zeroerror(void);
-int	 addunit(struct unittype * theunit, char *toadd, int flip);
+int	 addunit(struct unittype *theunit, char *toadd, int flip, int quantity);
 int	 compare(const void *item1, const void *item2);
 void	 sortunit(struct unittype * theunit);
 void	 cancelunit(struct unittype * theunit);
@@ -207,8 +209,10 @@
 void 
 initializeunit(struct unittype * theunit)
 {
+	theunit->numerator[0] = theunit->denominator[0] = NULL;
 	theunit->factor = 1.0;
-	theunit->numerator[0] = theunit->denominator[0] = NULL;
+	theunit->offset = 0.0;
+	theunit->quantity = 0;
 }
 
 
@@ -237,6 +241,8 @@
 	int counter = 1;
 
 	printf("\t%.8g", theunit->factor);
+	if (theunit->offset)
+		printf("&%.8g", theunit->offset);
 	for (ptr = theunit->numerator; *ptr; ptr++) {
 		if (ptr > theunit->numerator && **ptr &&
 		    !strcmp(*ptr, *(ptr - 1)))
@@ -284,16 +290,17 @@
 /*
    Adds the specified string to the unit.
    Flip is 0 for adding normally, 1 for adding reciprocal.
+   Quantity is 1 if this is a quantity to be converted rather than a pure unit.
 
    Returns 0 for successful addition, nonzero on error.
 */
 
 int 
-addunit(struct unittype * theunit, char *toadd, int flip)
+addunit(struct unittype * theunit, char *toadd, int flip, int quantity)
 {
 	char *scratch, *savescr;
 	char *item;
-	char *divider, *slash;
+	char *divider, *slash, *offset;
 	int doingtop;
 
 	if (!strlen(toadd))
@@ -313,7 +320,17 @@
 		item = strtok(scratch, " *\t\n/");
 		while (item) {
 			if (strchr("0123456789.", *item)) { /* item is a number */
-				double num;
+				double num, offsetnum;
+
+				if (quantity)
+					theunit->quantity = 1;
+
+				offset = strchr(item, '&');
+				if (offset) {
+					*offset = 0;
+					offsetnum = atof(offset+1);
+				} else
+					offsetnum = 0.0;
 
 				divider = strchr(item, '|');
 				if (divider) {
@@ -323,19 +340,25 @@
 						zeroerror();
 						return 1;
 					}
-					if (doingtop ^ flip)
+					if (doingtop ^ flip) {
 						theunit->factor *= num;
-					else
+						theunit->offset *= num;
+					} else {
 						theunit->factor /= num;
+						theunit->offset /= num;
+					}
 					num = atof(divider + 1);
 					if (!num) {
 						zeroerror();
 						return 1;
 					}
-					if (doingtop ^ flip)
+					if (doingtop ^ flip) {
 						theunit->factor /= num;
-					else
+						theunit->offset /= num;
+					} else {
 						theunit->factor *= num;
+						theunit->offset *= num;
+					}
 				}
 				else {
 					num = atof(item);
@@ -343,12 +366,16 @@
 						zeroerror();
 						return 1;
 					}
-					if (doingtop ^ flip)
+					if (doingtop ^ flip) {
 						theunit->factor *= num;
-					else
+						theunit->offset *= num;
+					} else {
 						theunit->factor /= num;
-
+						theunit->offset /= num;
+					}
 				}
+				if (doingtop ^ flip)
+					theunit->offset += offsetnum;
 			}
 			else {	/* item is not a number */
 				int repeat = 1;
@@ -534,7 +561,7 @@
 				free(*product);
 				*product = NULLUNIT;
 			}
-			if (addunit(theunit, toadd, flip))
+			if (addunit(theunit, toadd, flip, 0))
 				return ERROR;
 		}
 	}
@@ -613,6 +640,20 @@
 		showunit(have);
 		showunit(want);
 	}
+	else if (have->offset != want->offset) {
+		if (want->quantity)
+			printf("WARNING: conversion of non-proportional quantities.\n");
+		printf("\t");
+		if (have->quantity)
+			printf("%.8g\n",
+			    (have->factor + have->offset-want->offset)/want->factor);
+		else
+			printf(" (-> x*%.8g %+.8g)\n\t (<- y*%.8g %+.8g)\n",
+			    have->factor / want->factor,
+			    (have->offset-want->offset)/want->factor,
+			    want->factor / have->factor,
+			    (want->offset - have->offset)/have->factor);
+	}
 	else
 		printf("\t* %.8g\n\t/ %.8g\n", have->factor / want->factor,
 		    want->factor / have->factor);
@@ -666,10 +707,10 @@
 		strlcpy(havestr, argv[optind], sizeof(havestr));
 		strlcpy(wantstr, argv[optind + 1], sizeof(wantstr));
 		initializeunit(&have);
-		addunit(&have, havestr, 0);
+		addunit(&have, havestr, 0, 1);
 		completereduce(&have);
 		initializeunit(&want);
-		addunit(&want, wantstr, 0);
+		addunit(&want, wantstr, 0, 1);
 		completereduce(&want);
 		showanswer(&have, &want);
 	}
@@ -687,7 +728,7 @@
 						putchar('\n');
 					exit(0);
 				}
-			} while (addunit(&have, havestr, 0) ||
+			} while (addunit(&have, havestr, 0, 1) ||
 			    completereduce(&have));
 			do {
 				initializeunit(&want);
@@ -698,7 +739,7 @@
 						putchar('\n');
 					exit(0);
 				}
-			} while (addunit(&want, wantstr, 0) ||
+			} while (addunit(&want, wantstr, 0, 1) ||
 			    completereduce(&want));
 			showanswer(&have, &want);
 		}

==== //depot/projects/mpsafetty/usr.bin/units/units.lib#3 (text+ko) ====

@@ -1,4 +1,4 @@
-/ $FreeBSD: src/usr.bin/units/units.lib,v 1.18 2008/08/07 05:35:01 edwin Exp $
+/ $FreeBSD: src/usr.bin/units/units.lib,v 1.19 2008/08/16 16:27:41 dwmalone Exp $
 
 / primitive units
 
@@ -671,14 +671,14 @@
 k			1.38047e-16 erg/degC
 
 
-degC			K
+degC			1&+273.15 K
 kelvin			K
 brewster		1e-12 m2/newton
-degF			5|9 degC
-degreesrankine		degF
+degF			5|9&255.37222222222222222222 K
+degreesrankine		5|9 K
 degrankine		degreesrankine
-degreerankine		degF
-degreaumur		10|8 degC
+degreerankine		degreesrankine
+degreaumur		10|8&+273.15 K
 drachm			60 grain
 poncelet		100 kg m g / sec
 denier			.05|450 gram / m

==== //depot/projects/mpsafetty/usr.sbin/pw/pw_user.c#2 (text+ko) ====

@@ -27,7 +27,7 @@
 
 #ifndef lint
 static const char rcsid[] =
-  "$FreeBSD: src/usr.sbin/pw/pw_user.c,v 1.62 2008/05/27 19:04:31 antoine Exp $";
+  "$FreeBSD: src/usr.sbin/pw/pw_user.c,v 1.63 2008/08/16 15:41:03 ache Exp $";
 #endif /* not lint */
 
 #include <ctype.h>
@@ -43,9 +43,6 @@
 #include <unistd.h>
 #include <utmp.h>
 #include <login_cap.h>
-#if defined(USE_MD5RAND)
-#include <md5.h>
-#endif
 #include "pw.h"
 #include "bitmap.h"
 
@@ -1045,74 +1042,24 @@
 	 * Calculate a salt value
 	 */
 	for (i = 0; i < SALTSIZE; i++)
-		salt[i] = chars[arc4random() % (sizeof(chars) - 1)];
+		salt[i] = chars[arc4random_uniform(sizeof(chars) - 1)];
 	salt[SALTSIZE] = '\0';
 
 	return strcpy(buf, crypt(password, salt));
 }
 
-#if defined(USE_MD5RAND)
-u_char *
-pw_getrand(u_char *buf, int len)	/* cryptographically secure rng */
-{
-	int i;
-	for (i=0;i<len;i+=16) {
-		u_char ubuf[16];
-
-		MD5_CTX md5_ctx;
-		struct timeval tv, tvo;
-		struct rusage ru;
-		int n=0;
-		int t;
 
-		MD5Init (&md5_ctx);
-		t=getpid();
-		MD5Update (&md5_ctx, (u_char*)&t, sizeof t);
-		t=getppid();
-		MD5Update (&md5_ctx, (u_char*)&t, sizeof t);
-		gettimeofday (&tvo, NULL);
-		do {
-			getrusage (RUSAGE_SELF, &ru);
-			MD5Update (&md5_ctx, (u_char*)&ru, sizeof ru);
-			gettimeofday (&tv, NULL);
-			MD5Update (&md5_ctx, (u_char*)&tv, sizeof tv);
-		} while (n++<20 || tv.tv_usec-tvo.tv_usec<100*1000);
-		MD5Final (ubuf, &md5_ctx);
-		memcpy(buf+i, ubuf, MIN(16, len-i));
-	}
-	return buf;
-}
-
-#else	/* Portable version */
-
-static u_char *
-pw_getrand(u_char *buf, int len)
-{
-	int i;
-
-	for (i = 0; i < len; i++) {
-		unsigned long val = arc4random();
-		/* Use all bits in the random value */
-		buf[i]=(u_char)((val >> 24) ^ (val >> 16) ^ (val >> 8) ^ val);
-	}
-	return buf;
-}
-
-#endif
-
 static char    *
 pw_password(struct userconf * cnf, struct cargs * args, char const * user)
 {
 	int             i, l;
 	char            pwbuf[32];
-	u_char		rndbuf[sizeof pwbuf];
 
 	switch (cnf->default_password) {
 	case -1:		/* Random password */
 		l = (arc4random() % 8 + 8);	/* 8 - 16 chars */
-		pw_getrand(rndbuf, l);
 		for (i = 0; i < l; i++)
-			pwbuf[i] = chars[rndbuf[i] % (sizeof(chars)-1)];
+			pwbuf[i] = chars[arc4random_uniform(sizeof(chars)-1)];
 		pwbuf[i] = '\0';
 
 		/*



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