dragonfly.git
10 years agoCreate and install an initial ramdisk image
François Tigeot [Fri, 11 Apr 2014 19:33:30 +0000 (21:33 +0200)]
Create and install an initial ramdisk image

* This initrd can be used to mount encrypted filesystems or as a
  minimal rescue system

* Existing initrd.img files will be removed by make upgrade; the
  new ramdisk images are compressed and named initrd.img.gz

10 years agokernel/acpi: Add back another needed include. That should be all.
Sascha Wildner [Fri, 11 Apr 2014 10:06:41 +0000 (12:06 +0200)]
kernel/acpi: Add back another needed include. That should be all.

10 years agokernel/acpi: Add back two includes which are needed.
Sascha Wildner [Fri, 11 Apr 2014 07:55:39 +0000 (09:55 +0200)]
kernel/acpi: Add back two includes which are needed.

10 years agokernel/acpi: Move strstr() to libkern.
Sascha Wildner [Thu, 10 Apr 2014 21:39:21 +0000 (23:39 +0200)]
kernel/acpi: Move strstr() to libkern.

While here, clean up unneeded includes from acdragonfly.h too.

10 years agoAdd some manual pages for the ACPICA utilities provided by Intel.
Sascha Wildner [Thu, 10 Apr 2014 19:07:10 +0000 (21:07 +0200)]
Add some manual pages for the ACPICA utilities provided by Intel.

For now, just list the options and their descriptions (taken from the
usages).

10 years agoRemove the acpisrc utility which is for ACPICA distribution maintenance.
Sascha Wildner [Thu, 10 Apr 2014 18:23:08 +0000 (20:23 +0200)]
Remove the acpisrc utility which is for ACPICA distribution maintenance.

This is not necessary in base. In the unlikely case that anyone ever
needed it, we can bring it back.

10 years agonetinet/ip - Avoid a NULL pointer dereference.
Antonio Huete Jimenez [Thu, 10 Apr 2014 13:17:04 +0000 (15:17 +0200)]
netinet/ip - Avoid a NULL pointer dereference.

- Before checking for packets on broadcast addresses, see if there
  is actually a ifnet associated with the mbuf being handled.

FreeBSD-SVN: 130685
DragonFly-bug: <http://bugs.dragonflybsd.org/issues/2660>
Reported-and-Found-by: Vasily Postnicov
This commit closes #2660

10 years agodevd.conf: Comment some entries where we lack support in one way or the other.
Sascha Wildner [Thu, 10 Apr 2014 08:18:13 +0000 (10:18 +0200)]
devd.conf: Comment some entries where we lack support in one way or the other.

We'll gradually uncomment them again once they are known to work.

10 years agokernel/bwn: Replace callout_drain calls. Replace a tsleep by DELAY.
Imre Vadasz [Wed, 9 Apr 2014 22:48:16 +0000 (00:48 +0200)]
kernel/bwn: Replace callout_drain calls. Replace a tsleep by DELAY.

* Adjusting local #include statements to conform to style(9).

* callout_drain calls are replaced by callout_stop_sync.

* Reverting a DELAY -> tsleep replacement.

10 years agomkinitrd(8): gzip newly produced images
François Tigeot [Thu, 10 Apr 2014 06:15:09 +0000 (08:15 +0200)]
mkinitrd(8): gzip newly produced images

The space savings can be considerable with the current 15MB ramdisk images
beeing reduced to 3.9MB once compressed.

10 years agoloader - unset correct kenv for 'r'ecovery ramdisk mode
Matthew Dillon [Thu, 10 Apr 2014 01:26:04 +0000 (18:26 -0700)]
loader - unset correct kenv for 'r'ecovery ramdisk mode

* We have to unset vfs.root.real_root instead of lunset vfs.real_root.

* This will properly drop the loader into the recovery ramdisk without
  trying to do any crypt setup or access the root disk in any way (other
  than what it needs to get /boot stuff).

10 years agomount - Generate correct argv[0] for crunches
Matthew Dillon [Thu, 10 Apr 2014 01:12:43 +0000 (18:12 -0700)]
mount - Generate correct argv[0] for crunches

* The crunchgen consolidated binary uses argv[0] to determine which program
  to actually run.  The 'mount' program was putting the vfstype in argv[0]
  instead of "mount_<vfstype>".

* This caused crunchgen to run 'hammer' instead of 'mount_hammer'.

* Fixes installer encrypted installs with hammer roots.

10 years agokernel - Add mandatory config hooks delay
Matthew Dillon [Wed, 9 Apr 2014 23:49:12 +0000 (16:49 -0700)]
kernel - Add mandatory config hooks delay

* Add a mandatory 5-second minimum delay for config hooks.

  This fixes an issue with U4B's very late port probing.  Essentially the
  other disk devices (aka AHCI) can completely finish probing and attaching
  devices before USB even knows there's a stick in a port.  The result is
  that the run_interrupt_driven_config_hooks() routine thinks that all
  disk devices have attached and does not wait at all.

  In addition, usb devices tend to probe near dead last, making the problem
  worse.  The kernel tries to mount the root device the instant after
  the usb pci probe.

