svn commit: r325032 - head/lib/libc/stdio

2017-10-26 Thread Cy Schubert
Author: cy
Date: Fri Oct 27 05:04:29 2017
New Revision: 325032
URL: https://svnweb.freebsd.org/changeset/base/325032

Log:
  Revert r325031. This breaks the build due to __FBSDID.
  
  Pointy hat to:cy

Modified:
  head/lib/libc/stdio/gets.c

Modified: head/lib/libc/stdio/gets.c
==
--- head/lib/libc/stdio/gets.c  Fri Oct 27 04:51:05 2017(r325031)
+++ head/lib/libc/stdio/gets.c  Fri Oct 27 05:04:29 2017(r325032)
@@ -33,9 +33,9 @@
 #if defined(LIBC_SCCS) && !defined(lint)
 static char sccsid[] = "@(#)gets.c 8.1 (Berkeley) 6/4/93";
 #endif /* LIBC_SCCS and not lint */
+#include 
 __FBSDID("$FreeBSD$");
 
-#include 
 #include "namespace.h"
 #include 
 #include 
___
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: r325031 - head/lib/libc/stdio

2017-10-26 Thread Cy Schubert
Author: cy
Date: Fri Oct 27 04:51:05 2017
New Revision: 325031
URL: https://svnweb.freebsd.org/changeset/base/325031

Log:
  Ensure all incude statements are kept together by moving the
  sys/cdefs.h include appropriately.
  
  MFC after:1 week
  X-MFC with:   r325030

Modified:
  head/lib/libc/stdio/gets.c

Modified: head/lib/libc/stdio/gets.c
==
--- head/lib/libc/stdio/gets.c  Fri Oct 27 04:47:44 2017(r325030)
+++ head/lib/libc/stdio/gets.c  Fri Oct 27 04:51:05 2017(r325031)
@@ -33,9 +33,9 @@
 #if defined(LIBC_SCCS) && !defined(lint)
 static char sccsid[] = "@(#)gets.c 8.1 (Berkeley) 6/4/93";
 #endif /* LIBC_SCCS and not lint */
-#include 
 __FBSDID("$FreeBSD$");
 
+#include 
 #include "namespace.h"
 #include 
 #include 
___
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: r325030 - head/lib/libc/stdio

2017-10-26 Thread Cy Schubert
Author: cy
Date: Fri Oct 27 04:47:44 2017
New Revision: 325030
URL: https://svnweb.freebsd.org/changeset/base/325030

Log:
  Remove redundant sys/cdefs.h include.
  
  MFC after:1 week

Modified:
  head/lib/libc/stdio/gets.c

Modified: head/lib/libc/stdio/gets.c
==
--- head/lib/libc/stdio/gets.c  Fri Oct 27 04:38:42 2017(r325029)
+++ head/lib/libc/stdio/gets.c  Fri Oct 27 04:47:44 2017(r325030)
@@ -39,7 +39,6 @@ __FBSDID("$FreeBSD$");
 #include "namespace.h"
 #include 
 #include 
-#include 
 #include "un-namespace.h"
 #include "libc_private.h"
 #include "local.h"
___
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: r325028 - in head: sys/kern sys/sys tests/sys/kern

2017-10-26 Thread John Baldwin
Author: jhb
Date: Fri Oct 27 03:16:19 2017
New Revision: 325028
URL: https://svnweb.freebsd.org/changeset/base/325028

Log:
  Discard the correct thread event reported for a ptrace stop.
  
  When multiple threads wish to report a tracing event to a debugger,
  both threads call ptracestop() and one thread will win the race to be
  the reporting thread (p->p_xthread).  The debugger uses PT_LWPINFO
  with the process ID to determine which thread / LWP is reporting an
  event and the details of that event.  This event is cleared as a side
  effect of the subsequent ptrace event that resumed the process
  (PT_CONTINUE, PT_STEP, etc.).  However, ptrace() was clearing the
  event identified by the LWP ID passed to the resume request even if
  that wasn't the 'p_xthread'.  This could result in clearing an event
  that had not yet been observed by the debugger and leaving the
  existing event for 'p_thread' pending so that it was reported a second
  time.
  
  Specifically, if the debugger stopped due to a software breakpoint in
  one thread, but then switched to another thread that was used to
  resume (e.g. if the user switched to a different thread and issued a
  step), the resume request (PT_STEP) cleared a pending event (if any)
  for the thread being stepped.  However, the process immediately
  stopped and the first thread reported it's breakpoint event a second
  time.  The debugger decremented the PC for "both" breakpoint events
  which resulted in the PC now pointing into the middle of an
  instruction (on x86) and a SIGILL fault when the process was resumed a
  second time.
  
  To fix, always clear the pending event for 'p_xthread' when resuming a
  process.  ptrace() still honors the requested LWP ID when enabling
  single-stepping (PT_STEP) or setting a different PC (PT_CONTINUE).
  
  Reported by:  GDB testsuite (gdb.threads/continue-pending-status.exp)
  Reviewed by:  kib
  MFC after:1 week
  Differential Revision:https://reviews.freebsd.org/D12794

Modified:
  head/sys/kern/sys_process.c
  head/sys/sys/param.h
  head/tests/sys/kern/ptrace_test.c

Modified: head/sys/kern/sys_process.c
==
--- head/sys/kern/sys_process.c Thu Oct 26 22:53:55 2017(r325027)
+++ head/sys/kern/sys_process.c Fri Oct 27 03:16:19 2017(r325028)
@@ -1129,6 +1129,13 @@ kern_ptrace(struct thread *td, int req, pid_t pid, voi
}
 
