svn commit: r302941 - head/usr.sbin/bsdinstall/scripts

2016-07-16 Thread Allan Jude
Author: allanjude
Date: Sat Jul 16 19:35:04 2016
New Revision: 302941
URL: https://svnweb.freebsd.org/changeset/base/302941

Log:
  A failed installation once restarted will often error out
  
  If an encrypted install is attempted and fails for any reason, the disk
  cannot be erased by the installer because the partition is in use by GELI
  
  At the start of the installation process, all ZFS pools are exported and
  all GELI instances are detached, to allow a restarted install to proceed
  
  PR:   210814
  Reported by:  jonathan
  MFC after:10 days

Modified:
  head/usr.sbin/bsdinstall/scripts/zfsboot

Modified: head/usr.sbin/bsdinstall/scripts/zfsboot
==
--- head/usr.sbin/bsdinstall/scripts/zfsbootSat Jul 16 18:28:44 2016
(r302940)
+++ head/usr.sbin/bsdinstall/scripts/zfsbootSat Jul 16 19:35:04 2016
(r302941)
@@ -224,6 +224,7 @@ ZFS_UNMOUNT='zfs unmount "%s"'
 ZPOOL_CREATE_WITH_OPTIONS='zpool create %s "%s" %s %s'
 ZPOOL_DESTROY='zpool destroy "%s"'
 ZPOOL_EXPORT='zpool export "%s"'
+ZPOOL_EXPORT_F='zpool export -f "%s"'
 ZPOOL_IMPORT_WITH_OPTIONS='zpool import %s "%s"'
 ZPOOL_LABELCLEAR_F='zpool labelclear -f "%s"'
 ZPOOL_SET='zpool set %s "%s"'
@@ -783,6 +784,14 @@ zfs_create_diskpart()
# NOTE: `-F' required to destroy if partitions still exist.
# NOTE: Failure is ok here, blank disk will have nothing to destroy.
#
+   f_dprintf "$funcname: Exporting ZFS pools..."
+   zpool list -Ho name | while read z_name; do
+   f_eval_catch -d $funcname zpool "$ZPOOL_EXPORT_F" $z_name
+   done
+   f_dprintf "$funcname: Detaching all GELI providers..."
+   geli status | tail -n +2 | while read g_name g_status g_component; do
+   f_eval_catch -d $funcname geli "$GELI_DETACH_F" $g_name
+   done
f_dprintf "$funcname: Destroying all data/layouts on \`%s'..." "$disk"
f_eval_catch -d $funcname gpart "$GPART_DESTROY_F" $disk
f_eval_catch -d $funcname graid "$GRAID_DELETE" $disk
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r302940 - head/usr.sbin/bsdinstall/scripts

2016-07-16 Thread Allan Jude
Author: allanjude
Date: Sat Jul 16 18:28:44 2016
New Revision: 302940
URL: https://svnweb.freebsd.org/changeset/base/302940

Log:
  Fix encrypted MBR install
  
  The pools are exported and reimported in order to write the bootcode
  This causes an error when the bootpool is later mounted by common code
  The bootpool is now imported with the -N flag to prevent mounting
  
  Reported by:  Michael Dexter
  MFC after:5 days

Modified:
  head/usr.sbin/bsdinstall/scripts/zfsboot

Modified: head/usr.sbin/bsdinstall/scripts/zfsboot
==
--- head/usr.sbin/bsdinstall/scripts/zfsbootSat Jul 16 18:06:41 2016
(r302939)
+++ head/usr.sbin/bsdinstall/scripts/zfsbootSat Jul 16 18:28:44 2016
(r302940)
@@ -1384,8 +1384,9 @@ zfs_create_boot()
 "-o altroot=\"$BSDINSTALL_CHROOT\"" "$zroot_name" 
||
 return $FAILURE
if [ "$ZFSBOOT_BOOT_POOL" ]; then
+   # Import the bootpool, but do not mount it yet
f_eval_catch $funcname zpool 
"$ZPOOL_IMPORT_WITH_OPTIONS" \
-"-o altroot=\"$BSDINSTALL_CHROOT\"" \
+"-o altroot=\"$BSDINSTALL_CHROOT\" -N" \
 "$bootpool_name" || return $FAILURE