* This is a hack, but to really fix it requires a great deal of surgery in
  the U4B USB stack.

10 years agodloader: Add a rescue ramdisk boot option
François Tigeot [Wed, 9 Apr 2014 21:39:31 +0000 (23:39 +0200)]
dloader: Add a rescue ramdisk boot option

10 years agoinitrd: Add password databases
François Tigeot [Wed, 9 Apr 2014 21:28:39 +0000 (23:28 +0200)]
initrd: Add password databases

10 years agoinitrd: Create a home directory, initialize $HOME
François Tigeot [Wed, 9 Apr 2014 14:48:28 +0000 (16:48 +0200)]
initrd: Create a home directory, initialize $HOME

10 years agoinitrd: Add various /etc files
François Tigeot [Wed, 9 Apr 2014 21:26:28 +0000 (23:26 +0200)]
initrd: Add various /etc files

* /etc/motd submitted by Matthew Dillon <dillon@apollo.backplane.com>

10 years agomkinitrd(8): Stop copying regular binaries to the ramdisk
François Tigeot [Wed, 9 Apr 2014 21:13:48 +0000 (23:13 +0200)]
mkinitrd(8): Stop copying regular binaries to the ramdisk

* initrd binaries are specially tailored versions and don't necessarily
  work in the same way as regular ones

* In fact, regular binaries from newer DragonFly systems are expected to
  use dynamic libraries and won't work at all in the fully static environment
  of the ramdisk

10 years agoinitrd: Add wpa_supplicant
François Tigeot [Wed, 9 Apr 2014 15:56:50 +0000 (17:56 +0200)]
initrd: Add wpa_supplicant

Submitted-by: Matthew Dillon <dillon@apollo.backplane.com>
10 years agoinitrd: Add various binaries and scripts
François Tigeot [Wed, 9 Apr 2014 15:30:44 +0000 (17:30 +0200)]
initrd: Add various binaries and scripts

* Crunch bin and sbin commands with some usr.bin and usr.sbin binaries into
  /bin and /sbin respectively, we don't want to maintain a /usr directory

* Some of the symbols cryptsetup and tcplay use conflict with others used
  by regular /sbin binaries, crunch them separately

* lvm's libraries conflict even more, build it as a separate static binary

10 years agoinitrd: Remount / read-write
François Tigeot [Wed, 9 Apr 2014 15:04:55 +0000 (17:04 +0200)]
initrd: Remount / read-write

10 years agoinitrd: Run a rescue shell if vfs.real_root is not set
François Tigeot [Wed, 9 Apr 2014 14:54:52 +0000 (16:54 +0200)]
initrd: Run a rescue shell if vfs.real_root is not set

10 years agomini_init: Don't call exit(3), catch SIGTERM
François Tigeot [Wed, 9 Apr 2014 10:54:23 +0000 (12:54 +0200)]
mini_init: Don't call exit(3), catch SIGTERM

* During a reboot sequence, all processes are routinely killed.

* Sadly, if init dies, the kernel panics.

* Try to avoid this situation by ignoring SIGTERM and not explicitely
  calling exit(3) if the child process dies and the chrooting sequence
  fails.