sendsig:
+   /*
+* Clear the pending event for the thread that just
+* reported its event (p_xthread).  This may not be
+* the thread passed to PT_CONTINUE, PT_STEP, etc. if
+* the debugger is resuming a different thread.
+*/
+   td2 = p->p_xthread;
if (proctree_locked) {
sx_xunlock(_lock);
proctree_locked = 0;

Modified: head/sys/sys/param.h
==
--- head/sys/sys/param.hThu Oct 26 22:53:55 2017(r325027)
+++ head/sys/sys/param.hFri Oct 27 03:16:19 2017(r325028)
@@ -58,7 +58,7 @@
  * in the range 5 to 9.
  */
 #undef __FreeBSD_version
-#define __FreeBSD_version 1200051  /* Master, propagated to newvers */
+#define __FreeBSD_version 1200052  /* Master, propagated to newvers */
 
 /*
  * __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD,

Modified: head/tests/sys/kern/ptrace_test.c
==
--- head/tests/sys/kern/ptrace_test.c   Thu Oct 26 22:53:55 2017
(r325027)
+++ head/tests/sys/kern/ptrace_test.c   Fri Oct 27 03:16:19 2017
(r325028)
@@ -3463,6 +3463,174 @@ ATF_TC_BODY(ptrace__PT_STEP_with_signal, tc)
ATF_REQUIRE(errno == ECHILD);
 }
 
+#if defined(__amd64__) || defined(__i386__)
+/*
+ * Only x86 both define breakpoint() and have a PC after breakpoint so
+ * that restarting doesn't retrigger the breakpoint.
+ */
+static void *
+continue_thread(void *arg)
+{
+   breakpoint();
+   return (NULL);
+}
+
+static __dead2 void
+continue_thread_main(void)
+{
+   pthread_t threads[2];
+
+   CHILD_REQUIRE(pthread_create([0], NULL, continue_thread,
+   NULL) == 0);
+   CHILD_REQUIRE(pthread_create([1], NULL, continue_thread,
+   NULL) == 0);
+   CHILD_REQUIRE(pthread_join(threads[0], NULL) == 0);
+   CHILD_REQUIRE(pthread_join(threads[1], NULL) == 0);
+   exit(1);
+}
+
+/*
+ * Ensure that PT_CONTINUE clears the status of the thread that
+ * triggered the stop even if a different thread's LWP was passed to
+ * PT_CONTINUE.
+ */
+ATF_TC_WITHOUT_HEAD(ptrace__PT_CONTINUE_different_thread);
+ATF_TC_BODY(ptrace__PT_CONTINUE_different_thread, tc)
+{
+   struct ptrace_lwpinfo pl;
+   pid_t fpid, wpid;
+   lwpid_t lwps[2];
+   bool 

Re: svn commit: r325026 - head/sys/cam/ata

2017-10-26 Thread Warner Losh
On Thu, Oct 26, 2017 at 5:35 PM, Warner Losh  wrote:

>
>
> On Thu, Oct 26, 2017 at 5:04 PM, Alan Somers  wrote:
>
>> On Thu, Oct 26, 2017 at 4:53 PM, Warner Losh  wrote:
>> > Author: imp
>> > Date: Thu Oct 26 22:53:49 2017
>> > New Revision: 325026
>> > URL: https://svnweb.freebsd.org/changeset/base/325026
>> >
>> > Log:
>> >   Always send STANDBY IMMEDIATE when shutting down
>> >
>> >   To save SMART data and for a drive to understand that it's been nicely
>> >   shutdown, we need to send a STANDBY IMMEDIATE. Modify adaspindown to
>> >   use a local CCB on the stack. When we're panicing, used
>> >   xpt_polled_action rather than cam_periph_runccb so that we can SEND
>> >   IMMEDIATE after we've shutdown the scheduler.
>> >
>> >   Sponsored by: Netflix
>> >   Reviewed by: scottl@, gallatin@
>> >   Differential Revision: https://reviews.freebsd.org/D12799
>> >
>> > Modified:
>> >   head/sys/cam/ata/ata_da.c
>>
>> Will this put the drive into a standby state just prior to a warm
>> reboot?  That could cause lengthy delays on the new boot while the
>> drives spin up.  That behavior caused a problem when the mpr driver
>> did it to a JBOD full of 96 SATA drives.  On the new boot, each drive
>> spun up one at a time while they were being probed.  Eventually the
>> system paniced because run_interrupt_driven_hooks timed out.  With
>> mpr, I was able to fix the problem by setting hw.mpr.enable_ssu=0.
>>
>
> That's a good question. The standard is silent about what, exactly, the
> Standby state means. We already allow this to be disabled, and this commit
> doesn't change that. It looks like IDLE IMMEDIATE also forces SMART media
> non volatile to be flushed out.
>
> What do you suggest?
>

I see two paths forward. We need to flush the NV SMART data at reboot time.
SSDs that we use, at least, consider it an unclean shutdown if you don't
Idle the drive on reboot because part of that process does a
COMINIT/COMRESET and if the drive is in the Active state, it ticks up the
counter (and with at least one vendor can lose NV SMART data).

So, path forward #1 is that we do STANDBY IMMEDIATE for SSDs in the
RB_REBOOT case or all drives in the other cases. For HDD and RB_REBOOT we
do only a IDLE IMMEDIATE which shouldn't spin the drives down. This seems
to bake in what we know about storage devices and is easiest for the user.
If we get it right, it's easier for the user. If we get it wrong, the user
can disable all spin downs.

Path forward #2 is to just make what we send a sysctl. This is unsatisfying
and error-prone, but gives the most flexibility. I don't like this.

I'd be curious if there's another viable path forward I'm not seeing that
you might know.

FWIW, we don't connect HDDs to our AHCI ports (they are all on MPT/MPS/MPR
HBAs), so we've not seen any issues in the 6 or so months we've had this in
the tree.

Warner
___
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: r325026 - head/sys/cam/ata

2017-10-26 Thread Warner Losh
On Thu, Oct 26, 2017 at 5:04 PM, Alan Somers  wrote:

> On Thu, Oct 26, 2017 at 4:53 PM, Warner Losh  wrote:
> > Author: imp
> > Date: Thu Oct 26 22:53:49 2017
> > New Revision: 325026
> > URL: https://svnweb.freebsd.org/changeset/base/325026
> >
> > Log:
> >   Always send STANDBY IMMEDIATE when shutting down
> >
> >   To save SMART data and for a drive to understand that it's been nicely
> >   shutdown, we need to send a STANDBY IMMEDIATE. Modify adaspindown to
> >   use a local CCB on the stack. When we're panicing, used
> >   xpt_polled_action rather than cam_periph_runccb so that we can SEND
> >   IMMEDIATE after we've shutdown the scheduler.
> >
> >   Sponsored by: Netflix
> >   Reviewed by: scottl@, gallatin@
> >   Differential Revision: https://reviews.freebsd.org/D12799
> >
> > Modified:
> >   head/sys/cam/ata/ata_da.c
>
> Will this put the drive into a standby state just prior to a warm
> reboot?  That could cause lengthy delays on the new boot while the
> drives spin up.  That behavior caused a problem when the mpr driver
> did it to a JBOD full of 96 SATA drives.  On the new boot, each drive
> spun up one at a time while they were being probed.  Eventually the
> system paniced because run_interrupt_driven_hooks timed out.  With
> mpr, I was able to fix the problem by setting hw.mpr.enable_ssu=0.
>

That's a good question. The standard is silent about what, exactly, the
Standby state means. We already allow this to be disabled, and this commit
doesn't change that. It looks like IDLE IMMEDIATE also forces SMART media
non volatile to be flushed out.

What do you suggest?

Warner
___
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: r325026 - head/sys/cam/ata

2017-10-26 Thread Alan Somers
On Thu, Oct 26, 2017 at 4:53 PM, Warner Losh  wrote:
> Author: imp
> Date: Thu Oct 26 22:53:49 2017
> New Revision: 325026
> URL: https://svnweb.freebsd.org/changeset/base/325026
>
> Log:
>   Always send STANDBY IMMEDIATE when shutting down
>
>   To save SMART data and for a drive to understand that it's been nicely
>   shutdown, we need to send a STANDBY IMMEDIATE. Modify adaspindown to
>   use a local CCB on the stack. When we're panicing, used
>   xpt_polled_action rather than cam_periph_runccb so that we can SEND
>   IMMEDIATE after we've shutdown the scheduler.
>
>   Sponsored by: Netflix
>   Reviewed by: scottl@, gallatin@
>   Differential Revision: https://reviews.freebsd.org/D12799
>
> Modified:
>   head/sys/cam/ata/ata_da.c

Will this put the drive into a standby state just prior to a warm
reboot?  That could cause lengthy delays on the new boot while the
drives spin up.  That behavior caused a problem when the mpr driver
did it to a JBOD full of 96 SATA drives.  On the new boot, each drive
spun up one at a time while they were being probed.  Eventually the
system paniced because run_interrupt_driven_hooks timed out.  With
mpr, I was able to fix the problem by setting hw.mpr.enable_ssu=0.

-Alan
___
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: r325027 - head/sys/cam/ata

2017-10-26 Thread Warner Losh
Author: imp
Date: Thu Oct 26 22:53:55 2017
New Revision: 325027
URL: https://svnweb.freebsd.org/changeset/base/325027

Log:
  We should be call adaerror() instead of cam_periph_error() always.
  
  Sponsored by: Netflix

Modified:
  head/sys/cam/ata/ata_da.c

Modified: head/sys/cam/ata/ata_da.c
==
--- head/sys/cam/ata/ata_da.c   Thu Oct 26 22:53:49 2017(r325026)
+++ head/sys/cam/ata/ata_da.c   Thu Oct 26 22:53:55 2017(r325027)
@@ -1080,8 +1080,8 @@ adadump(void *arg, void *virtual, vm_offset_t physical
}
xpt_polled_action();
 
-   error = cam_periph_error(,
-   0, SF_NO_RECOVERY | SF_NO_RETRY, NULL);
+   error = adaerror(,
+   0, SF_NO_RECOVERY | SF_NO_RETRY);
if ((ccb.ccb_h.status & CAM_DEV_QFRZN) != 0)
cam_release_devq(ccb.ccb_h.path, /*relsim_flags*/0,
/*reduction*/0, /*timeout*/0, /*getcount_only*/0);
@@ -1116,8 +1116,8 @@ adadump(void *arg, void *virtual, vm_offset_t physical
ata_28bit_cmd(, ATA_FLUSHCACHE, 0, 0, 0);
xpt_polled_action();
 
-   error = cam_periph_error(,
-   0, SF_NO_RECOVERY | SF_NO_RETRY, NULL);
+   error = adaerror(,
+   0, SF_NO_RECOVERY | SF_NO_RETRY);
if ((ccb.ccb_h.status & CAM_DEV_QFRZN) != 0)
cam_release_devq(ccb.ccb_h.path, /*relsim_flags*/0,
/*reduction*/0, /*timeout*/0, /*getcount_only*/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: r325025 - head/sys/dev/ipmi

2017-10-26 Thread Warner Losh
Author: imp
Date: Thu Oct 26 22:53:02 2017
New Revision: 325025
URL: https://svnweb.freebsd.org/changeset/base/325025

Log:
  Make time we wait for a power cycle tunable.
  
  hw.ipmi.cycle_time is the time to wait for the power down phase of the
  ipmi power cycle before falling back to either reboot or halt.
  
  Sponsored by: Netflix

Modified:
  head/sys/dev/ipmi/ipmi.c

Modified: head/sys/dev/ipmi/ipmi.c
==
--- head/sys/dev/ipmi/ipmi.cThu Oct 26 22:52:51 2017(r325024)
+++ head/sys/dev/ipmi/ipmi.cThu Oct 26 22:53:02 2017(r325025)
@@ -86,6 +86,7 @@ static int wd_timer_actions = IPMI_SET_WD_ACTION_POWER
 static int wd_shutdown_countdown = 420; /* sec */
 static int wd_startup_countdown = 420; /* sec */
 static int wd_pretimeout_countdown = 120; /* sec */
+static int cycle_wait = 10; /* sec */
 
 static SYSCTL_NODE(_hw, OID_AUTO, ipmi, CTLFLAG_RD, 0,
 "IPMI driver parameters");
@@ -103,6 +104,9 @@ SYSCTL_INT(_hw_ipmi, OID_AUTO, wd_startup_countdown, C
 SYSCTL_INT(_hw_ipmi, OID_AUTO, wd_pretimeout_countdown, CTLFLAG_RW,
_pretimeout_countdown, 0,
"IPMI watchdog pre-timeout countdown (seconds)");
+SYSCTL_INT(_hw_ipmi, OID_AUTO, cyle_wait, CTLFLAG_RWTUN,
+   _wait, 0,
+   "IPMI power cycle on reboot delay time (seconds)");
 
 static struct cdevsw ipmi_cdevsw = {
.d_version =D_VERSION,
@@ -797,11 +801,11 @@ ipmi_power_cycle(void *arg, int howto)
}
 
/*
-* BMCs are notoriously slow, give it up to 10s to effect the power
+* BMCs are notoriously slow, give it cyle_wait seconds for the power
 * down leg of the power cycle. If that fails, fallback to the next
 * hanlder in the shutdown_final chain and/or the platform failsafe.
 */
-   DELAY(10 * 1000 * 1000);
+   DELAY(cycle_wait * 1000 * 1000);
device_printf(sc->ipmi_dev, "Power cycling via IPMI timed out\n");
 }
 
___
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: r325026 - head/sys/cam/ata

2017-10-26 Thread Warner Losh
Author: imp
Date: Thu Oct 26 22:53:49 2017
New Revision: 325026
URL: https://svnweb.freebsd.org/changeset/base/325026

Log:
  Always send STANDBY IMMEDIATE when shutting down
  
  To save SMART data and for a drive to understand that it's been nicely
  shutdown, we need to send a STANDBY IMMEDIATE. Modify adaspindown to
  use a local CCB on the stack. When we're panicing, used
  xpt_polled_action rather than cam_periph_runccb so that we can SEND
  IMMEDIATE after we've shutdown the scheduler.
  
  Sponsored by: Netflix
  Reviewed by: scottl@, gallatin@
  Differential Revision: https://reviews.freebsd.org/D12799

Modified:
  head/sys/cam/ata/ata_da.c

Modified: head/sys/cam/ata/ata_da.c
==
--- head/sys/cam/ata/ata_da.c   Thu Oct 26 22:53:02 2017(r325025)
+++ head/sys/cam/ata/ata_da.c   Thu Oct 26 22:53:49 2017(r325026)
@@ -3466,7 +3466,7 @@ adaspindown(uint8_t cmd, int flags)
 {
struct cam_periph *periph;
struct ada_softc *softc;
-   union ccb *ccb;
+   struct ccb_ataio local_ccb;
int error;
 
CAM_PERIPH_FOREACH(periph, ) {
@@ -3486,8 +3486,11 @@ adaspindown(uint8_t cmd, int flags)
if (bootverbose)
xpt_print(periph->path, "spin-down\n");
 
-   ccb = cam_periph_getccb(periph, CAM_PRIORITY_NORMAL);
-   cam_fill_ataio(>ataio,
+   memset(_ccb, 0, sizeof(local_ccb));
+   xpt_setup_ccb(_ccb.ccb_h, periph->path, 
CAM_PRIORITY_NORMAL);
+   local_ccb.ccb_h.ccb_state = ADA_CCB_DUMP;
+
+   cam_fill_ataio(_ccb,
0,
adadone,
CAM_DIR_NONE | flags,
@@ -3495,14 +3498,35 @@ adaspindown(uint8_t cmd, int flags)
NULL,
0,
ada_default_timeout*1000);
-   ata_28bit_cmd(>ataio, cmd, 0, 0, 0);
+   ata_28bit_cmd(_ccb, cmd, 0, 0, 0);
 
-   error = cam_periph_runccb(ccb, adaerror, /*cam_flags*/0,
-   /*sense_flags*/ SF_NO_RECOVERY | SF_NO_RETRY,
-   softc->disk->d_devstat);
+   if (!SCHEDULER_STOPPED()) {
+   /*
+* Not panicing, can just do the normal runccb
+* XXX should make cam_periph_runccb work while
+* XXX panicing... later
+*/
+   error = cam_periph_runccb((union ccb *)_ccb, 
adaerror,
+   /*cam_flags*/0, /*sense_flags*/ SF_NO_RECOVERY | 
SF_NO_RETRY,
+   softc->disk->d_devstat);
+   } else {
+   /*
+* Panicing, so we have to do this by hand: do
+* xpt_polled_action to run the request through the SIM,
+* extract the error, and if the queue was frozen,
+* unfreeze it. cam_periph_runccb takes care of these
+* details, but xpt_polled_action doesn't.
+*/
+   xpt_polled_action((union ccb *)_ccb);
+   error = adaerror((union ccb *)_ccb, 0,
+   SF_NO_RECOVERY | SF_NO_RETRY);
+   if ((local_ccb.ccb_h.status & CAM_DEV_QFRZN) != 0)
+   cam_release_devq(local_ccb.ccb_h.path,
+   /*relsim_flags*/0, /*reduction*/0,
+   /*timeout*/0, /*getcount_only*/0);
+   }
if (error != 0)
xpt_print(periph->path, "Spin-down disk failed\n");
-   xpt_release_ccb(ccb);
cam_periph_unlock(periph);
}
 }
@@ -3512,8 +3536,14 @@ adashutdown(void *arg, int howto)
 {
 
adaflush();
-   if (ada_spindown_shutdown != 0 &&
-   (howto & (RB_HALT | RB_POWEROFF | RB_POWERCYCLE)) != 0)
+
+   /*
+* STANDBY IMMEDIATE flushes any volatile data to the drive so
+* do this always to ensure we flush a cosnsistent state to
+* the drive. adaspindown will ensure that we don't send this
+* to a drive that doesn't support it.
+*/
+   if (ada_spindown_shutdown != 0)
adaspindown(ATA_STANDBY_IMMEDIATE, 0);
 }
 
@@ -3522,6 +3552,10 @@ adasuspend(void *arg)
 {
 
adaflush();
+   /*
+* SLEEP also fushes any volatile data, like STANDBY IMEDIATE,
+* so we don't need to send it as well.
+*/
if (ada_spindown_suspend != 0)
adaspindown(ATA_SLEEP, CAM_DEV_QFREEZE);
 }
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To 

svn commit: r325024 - in head/sys: dev/ipmi sys

2017-10-26 Thread Warner Losh
Author: imp
Date: Thu Oct 26 22:52:51 2017
New Revision: 325024
URL: https://svnweb.freebsd.org/changeset/base/325024

Log:
  Various IPMI watchdog timer improvements
  
  o Make hw.ipmi.on a tuneable
  o Changes to keep shutdown from hanging indefinitately after the wd
would normally have been disabled.
  o Add support for setting pretimeout (which fires an interrupt
some time before the actual watchdog expires)
  o Allow refinement of the actions to take when the watchdog expires
  o Allow special startup timeout to keep us from hanging in boot
before watchdogd is started, but after we've loaded the kernel.
  
  Obtained From: Netflix OCA Firmware

Modified:
  head/sys/dev/ipmi/ipmi.c
  head/sys/dev/ipmi/ipmivars.h
  head/sys/sys/ipmi.h

Modified: head/sys/dev/ipmi/ipmi.c
==
--- head/sys/dev/ipmi/ipmi.cThu Oct 26 22:19:28 2017(r325023)
+++ head/sys/dev/ipmi/ipmi.cThu Oct 26 22:52:51 2017(r325024)
@@ -81,10 +81,28 @@ static void ipmi_dtor(void *arg);
 int ipmi_attached = 0;
 
 static int on = 1;
+static bool wd_in_shutdown = false;
+static int wd_timer_actions = IPMI_SET_WD_ACTION_POWER_CYCLE;
+static int wd_shutdown_countdown = 420; /* sec */
+static int wd_startup_countdown = 420; /* sec */
+static int wd_pretimeout_countdown = 120; /* sec */
+
 static SYSCTL_NODE(_hw, OID_AUTO, ipmi, CTLFLAG_RD, 0,
 "IPMI driver parameters");
-SYSCTL_INT(_hw_ipmi, OID_AUTO, on, CTLFLAG_RW,
+SYSCTL_INT(_hw_ipmi, OID_AUTO, on, CTLFLAG_RWTUN,
, 0, "");
+SYSCTL_INT(_hw_ipmi, OID_AUTO, wd_timer_actions, CTLFLAG_RW,
+   _timer_actions, 0,
+   "IPMI watchdog timer actions (including pre-timeout interrupt)");
+SYSCTL_INT(_hw_ipmi, OID_AUTO, wd_shutdown_countdown, CTLFLAG_RW,
+   _shutdown_countdown, 0,
+   "IPMI watchdog countdown for shutdown (seconds)");
+SYSCTL_INT(_hw_ipmi, OID_AUTO, wd_startup_countdown, CTLFLAG_RDTUN,
+   _startup_countdown, 0,
+   "IPMI watchdog countdown initialized during startup (seconds)");
+SYSCTL_INT(_hw_ipmi, OID_AUTO, wd_pretimeout_countdown, CTLFLAG_RW,
+   _pretimeout_countdown, 0,
+   "IPMI watchdog pre-timeout countdown (seconds)");
 
 static struct cdevsw ipmi_cdevsw = {
.d_version =D_VERSION,
@@ -631,8 +649,8 @@ ipmi_set_watchdog(struct ipmi_softc *sc, unsigned int 
if (sec) {
req->ir_request[0] = IPMI_SET_WD_TIMER_DONT_STOP
| IPMI_SET_WD_TIMER_SMS_OS;
-   req->ir_request[1] = IPMI_SET_WD_ACTION_RESET;
-   req->ir_request[2] = 0;
+   req->ir_request[1] = (wd_timer_actions & 0xff);
+   req->ir_request[2] = (wd_pretimeout_countdown & 0xff);
req->ir_request[3] = 0; /* Timer use */
req->ir_request[4] = (sec * 10) & 0xff;
req->ir_request[5] = (sec * 10) >> 8;
@@ -657,21 +675,40 @@ ipmi_wd_event(void *arg, unsigned int cmd, int *error)
unsigned int timeout;
int e;
 
-   if (dumping)
+   /* Ignore requests while disabled. */
+   if (!on)
return;
 
+   /*
+* To prevent infinite hangs, we don't let anyone pat or change
+* the watchdog when we're shutting down. (See ipmi_shutdown_event().)
+* However, we do want to keep patting the watchdog while we are doing
+* a coredump.
+*/
+   if (wd_in_shutdown) {
+   if (dumping && sc->ipmi_watchdog_active)
+   ipmi_reset_watchdog(sc);
+   return;
+   }
+
cmd &= WD_INTERVAL;
if (cmd > 0 && cmd <= 63) {
timeout = ((uint64_t)1 << cmd) / 10;
if (timeout == 0)
timeout = 1;
-   if (timeout != sc->ipmi_watchdog_active) {
+   if (timeout != sc->ipmi_watchdog_active ||
+   wd_timer_actions != sc->ipmi_watchdog_actions ||
+   wd_pretimeout_countdown != sc->ipmi_watchdog_pretimeout) {
e = ipmi_set_watchdog(sc, timeout);
if (e == 0) {
sc->ipmi_watchdog_active = timeout;
+   sc->ipmi_watchdog_actions = wd_timer_actions;
+   sc->ipmi_watchdog_pretimeout = 
wd_pretimeout_countdown;
} else {
(void)ipmi_set_watchdog(sc, 0);
sc->ipmi_watchdog_active = 0;
+   sc->ipmi_watchdog_actions = 0;
+   sc->ipmi_watchdog_pretimeout = 0;
}
}
if (sc->ipmi_watchdog_active != 0) {
@@ -681,9 +718,14 @@ ipmi_wd_event(void *arg, unsigned int cmd, int *error)
} else {
(void)ipmi_set_watchdog(sc, 0);

svn commit: r325022 - head/tests/sys/netpfil/pf

2017-10-26 Thread Kristof Provost
Author: kp
Date: Thu Oct 26 20:55:33 2017
New Revision: 325022
URL: https://svnweb.freebsd.org/changeset/base/325022

Log:
  pf tests: Remove temporary files
  
  Remove the created_jails.lst and created_interfaces.lst files in the
  cleanup code.

Modified:
  head/tests/sys/netpfil/pf/utils.subr

Modified: head/tests/sys/netpfil/pf/utils.subr
==
--- head/tests/sys/netpfil/pf/utils.subrThu Oct 26 20:54:52 2017
(r325021)
+++ head/tests/sys/netpfil/pf/utils.subrThu Oct 26 20:55:33 2017
(r325022)
@@ -56,6 +56,7 @@ pft_cleanup()
do
jail -r ${jailname}
done
+   rm created_jails.lst
fi
 
if [ -f created_interfaces.lst ]; then
@@ -63,5 +64,6 @@ pft_cleanup()
do
ifconfig ${ifname} destroy
done
+   rm created_interfaces.lst
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: r325021 - head/tests/sys/netpfil/pf

2017-10-26 Thread Kristof Provost
Author: kp
Date: Thu Oct 26 20:54:52 2017
New Revision: 325021
URL: https://svnweb.freebsd.org/changeset/base/325021

Log:
  pf tests: Fragmentation (v6) test
  
  Test fragmentation handling (i.e. scrub fragment reassemble) code for
  IPv6.
  
  Two simple tests: Ping a host (jail) and test forwarding of fragmented
  packets.

Added:
  head/tests/sys/netpfil/pf/fragmentation.sh   (contents, props changed)
Modified:
  head/tests/sys/netpfil/pf/Makefile

Modified: head/tests/sys/netpfil/pf/Makefile
==
--- head/tests/sys/netpfil/pf/Makefile  Thu Oct 26 20:53:56 2017
(r325020)
+++ head/tests/sys/netpfil/pf/Makefile  Thu Oct 26 20:54:52 2017
(r325021)
@@ -6,6 +6,7 @@ TESTSDIR=   ${TESTSBASE}/sys/netpfil/pf
 
 ATF_TESTS_SH+= pass_block \
forward \
+   fragmentation \
set_tos
 
 ${PACKAGE}FILES+=  utils.subr \

Added: head/tests/sys/netpfil/pf/fragmentation.sh
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/tests/sys/netpfil/pf/fragmentation.sh  Thu Oct 26 20:54:52 2017
(r325021)
@@ -0,0 +1,74 @@
+# $FreeBSD$
+
+. $(atf_get_srcdir)/utils.subr
+
+atf_test_case "v6" "cleanup"
+v6_head()
+{
+   atf_set descr 'IPv6 fragmentation test'
+   atf_set require.user root
+   atf_set require.progs scapy
+}
+
+v6_body()
+{
+   pft_init
+
+   epair_send=$(pft_mkepair)
+   epair_link=$(pft_mkepair)
+
+   pft_mkjail alcatraz ${epair_send}b ${epair_link}a
+   pft_mkjail singsing ${epair_link}b
+
+   ifconfig ${epair_send}a inet6 2001:db8:42::1/64 no_dad up
+
+   jexec alcatraz ifconfig ${epair_send}b inet6 2001:db8:42::2/64 no_dad up
+   jexec alcatraz ifconfig ${epair_link}a inet6 2001:db8:43::2/64 no_dad up
+   jexec alcatraz sysctl net.inet6.ip6.forwarding=1
+
+   jexec singsing ifconfig ${epair_link}b inet6 2001:db8:43::3/64 no_dad up
+   jexec singsing route add -6 2001:db8:42::/64 2001:db8:43::2
+   route add -6 2001:db8:43::/64 2001:db8:42::2
+
+   jexec alcatraz ifconfig ${epair_send}b inet6 -ifdisabled
+   jexec alcatraz ifconfig ${epair_link}a inet6 -ifdisabled
+   jexec singsing ifconfig ${epair_link}b inet6 -ifdisabled
+   ifconfig ${epair_send}a inet6 -ifdisabled
+
+   jexec alcatraz pfctl -e
+   pft_set_rules alcatraz \
+   "scrub fragment reassemble" \
+   "block in" \
+   "pass in inet6 proto icmp6 icmp6-type { neighbrsol, neighbradv 
}" \
+   "pass in inet6 proto icmp6 icmp6-type { echoreq, echorep }"
+
+   # Host test
+   atf_check -s exit:0 -o ignore \
+   ping6 -c 1 2001:db8:42::2
+
+   atf_check -s exit:0 -o ignore \
+   ping6 -c 1 -s 4500 2001:db8:42::2
+
+   atf_check -s exit:0 -o ignore\
+   ping6 -c 1 -b 7 -s 65000 2001:db8:42::2
+
+   # Forwarding test
+   atf_check -s exit:0 -o ignore \
+   ping6 -c 1 2001:db8:43::3
+
+   atf_check -s exit:0 -o ignore \
+   ping6 -c 1 -s 4500 2001:db8:43::3
+
+   atf_check -s exit:0 -o ignore\
+   ping6 -c 1 -b 7 -s 65000 2001:db8:43::3
+}
+
+v6_cleanup()
+{
+   pft_cleanup
+}
+
+atf_init_test_cases()
+{
+   atf_add_test_case "v6"
+}
___
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: r325020 - head/tests/sys/netpfil/pf

2017-10-26 Thread Kristof Provost
Author: kp
Date: Thu Oct 26 20:53:56 2017
New Revision: 325020
URL: https://svnweb.freebsd.org/changeset/base/325020

Log:
  pf tests: destroy jails before destroying interfaces
  
  When cleaning up we must destroy the jails before we destroy the interfaces.
  Otherwise we might try to destroy interfaces that belong to a jail, which 
won't
  work and fail to completely clean up.

Modified:
  head/tests/sys/netpfil/pf/utils.subr

Modified: head/tests/sys/netpfil/pf/utils.subr
==
--- head/tests/sys/netpfil/pf/utils.subrThu Oct 26 20:44:42 2017
(r325019)
+++ head/tests/sys/netpfil/pf/utils.subrThu Oct 26 20:53:56 2017
(r325020)
@@ -51,17 +51,17 @@ pft_set_rules()
 
 pft_cleanup()
 {
-   if [ -f created_interfaces.lst ]; then
-   for ifname in `cat created_interfaces.lst`
+   if [ -f created_jails.lst ]; then
+   for jailname in `cat created_jails.lst`
do
-   ifconfig ${ifname} destroy
+   jail -r ${jailname}
done
fi
 
-   if [ -f created_jails.lst ]; then
-   for jailname in `cat created_jails.lst`
+   if [ -f created_interfaces.lst ]; then
+   for ifname in `cat created_interfaces.lst`
do
-   jail -r ${jailname}
+   ifconfig ${ifname} destroy
done
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: r325019 - in head: share/man/man9 sys/contrib/libnv sys/sys

2017-10-26 Thread Mariusz Zaborski
Author: oshogbo
Date: Thu Oct 26 20:44:42 2017
New Revision: 325019
URL: https://svnweb.freebsd.org/changeset/base/325019

Log:
  Introduce cnvlist_name() and cnvlist_type() functions.
  
  Those function can be used when we are iterating over nvlist to reduce
  amount of extra variables we need to declare.
  
  MFC after:1 month

Modified:
  head/share/man/man9/cnv.9
  head/sys/contrib/libnv/cnvlist.c
  head/sys/sys/cnv.h

Modified: head/share/man/man9/cnv.9
==
--- head/share/man/man9/cnv.9   Thu Oct 26 19:45:15 2017(r325018)
+++ head/share/man/man9/cnv.9   Thu Oct 26 20:44:42 2017(r325019)
@@ -25,7 +25,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd August 27, 2016
+.Dd October 26, 2017
 .Dt CNV 9
 .Os
 .Sh NAME
@@ -37,6 +37,11 @@
 .Lb libnv
 .Sh SYNOPSIS
 .In sys/cnv.h
+.Ft const char *
+.Fn cnvlist_name "void *cookiep"
+.Ft int
+.Fn cnvlist_type "void *cookiep"
+.\"
 .Ft bool
 .Fn cnvlist_get_bool "void *cookiep"
 .Ft uint64_t
@@ -121,6 +126,16 @@ The concept of cookies is explained in
 and
 .Fn nvlist_get_pararr
 from
+.Xr nv 9 .
+.Pp
+The
+.Fn cnvlist_name
+function returns the name of an element associated with the given cookie.
+.Pp
+The
+.Fn cnvlist_type
+function returns the type of an element associated with the given cookie.
+Types which can be returned are described in
 .Xr nv 9 .
 .Pp
 The

Modified: head/sys/contrib/libnv/cnvlist.c
==
--- head/sys/contrib/libnv/cnvlist.cThu Oct 26 19:45:15 2017
(r325018)
+++ head/sys/contrib/libnv/cnvlist.cThu Oct 26 20:44:42 2017
(r325019)
@@ -53,6 +53,20 @@ __FBSDID("$FreeBSD$");
 #include "nvlist_impl.h"
 #include "nvpair_impl.h"
 
+const char *
+cnvlist_name(void *cookiep)
+{
+
+   return (nvpair_name(cookiep));
+}
+
+int
+cnvlist_type(void *cookiep)
+{
+
+   return (nvpair_type(cookiep));
+}
+
 #defineCNVLIST_GET(ftype, type, NVTYPE)
\
 ftype  \
 cnvlist_get_##type(void *cookiep)  \

Modified: head/sys/sys/cnv.h
==
--- head/sys/sys/cnv.h  Thu Oct 26 19:45:15 2017(r325018)
+++ head/sys/sys/cnv.h  Thu Oct 26 20:44:42 2017(r325019)
@@ -48,6 +48,12 @@ typedef struct nvlist nvlist_t;
 __BEGIN_DECLS
 
 /*
+ * Functions which returns information about the given cookie.
+ */
+const char *cnvlist_name(void *cookiep);
+int cnvlist_type(void *cookiep);
+
+/*
  * The cnvlist_get functions returns value associated with the given cookie.
  * If it returns a pointer, the pointer represents internal buffer and should
  * not be freed by the caller.
___
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: r325009 - head/sys/geom/mountver

2017-10-26 Thread Gleb Smirnoff
  Hi Edward,

On Thu, Oct 26, 2017 at 10:18:31AM +, Edward Tomasz Napierala wrote:
E> Log:
E>   Make gmountver(8) use direct dispatch.
E>   
E>   MFC after: 2 weeks
E> 
E> Modified:
E>   head/sys/geom/mountver/g_mountver.c
E> 
E> Modified: head/sys/geom/mountver/g_mountver.c
E> 
==
E> --- head/sys/geom/mountver/g_mountver.c  Thu Oct 26 10:11:35 2017
(r325008)
E> +++ head/sys/geom/mountver/g_mountver.c  Thu Oct 26 10:18:31 2017
(r325009)
E> @@ -257,7 +257,7 @@ g_mountver_create(struct gctl_req *req, struct g_class
E>  }
E>  gp = g_new_geomf(mp, "%s", name);
E>  sc = g_malloc(sizeof(*sc), M_WAITOK | M_ZERO);
E> -mtx_init(>sc_mtx, "gmountver", NULL, MTX_DEF);
E> +mtx_init(>sc_mtx, "gmountver", NULL, MTX_RECURSE);

MTX_RECURSE is a flag not a type, should be:

mtx_init(>sc_mtx, "gmountver", NULL, MTX_DEF | MTX_RECURSE);

-- 
Gleb Smirnoff
___
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: r325018 - head/sys/kern

2017-10-26 Thread Alan Somers
Author: asomers
Date: Thu Oct 26 19:45:15 2017
New Revision: 325018
URL: https://svnweb.freebsd.org/changeset/base/325018

Log:
  Fix aio_suspend in 32-bit emulation
  
  An off-by-one error has been present since the system call was first present
  in 185878.  It additionally became a memory corruption bug after change
  324941.  The failure is actually revealed by our existing AIO tests.
  However, apparently nobody's been running those in 32-bit emulation mode.
  
  Reported by:  Coverity, cem
  CID:  1382114
  MFC after:18 days
  X-MFC-With:   324941
  Sponsored by: Spectra Logic Corp

Modified:
  head/sys/kern/vfs_aio.c

Modified: head/sys/kern/vfs_aio.c
==
--- head/sys/kern/vfs_aio.c Thu Oct 26 18:32:04 2017(r325017)
+++ head/sys/kern/vfs_aio.c Thu Oct 26 19:45:15 2017(r325018)
@@ -2814,7 +2814,7 @@ freebsd32_aio_suspend(struct thread *td, struct freebs
error = copyin(uap->aiocbp, ujoblist32, uap->nent *
sizeof(ujoblist32[0]));
if (error == 0) {
-   for (i = uap->nent; i > 0; i--)
+   for (i = uap->nent - 1; i >= 0; i--)
ujoblist[i] = PTRIN(ujoblist32[i]);
 
error = kern_aio_suspend(td, uap->nent, ujoblist, tsp);
___
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: r325017 - head/sys/contrib/libnv

2017-10-26 Thread Jilles Tjoelker
Author: jilles
Date: Thu Oct 26 18:32:04 2017
New Revision: 325017
URL: https://svnweb.freebsd.org/changeset/base/325017

Log:
  libnv: Fix strict-aliasing violation with cookie
  
  In rS323851, some casts were adjusted in calls to nvlist_next() and
  nvlist_get_pararr() in order to make scan-build happy. I think these changes
  just confused scan-build into not reporting the strict-aliasing violation.
  
  For example, nvlist_xdescriptors() is causing nvlist_next() to write to its
  local variable nvp of type nvpair_t * using the lvalue *cookiep of type
  void *, which is not allowed. Given the APIs of nvlist_next(),
  nvlist_get_parent() and nvlist_get_pararr(), one possible fix is to create a
  local void *cookie in nvlist_xdescriptors() and other places, and to convert
  the value to nvpair_t * when necessary. This patch implements that fix.
  
  Reviewed by:  oshogbo
  MFC after:1 week
  Differential Revision:https://reviews.freebsd.org/D12760

Modified:
  head/sys/contrib/libnv/nvlist.c

Modified: head/sys/contrib/libnv/nvlist.c
==
--- head/sys/contrib/libnv/nvlist.c Thu Oct 26 17:56:34 2017
(r325016)
+++ head/sys/contrib/libnv/nvlist.c Thu Oct 26 18:32:04 2017
(r325017)
@@ -707,15 +707,17 @@ out:
 static int *
 nvlist_xdescriptors(const nvlist_t *nvl, int *descs)
 {
+   void *cookie;
nvpair_t *nvp;
int type;
 
NVLIST_ASSERT(nvl);
PJDLOG_ASSERT(nvl->nvl_error == 0);
 
-   nvp = NULL;
+   cookie = NULL;
do {
-   while (nvlist_next(nvl, , (void *)) != NULL) {
+   while (nvlist_next(nvl, , ) != NULL) {
+   nvp = cookie;
switch (type) {
case NV_TYPE_DESCRIPTOR:
*descs = nvpair_get_descriptor(nvp);
@@ -737,7 +739,7 @@ nvlist_xdescriptors(const nvlist_t *nvl, int *descs)
}
case NV_TYPE_NVLIST:
nvl = nvpair_get_nvlist(nvp);
-   nvp = NULL;
+   cookie = NULL;
break;
case NV_TYPE_NVLIST_ARRAY:
{
@@ -749,12 +751,12 @@ nvlist_xdescriptors(const nvlist_t *nvl, int *descs)
PJDLOG_ASSERT(nitems > 0);
 
nvl = value[0];
-   nvp = NULL;
+   cookie = NULL;
break;
}
}
}
-   } while ((nvl = nvlist_get_pararr(nvl, (void *))) != NULL);
+   } while ((nvl = nvlist_get_pararr(nvl, )) != NULL);
 
return (descs);
 }
@@ -784,6 +786,7 @@ size_t
 nvlist_ndescriptors(const nvlist_t *nvl)
 {
 #ifndef _KERNEL
+   void *cookie;
nvpair_t *nvp;
size_t ndescs;
int type;
@@ -792,16 +795,17 @@ nvlist_ndescriptors(const nvlist_t *nvl)
PJDLOG_ASSERT(nvl->nvl_error == 0);
 
ndescs = 0;
-   nvp = NULL;
+   cookie = NULL;
do {
-   while (nvlist_next(nvl, , (void *)) != NULL) {
+   while (nvlist_next(nvl, , ) != NULL) {
+   nvp = cookie;
switch (type) {
case NV_TYPE_DESCRIPTOR:
ndescs++;
break;
case NV_TYPE_NVLIST:
nvl = nvpair_get_nvlist(nvp);
-   nvp = NULL;
+   cookie = NULL;
break;
case NV_TYPE_NVLIST_ARRAY:
{
@@ -813,7 +817,7 @@ nvlist_ndescriptors(const nvlist_t *nvl)
PJDLOG_ASSERT(nitems > 0);
 
nvl = value[0];
-   nvp = NULL;
+   cookie = NULL;
break;
}
case NV_TYPE_DESCRIPTOR_ARRAY:
@@ -827,7 +831,7 @@ nvlist_ndescriptors(const nvlist_t *nvl)
}
}
}
-   } while ((nvl = nvlist_get_pararr(nvl, (void *))) != NULL);
+   } while ((nvl = nvlist_get_pararr(nvl, )) != NULL);
 
return (ndescs);
 #else
___
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: r325016 - head/lib/libdevdctl

2017-10-26 Thread Alan Somers
Author: asomers
Date: Thu Oct 26 17:56:34 2017
New Revision: 325016
URL: https://svnweb.freebsd.org/changeset/base/325016

Log:
  Partially revert r325011: restore Guid's default constructor
  
  Reported by:  ohartmann
  MFC after:3 weeks
  X-MFC-With:   325011
  Sponsored by: Spectra Logic Corp

Modified:
  head/lib/libdevdctl/guid.h

Modified: head/lib/libdevdctl/guid.h
==
--- head/lib/libdevdctl/guid.h  Thu Oct 26 17:45:01 2017(r325015)
+++ head/lib/libdevdctl/guid.h  Thu Oct 26 17:56:34 2017(r325016)
@@ -62,7 +62,11 @@ class Guid
 {
 public:
/* Constructors */
+   /* Default constructor: an Invalid guid */
+   Guid();
+   /* Construct a guid from a provided integer */
Guid(uint64_t guid);
+   /* Construct a guid from a string in base 8, 10, or 16 */
Guid(const std::string );
static Guid InvalidGuid();
 
@@ -88,6 +92,12 @@ class Guid
 };
 
 //- Guid Inline Public Methods 
+inline
+Guid::Guid()
+  : m_GUID(INVALID_GUID)
+{
+}
+
 inline
 Guid::Guid(uint64_t guid)
   : m_GUID(guid)
___
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: r325011 - in head: cddl/usr.sbin/zfsd lib/libdevdctl

2017-10-26 Thread O. Hartmann
Am Thu, 26 Oct 2017 15:28:18 + (UTC)
Alan Somers  schrieb:

> Author: asomers
> Date: Thu Oct 26 15:28:18 2017
> New Revision: 325011
> URL: https://svnweb.freebsd.org/changeset/base/325011
> 
> Log:
>   zfsd should be able to online an L2ARC that disappears and returns
>   
>   Previously, this didn't work because L2ARC devices' labels don't contain
>   pool GUIDs.  Modify zfsd so that the pool GUID won't be required:
>   
>   lib/libdevdctl/guid.h
>   Change INVALID_GUID from a uint64_t constant to a function that
>   returns an invalid Guid object.  Remove the void constructor.
>   Nothing uses it, and it violates RAII.
>   
>   cddl/usr.sbin/zfsd/case_file.h
>   cddl/usr.sbin/zfsd/case_file.cc
>   Allow CaseFile::Find to match a CaseFile based on Vdev GUID alone.
>   In CaseFile::ReEvaluate, attempt to online devices even if the newly
>   arrived device has no pool GUID.
>   
>   cddl/usr.sbin/zfsd/vdev_iterator.cc
>   Iterate through a pool's cache devices as well as its regular
>   devices.
>   
>   Reported by:avg
>   Reviewed by:avg
>   MFC after:  3 weeks
>   Sponsored by:   Spectra Logic Corp
>   Differential Revision:  https://reviews.freebsd.org/D12791
> 
> Modified:
>   head/cddl/usr.sbin/zfsd/case_file.cc
>   head/cddl/usr.sbin/zfsd/case_file.h
>   head/cddl/usr.sbin/zfsd/vdev_iterator.cc
>   head/lib/libdevdctl/guid.h
> 
> Modified: head/cddl/usr.sbin/zfsd/case_file.cc
> ==
> --- head/cddl/usr.sbin/zfsd/case_file.cc  Thu Oct 26 13:23:13 2017
> (r325010) +++ head/cddl/usr.sbin/zfsd/case_file.ccThu Oct 26 15:28:18
> 2017  (r325011) @@ -102,7 +102,8 @@ CaseFile::Find(Guid poolGUID, Guid 
> vdevGUID)
>   for (CaseFileList::iterator curCase = s_activeCases.begin();
>curCase != s_activeCases.end(); curCase++) {
>  
> - if ((*curCase)->PoolGUID() != poolGUID
> + if (((*curCase)->PoolGUID() != poolGUID
> +   && Guid::InvalidGuid() != poolGUID)
>|| (*curCase)->VdevGUID() != vdevGUID)
>   continue;
>  
> @@ -268,7 +269,8 @@ CaseFile::ReEvaluate(const string , const stri
>   }
>  
>   if (vdev != NULL
> -  && vdev->PoolGUID() == m_poolGUID
> +  && ( vdev->PoolGUID() == m_poolGUID
> +|| vdev->PoolGUID() == Guid::InvalidGuid())
>&& vdev->GUID() == m_vdevGUID) {
>  
>   zpool_vdev_online(pool, vdev->GUIDString().c_str(),
> 
> Modified: head/cddl/usr.sbin/zfsd/case_file.h
> ==
> --- head/cddl/usr.sbin/zfsd/case_file.h   Thu Oct 26 13:23:13 2017
> (r325010)
> +++ head/cddl/usr.sbin/zfsd/case_file.h   Thu Oct 26 15:28:18 2017
> (r325011)
> @@ -89,6 +89,8 @@ class CaseFile (public)
>* \brief Find a CaseFile object by a vdev's pool/vdev GUID tuple.
>*
>* \param poolGUID  Pool GUID for the vdev of the CaseFile to find.
> +  *  If InvalidGuid, then only match the vdev GUID
> +  *  instead of both pool and vdev GUIDs.
>* \param vdevGUID  Vdev GUID for the vdev of the CaseFile to find.
>*
>* \return  If found, a pointer to a valid CaseFile object.
> 
> Modified: head/cddl/usr.sbin/zfsd/vdev_iterator.cc
> ==
> --- head/cddl/usr.sbin/zfsd/vdev_iterator.cc  Thu Oct 26 13:23:13 2017
> (r325010) +++ head/cddl/usr.sbin/zfsd/vdev_iterator.ccThu Oct 26 
> 15:28:18
> 2017  (r325011) @@ -76,7 +76,9 @@ void
>  VdevIterator::Reset()
>  {
>   nvlist_t  *rootVdev;
> + nvlist**cache_child;
>   intresult;
> + uint_t   cache_children;
>  
>   result = nvlist_lookup_nvlist(m_poolConfig,
> ZPOOL_CONFIG_VDEV_TREE,
> @@ -85,6 +87,13 @@ VdevIterator::Reset()
>   throw ZfsdException(m_poolConfig, "Unable to extract "
>   "ZPOOL_CONFIG_VDEV_TREE from pool.");
>   m_vdevQueue.assign(1, rootVdev);
> + result = nvlist_lookup_nvlist_array(rootVdev,
> + ZPOOL_CONFIG_L2CACHE,
> + _child,
> + _children);
> + if (result == 0)
> + for (uint_t c = 0; c < cache_children; c++)
> + m_vdevQueue.push_back(cache_child[c]);
>  }
>  
>  nvlist_t *
> 
> Modified: head/lib/libdevdctl/guid.h
> ==
> --- head/lib/libdevdctl/guid.hThu Oct 26 13:23:13 2017
> (r325010)
> +++ head/lib/libdevdctl/guid.hThu Oct 26 15:28:18 2017
> (r325011)
> @@ -62,9 +62,9 @@ class Guid
>  {
>  public:
>   /* Constructors */
> - Guid();
>  

svn commit: r325014 - head/sys/arm/include

2017-10-26 Thread Warner Losh
Author: imp
Date: Thu Oct 26 16:36:27 2017
New Revision: 325014
URL: https://svnweb.freebsd.org/changeset/base/325014

Log:
  Add a 'place holder' arm struct efi_fb until a real one comes
  along. This allows the arm efi boot loader to compile again.
  
  Sponsored by: Netflix

Modified:
  head/sys/arm/include/metadata.h

Modified: head/sys/arm/include/metadata.h
==
--- head/sys/arm/include/metadata.h Thu Oct 26 16:20:47 2017
(r325013)
+++ head/sys/arm/include/metadata.h Thu Oct 26 16:36:27 2017
(r325014)
@@ -39,4 +39,19 @@ struct efi_map_header {
uint32_tdescriptor_version;
 };
 
+/*
+ * Placeholder for now
+ */
+struct efi_fb {
+   uint64_tfb_addr;
+   uint64_tfb_size;
+   uint32_tfb_height;
+   uint32_tfb_width;
+   uint32_tfb_stride;
+   uint32_tfb_mask_red;
+   uint32_tfb_mask_green;
+   uint32_tfb_mask_blue;
+   uint32_tfb_mask_reserved;
+};
+
 #endif /* !_MACHINE_METADATA_H_ */
___
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: r325012 - in head/sys/boot/arm: at91 ixp425

2017-10-26 Thread Warner Losh
Author: imp
Date: Thu Oct 26 16:02:38 2017
New Revision: 325012
URL: https://svnweb.freebsd.org/changeset/base/325012

Log:
  Remove now-empty directories

Deleted:
  head/sys/boot/arm/at91/
  head/sys/boot/arm/ixp425/
___
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: r325011 - in head: cddl/usr.sbin/zfsd lib/libdevdctl

2017-10-26 Thread Alan Somers
Author: asomers
Date: Thu Oct 26 15:28:18 2017
New Revision: 325011
URL: https://svnweb.freebsd.org/changeset/base/325011

Log:
  zfsd should be able to online an L2ARC that disappears and returns
  
  Previously, this didn't work because L2ARC devices' labels don't contain
  pool GUIDs.  Modify zfsd so that the pool GUID won't be required:
  
  lib/libdevdctl/guid.h
Change INVALID_GUID from a uint64_t constant to a function that
returns an invalid Guid object.  Remove the void constructor.
Nothing uses it, and it violates RAII.
  
  cddl/usr.sbin/zfsd/case_file.h
  cddl/usr.sbin/zfsd/case_file.cc
Allow CaseFile::Find to match a CaseFile based on Vdev GUID alone.
In CaseFile::ReEvaluate, attempt to online devices even if the newly
arrived device has no pool GUID.
  
  cddl/usr.sbin/zfsd/vdev_iterator.cc
Iterate through a pool's cache devices as well as its regular
devices.
  
  Reported by:  avg
  Reviewed by:  avg
  MFC after:3 weeks
  Sponsored by: Spectra Logic Corp
  Differential Revision:https://reviews.freebsd.org/D12791

Modified:
  head/cddl/usr.sbin/zfsd/case_file.cc
  head/cddl/usr.sbin/zfsd/case_file.h
  head/cddl/usr.sbin/zfsd/vdev_iterator.cc
  head/lib/libdevdctl/guid.h

Modified: head/cddl/usr.sbin/zfsd/case_file.cc
==
--- head/cddl/usr.sbin/zfsd/case_file.ccThu Oct 26 13:23:13 2017
(r325010)
+++ head/cddl/usr.sbin/zfsd/case_file.ccThu Oct 26 15:28:18 2017
(r325011)
@@ -102,7 +102,8 @@ CaseFile::Find(Guid poolGUID, Guid vdevGUID)
for (CaseFileList::iterator curCase = s_activeCases.begin();
 curCase != s_activeCases.end(); curCase++) {
 
-   if ((*curCase)->PoolGUID() != poolGUID
+   if (((*curCase)->PoolGUID() != poolGUID
+ && Guid::InvalidGuid() != poolGUID)
 || (*curCase)->VdevGUID() != vdevGUID)
continue;
 
@@ -268,7 +269,8 @@ CaseFile::ReEvaluate(const string , const stri
}
 
if (vdev != NULL
-&& vdev->PoolGUID() == m_poolGUID
+&& ( vdev->PoolGUID() == m_poolGUID
+  || vdev->PoolGUID() == Guid::InvalidGuid())
 && vdev->GUID() == m_vdevGUID) {
 
zpool_vdev_online(pool, vdev->GUIDString().c_str(),

Modified: head/cddl/usr.sbin/zfsd/case_file.h
==
--- head/cddl/usr.sbin/zfsd/case_file.h Thu Oct 26 13:23:13 2017
(r325010)
+++ head/cddl/usr.sbin/zfsd/case_file.h Thu Oct 26 15:28:18 2017
(r325011)
@@ -89,6 +89,8 @@ class CaseFile (public)
 * \brief Find a CaseFile object by a vdev's pool/vdev GUID tuple.
 *
 * \param poolGUID  Pool GUID for the vdev of the CaseFile to find.
+*  If InvalidGuid, then only match the vdev GUID
+*  instead of both pool and vdev GUIDs.
 * \param vdevGUID  Vdev GUID for the vdev of the CaseFile to find.
 *
 * \return  If found, a pointer to a valid CaseFile object.

Modified: head/cddl/usr.sbin/zfsd/vdev_iterator.cc
==
--- head/cddl/usr.sbin/zfsd/vdev_iterator.ccThu Oct 26 13:23:13 2017
(r325010)
+++ head/cddl/usr.sbin/zfsd/vdev_iterator.ccThu Oct 26 15:28:18 2017
(r325011)
@@ -76,7 +76,9 @@ void
 VdevIterator::Reset()
 {
nvlist_t  *rootVdev;
+   nvlist**cache_child;
intresult;
+   uint_t   cache_children;
 
result = nvlist_lookup_nvlist(m_poolConfig,
  ZPOOL_CONFIG_VDEV_TREE,
@@ -85,6 +87,13 @@ VdevIterator::Reset()
throw ZfsdException(m_poolConfig, "Unable to extract "
"ZPOOL_CONFIG_VDEV_TREE from pool.");
m_vdevQueue.assign(1, rootVdev);
+   result = nvlist_lookup_nvlist_array(rootVdev,
+   ZPOOL_CONFIG_L2CACHE,
+   _child,
+   _children);
+   if (result == 0)
+   for (uint_t c = 0; c < cache_children; c++)
+   m_vdevQueue.push_back(cache_child[c]);
 }
 
 nvlist_t *

Modified: head/lib/libdevdctl/guid.h
==
--- head/lib/libdevdctl/guid.h  Thu Oct 26 13:23:13 2017(r325010)
+++ head/lib/libdevdctl/guid.h  Thu Oct 26 15:28:18 2017(r325011)
@@ -62,9 +62,9 @@ class Guid
 {
 public:
/* Constructors */
-   Guid();
Guid(uint64_t guid);
Guid(const std::string );
+   static Guid InvalidGuid();
 
/* Assignment */
Guid& operator=(const Guid& rhs);
@@ -80,23 +80,24 @@ class Guid
operator uint64_t()  

svn commit: r325010 - head/lib/libpam/modules/pam_unix

2017-10-26 Thread Dag-Erling Smørgrav
Author: des
Date: Thu Oct 26 13:23:13 2017
New Revision: 325010
URL: https://svnweb.freebsd.org/changeset/base/325010

Log:
  If the user-provided password exceeds the maximum password length, don't
  bother passing it to crypt().  It won't succeed and may allow an attacker
  to confirm that the user exists.
  
  Reported by:  jkim@
  MFC after:1 week
  Security: CVE-2016-6210

Modified:
  head/lib/libpam/modules/pam_unix/pam_unix.c

Modified: head/lib/libpam/modules/pam_unix/pam_unix.c
==
--- head/lib/libpam/modules/pam_unix/pam_unix.c Thu Oct 26 10:18:31 2017
(r325009)
+++ head/lib/libpam/modules/pam_unix/pam_unix.c Thu Oct 26 13:23:13 2017
(r325010)
@@ -111,6 +111,7 @@ pam_sm_authenticate(pam_handle_t *pamh, int flags __un
if (!(flags & PAM_DISALLOW_NULL_AUTHTOK) &&
openpam_get_option(pamh, PAM_OPT_NULLOK))
return (PAM_SUCCESS);
+   PAM_LOG("Password is empty, using fake password");
realpw = "*";
}
lc = login_getpwclass(pwd);
@@ -125,6 +126,10 @@ pam_sm_authenticate(pam_handle_t *pamh, int flags __un
if (retval != PAM_SUCCESS)
return (retval);
PAM_LOG("Got password");
+   if (strnlen(pass, _PASSWORD_LEN + 1) > _PASSWORD_LEN) {
+   PAM_LOG("Password is too long, using fake password");
+   realpw = "*";
+   }
if (strcmp(crypt(pass, realpw), realpw) == 0)
return (PAM_SUCCESS);
 
___
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: r325009 - head/sys/geom/mountver

2017-10-26 Thread Edward Tomasz Napierala
Author: trasz
Date: Thu Oct 26 10:18:31 2017
New Revision: 325009
URL: https://svnweb.freebsd.org/changeset/base/325009

Log:
  Make gmountver(8) use direct dispatch.
  
  MFC after:2 weeks

Modified:
  head/sys/geom/mountver/g_mountver.c

Modified: head/sys/geom/mountver/g_mountver.c
==
--- head/sys/geom/mountver/g_mountver.c Thu Oct 26 10:11:35 2017
(r325008)
+++ head/sys/geom/mountver/g_mountver.c Thu Oct 26 10:18:31 2017
(r325009)
@@ -257,7 +257,7 @@ g_mountver_create(struct gctl_req *req, struct g_class
}
gp = g_new_geomf(mp, "%s", name);
sc = g_malloc(sizeof(*sc), M_WAITOK | M_ZERO);
-   mtx_init(>sc_mtx, "gmountver", NULL, MTX_DEF);
+   mtx_init(>sc_mtx, "gmountver", NULL, MTX_RECURSE);
TAILQ_INIT(>sc_queue);
sc->sc_provider_name = strdup(pp->name, M_GEOM);
gp->softc = sc;
@@ -270,6 +270,7 @@ g_mountver_create(struct gctl_req *req, struct g_class
newpp = g_new_providerf(gp, "%s", gp->name);
newpp->mediasize = pp->mediasize;
newpp->sectorsize = pp->sectorsize;
+   newpp->flags |= G_PF_DIRECT_SEND | G_PF_DIRECT_RECEIVE;
 
if ((pp->flags & G_PF_ACCEPT_UNMAPPED) != 0) {
G_MOUNTVER_DEBUG(0, "Unmapped supported for %s.", gp->name);
@@ -280,6 +281,7 @@ g_mountver_create(struct gctl_req *req, struct g_class
}
 
cp = g_new_consumer(gp);
+   cp->flags |= G_CF_DIRECT_SEND | G_CF_DIRECT_RECEIVE;
error = g_attach(cp, pp);
if (error != 0) {
gctl_error(req, "Cannot attach to provider %s.", pp->name);
___
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: r325008 - head/sys/netpfil/ipfw

2017-10-26 Thread Don Lewis
Author: truckman
Date: Thu Oct 26 10:11:35 2017
New Revision: 325008
URL: https://svnweb.freebsd.org/changeset/base/325008

Log:
  Fix Dummynet AQM packet marking function ecn_mark() and fq_codel /
  fq_pie schedulers packet classification functions in layer2 (bridge mode).
  
  Dummynet AQM packet marking function ecn_mark() and fq_codel/fq_pie
  schedulers packet classification functions (fq_codel_classify_flow()
  and fq_pie_classify_flow()) assume mbuf is pointing at L3 (IP)
  packet. However, this assumption is incorrect if ipfw/dummynet is
  used to manage layer2 traffic (bridge mode) since mbuf will point
  at L2 frame.  This patch solves this problem by identifying the
  source of the frame/packet (L2 or L3) and adding ETHER_HDR_LEN
  offset when converting an mbuf pointer to ip pointer if the traffic
  is from layer2.  More specifically, in dummynet packet tagging
  function, tag_mbuf(), iphdr_off is set to ETHER_HDR_LEN if the
  traffic is from layer2 and set to zero otherwise. Whenever an access
  to IP header is required, mtodo(m, dn_tag_get(m)->iphdr_off) is
  used instead of mtod(m, struct ip *) to correctly convert mbuf
  pointer to ip pointer in both L2 and L3 traffic.
  
  Submitted by: lstewart
  MFC after:2 weeks
  Relnotes: yes
  Differential Revision:https://reviews.freebsd.org/D12506

Modified:
  head/sys/netpfil/ipfw/dn_sched_fifo.c
  head/sys/netpfil/ipfw/dn_sched_fq_codel.c
  head/sys/netpfil/ipfw/dn_sched_fq_pie.c
  head/sys/netpfil/ipfw/dn_sched_prio.c
  head/sys/netpfil/ipfw/dn_sched_qfq.c
  head/sys/netpfil/ipfw/dn_sched_rr.c
  head/sys/netpfil/ipfw/dn_sched_wf2q.c
  head/sys/netpfil/ipfw/ip_dn_io.c
  head/sys/netpfil/ipfw/ip_dn_private.h

Modified: head/sys/netpfil/ipfw/dn_sched_fifo.c
==
--- head/sys/netpfil/ipfw/dn_sched_fifo.c   Thu Oct 26 09:29:35 2017
(r325007)
+++ head/sys/netpfil/ipfw/dn_sched_fifo.c   Thu Oct 26 10:11:35 2017
(r325008)
@@ -33,13 +33,16 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
+#include 
 #include /* IFNAMSIZ */
 #include 
 #include /* ipfw_rule_ref */
 #include  /* flow_id */
 #include 
+#include 
 #include 
 #include 
 #ifdef NEW_AQM

Modified: head/sys/netpfil/ipfw/dn_sched_fq_codel.c
==
--- head/sys/netpfil/ipfw/dn_sched_fq_codel.c   Thu Oct 26 09:29:35 2017
(r325007)
+++ head/sys/netpfil/ipfw/dn_sched_fq_codel.c   Thu Oct 26 10:11:35 2017
(r325008)
@@ -218,13 +218,14 @@ fq_codel_classify_flow(struct mbuf *m, uint16_t fcount
uint8_t tuple[41];
uint16_t hash=0;
 
+   ip = (struct ip *)mtodo(m, dn_tag_get(m)->iphdr_off);
 //#ifdef INET6
struct ip6_hdr *ip6;
int isip6;
-   isip6 = (mtod(m, struct ip *)->ip_v == 6) ? 1 : 0;
+   isip6 = (ip->ip_v == 6);
 
if(isip6) {
-   ip6 = mtod(m, struct ip6_hdr *);
+   ip6 = (struct ip6_hdr *)ip;
*((uint8_t *) [0]) = ip6->ip6_nxt;
*((uint32_t *) [1]) = si->perturbation;
memcpy([5], ip6->ip6_src.s6_addr, 16);
@@ -253,7 +254,6 @@ fq_codel_classify_flow(struct mbuf *m, uint16_t fcount
 //#endif
 
/* IPv4 */
-   ip = mtod(m, struct ip *);
*((uint8_t *) [0]) = ip->ip_p;
*((uint32_t *) [1]) = si->perturbation;
*((uint32_t *) [5]) = ip->ip_src.s_addr;

Modified: head/sys/netpfil/ipfw/dn_sched_fq_pie.c
==
--- head/sys/netpfil/ipfw/dn_sched_fq_pie.c Thu Oct 26 09:29:35 2017
(r325007)
+++ head/sys/netpfil/ipfw/dn_sched_fq_pie.c Thu Oct 26 10:11:35 2017
(r325008)
@@ -792,13 +792,14 @@ fq_pie_classify_flow(struct mbuf *m, uint16_t fcount, 
uint8_t tuple[41];
uint16_t hash=0;
 
+   ip = (struct ip *)mtodo(m, dn_tag_get(m)->iphdr_off);
 //#ifdef INET6
struct ip6_hdr *ip6;
int isip6;
-   isip6 = (mtod(m, struct ip *)->ip_v == 6) ? 1 : 0;
+   isip6 = (ip->ip_v == 6);
 
if(isip6) {
-   ip6 = mtod(m, struct ip6_hdr *);
+   ip6 = (struct ip6_hdr *)ip;
*((uint8_t *) [0]) = ip6->ip6_nxt;
*((uint32_t *) [1]) = si->perturbation;
memcpy([5], ip6->ip6_src.s6_addr, 16);
@@ -826,7 +827,6 @@ fq_pie_classify_flow(struct mbuf *m, uint16_t fcount, 
 //#endif
 
/* IPv4 */
-   ip = mtod(m, struct ip *);
*((uint8_t *) [0]) = ip->ip_p;
*((uint32_t *) [1]) = si->perturbation;
*((uint32_t *) [5]) = ip->ip_src.s_addr;

Modified: head/sys/netpfil/ipfw/dn_sched_prio.c
==
--- head/sys/netpfil/ipfw/dn_sched_prio.c   Thu Oct 26 09:29:35 2017
(r325007)
+++ head/sys/netpfil/ipfw/dn_sched_prio.c   Thu Oct 

svn commit: r325007 - head/sys/geom/mountver

2017-10-26 Thread Edward Tomasz Napierala
Author: trasz
Date: Thu Oct 26 09:29:35 2017
New Revision: 325007
URL: https://svnweb.freebsd.org/changeset/base/325007

Log:
  Make gmountver(8) use G_PF_ACCEPT_UNMAPPED.
  
  MFC after:2 weeks

Modified:
  head/sys/geom/mountver/g_mountver.c

Modified: head/sys/geom/mountver/g_mountver.c
==
--- head/sys/geom/mountver/g_mountver.c Thu Oct 26 03:38:40 2017
(r325006)
+++ head/sys/geom/mountver/g_mountver.c Thu Oct 26 09:29:35 2017
(r325007)
@@ -271,6 +271,14 @@ g_mountver_create(struct gctl_req *req, struct g_class
newpp->mediasize = pp->mediasize;
newpp->sectorsize = pp->sectorsize;
 
+   if ((pp->flags & G_PF_ACCEPT_UNMAPPED) != 0) {
+   G_MOUNTVER_DEBUG(0, "Unmapped supported for %s.", gp->name);
+   newpp->flags |= G_PF_ACCEPT_UNMAPPED;
+   } else {
+   G_MOUNTVER_DEBUG(0, "Unmapped unsupported for %s.", gp->name);
+   newpp->flags &= ~G_PF_ACCEPT_UNMAPPED;
+   }
+
cp = g_new_consumer(gp);
error = g_attach(cp, pp);
if (error != 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"