fi
fi
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r302939 - head/sys/arm/allwinner

2016-07-16 Thread Jared McNeill
Author: jmcneill
Date: Sat Jul 16 18:06:41 2016
New Revision: 302939
URL: https://svnweb.freebsd.org/changeset/base/302939

Log:
  Add support for Allwinner H3 EMAC.
  
  H3 EMAC is the same as A83T/A64 except the SoC includes an (optional)
  internal 10/100 PHY. Both internal and external PHYs are supported on H3
  with this driver.

Modified:
  head/sys/arm/allwinner/if_awg.c

Modified: head/sys/arm/allwinner/if_awg.c
==
--- head/sys/arm/allwinner/if_awg.c Sat Jul 16 15:52:14 2016
(r302938)
+++ head/sys/arm/allwinner/if_awg.c Sat Jul 16 18:06:41 2016
(r302939)
@@ -46,6 +46,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -69,9 +70,10 @@ __FBSDID("$FreeBSD$");
 #include 
 
 #include "miibus_if.h"
+#include "gpio_if.h"
 
-#defineRD4(sc, reg)bus_read_4((sc)->res[0], (reg))
-#defineWR4(sc, reg, val)   bus_write_4((sc)->res[0], (reg), (val))
+#defineRD4(sc, reg)bus_read_4((sc)->res[_RES_EMAC], (reg))
+#defineWR4(sc, reg, val)   bus_write_4((sc)->res[_RES_EMAC], 
(reg), (val))
 
 #defineAWG_LOCK(sc)mtx_lock(&(sc)->mtx)
 #defineAWG_UNLOCK(sc)  mtx_unlock(&(sc)->mtx);
@@ -101,6 +103,25 @@ __FBSDID("$FreeBSD$");
 #defineTX_INTERVAL_DEFAULT 64
 #defineRX_BATCH_DEFAULT64
 
+/* syscon EMAC clock register */
+#defineEMAC_CLK_EPHY_ADDR  (0x1f << 20)/* H3 */
+#defineEMAC_CLK_EPHY_ADDR_SHIFT 20
+#defineEMAC_CLK_EPHY_LED_POL   (1 << 17)   /* H3 */
+#defineEMAC_CLK_EPHY_SHUTDOWN  (1 << 16)   /* H3 */
+#defineEMAC_CLK_EPHY_SELECT(1 << 15)   /* H3 */
+#defineEMAC_CLK_RMII_EN(1 << 13)
+#defineEMAC_CLK_ETXDC  (0x7 << 10)
+#defineEMAC_CLK_ETXDC_SHIFT10
+#defineEMAC_CLK_ERXDC  (0x1f << 5)
+#defineEMAC_CLK_ERXDC_SHIFT5
+#defineEMAC_CLK_PIT(0x1 << 2)
+#define EMAC_CLK_PIT_MII   (0 << 2)
+#define EMAC_CLK_PIT_RGMII (1 << 2)
+#defineEMAC_CLK_SRC(0x3 << 0)
+#define EMAC_CLK_SRC_MII   (0 << 0)
+#define EMAC_CLK_SRC_EXT_RGMII (1 << 0)
+#define EMAC_CLK_SRC_RGMII (2 << 0)
+
 /* Burst length of RX and TX DMA transfers */
 static int awg_burst_len = BURST_LEN_DEFAULT;
 TUNABLE_INT("hw.awg.burst_len", _burst_len);