10 years agoRemove NOLINT from a couple of Makefiles (we don't have it).
Sascha Wildner [Wed, 9 Apr 2014 19:16:27 +0000 (21:16 +0200)]
Remove NOLINT from a couple of Makefiles (we don't have it).

10 years agobwn.4: There is no 'firmware' kernel option in DragonFly.
Sascha Wildner [Wed, 9 Apr 2014 17:08:54 +0000 (19:08 +0200)]
bwn.4: There is no 'firmware' kernel option in DragonFly.

10 years agoinitrd: Move mini_init sources to share/initrd/
François Tigeot [Wed, 9 Apr 2014 07:36:31 +0000 (09:36 +0200)]
initrd: Move mini_init sources to share/initrd/

10 years agoinitrd: Move existing files to an etc/ subdirectory
François Tigeot [Wed, 9 Apr 2014 07:32:23 +0000 (09:32 +0200)]
initrd: Move existing files to an etc/ subdirectory

10 years agomkinitrd(8): Optimize newfs for size
François Tigeot [Tue, 8 Apr 2014 20:25:15 +0000 (22:25 +0200)]
mkinitrd(8): Optimize newfs for size

10 years agocrunchgen(1): Stop adding underscores to symbols
François Tigeot [Tue, 8 Apr 2014 19:16:13 +0000 (21:16 +0200)]
crunchgen(1): Stop adding underscores to symbols

* The configuration file has provisions to manually specify a few symbols
  to keep public.

* Unfortunately this feature was rendered useless by crunchgen itself,
  which prepended an underscore character before each symbol in the call
  to crunchide(1).

10 years agobsd.crunchgen.mk: Add a mechanism to keep handpicked symbols
François Tigeot [Tue, 8 Apr 2014 19:14:48 +0000 (21:14 +0200)]
bsd.crunchgen.mk: Add a mechanism to keep handpicked symbols

10 years agobsd.crunchgen.mk: Change paths
François Tigeot [Tue, 8 Apr 2014 19:10:33 +0000 (21:10 +0200)]
bsd.crunchgen.mk: Change paths

This file is intended to be used from src/share/initrd/
and not src/rescue/ like on FreeBSD.

10 years agoRemove the RELEASE_CRUNCH build variable
François Tigeot [Tue, 8 Apr 2014 18:12:00 +0000 (20:12 +0200)]
Remove the RELEASE_CRUNCH build variable

* It was used to specially craft binaries for use with PicoBSD in the
  distant past.

* The conditional code paths it enables have not been maintained for
  more than a decade and are of dubious value.

* At this point it's best to just remove it.

10 years agocryptsetup: Fix a compilation warning
François Tigeot [Tue, 8 Apr 2014 15:27:21 +0000 (17:27 +0200)]
cryptsetup: Fix a compilation warning

Submitted-by: Matthew Dillon <dillon@apollo.backplane.com>
10 years agokernel/bwn: Remove an unnecessary call to ieee80211_start_all
Imre Vadasz [Tue, 8 Apr 2014 08:42:17 +0000 (10:42 +0200)]
kernel/bwn: Remove an unnecessary call to ieee80211_start_all

* Fixes a bug when the firmware is not found.

10 years agoin6pcb: in6_pcbsetport -> in6_pcbsetlport; no functional changes
Sepherosa Ziehau [Sat, 5 Apr 2014 13:08:13 +0000 (21:08 +0800)]
in6pcb: in6_pcbsetport -> in6_pcbsetlport; no functional changes

10 years agoinpcb: Add comment about saved inpcbport
Sepherosa Ziehau [Sat, 5 Apr 2014 12:59:06 +0000 (20:59 +0800)]
inpcb: Add comment about saved inpcbport

10 years agoinpcb: Add macros to get/release/assert port token
Sepherosa Ziehau [Sat, 5 Apr 2014 12:51:36 +0000 (20:51 +0800)]
inpcb: Add macros to get/release/assert port token

10 years agomake upgrade: Add more files for cleaner switching between USB stacks.
Sascha Wildner [Tue, 8 Apr 2014 11:19:46 +0000 (13:19 +0200)]
make upgrade: Add more files for cleaner switching between USB stacks.

10 years agolibu4bhid: Add missing MLINKS.
Sascha Wildner [Tue, 8 Apr 2014 10:14:25 +0000 (12:14 +0200)]
libu4bhid: Add missing MLINKS.

10 years agoUpdate files for OpenSSL-1.0.1g import.
Peter Avalos [Tue, 8 Apr 2014 01:26:13 +0000 (18:26 -0700)]
Update files for OpenSSL-1.0.1g import.

10 years agoMerge branch 'vendor/OPENSSL'
Peter Avalos [Tue, 8 Apr 2014 01:21:14 +0000 (18:21 -0700)]
Merge branch 'vendor/OPENSSL'

10 years agoImport OpenSSL-1.0.1g.
Peter Avalos [Tue, 8 Apr 2014 00:59:53 +0000 (17:59 -0700)]
Import OpenSSL-1.0.1g.

o Fix for CVE-2014-0160
o Add TLS padding extension workaround for broken servers.
o Fix for CVE-2014-0076
o Don't include gmt_unix_time in TLS server and client random values
o Fix for TLS record tampering bug CVE-2013-4353
o Fix for TLS version checking bug CVE-2013-6449
o Fix for DTLS retransmission bug CVE-2013-6450

10 years agonetwork/pf - Avoid a possible bad pointer access.
Antonio Huete Jimenez [Mon, 7 Apr 2014 22:26:53 +0000 (00:26 +0200)]
network/pf - Avoid a possible bad pointer access.

- Make sure new pfi_kif structures are zeroed on allocation.
- A panic was hit when pfi_instance_add() tried to access a bad ifp
  pointer (i.e. when using non-existing iface names in pf.conf)

10 years agonetwork/gif - Correctly clear route cache on destroy.
Antonio Huete Jimenez [Mon, 7 Apr 2014 07:37:56 +0000 (09:37 +0200)]
network/gif - Correctly clear route cache on destroy.

RTFREE() requires that the route is freed in the CPU it belongs to.
Migrating to the target CPU *before* calling it and returning to the
original CPU afterwards seems to do the trick.

Ok: @sephe

10 years agohammer - Fix missing reltoken
Matthew Dillon [Sun, 6 Apr 2014 22:59:08 +0000 (15:59 -0700)]
hammer - Fix missing reltoken

* Fix a missing token release on hmp->fs_token.

Reported-by: joris
10 years agobwn.4: Comment out another bwi(4) reference.
Sascha Wildner [Sun, 6 Apr 2014 12:52:27 +0000 (14:52 +0200)]
bwn.4: Comment out another bwi(4) reference.

10 years agokernel/drm: Add a missing include
Markus Pfeiffer [Sun, 6 Apr 2014 10:09:49 +0000 (11:09 +0100)]
kernel/drm: Add a missing include

Include sys/devfs.h in drm_vm.h and correct the use of
devfs_get_cdevpriv.

Reported-By: Sascha Wildner <saw@online.de>
10 years agokernel/run: Add missing unlock.
Sascha Wildner [Sat, 5 Apr 2014 22:58:00 +0000 (00:58 +0200)]
kernel/run: Add missing unlock.

10 years agobmake - Always pass the jobs pipe descriptor
Matthew Dillon [Sat, 5 Apr 2014 19:48:59 +0000 (12:48 -0700)]
bmake - Always pass the jobs pipe descriptor

* bmake currently requires a .MAKE target dependency to induce the passing
  of the jobs pipe descriptor to sub-jobs (aka sub-makes).  This requirement
  was lost due to a bug in bmake where it's F_SETFD fcntl was being run on
  the wrong descriptor.  This was recently fixed in bmake and exposed this
  new problem.

* bmake might be run with the MAKEFLAGS environment intact but not be passed
  the jobs descriptor.  While bmake creates a new fresh jobs descriptor in
  this case, it would remain an issue if some other parent program happened
  to use a pipe descriptor with the same fd number.

* bmake or intermediate build programs might not be run with a .MAKE target
  dependency, causing sub-bmakes to run an excessive number of concurrent
  jobs.

* The question is whether we can really safely require this new behavior
  or whether we should revert to the prior behavior.

  FreeBSD modified the default to be the prior behavior of always passing
  the jobs pipe descriptor and added a new .MAKE* directive to override it,
  but I don't see how this helps matters when the default really needs to be
  the always-pass behavior anyway.

  The only other solution is to use a filesystem-visible pipe (filesystem fifo
  in /tmp), which the old make used.  But this often results in a lot of cruft
  building up in /tmp from ^C's and/or system crashes.  This solution is the
  most compatible with expectations, frankly.

* For now revert to the prior behavior of always passing the jobs pipe
  descriptor.  This does a better job of guarenteeing that the descriptor
  number remains intact through multiple fork/execs.

10 years agorun.4: D1 is an mdoc macro, so we have to escape it :)
Sascha Wildner [Sat, 5 Apr 2014 18:22:32 +0000 (20:22 +0200)]
run.4: D1 is an mdoc macro, so we have to escape it :)