@@ -121,8 +142,14 @@ TUNABLE_INT("hw.awg.tx_interval", _t
 static int awg_rx_batch = RX_BATCH_DEFAULT;
 TUNABLE_INT("hw.awg.rx_batch", _rx_batch);
 
+enum awg_type {
+   EMAC_A83T = 1,
+   EMAC_H3,
+};
+
 static struct ofw_compat_data compat_data[] = {
-   { "allwinner,sun8i-a83t-emac",  1 },
+   { "allwinner,sun8i-a83t-emac",  EMAC_A83T },
+   { "allwinner,sun8i-h3-emac",EMAC_H3 },
{ NULL, 0 }
 };
 
@@ -151,8 +178,15 @@ struct awg_rxring {
u_int   cur;
 };
 
+enum {
+   _RES_EMAC,
+   _RES_IRQ,
+   _RES_SYSCON,
+   _RES_NITEMS
+};
+
 struct awg_softc {
-   struct resource *res[2];
+   struct resource *res[_RES_NITEMS];
struct mtx  mtx;
if_tifp;
device_tmiibus;
@@ -162,6 +196,7 @@ struct awg_softc {
u_int   mdc_div_ratio_m;
int link;
int if_flags;
+   enum awg_type   type;
 
struct awg_txring   tx;
struct awg_rxring   rx;
@@ -170,6 +205,7 @@ struct awg_softc {
 static struct resource_spec awg_spec[] = {
{ SYS_RES_MEMORY,   0,  RF_ACTIVE },
{ SYS_RES_IRQ,  0,  RF_ACTIVE },
+   { SYS_RES_MEMORY,   1,  RF_ACTIVE | RF_OPTIONAL },
{ -1, 0 }
 };
 
@@ -1016,49 +1052,73 @@ awg_ioctl(if_t ifp, u_long cmd, caddr_t 
 }
 
 static int
-awg_setup_extres(device_t dev)
+awg_setup_phy(device_t dev)
 {
struct awg_softc *sc;
-   hwreset_t rst_ahb;
-   clk_t clk_ahb, clk_tx, clk_tx_parent;
-   regulator_t reg;
+   clk_t clk_tx, clk_tx_parent;
const char *tx_parent_name;
char *phy_type;
phandle_t node;
-   uint64_t freq;
-   int error, div;
+   uint32_t reg, tx_delay, rx_delay;
+   int error;
 
sc = device_get_softc(dev);
node = ofw_bus_get_node(dev);
-   rst_ahb = NULL;
-   clk_ahb = NULL;
-   clk_tx = NULL;
-   clk_tx_parent = NULL;
-   reg = NULL;
-   phy_type = NULL;
 
-   /* Get AHB clock and reset resources */
-   error = hwreset_get_by_ofw_name(dev, 0, "ahb", _ahb);
-   if (error != 0) {
-   device_printf(dev, "cannot get ahb reset\n");
-   goto fail;
-   }
-   error = clk_get_by_ofw_name(dev, 0, "ahb", 

svn commit: r302937 - in head/bin/sh: . tests/expansion

2016-07-16 Thread Andrey A. Chernov
Author: ache
Date: Sat Jul 16 13:26:18 2016
New Revision: 302937
URL: https://svnweb.freebsd.org/changeset/base/302937

Log:
  Path generation was not according to collate
  
  Approved by:jilles

Added:
  head/bin/sh/tests/expansion/pathname6.0   (contents, props changed)
Modified:
  head/bin/sh/expand.c
  head/bin/sh/tests/expansion/Makefile
  head/bin/sh/tests/expansion/pathname1.0
  head/bin/sh/tests/expansion/pathname2.0

Modified: head/bin/sh/expand.c
==
--- head/bin/sh/expand.cSat Jul 16 13:24:58 2016(r302936)
+++ head/bin/sh/expand.cSat Jul 16 13:26:18 2016(r302937)
@@ -1196,7 +1196,7 @@ expsortcmp(const void *p1, const void *p
const char *s1 = *(const char * const *)p1;
const char *s2 = *(const char * const *)p2;
 
-   return (strcmp(s1, s2));
+   return (strcoll(s1, s2));
 }
 
 

Modified: head/bin/sh/tests/expansion/Makefile
==
--- head/bin/sh/tests/expansion/MakefileSat Jul 16 13:24:58 2016
(r302936)
+++ head/bin/sh/tests/expansion/MakefileSat Jul 16 13:26:18 2016
(r302937)
@@ -66,6 +66,7 @@ ${PACKAGE}FILES+= pathname2.0
 ${PACKAGE}FILES+=  pathname3.0
 ${PACKAGE}FILES+=  pathname4.0
 ${PACKAGE}FILES+=  pathname5.0
+${PACKAGE}FILES+=  pathname6.0
 ${PACKAGE}FILES+=  plus-minus1.0
 ${PACKAGE}FILES+=  plus-minus2.0
 ${PACKAGE}FILES+=  plus-minus3.0

Modified: head/bin/sh/tests/expansion/pathname1.0
==
--- head/bin/sh/tests/expansion/pathname1.0 Sat Jul 16 13:24:58 2016
(r302936)
+++ head/bin/sh/tests/expansion/pathname1.0 Sat Jul 16 13:26:18 2016
(r302937)
@@ -1,5 +1,9 @@
 # $FreeBSD$
 
+unset LC_ALL
+LC_COLLATE=C
+export LC_COLLATE
+
 failures=0
 
 check() {

Modified: head/bin/sh/tests/expansion/pathname2.0
==
--- head/bin/sh/tests/expansion/pathname2.0 Sat Jul 16 13:24:58 2016
(r302936)
+++ head/bin/sh/tests/expansion/pathname2.0 Sat Jul 16 13:26:18 2016
(r302937)
@@ -1,5 +1,9 @@
 # $FreeBSD$
 
+unset LC_ALL
+LC_COLLATE=C
+export LC_COLLATE
+
 failures=0
 
 check() {

Added: head/bin/sh/tests/expansion/pathname6.0
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/bin/sh/tests/expansion/pathname6.0 Sat Jul 16 13:26:18 2016
(r302937)
@@ -0,0 +1,29 @@
+# $FreeBSD$
+
+unset LC_ALL
+LC_COLLATE=en_US.US-ASCII
+export LC_COLLATE
+
+failures=0
+
+check() {
+   testcase=$1
+   expect=$2
+   eval "set -- $testcase"
+   actual="$*"
+   if [ "$actual" != "$expect" ]; then
+   failures=$((failures+1))
+   printf '%s\n' "For $testcase, expected $expect actual $actual"
+   fi
+}
+
+set -e
+T=$(mktemp -d ${TMPDIR:-/tmp}/sh-test.XX)
+trap 'rm -rf $T' 0
+cd -P $T
+
+touch A B a b
+
+check '*' 'a A b B'
+
+exit $((failures != 0))
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r302936 - head/sys/kern

2016-07-16 Thread Konstantin Belousov
Author: kib
Date: Sat Jul 16 13:24:58 2016
New Revision: 302936
URL: https://svnweb.freebsd.org/changeset/base/302936

Log:
  Another issue reported on http://seclists.org/oss-sec/2016/q3/68 is
  that struct kevent member ident has uintptr_t type, which is silently
  truncated to int in the call to fget().  Explicitely check for the
  valid range.
  
  Sponsored by: The FreeBSD Foundation
  MFC after:1 week

Modified:
  head/sys/kern/kern_event.c

Modified: head/sys/kern/kern_event.c
==
--- head/sys/kern/kern_event.c  Sat Jul 16 12:25:37 2016(r302935)
+++ head/sys/kern/kern_event.c  Sat Jul 16 13:24:58 2016(r302936)
@@ -1183,8 +1183,11 @@ kqueue_register(struct kqueue *kq, struc
 findkn:
if (fops->f_isfd) {
KASSERT(td != NULL, ("td is NULL"));
-   error = fget(td, kev->ident,
-   cap_rights_init(, CAP_EVENT), );
+   if (kev->ident > INT_MAX)
+   error = EBADF;
+   else
+   error = fget(td, kev->ident,
+   cap_rights_init(, CAP_EVENT), );
if (error)
goto done;
 
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r302935 - head/sys/netinet

2016-07-16 Thread Michael Tuexen
Author: tuexen
Date: Sat Jul 16 12:25:37 2016
New Revision: 302935
URL: https://svnweb.freebsd.org/changeset/base/302935

Log:
  Deal with a portential memory allocation failure, which was reported
  by the clang static code analyzer.
  Joint work with rrs@.
  
  MFC after:3 days

Modified:
  head/sys/netinet/sctp_indata.c

Modified: head/sys/netinet/sctp_indata.c
==
--- head/sys/netinet/sctp_indata.c  Sat Jul 16 10:50:28 2016
(r302934)
+++ head/sys/netinet/sctp_indata.c  Sat Jul 16 12:25:37 2016
(r302935)
@@ -753,7 +753,7 @@ sctp_handle_old_data(struct sctp_tcb *st
 */
struct sctp_tmit_chunk *chk, *lchk, *tchk;
uint32_t fsn;
-   struct sctp_queued_to_read *nc = NULL;
+   struct sctp_queued_to_read *nc;
int cnt_added;
 
if (control->first_frag_seen == 0) {
@@ -768,6 +768,11 @@ restart:
TAILQ_FOREACH_SAFE(chk, >reasm, sctp_next, lchk) {
if (chk->rec.data.fsn_num == fsn) {
/* Ok lets add it */
+   sctp_alloc_a_readq(stcb, nc);
+   if (nc == NULL) {
+   break;
+   }
+   memset(nc, 0, sizeof(struct sctp_queued_to_read));
TAILQ_REMOVE(>reasm, chk, sctp_next);
sctp_add_chk_to_control(control, strm, stcb, asoc, chk);
fsn++;
@@ -781,7 +786,6 @@ restart:
 * on the control queue to a new
 * control.
 */
-   sctp_alloc_a_readq(stcb, nc);
sctp_build_readq_entry_from_ctl(nc, 
control);
tchk = TAILQ_FIRST(>reasm);
if (tchk->rec.data.rcv_flags & 
SCTP_DATA_FIRST_FRAG) {
@@ -826,16 +830,19 @@ restart:
SCTP_READ_LOCK_NOT_HELD, 
SCTP_SO_NOT_LOCKED);
}
sctp_wakeup_the_read_socket(stcb->sctp_ep, 
stcb, SCTP_SO_NOT_LOCKED);
-   if ((nc) && (nc->first_frag_seen)) {
+   if (!TAILQ_EMPTY(>reasm) && 
(nc->first_frag_seen)) {
/*
 * Switch to the new guy and
 * continue
 */
control = nc;
-   nc = NULL;
goto restart;
+   } else {
+   sctp_free_a_readq(stcb, nc);
}
return (1);
+   } else {
+   sctp_free_a_readq(stcb, nc);
}
} else {
/* Can't add more */
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r302933 - head/usr.sbin/bhyve

2016-07-16 Thread Alexander Motin
Author: mav
Date: Sat Jul 16 09:44:31 2016
New Revision: 302933
URL: https://svnweb.freebsd.org/changeset/base/302933

Log:
  Revert unwanted change leaked into r302932.

Modified:
  head/usr.sbin/bhyve/Makefile

Modified: head/usr.sbin/bhyve/Makefile
==
--- head/usr.sbin/bhyve/MakefileSat Jul 16 09:08:33 2016
(r302932)
+++ head/usr.sbin/bhyve/MakefileSat Jul 16 09:44:31 2016
(r302933)
@@ -29,7 +29,6 @@ SRCS= \
mptbl.c \
pci_ahci.c  \
pci_e82545.c\
-   pci_e82580.c\
pci_emul.c  \
pci_fbuf.c  \
pci_hostbridge.c\
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r302932 - head/usr.sbin/bhyve

2016-07-16 Thread Alexander Motin
Author: mav
Date: Sat Jul 16 09:08:33 2016
New Revision: 302932
URL: https://svnweb.freebsd.org/changeset/base/302932

Log:
  Increase I82545_MAX_TXSEGS from 20 to 64 and add checks for it.
  
  There seems no hard limit on number of segments per packet in the chip,
  and 20 appeared insufficient.  Hope 64 will be enough, but if not -- add
  check to report that and drop the packet instead of corrupting stack.

Modified:
  head/usr.sbin/bhyve/Makefile
  head/usr.sbin/bhyve/pci_e82545.c

Modified: head/usr.sbin/bhyve/Makefile
==
--- head/usr.sbin/bhyve/MakefileSat Jul 16 08:17:14 2016
(r302931)
+++ head/usr.sbin/bhyve/MakefileSat Jul 16 09:08:33 2016
(r302932)
@@ -29,6 +29,7 @@ SRCS= \
mptbl.c \
pci_ahci.c  \
pci_e82545.c\
+   pci_e82580.c\
pci_emul.c  \
pci_fbuf.c  \
pci_hostbridge.c\

Modified: head/usr.sbin/bhyve/pci_e82545.c
==
--- head/usr.sbin/bhyve/pci_e82545.cSat Jul 16 08:17:14 2016
(r302931)
+++ head/usr.sbin/bhyve/pci_e82545.cSat Jul 16 09:08:33 2016
(r302932)
@@ -109,12 +109,8 @@ __FBSDID("$FreeBSD$");
 
 #define E1000_ICR_SRPD 0x0001
 
-/*
- * XXX does this actually have a limit on the 82545 ?
- * There is a limit on the max number of bytes, but perhaps not
- * on descriptors ??
- */
-#define I82545_MAX_TXSEGS  20
+/* This is an arbitrary number.  There is no hard limit on the chip. */
+#define I82545_MAX_TXSEGS  64
 
 /* Legacy receive descriptor */
 struct e1000_rx_desc {
@@ -1050,15 +1046,18 @@ e82545_transmit_backend(struct e82545_so
 }
 
 static void
-e82545_transmit_done(struct e82545_softc *sc, union e1000_tx_udesc **txwb,
-int nwb)
+e82545_transmit_done(struct e82545_softc *sc, uint16_t head, uint16_t tail,
+uint16_t dsize, int *tdwb)
 {
-   int i;
+   union e1000_tx_udesc *dsc;
 
-   /* Write-back tx descriptor status */
-   for (i = 0; i < nwb; i++)
-   txwb[i]->td.upper.data |= E1000_TXD_STAT_DD;
-   /* XXX wmb() */
+   for ( ; head != tail; head = (head + 1) % dsize) {
+   dsc = >esc_txdesc[head];
+   if (dsc->td.lower.data & E1000_TXD_CMD_RS) {
+   dsc->td.upper.data |= E1000_TXD_STAT_DD;
+   *tdwb = 1;
+   }
+   }
 }
 
 static int
@@ -1068,22 +1067,21 @@ e82545_transmit(struct e82545_softc *sc,
uint8_t *hdr, *hdrp;
struct iovec iovb[I82545_MAX_TXSEGS + 2];
struct iovec tiov[I82545_MAX_TXSEGS + 2];
-   union e1000_tx_udesc *txwb[I82545_MAX_TXSEGS];
struct e1000_context_desc *cd;
struct ck_info ckinfo[2];
struct iovec *iov;
union  e1000_tx_udesc *dsc;
-   int desc, dtype, len, ntype, nwb, iovcnt, tlen, hdrlen, vlen, tcp, tso;
+   int desc, dtype, len, ntype, iovcnt, tlen, hdrlen, vlen, tcp, tso;
int mss, paylen, seg, tiovcnt, left, now, nleft, nnow, pv, pvoff;
uint32_t tcpsum, tcpseq;
-   uint16_t ipcs, tcpcs, ipid;
+   uint16_t ipcs, tcpcs, ipid, ohead;
 
ckinfo[0].ck_valid = ckinfo[1].ck_valid = 0;
iovcnt = 0;
tlen = 0;
-   nwb = 0;
ntype = 0;
tso = 0;
+   ohead = head;
 
/* iovb[0/1] may be used for writable copy of headers. */
iov = [2];
@@ -1104,11 +1102,8 @@ e82545_transmit(struct e82545_softc *sc,
head, dsc->td.buffer_addr,
dsc->td.upper.data, dsc->td.lower.data);
/* Save context and return */
-   /* XXX ignore DD processing here */
sc->esc_txctx = dsc->cd;
-   *rhead = (head + 1) % dsize;
-   return (1);
-   break;
+   goto done;
case E1000_TXD_TYP_L:
DPRINTF("tx legacy desc idx %d: %08x%08x\r\n",
head, dsc->td.upper.data, 
dsc->td.lower.data);
@@ -1142,16 +1137,14 @@ e82545_transmit(struct e82545_softc *sc,
(dsc->td.lower.data & E1000_TXD_CMD_IFCS) == 0)
len -= 2;
tlen += len;
-   iov[iovcnt].iov_base = paddr_guest2host(sc->esc_ctx,
-   dsc->td.buffer_addr, len);
-   iov[iovcnt].iov_len = len;
+   if (iovcnt < I82545_MAX_TXSEGS) {
+   iov[iovcnt].iov_base = paddr_guest2host(
+   sc->esc_ctx, dsc->td.buffer_addr, len);
+   

svn commit: r302930 - head/sys/netinet

2016-07-16 Thread Michael Tuexen
Author: tuexen
Date: Sat Jul 16 08:11:43 2016
New Revision: 302930
URL: https://svnweb.freebsd.org/changeset/base/302930

Log:
  Don't free a data chunk twice.
  Found by the clang static code analyzer running for the userland stack.
  
  MFC after:3 days

Modified:
  head/sys/netinet/sctp_indata.c

Modified: head/sys/netinet/sctp_indata.c
==
--- head/sys/netinet/sctp_indata.c  Sat Jul 16 08:04:00 2016
(r302929)
+++ head/sys/netinet/sctp_indata.c  Sat Jul 16 08:11:43 2016
(r302930)
@@ -961,11 +961,6 @@ place_chunk:
 * should not happen since the FSN is a TSN and it
 * should have been dropped earlier.
 */
-   if (chk->data) {
-   sctp_m_freem(chk->data);
-   chk->data = NULL;
-   }
-   sctp_free_a_chunk(stcb, chk, SCTP_SO_NOT_LOCKED);
sctp_abort_in_reasm(stcb, control, chk,
abort_flag,
SCTP_FROM_SCTP_INDATA + SCTP_LOC_5);
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r302929 - head/release/tools

2016-07-16 Thread Colin Percival
Author: cperciva
Date: Sat Jul 16 08:04:00 2016
New Revision: 302929
URL: https://svnweb.freebsd.org/changeset/base/302929

Log:
  Now that potentially buggy versions of Xen are automatically detected
  (see r302635), there is no need to force msix interrupt migration off
  via loader.conf.
  
  Reverts:  r302184
  MFC after:3 days

Modified:
  head/release/tools/ec2.conf

Modified: head/release/tools/ec2.conf
==
--- head/release/tools/ec2.conf Sat Jul 16 07:48:01 2016(r302928)
+++ head/release/tools/ec2.conf Sat Jul 16 08:04:00 2016(r302929)
@@ -72,12 +72,6 @@ vm_extra_pre_umount() {
# nodes, but apply the workaround just in case.
echo 'hw.broken_txfifo="1"' >> ${DESTDIR}/boot/loader.conf
 
-   # Some EC2 instances run on a version of Xen which has a bug relating
-   # to the migration of MSI-X interrupts; this is visible as SR-IOV
-   # networking (aka. "EC2 Enhanced Networking") not being able to pass
-   # packets.  Disable MSI-X interrupt migration to work around this bug.
-   echo 'machdep.disable_msix_migration="1"' >> ${DESTDIR}/boot/loader.conf
-
# The first time the AMI boots, the installed "first boot" scripts
# should be allowed to run:
# * ec2_configinit (download and process EC2 user-data)
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r302928 - head/sys/netinet

2016-07-16 Thread Michael Tuexen
Author: tuexen
Date: Sat Jul 16 07:48:01 2016
New Revision: 302928
URL: https://svnweb.freebsd.org/changeset/base/302928

Log:
  Address a potential memory leak found a the clang static code analyzer
  running on the userland stack.
  
  MFC after:3 days

Modified:
  head/sys/netinet/sctp_auth.c

Modified: head/sys/netinet/sctp_auth.c
==
--- head/sys/netinet/sctp_auth.cSat Jul 16 06:41:02 2016
(r302927)
+++ head/sys/netinet/sctp_auth.cSat Jul 16 07:48:01 2016
(r302928)
@@ -542,7 +542,7 @@ sctp_insert_sharedkey(struct sctp_keyhea
}
}
/* shouldn't reach here */
-   return (0);
+   return (EINVAL);
 }
 
 void
@@ -622,8 +622,11 @@ sctp_copy_skeylist(const struct sctp_key
LIST_FOREACH(skey, src, next) {
new_skey = sctp_copy_sharedkey(skey);
if (new_skey != NULL) {
-   (void)sctp_insert_sharedkey(dest, new_skey);
-   count++;
+   if (sctp_insert_sharedkey(dest, new_skey)) {
+   sctp_free_sharedkey(new_skey);
+   } else {
+   count++;
+   }
}
}
return (count);
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r302790 - head/usr.sbin/bsdinstall/scripts

2016-07-16 Thread Slawa Olhovchenkov
On Wed, Jul 13, 2016 at 11:49:46PM +, Allan Jude wrote:

> Author: allanjude
> Date: Wed Jul 13 23:49:45 2016
> New Revision: 302790
> URL: https://svnweb.freebsd.org/changeset/base/302790
> 
> Log:
>   bsdinstall: Prompt user to set the date and time after selecting timezone
>   
>   Not having the correct date and time makes many PKI based things not work
>   
>   In 10 and 11, it can mean that Unbound, ntpd, and sshd won't start

Can you do more sofistical -- using current date and time as start
value?

PS: this is don't resolve case of cmos-less machines.

>   Submitted by:   des (original patch)
>   MFC after:  7 days
> 
> Modified:
>   head/usr.sbin/bsdinstall/scripts/time
> 
> Modified: head/usr.sbin/bsdinstall/scripts/time
> ==
> --- head/usr.sbin/bsdinstall/scripts/time Wed Jul 13 23:03:34 2016
> (r302789)
> +++ head/usr.sbin/bsdinstall/scripts/time Wed Jul 13 23:49:45 2016
> (r302790)
> @@ -26,4 +26,40 @@
>  #
>  # $FreeBSD$
>  
> +# Select timezone
>  chroot $BSDINSTALL_CHROOT tzsetup
> +
> +# Switch to target timezone
> +saved_TZ="$TZ"
> +TZ="${BSDINSTALL_CHROOT}/etc/localtime"
> +export TZ
> +
> +# Set date
> +exec 3>&1
> +DATE=$(dialog --backtitle 'FreeBSD Installer' \
> + --title 'Time & Date' \
> + --ok-label 'Set Date' \
> + --cancel-label 'Skip' \
> + --date-format '%Y%m%d%H%M.%S' \
> + --calendar '' 2 40 \
> +2>&1 1>&3) && date $DATE
> +exec 3>&-
> +
> +# Set time
> +exec 3>&1
> +TIME=$(dialog --backtitle 'FreeBSD Installer' \
> + --title 'Time & Date' \
> + --ok-label 'Set Time' \
> + --cancel-label 'Skip' \
> + --time-format '%H%M.%S' \
> + --timebox '' 2 40 \
> +2>&1 1>&3) && date $TIME
> +exec 3>&-
> +
> +# Switch back
> +if [ -n "$saved_TZ" ]; then
> + TZ="$saved_TZ"
> +else
> + unset TZ
> +fi
> +unset saved_TZ
> ___
> svn-src-...@freebsd.org mailing list
> https://lists.freebsd.org/mailman/listinfo/svn-src-all
> To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"