10 years agobwn: fixing performance problems and an RX buffer overflow problem
Imre Vadasz [Thu, 3 Apr 2014 12:16:48 +0000 (14:16 +0200)]
bwn: fixing performance problems and an RX buffer overflow problem

* Commenting a bwn_shm_write_2 call that destroys performance especially
  when sending.  This call is also commented in Linux's b43 driver.

* Handling Overflows of the RX buffer in bwn by just dropping all entries.
  With 256 slots in the RX buffer this overflow will almost never happen in
  practice.

10 years agobwn: Porting from FreeBSD
Imre Vadasz [Thu, 27 Mar 2014 20:24:28 +0000 (21:24 +0100)]
bwn: Porting from FreeBSD

* Adding bwn and siba_bwn to sys/conf/files and to the X86_64_GENERIC kernel
  configuration.

* Replacing BWN_LOCK, BWN_UNLOCK, BWN_ASSERT_SERIALIZED with
  wlan_global_serializer.

* Increasing some alignments from 4K to 8K and some from 1 byte to 4 bytes.

* Changing slot counts for RX and TX from 64 to 256, which is the same size
  as used by b43 in Linux.

* Allow overriding the BWN_TXRING_SLOTS and BWN_RXRING_SLOTS values in the
  kernel configuration.

* Some style fixes. Removing unneeded NULL checks.

* Replace a DELAY(50000) with tsleep.

* Can't use kmalloc to allocate memory for dma like in FreeBSD and Linux.

* A few typo and grammar fixes in the bwn.4 manpage.

10 years agobwn: Import from FreeBSD
Imre Vadasz [Thu, 27 Mar 2014 20:12:23 +0000 (21:12 +0100)]
bwn: Import from FreeBSD

* bwn depends on siba_bwn, importing that code as well

* Including the bwn.4 manpage, but not siba.4

* In FreeBSD the siba driver lives in a separate directory. Since we only
  need the siba_bwn part we just put it below sys/dev/netif/bwn.

10 years agokernel/drm: use devfs_*_cdevpriv functions
Markus Pfeiffer [Thu, 3 Apr 2014 23:47:32 +0000 (00:47 +0100)]
kernel/drm: use devfs_*_cdevpriv functions

drm relied on a custom hack to implement those functions, this hack
has now been removed, and the devfs based functions are used.

10 years agoinpcb/in6pcb: Split port token
Sepherosa Ziehau [Tue, 25 Mar 2014 12:50:53 +0000 (20:50 +0800)]
inpcb/in6pcb: Split port token

The original single local port space is devided into ncpus2 local port
space groups.  We denote local port space group as PG(N), N=[0, ncpus2).

Property of PG(N):
- PG(N) only contains local ports matching following condition:
  (host_order(port) & ncpus2_mask) == N
- PG(N) is protected by its own token.

On explicit local port bind(2) path and accept(2) path, PG(N) is selected
by using the local port already available (accept(2)) or supplied
(bind(2)):
    N = host_order(port) & ncpus2_mask

On implicit local port selection path (bind(2) and connect(2)), PG(N) is
selected and used in the following way:
    N = mycpuid;
    N1 = N;
again:
    if (find free port in PG(N)) {
        DONE;
    } else {
        N = (N + 1) & ncpus2_mask;
        if (N != N1)
            goto again;
        FAILED;
    }

PG(N) is now recorded in inpcb struct, so when inpcb is destroyed, we
know which port space group it should use.

On i7-3770 w/ Intel 82599ES, using tools/kq_connect_client:
Port token contention rate on each hyperthread is reduced from 120K/s to
40K/s.  Admittedly the contention rate is still high but it is much
better than before.

Now the major source of port token contention is the contention between
implicit local port select path and inpcb destroy path.  There may be a
way to choose local port which could hash the inpcb to the current CPU;
this needs more investigation.

10 years ago<sys/cdefs.h>: Make CTASSERT() kernel only (again).
Sascha Wildner [Sat, 5 Apr 2014 07:43:33 +0000 (09:43 +0200)]
<sys/cdefs.h>: Make CTASSERT() kernel only (again).

When I moved it from <sys/systm.h> to <sys/cdefs.h> to have it near
_Static_assert's definition, I overlooked that <sys/systm.h> is a
kernel-only header.

Since there are ports which define their own CTASSERT (such as openjdk),
make ours kernel-only again.

Reported-by: marino
10 years agokernel/802_11: Fix a panic in RUN -> AUTH -> RUN FSM transition.
Sascha Wildner [Fri, 4 Apr 2014 21:40:59 +0000 (23:40 +0200)]
kernel/802_11: Fix a panic in RUN -> AUTH -> RUN FSM transition.

When ratectl_node_init() is called and ni_rctls is already allocated,
use that pointer.

This is FreeBSD's r207323.

Pointed-out-by: Imre Vadasz <imre@vdsz.com>
Tested-by: Markus Pfeiffer <markus.pfeiffer@morphism.de>
10 years agokernel/802_11: Release the WLAN serializer around if_detach().
Sascha Wildner [Fri, 4 Apr 2014 18:20:10 +0000 (20:20 +0200)]
kernel/802_11: Release the WLAN serializer around if_detach().

This should fix all crashes we are seeing upon kldunload of WLAN
drivers.

In-discussion-with-and-tested-by: ivadasz, jh32, sephe
10 years agokernel/ath: Grab the WLAN serializer around ieee80211_ifdetach().
Sascha Wildner [Fri, 4 Apr 2014 18:16:01 +0000 (20:16 +0200)]
kernel/ath: Grab the WLAN serializer around ieee80211_ifdetach().

Reported-by: Imre Vadasz <imre@vdsz.com>
10 years agoFix buildkernel (missing include).
Sascha Wildner [Fri, 4 Apr 2014 13:35:20 +0000 (15:35 +0200)]
Fix buildkernel (missing include).

Reported-by: luxh
10 years agokernel/802_11: More ratectl fixes (fixes an ath(4) panic).
Sascha Wildner [Fri, 4 Apr 2014 08:07:53 +0000 (10:07 +0200)]
kernel/802_11: More ratectl fixes (fixes an ath(4) panic).

Set the default rate control algorithm to NONE instead of AMRR and
add some missing ieee80211_ratectl_node_init()s which I had overlooked
earlier.

Reported-by: Johannes Hofmann <johannes.hofmann@gmx.de>
Tested-by: Imre Vadasz <imre@vdsz.com>
10 years agokernel - bring acpi_thinkpad in sync with FreeBSD r246128
Markus Pfeiffer [Thu, 3 Apr 2014 22:06:19 +0000 (23:06 +0100)]
kernel - bring acpi_thinkpad in sync with FreeBSD r246128

Submitted-By: Sascha Wildner <saw@online.de>
10 years agoAdd ident string to acpi_thinkpad module
Markus Pfeiffer [Thu, 3 Apr 2014 21:36:40 +0000 (22:36 +0100)]
Add ident string to acpi_thinkpad module

10 years agols(1): Restore the traditional behavior of -f implying -a.
Sascha Wildner [Thu, 3 Apr 2014 07:21:04 +0000 (09:21 +0200)]
ls(1): Restore the traditional behavior of -f implying -a.

OpenBSD's commit msg:

------
restore the traditional behavior of -f implying -a; apparently Keith Bostic
forgot to restore it when the -f flag was put back on 2nd of September 1989,
after being removed on 16th of August as a consequence of issues getting it
working over NFS, so deviation from traditional UNIX behavior in all BSDs
looks like an historical accident; as a side effect, this change accommodates
behavior of this option to IEEE Std 1003.1-2008 (``POSIX.1'').

joint work with jmc@ (who found the inaccuracy in our implementation),
schwarze@ (who provided a detailed tracking of historical facts) and millert@

ok millert@, schwarze@
------

The same patch has been pushed to NetBSD and FreeBSD too.

Submitted-by: Igor Sobrado
Taken-from:   OpenBSD

10 years agoMove ieee80211_ratectl_node_init() from drivers into ieee80211.
Sascha Wildner [Thu, 3 Apr 2014 07:10:23 +0000 (09:10 +0200)]
Move ieee80211_ratectl_node_init() from drivers into ieee80211.

This fixes the amrr_node_deinit() panics we were getting after my
recent ratectl commit broke it (it was trying to kfree a NULL
pointer).

It should also fix hostap mode for run(4) e.g.

This commit is essentially FreeBSD's r217511.

Pointed-out-by: Imre Vadasz <imre@vdsz.com>
Taken-from:     FreeBSD

10 years agoRevert "wlan - Allow NULL field in amrr_node_deinit()"
Sascha Wildner [Thu, 3 Apr 2014 07:00:42 +0000 (09:00 +0200)]
Revert "wlan - Allow NULL field in amrr_node_deinit()"

This reverts commit d68ce29fbc7cb83d080f0abb8790151cd6fec598.

10 years agowlan - Allow NULL field in amrr_node_deinit()
Matthew Dillon [Thu, 3 Apr 2014 02:09:55 +0000 (19:09 -0700)]
wlan - Allow NULL field in amrr_node_deinit()

* Allow a NULL field in amrr_node_deinit(), prevent kfree() from being
  called with NULL, which DragonFly explicitly does not allow.

10 years agoloader - Add slowprint() debugging helper
Matthew Dillon [Wed, 2 Apr 2014 21:41:00 +0000 (14:41 -0700)]
loader - Add slowprint() debugging helper

* Add a slowprint() function and command to enable it
  to help trace out problems.

* Used for recent debugging but calls are not intended to be permanently
  resident in the code.  Leave the infrastructure in place for future
  debugging.

10 years agolibstand - Fix excessive memory use by hammer2 module
Matthew Dillon [Wed, 2 Apr 2014 21:38:54 +0000 (14:38 -0700)]
libstand - Fix excessive memory use by hammer2 module

* Don't try to dynamically allocate 64KB for each open file.  Just use
  the same static media buffer that normal operations use.

  This fixes some severe heap fragmentation and out-of-memory issues
  when a lot (20+) modules are specified in /boot/loader.conf that
  can cause the boot loader to fail.

* Add getheap() to retrieve heap stats.

10 years agokernel - Fix mid-kernel-boot lockups due to module order
Matthew Dillon [Wed, 2 Apr 2014 19:24:57 +0000 (12:24 -0700)]
kernel - Fix mid-kernel-boot lockups due to module order

* Sometimes the kernel would just lock up for no apparent reason.  Changing
  the preloaded module set (even randomly) could effect the behavior.

* The problem turned out to be an issue with kernel modules needing to
  temporarily migrate to another cpu (such as when installing a SWI or
  other interrupt handler).  If the idle thread on cpu 0 had not yet
  bootstrapped, lwkt_switch_return() would not be called properly and
  the LWKT cpu migration code would never schedule on the target cpu.

* Fix the problem by handling the idle thread bootstrap case for cpu 0
  properly in pc64.

10 years agoboot - boot loader fixes
Matthew Dillon [Wed, 2 Apr 2014 19:22:50 +0000 (12:22 -0700)]
boot - boot loader fixes

* Clarify some issues in comments.

* Don't trust the bios memory boundary, start 1K below it.

* Always bounce, not just for floppies.  This should help with situations
  when loading kernels and modules beyond the 16MB mark.

* Add some debugging memory commands

10 years agocrunch: We use .Mt for mail addresses.
Sascha Wildner [Wed, 2 Apr 2014 17:56:03 +0000 (19:56 +0200)]
crunch: We use .Mt for mail addresses.

10 years agoRevert "installer: Export /boot device name in loader.conf"
François Tigeot [Wed, 2 Apr 2014 08:04:47 +0000 (10:04 +0200)]
Revert "installer: Export /boot device name in loader.conf"

This reverts commit 8a01d9f7000ef8c274b595edf681b3ff0b17591e.

It turns out putting the boot device name in a sysctl variable for its
use by a rescue system is not such a good idea.

10 years agocrunch - Remove FBSDID
Matthew Dillon [Tue, 1 Apr 2014 23:56:43 +0000 (16:56 -0700)]
crunch - Remove FBSDID

* buildworld bootstrap doesn't seem to be using the world's
  sys/cdefs.h, and the installed sys/cdefs.h might not have
  the FBSDID hack.

* Remove the FBSDID stuff from crunch to fix buildworld.  Wish I had
  never invented FBSDID.

10 years agomkinitrd(8): Use cpdup to copy files
François Tigeot [Mon, 31 Mar 2014 20:36:03 +0000 (22:36 +0200)]
mkinitrd(8): Use cpdup to copy files

Preserving hard links

10 years agokernel/acpi: Fix a x86_64 warning in the ACPI_DEBUG_MEMMAP code.
Sascha Wildner [Mon, 31 Mar 2014 17:16:31 +0000 (19:16 +0200)]
kernel/acpi: Fix a x86_64 warning in the ACPI_DEBUG_MEMMAP code.

10 years agokernel/acpi: Restore ACPI_DEBUG_{CACHE,LOCKS,MEMMAP} functionality.
Sascha Wildner [Mon, 31 Mar 2014 17:02:29 +0000 (19:02 +0200)]
kernel/acpi: Restore ACPI_DEBUG_{CACHE,LOCKS,MEMMAP} functionality.

Unfortunately we can't do this in acdragonfly.h alone since ACPICA
types such as ACPI_SIZE and so on are unavailable in acdragonfly.h.
This is because acpi.h includes acenv.h (and therefore acdragonfly.h)
before actypes.h.

10 years agoUpdate crunched binaries tools from FreeBSD
François Tigeot [Sun, 30 Mar 2014 19:55:54 +0000 (21:55 +0200)]
Update crunched binaries tools from FreeBSD

* Fix amd64/x86_64 confusion

* Remove a.out support

10 years agoRevert "Remove crunchgen(8)."
François Tigeot [Sun, 30 Mar 2014 19:46:42 +0000 (21:46 +0200)]
Revert "Remove crunchgen(8)."

This reverts commit 97c14704c37c914dbd89b22465a421ffde7fe89d.

Conflicts:
Makefile.inc1
Makefile_upgrade.inc
sbin/ifconfig/Makefile
usr.bin/vi/Makefile
usr.sbin/ppp/bundle.c
usr.sbin/pppd/Makefile
usr.sbin/tcpdump/Makefile

10 years agohammer2 - multi-target mount part 4/many (stabilization)
Matthew Dillon [Mon, 31 Mar 2014 01:43:51 +0000 (18:43 -0700)]
hammer2 - multi-target mount part 4/many (stabilization)

* Fix spmp mirror_tid synchronization bug in the flush code.  TIDs were
  not being allocated properly for the super-root portion of the flush.

* Add in-memory chain dump ioctl.

* Fix another missing modsync.

10 years agohammer2 - Add debug ioctl
Matthew Dillon [Mon, 31 Mar 2014 01:42:25 +0000 (18:42 -0700)]
hammer2 - Add debug ioctl

* Add a a debugging command to dump the in-memory chain topology.

10 years agoUnbreak buildworld after recent hammer2 changes.
Sascha Wildner [Sun, 30 Mar 2014 21:36:05 +0000 (23:36 +0200)]
Unbreak buildworld after recent hammer2 changes.

504565062f34ec55037ac0cf308fe3562f091460 renamed HAMMER2_MAX_KEY to
HAMMER2_KEY_MAX but libstand wasn't adjusted.

Reported-by: David Shao
Dragonfly-bug: <https://bugs.dragonflybsd.org/issues/2658>

10 years agohammer2 - multi-target mount part 3/many (stabilization)
Matthew Dillon [Sun, 30 Mar 2014 18:07:36 +0000 (11:07 -0700)]
hammer2 - multi-target mount part 3/many (stabilization)

* Fix cluster memory leaks, fix a malloc_type leak.

* Resync cached PFS (pmp) data in the root inode for the PFS on flush.
  (inode allocator).

* Track total DIO memory.

* For now assert on logical mirror mismatches.

* Minor start on infrastructure for mirror synchronization.

* Refactor hammer2_cluster_copy() flags.

10 years ago<sys/cdefs.h>: Simplify the CTASSERT definition better.
Sascha Wildner [Sun, 30 Mar 2014 10:27:07 +0000 (12:27 +0200)]
<sys/cdefs.h>: Simplify the CTASSERT definition better.

10 years agohammer2 - multi-target mount part 2/many
Matthew Dillon [Sun, 30 Mar 2014 00:09:08 +0000 (17:09 -0700)]
hammer2 - multi-target mount part 2/many

* Split media and in-memory tracking of TIDs.  In-memory tracking is
  effectively global, while on-media TIDs are now split into an independent
  domain for each PFS plus one for the super-root and freemap topology.

  Introduces hammer2_xid_t and reformulates some of the TID and XID
  constants.

* Refactor the flush code to no longer depend on media modify_tid/mirror_tid
  values during a flush.  In-memory XIDs are used for all flush recursions.

* Refactor the transaction mechanisms in order to allow XIDs to cover multiple
  TID domains.  For the moment, the transaction management structure is
  global but the code is designed to allow us to have multiple management
  domains in a future commit.

* Associate a PMP structure with each storage topology's super-root and
  freemap (still a bit rough).

* Each PFS now accounts for its own inode numbers and transaction ids,
  independent of other PFSs.  This also means that both inode numbers
  and transaction ids are PFS-specific, so multiple storage medias which
  are part of the same PFS will use the PFS-centric tracking rather than
  per-media tracking.

* Cleanup a few memory leaks and remove some debugging from the chain code.

* Refactor mount and unmount code to handle the new PFS abstraction.

* Refactor the volume data lock/unlock/modify mechanics somewhat.

10 years ago<sys/cdefs.h>: Use _Static_assert for CTASSERT.
Sascha Wildner [Sat, 29 Mar 2014 09:07:03 +0000 (10:07 +0100)]
<sys/cdefs.h>: Use _Static_assert for CTASSERT.

Move CTASSERT from <sys/systm.h> to <sys/cdefs.h> and use _Static_assert
for its definition (which gives us a better error message in case it is
triggered).

But if there is no support for _Static_assert or static_assert in the
compiler, use the previous typedef method.

10 years agokernel/hptmv: Don't mess up the struct by copying too much.
Sascha Wildner [Sat, 29 Mar 2014 08:06:44 +0000 (09:06 +0100)]
kernel/hptmv: Don't mess up the struct by copying too much.

VendorId is only 8 chars.

10 years agokernel/cpu_topology: Fix a casting issue in the topology tree printing.
Sascha Wildner [Fri, 28 Mar 2014 22:18:02 +0000 (23:18 +0100)]
kernel/cpu_topology: Fix a casting issue in the topology tree printing.

compute_unit_id is uint8_t so it's actually 0xff we want to check for.
Before this commit, the "... != -1" checks were always true.

10 years agokernel/acpi_fujitsu: Doh, fix a copy/paste error I did in my last upgrade.
Sascha Wildner [Fri, 28 Mar 2014 21:09:55 +0000 (22:09 +0100)]
kernel/acpi_fujitsu: Doh, fix a copy/paste error I did in my last upgrade.

10 years ago<sys/hash.h>: Fix wrong header guard.
Sascha Wildner [Fri, 28 Mar 2014 20:54:07 +0000 (21:54 +0100)]
<sys/hash.h>: Fix wrong header guard.

10 years agokernel/acpi: Improve the errors which AcpiOsTableOverride() returns.
Sascha Wildner [Thu, 27 Mar 2014 13:49:25 +0000 (14:49 +0100)]
kernel/acpi: Improve the errors which AcpiOsTableOverride() returns.

While here, use ACPI_COMPARE_NAME() and ACPI_SIG_DSDT.

10 years agoFix the usbd rc script a bit better.
Sascha Wildner [Wed, 26 Mar 2014 09:42:11 +0000 (10:42 +0100)]
Fix the usbd rc script a bit better.

Most importantly, take care about the case where usb isn't in the
kernel config.

Reported-by: lhmwzy on users@
10 years agoSync zoneinfo database with tzdata2014b from ftp://ftp.iana.org/tz/releases
Sascha Wildner [Tue, 25 Mar 2014 09:35:13 +0000 (10:35 +0100)]
Sync zoneinfo database with tzdata2014b from ftp://ftp.iana.org/tz/releases

* africa: Morocco's 2014 DST start will be as predicted. (Thanks to
    Sebastien Willemijns.)

* australasia: Add comments about Johnston Island time in the 1960s.
    (Thanks to Lyle McElhaney.)

* antarctica: New entry for Troll station, Antarctica. (Thanks to
    Paul-Inge Flakstad and Bengt-Inge Larsson.) This is currently an
    approximation; a better version will require zic and localtime
    fixes. Also the NZAQ rules - which are never used - have been
    removed.

* europe: Crimea switches to Moscow time on 2014-03-30 at 02:00 local
    time. (Thanks to Alexander Krivenyshev.)
    Move its zone.tab entry from UA to RU.

10 years agokernel/i386: Remove CPU_ENABLE_TCC traces.
Sascha Wildner [Tue, 25 Mar 2014 03:32:16 +0000 (04:32 +0100)]
kernel/i386: Remove CPU_ENABLE_TCC traces.

10 years agoinpcb: Use a special version of in_pcbinsporthash() on TCP accept path
Sepherosa Ziehau [Mon, 24 Mar 2014 13:22:27 +0000 (21:22 +0800)]
inpcb: Use a special version of in_pcbinsporthash() on TCP accept path

It holds the port token for in_pcbinsporthash().  Assert that the port
token is held in in_pcbinsport() now.

10 years agoFix kernel build.
Sascha Wildner [Mon, 24 Mar 2014 08:59:54 +0000 (09:59 +0100)]
Fix kernel build.

10 years agonetstat - Replace a couple malloc calls.
Antonio Huete Jimenez [Thu, 20 Mar 2014 15:26:26 +0000 (08:26 -0700)]
netstat - Replace a couple malloc calls.

- Use calloc to ensure memory is zeroed.

10 years agoinpcb: Group port related fields into inpcbportinfo
Sepherosa Ziehau [Sun, 23 Mar 2014 13:30:27 +0000 (21:30 +0800)]
inpcb: Group port related fields into inpcbportinfo

Prepare for port token splitting.

10 years agolibc: Remove a useless assignment.
Sascha Wildner [Sun, 23 Mar 2014 11:53:57 +0000 (12:53 +0100)]
libc: Remove a useless assignment.

10 years agoext2fs - Attempt to fix a panic on VOP_CLOSE
Antonio Huete Jimenez [Sun, 23 Mar 2014 01:30:01 +0000 (02:30 +0100)]
ext2fs - Attempt to fix a panic on VOP_CLOSE

Follows-up commit 12cdc371fb859682eda7d1c26c5059920a7cf118