dragonfly.git
5 years agohammer2 - refactor filesystem sync 5/N
Matthew Dillon [Sat, 1 Dec 2018 21:57:35 +0000 (13:57 -0800)]
hammer2 - refactor filesystem sync 5/N

* Dependency ops need one atomic wrapper.  Adjust the use of
  pmp->list_spin for the atomic wrapper.

* Reorder hammer2_inode_depend() call from after hammer2_igetv()
  to before it.  This is because hammer2_igetv() can temporarily
  release the inode lock and the dependency code assumes that does
  not happen.

* Cleanup

* This code is still not 100% because earlier dependency pairs
  that wind up on the sideq can be split if an overlapping dependency
  occurs later that flags PASS2.

5 years agohammer2 - Add 'snapshot-debug' directive
Matthew Dillon [Fri, 16 Nov 2018 06:32:56 +0000 (22:32 -0800)]
hammer2 - Add 'snapshot-debug' directive

* Add the 'snapshot-debug' directive which takes a snapshot without
  first sync'ing the filesystem.  The idea is that the snapshot will
  be taken relative to the most recent filesystem sync (automatic or
  manual), and should still represent a fully consistent filesystem.

5 years agohammer2 - refactor filesystem sync 4/N
Matthew Dillon [Tue, 13 Nov 2018 21:32:33 +0000 (13:32 -0800)]
hammer2 - refactor filesystem sync 4/N

* Save synchronized iroot blockmaps for snapshot code, and use them
  in the snapshot code.

* Improve dependency handling and syncq/sideq flagging for
  dependencies.  Also improve the hammer2_inode_t reordering
  code that allows the frontend to continue operating on dirty
  inodes simultaneous with a filesystem sync.

* Move inode deletion into the filesystem sync code (in addition to
  creation), for the same reason.

* Fix lost ref counts in the snapshot code which were causing umount
  panics.

* Stabilization pass on volume flush code.  Since flushes stop at
  inode boundaries, we must properly flush the superroot before
  flushing the volume header.  That is, the flush sequence is:

  - flush inodes for PFS  (flushes inode content)
  - flush PFS root inode  (flushes through to inodes)
  - flush superroot inode (flushes through to PFS root)
  - flush volume header   (flushes voulume header to superroot)

  Theoretically this allows the filesystem asynchronously write data
  and inodes flushed by the kernel's buffer cache and vnode code
  concurrent with a filesystem flush without messing up filesystem
  consistency, because these asynchronously flushed inodes are not
  included (or have already been flushed) in the filesystem flush that
  is already underway.

* Filesystem consistency still not perfect (using snapshot-debug
  directive to test during heavy filesystem modification loads,
  directory entries are sometimes desynchronized from their inodes).

5 years agohammer2 - refactor filesystem sync 3/N
Matthew Dillon [Sat, 10 Nov 2018 02:05:14 +0000 (18:05 -0800)]
hammer2 - refactor filesystem sync 3/N

* Attempt to guarantee filesystem consistency at all sync points.

* Pretty severely hacked, and at the moment this can result in
  syncs which never end if the filesystem is busy.

5 years agohammer2 - refactor filesystem sync 2/N
Matthew Dillon [Fri, 9 Nov 2018 01:10:07 +0000 (17:10 -0800)]
hammer2 - refactor filesystem sync 2/N

* Flesh out the flush partitioning code, fixing a number of issues.

* Refactor hammer2_inode_lock() and add hammer2_inode_lock4() to
  interlock against flushes.  This is handled by blocking inode locks
  against SYNCQ, and reordering the inode to the front of the SYNCQ list
  in order to unblock as quickly as possible as the filesystem sync
  progresses.  The result should be relatively few frontend stalls
  during a filesystem sync.

* Disable resource caps for the moment, because synchronous
  operations to prevent resource limits from blowing out break
  the current inode_lock*() code and allow vnode deadlocks to
  occur.

* To avoid deadlocks, the filesystem sync currently must clear SYNCQ
  before locking the inode & vnode, and if it cannot lock a vnode it
  must continue on with the next inode and then restart.  Retried
  vnodes introduce a short delay to give the frontend time to work
  the blocking operation.

  This is necessary because the kernel locks vnodes before entering the
  H2 frontend, and we cannot safely unlock/relock them to work around
  this.  Nor do we necessarily even have full knowledge on which vnodes
  the current thread has locked.

* Does not yet guarantee complete filesystem consistency on-crash.

5 years agohammer2 - refactor filesystem sync 1/N
Matthew Dillon [Mon, 5 Nov 2018 01:31:07 +0000 (17:31 -0800)]
hammer2 - refactor filesystem sync 1/N

* Change H2 to allow concurrent filesystem sync and modifying
  frontend operations.

* FLUSH transactions no longer block modifying frontend
  transactions.

* Change filesystem sync operation to put all modified
  inodes on the pmp->syncq (which is also combined with
  any inodes on pmp->sideq), and then iterating the
  syncq to flush each inode.

  After this is done, stage 2 will flush the meta-data tree
  leading to each inode.

  This code will also handle delayed inode creation and
  destruction ops, which require modifications to the meta-data
  tree governing the inodes themselves (so we don't want the
  frontend to do it and interfere with the flush).

* Modifying operations against inodes already queued for a
  filesystem sync that is in progress will now reorder the
  inode to the front of the filesystem sync in progress and
  wait for the sync on that inode to complete before proceeding.

  This is handled by blocking in the exclusive inode lock code.

* hammer2_inode_get() does not need to pass 'dip' any more
  because regular inodes are inserted under the iroot (PFS root
  inode) and no longer inserted hierarchically.

* Separate out hammer2_inode_create() into hammer2_inode_create_pfs()
  and hammer2_inode_create_normal().  These two forms are now distinct
  enough that the code is a mess if we try to leave them combined.

5 years agodrm/i915: Add Kaby Lake and Amber Lake PCI IDs
François Tigeot [Tue, 4 Dec 2018 21:54:39 +0000 (22:54 +0100)]
drm/i915: Add Kaby Lake and Amber Lake PCI IDs

Obtained-from: Linux 4.19

5 years agodrm/i915: Add Whiskey Lake PCI IDs
François Tigeot [Tue, 4 Dec 2018 21:27:20 +0000 (22:27 +0100)]
drm/i915: Add Whiskey Lake PCI IDs

Obtained-from: Linux 4.19

5 years agodrm/i915: Add more Coffeelake PCI IDs
François Tigeot [Tue, 4 Dec 2018 20:57:46 +0000 (21:57 +0100)]
drm/i915: Add more Coffeelake PCI IDs

Obtained-from: Linux 4.19

5 years agoRevert "drm/ttm: Remove ttm_bo_unreserve_core()"
François Tigeot [Sat, 24 Nov 2018 13:12:34 +0000 (14:12 +0100)]
Revert "drm/ttm: Remove ttm_bo_unreserve_core()"

This reverts commit 5d4803440754b62fed1abd6d641d1f7a6f7b454e.

The drm/radeon driver has a tendency to lock up more frequently
without ttm_bo_unreserve_core().

Reported-by: Michael Neumann <mneumann@ntecs.de>
5 years agousb.4: Clean up a bit.
Sascha Wildner [Sun, 2 Dec 2018 12:32:35 +0000 (13:32 +0100)]
usb.4: Clean up a bit.

5 years agohier.7: Use .Xr
Sascha Wildner [Sun, 2 Dec 2018 03:24:54 +0000 (04:24 +0100)]
hier.7: Use .Xr

5 years agohier.7: Document some recently added directories.
Sascha Wildner [Sun, 2 Dec 2018 03:06:25 +0000 (04:06 +0100)]
hier.7: Document some recently added directories.

5 years agoRemove an unused include file.
Sascha Wildner [Sun, 2 Dec 2018 02:13:39 +0000 (03:13 +0100)]
Remove an unused include file.

5 years agolibc/locale: Mark up defined values better in the manual pages.
Sascha Wildner [Sat, 1 Dec 2018 20:15:32 +0000 (21:15 +0100)]
libc/locale: Mark up defined values better in the manual pages.

5 years agoInstall input{,-event-types}.h to /usr/include/compat/linux too.
Sascha Wildner [Fri, 30 Nov 2018 20:13:02 +0000 (21:13 +0100)]
Install input{,-event-types}.h to /usr/include/compat/linux too.

It helps preventing excessive patches in ravenport's weston.

It is kind of experimental, but depending on how useful it
proves to be for 3rd party software all in all, we will
eventually remove /usr/include/dev/misc/evdev in the future.

A -I /usr/include/compat is needed to get at these headers using
"#include <linux/input.h>", etc. They were not put in the default
include path to mislead configure scripts and the likes.

We will also evaluate if it is worth exposing further linux
specific headers in this directory.

It might even be that we change the new location again in the
future.

Requested-by: Peeter Must
5 years agokernel: Move some old unused stuff out of the way.
Sascha Wildner [Fri, 30 Nov 2018 16:13:37 +0000 (17:13 +0100)]
kernel: Move some old unused stuff out of the way.

5 years agokernel - Cleanup blist debug code (2)
Matthew Dillon [Thu, 29 Nov 2018 08:17:57 +0000 (00:17 -0800)]
kernel - Cleanup blist debug code (2)

* Conditionalize debugging kprintf() for non-kernel test
  code only.

5 years agokernel - Fix nstopped SMP race during core dump
Matthew Dillon [Thu, 29 Nov 2018 06:56:24 +0000 (22:56 -0800)]
kernel - Fix nstopped SMP race during core dump

* During a process core dump, p->p_nstopped can be adjusted without
  holding p->p_token, resulting in a SMP race which can cause
  p_nstopped to become permanently desynchronized and deadlock the
  process.

* Be robust in a p_nstopped handling case in kern_exit, just in case.

5 years agokernel - Cleanup blist debug code
Matthew Dillon [Tue, 27 Nov 2018 01:39:56 +0000 (17:39 -0800)]
kernel - Cleanup blist debug code

* Allow 64-bit fields to be specified in the debug code.  Does not
  affect the kernel.

* Correct two next_skip calculations that were casting to 32 bits.
  These are block numbers and can affect operations when > 2TB of
  swap is configured.

5 years agodrm includes: Rename uapi_xxx to uapi/xxx
François Tigeot [Wed, 28 Nov 2018 20:16:37 +0000 (21:16 +0100)]
drm includes: Rename uapi_xxx to uapi/xxx

Making the include hierarchy 100% compatible with the Linux one.

5 years agonetwork.subr: Handle DHCP in ipv6_ifconfig_<ifname>
Aaron LI [Wed, 28 Nov 2018 04:50:44 +0000 (12:50 +0800)]
network.subr: Handle DHCP in ipv6_ifconfig_<ifname>

Commit 329743def50a061489debcd9682983235c8f5b42 allows to set
'ipv6_ifconfig_<ifname>="DHCP"' to tell dhcpcd(8) to configure DHCPv6
for interface <ifname>.  However, the "DHCP" argument shouldn't be
passed to ifconfig(8).  Handle this case by using 'ifconfig_getargs()'
in 'network6_interface_setup()'.

5 years ago<sys/errno.h>: Remove EUNUSED*.
Levente Kurusa [Tue, 27 Nov 2018 10:48:45 +0000 (11:48 +0100)]
<sys/errno.h>: Remove EUNUSED*.

These values are not used (as their name suggests) and there is no
reason for an application to ever see or use them. This has recently
caused some confusion in the Rust ecosystem, and it looks like a
comment would better serve the intended purpose than making these
values available.

Signed-off-by: Levente Kurusa <lkurusa@acm.org>
5 years agoinitrd: Explicitly say the status when build completes
Aaron LI [Mon, 26 Nov 2018 07:29:56 +0000 (15:29 +0800)]
initrd: Explicitly say the status when build completes

Before this change, the 'all' target that builds the rescue and initrd
will end with a '--- obj ---' line, which may cause an illusion that the
build hasn't finished.  Now, explicitly say that the build has finished.

Suggested-by: swildner
5 years agoPut note about DSA OpenSSH key deprecation, from 5 versions ago, into UPDATING.
Justin C. Sherrill [Mon, 26 Nov 2018 02:45:51 +0000 (21:45 -0500)]
Put note about DSA OpenSSH key deprecation, from 5 versions ago, into UPDATING.
This probably affects nobody at this point, but now I can feel better about
removing it from release notes where it keeps getting reprinted.

5 years agoscript.1: Fix a typo, bump date.
Sascha Wildner [Sun, 25 Nov 2018 17:40:14 +0000 (18:40 +0100)]
script.1: Fix a typo, bump date.

5 years agodrm/ttm: Sync ttm_page_alloc.c with Linux
François Tigeot [Sun, 25 Nov 2018 15:54:27 +0000 (16:54 +0100)]
drm/ttm: Sync ttm_page_alloc.c with Linux

5 years agodrm/linux: Add set_pages_array_xx() functions
François Tigeot [Sun, 25 Nov 2018 15:28:33 +0000 (16:28 +0100)]
drm/linux: Add set_pages_array_xx() functions

5 years agoscript(1): Sync with FreeBSD
Antonio Huete Jimenez [Sun, 25 Nov 2018 11:05:59 +0000 (12:05 +0100)]
script(1): Sync with FreeBSD

- Add -p flag which is used to replay typescripts.
- Add -d flag to avoid sleeps in playbacks.
- Add -F flag which allows recording/playing through pipes.
- Add -r flag to optionally record all.
- A bunch of fixes, mostly.

Note: -f flag from FreeBSD is not available since DragonFly BSD does not
      have filemon(4)

5 years agoMakefile.inc1: Some minor cleanups
Aaron LI [Sat, 24 Nov 2018 11:09:00 +0000 (19:09 +0800)]
Makefile.inc1: Some minor cleanups

No functional change.

5 years agoinitrd: Rework build and install stages
Aaron LI [Sat, 24 Nov 2018 10:52:03 +0000 (18:52 +0800)]
initrd: Rework build and install stages

* Rewrite the Makefile to provide only the 'all' and 'install' targets.
  Do not separate the handling of the rescue tools and initrd image.
  Thus greatly simplify the whole logic.

  The 'all' target will build the rescue tools and initrd contents, and
  does not require root priviledge, while the 'install' target will
  install the rescue tools to the system, create the initrd image and
  install it.

* Update the top-level makefiles to call the new 'all' and 'install'.
  The 'buildworld' target now doesn't require root priviledge, same as
  before the refactoring in 9b724c0dcb2b9548a82d28d97e34375f64668669.

* Only provide the 'initrd' top-level target to keep it simple.  This
  target will install the rescue tools and initrd image built by the
  'buildworld', overwriting the existing ones.

* Clean up the nrelease/Makefile a bit, since 'installworld' will also
  install the rescue tools and initrd image in such a case.

* Update the mkinitrd.sh script a bit.

* Update the build(7) man page and clean up a bit.

Reviewed-by: swildner
5 years agorc.d/wpa_supplicant: Prefer the DPorts version for the moment
Aaron LI [Sun, 25 Nov 2018 09:39:41 +0000 (17:39 +0800)]
rc.d/wpa_supplicant: Prefer the DPorts version for the moment

We now also ship the wpa_supplicant from DPorts, which has several
important security fixes than the base one, so prefer the DPorts
wpa_supplicant if it exists for the moment.

This patch allows us to bring the base wpa_supplicant up-to-date and
switch back to it later without requiring users to modify their
'/etc/rc.conf'.

5 years agobuild - Add security/wpa_supplicant to nrelease
Matthew Dillon [Sun, 25 Nov 2018 07:44:21 +0000 (23:44 -0800)]
build - Add security/wpa_supplicant to nrelease

* Add security/wpa_supplicant to the nrelease build.  This ensures
  that the latest wpa_supplicant is available on release.  The
  wpa_supplicant in the base system exists only to help bootstrap
  systems when the port is not installed.

5 years agokernel - Fix probable callout race
Matthew Dillon [Sun, 25 Nov 2018 07:39:15 +0000 (23:39 -0800)]
kernel - Fix probable callout race

* Fix a probable callout race in kern/kern_event.c.  It is possible
  for the callout to be requeued during teardown and for the
  structure to subsequently become corrupted.

  Manifests as 'stuck' processes (still ^C'able if PCATCH is flagged),
  and sleeps which do not expire.  Can be triggered by synth bulk runs.

* Increase maximum number of kqueue timers from 4096 to 65536.  This
  limit will have to be moved to uidinfo (but not in this commit).

5 years ago<sys/param.h>: Adjust __DragonFly_version.
Sascha Wildner [Sat, 24 Nov 2018 18:02:08 +0000 (19:02 +0100)]
<sys/param.h>: Adjust __DragonFly_version.

5 years agoUpdates for new 5.5 master. v5.5.0
Justin C. Sherrill [Fri, 23 Nov 2018 03:38:50 +0000 (22:38 -0500)]
Updates for new 5.5 master.

5 years agoinstaller: Add serial detection
Diederik de Groot [Sun, 14 Oct 2018 23:53:19 +0000 (01:53 +0200)]
installer: Add serial detection

- The installer script now asks for TERM type when in serial port console.
- Make sure dfui is not left running using trap/cleanup

5 years agotest: Attempt to fix vnodeinfo.c (2)
Antonio Huete Jimenez [Thu, 22 Nov 2018 19:15:11 +0000 (20:15 +0100)]
test: Attempt to fix vnodeinfo.c (2)

5 years agosio: Correct how DDB option is checked
Antonio Huete Jimenez [Thu, 22 Nov 2018 11:30:38 +0000 (12:30 +0100)]
sio: Correct how DDB option is checked

5 years agotest: Fix some debug programs
Antonio Huete Jimenez [Thu, 22 Nov 2018 09:16:48 +0000 (10:16 +0100)]
test: Fix some debug programs

5 years agotest: Remove no longer relevant ttyinfo.c
Antonio Huete Jimenez [Thu, 22 Nov 2018 09:16:30 +0000 (10:16 +0100)]
test: Remove no longer relevant ttyinfo.c

5 years agokernel: Move vnode_index to sys/vnode.h
Antonio Huete Jimenez [Wed, 21 Nov 2018 23:51:19 +0000 (00:51 +0100)]
kernel: Move vnode_index to sys/vnode.h

- This allows userland programs (test/debug) to use that structure.

5 years agokernel - Refactor inum stat data for sockets
Matthew Dillon [Wed, 21 Nov 2018 21:06:24 +0000 (13:06 -0800)]
kernel - Refactor inum stat data for sockets

* Assign a dummy inode number to all sockets.  We previously were
  only assigning a dummy inode number to unix domain sockets.  Use
  the new pcpu facility and store the inum in the socket structure.

* Rip out the old inode number assigner for unix domain sockets, it
  was using an atomic_fetchadd_long() on a global variable, introducing
  unnecessary SMP stalls.  And it was specific to unix domain sockets.
  The new facility is generic to all sockets and uses a pcpu data
  structure.

5 years agokernel - Add uid, gid, and inum to stat data for pipes
Matthew Dillon [Wed, 21 Nov 2018 20:37:08 +0000 (12:37 -0800)]
kernel - Add uid, gid, and inum to stat data for pipes

* fstat(pipefd) now populations additional fields. uid, gid,
  and inum.  In-line with other BSDs and Linux.  Not sure why
  any program would use the inum field but... now its populated.

* Add an anonymous inode allocator to the pcpu structure.  No
  atomic ops required.  Basically just does:

  pipe->inum = gd->gd_anoninum++ * ncpus + gd->gd_cpuid + 2;

* Facility can be used for other things as needed.

Suggested-by: mjg
5 years agoinet: Recalculate the packet hash for IP encapsulation.
Sepherosa Ziehau [Tue, 20 Nov 2018 13:13:18 +0000 (21:13 +0800)]
inet: Recalculate the packet hash for IP encapsulation.

Some NICs, noticeably igb(4) and ix(4), calculate the packet hash
based on the encapsulated IP datagram instead of the outmost header.

Force packet hash recalculation using the outmost for encapsulated
packets; this is done on the encap_input() path, which leaves enough
room for us to utilize the NIC feature mentioned above.

Reported-by: dillon@
5 years agostf/gre: Make sure the input packet's hash is recalculated.
Sepherosa Ziehau [Tue, 20 Nov 2018 12:39:47 +0000 (20:39 +0800)]
stf/gre: Make sure the input packet's hash is recalculated.

5 years agokernel: Fix some -Wundef corner cases.
Sascha Wildner [Mon, 19 Nov 2018 18:07:35 +0000 (19:07 +0100)]
kernel: Fix some -Wundef corner cases.

When those modules were built outside buildkernel, NVN and NSNP would
not be defined, so provide some defaults.

5 years agoinet6: Set net.inet6.icmp6.nd6_onlink_ns_rfc4861 to 1 by default.
Sepherosa Ziehau [Mon, 19 Nov 2018 13:50:15 +0000 (21:50 +0800)]
inet6: Set net.inet6.icmp6.nd6_onlink_ns_rfc4861 to 1 by default.

It is almost required by contemporary INET6 deployment.

5 years agoinet6: Make non-prefix and directly reachable inet6 routes work (2).
Sepherosa Ziehau [Mon, 19 Nov 2018 13:45:30 +0000 (21:45 +0800)]
inet6: Make non-prefix and directly reachable inet6 routes work (2).

Generalize "non-prefix and directly reachable" inet6 routes lookup,
instead of specializing the ifa_rtrequest method as we did in
b72db1d3321d7a80f4da3f727765bcc200f30278

NOTE: net.inet6.icmp6.nd6_onlink_ns_rfc4861 MUST be on.

Reported-by: aly@
Tested-by: aly@
5 years agomtree(8): Bring in a fix from NetBSD.
Sascha Wildner [Mon, 19 Nov 2018 08:03:02 +0000 (09:03 +0100)]
mtree(8): Bring in a fix from NetBSD.

Thanks for sevan@netbsd for handling upstream.

5 years agoadd subdevice id 0x5260 for iwn 6035 series
Tobias Heilig [Mon, 29 Oct 2018 00:26:31 +0000 (01:26 +0100)]
add subdevice id 0x5260 for iwn 6035 series

5 years agokernel: Add -Wundef to our default kernel warning options.
Sascha Wildner [Sun, 18 Nov 2018 09:05:32 +0000 (10:05 +0100)]
kernel: Add -Wundef to our default kernel warning options.

It will warn when an undefined identifier is evaluated in an "#if"
directive and would be replaced with zero.

After the last such warnings were fixed in September, we can now do
this.

5 years agokernel: Clean up the warning flags a bit.
Sascha Wildner [Sun, 18 Nov 2018 09:02:31 +0000 (10:02 +0100)]
kernel: Clean up the warning flags a bit.

We had both -Winline and -Wno-inline.

5 years agofetch.9: Document fuwordadd{32,64}().
Sascha Wildner [Sat, 17 Nov 2018 20:25:37 +0000 (21:25 +0100)]
fetch.9: Document fuwordadd{32,64}().

5 years agodhcpcd.8: Comment out some info on /dev management.
Sascha Wildner [Sat, 17 Nov 2018 18:42:35 +0000 (19:42 +0100)]
dhcpcd.8: Comment out some info on /dev management.

It is not configured in DragonFly.

While here, fix some trailing whitespace and an .Xr misuse.

5 years agoresolvconf.conf.5: Fix some mandoc warnings.
Sascha Wildner [Sat, 17 Nov 2018 18:47:57 +0000 (19:47 +0100)]
resolvconf.conf.5: Fix some mandoc warnings.

5 years agoRevert "drm/linux: Fix vmap()"
François Tigeot [Sat, 17 Nov 2018 13:41:21 +0000 (14:41 +0100)]
Revert "drm/linux: Fix vmap()"

This reverts commit c9f83a72b5c7c2f29b40b404aa63767b20a7422c.

It introduced instability on Broadwell platforms.

Reported-by: Daniel Bilik
5 years agorc.d/dhcpcd: Fix passing of extra arguments
Aaron LI [Sat, 17 Nov 2018 02:28:22 +0000 (10:28 +0800)]
rc.d/dhcpcd: Fix passing of extra arguments

Before this fix, 'dhcpcd' ignores extra arguments when calling
'run_rc_command()', which causes '/etc/rc.d/dhcpcd restart <ifname>' to
fail.  Fix this issue by passing all arguments to 'run_rc_command()'.

5 years agosshlockout.8: Use a display instead of .Cd in the SYNOPSIS.
Sascha Wildner [Fri, 16 Nov 2018 16:26:01 +0000 (17:26 +0100)]
sshlockout.8: Use a display instead of .Cd in the SYNOPSIS.

.Cd is only for kernel configuration options.

5 years agoAdd "device uether" to various manual pages' synopses.
Sascha Wildner [Fri, 16 Nov 2018 12:15:07 +0000 (13:15 +0100)]
Add "device uether" to various manual pages' synopses.

It is needed to be compiled in.

Reported-by: aly
5 years agorc.d/ip6addrctl: Fix REQUIRE and afexists()
Aaron LI [Fri, 16 Nov 2018 03:01:28 +0000 (11:01 +0800)]
rc.d/ip6addrctl: Fix REQUIRE and afexists()

* DragonFly doesn't has the 'FILESYSTEMS' rc target.

* I forgot to implement the 'afexists()' function when import this.
  However, FreeBSD's 'afexists()' relies 'kern.features.<feature>'
  sysctls to determine whether the address family is supported, but
  DragonFly doesn't allow this.  So come up with a little 'has_inet6()'
  function for this rc script use only.

Reported-by: Thomas Nikolajsen <thomas.nikolajsen@mail.dk>
5 years agoexamples: Fix build
Antonio Huete Jimenez [Thu, 15 Nov 2018 19:39:59 +0000 (20:39 +0100)]
examples: Fix build

- While here hook 'firmware' to the main Makefile

5 years agosyscons - Increase static buffer size for ttyv0.
Imre Vadász [Thu, 15 Nov 2018 12:53:02 +0000 (13:53 +0100)]
syscons - Increase static buffer size for ttyv0.

* This allows the console on the EFI framebuffer to fill the whole screen
  on "odd" resolutions. This only takes up slightly less than 12KB extra
  space in the kernel binary size.

5 years agodrm/ttm: Remove sf_buf usage
François Tigeot [Wed, 14 Nov 2018 18:35:30 +0000 (19:35 +0100)]
drm/ttm: Remove sf_buf usage

* Use Linux memory allocation/mapping functions instead.

* Opportunistically sync some code with Linux

5 years agodrm/linux: Add a few GFP_XXX values
François Tigeot [Wed, 14 Nov 2018 17:42:49 +0000 (18:42 +0100)]
drm/linux: Add a few GFP_XXX values

5 years agorc.d: Introduce 'dhcp_client' to wrap over dhclient and dhcpcd
Aaron LI [Thu, 25 Oct 2018 12:25:03 +0000 (20:25 +0800)]
rc.d: Introduce 'dhcp_client' to wrap over dhclient and dhcpcd

The new 'dhcp_client' rc script is a wrapper to start either dhclient(8)
or dhcpcd(8) based on the value of the 'dhcp_client' rc variable.

Other rc scripts are updated to depend on this wrapper instead of the
explicit 'dhclient'.  This eases the migration from dhclient(8) to
dhcpcd(8) later.

Update rc.conf.5 and dhcp.8 man pages accordingly.

Meanwhile, remove the two obsolete variables 'dhcp_{program,flags}' from
/etc/rc.subr.

5 years agodhcpcd: Add rc script rc.d/dhcpcd
Aaron LI [Fri, 19 Oct 2018 15:28:29 +0000 (23:28 +0800)]
dhcpcd: Add rc script rc.d/dhcpcd

The dhcpcd supports both DHCPv4 and DHCPv6.

5 years agonetwork.subr: Support IPv6 in dhcpif()
Aaron LI [Wed, 14 Nov 2018 09:49:03 +0000 (17:49 +0800)]
network.subr: Support IPv6 in dhcpif()

Extend the 'dhcpif()' to support checking the interface needs DHCP for
IPv4-only, IPv6-only or either.

The 'dhcpcd' rc script in the following commit will use this new feature
to determine whether dhcpcd should do DHCPv4 or DHCPv6 or both.

5 years agonetwork.subr: Add ipv6if()
Aaron LI [Thu, 25 Oct 2018 17:05:20 +0000 (01:05 +0800)]
network.subr: Add ipv6if()

This function determines whether the given interface should be
configured for IPv6.  This function will be used to determine whether to
apply DHCPv6 to an interface in the following commit.

Taken from FreeBSD, but modified to consider ${ipv6_enable}.

5 years agonetwork.subr: Support IPv6 in ifconfig_getargs()
Aaron LI [Thu, 25 Oct 2018 12:11:28 +0000 (20:11 +0800)]
network.subr: Support IPv6 in ifconfig_getargs()

Update the 'ifconfig_getargs()' to accept the address family option
to support the extraction of IPv6 arguments of an interface, which
is configured using 'ipv6_ifconfig_<ifname>="..."'.

Obtained from FreeBSD; but FreeBSD uses 'ifconfig_<ifname>_ipv6'.

5 years agodhcpcd: Add upgrade notes to README.DRAGONFLY
Aaron LI [Fri, 19 Oct 2018 07:34:05 +0000 (15:34 +0800)]
dhcpcd: Add upgrade notes to README.DRAGONFLY

5 years agodhcpcd: Bind to system
Aaron LI [Fri, 19 Oct 2018 07:32:31 +0000 (15:32 +0800)]
dhcpcd: Bind to system

NOTE:
This only makes 'dhcpcd' be built and installed, and doesn't affect the
existing 'dhclient'.

5 years agodhcpcd: Apply local modifications
Aaron LI [Fri, 19 Oct 2018 06:54:55 +0000 (14:54 +0800)]
dhcpcd: Apply local modifications

* The modification to 'src/if.c' makes it can be build with
  '-Werror=implicit-fallthrough', which is enabled with '-Wextra'.
  However, both swildner and I still don't understand why such a
  modification is needed :(

* In 'src/ipv6.c', explicitly suppress the '#warning' on
  IPV6_POLLADDRFLAG, an IPv6 feature that dfly currently doesn't
  support.

5 years agodhcpcd: Generate src/dhcpcd-embedded.[ch]
Aaron LI [Fri, 19 Oct 2018 06:41:10 +0000 (14:41 +0800)]
dhcpcd: Generate src/dhcpcd-embedded.[ch]

$ cd src
$ ./genembedc > dhcpcd-embedded.c
$ ./genembedh > dhcpcd-embedded.h
$ rm genembed[ch] dhcpcd-embedded.[ch].in dhcpcd-definitions.conf

5 years agoMerge branch 'vendor/DHCPCD'
Aaron LI [Wed, 14 Nov 2018 12:51:02 +0000 (20:51 +0800)]
Merge branch 'vendor/DHCPCD'

Import dhcpcd 7.0.8

5 years agodhcpcd: Add READMEs
Aaron LI [Fri, 19 Oct 2018 06:32:39 +0000 (14:32 +0800)]
dhcpcd: Add READMEs

5 years agoImport dhcpcd 7.0.8
Aaron LI [Fri, 19 Oct 2018 06:22:17 +0000 (14:22 +0800)]
Import dhcpcd 7.0.8

Version: 7.0.8
Date: 2018 August 20
URL: https://github.com/rsmarples/dhcpcd/releases
Homepage: https://roy.marples.name/projects/dhcpcd

5 years agokernel - Fix sack NULL pointer dereference
Matthew Dillon [Tue, 13 Nov 2018 19:12:36 +0000 (11:12 -0800)]
kernel - Fix sack NULL pointer dereference

* sack_block_lookup() can get confused when the passed-in sequence
  number appears to be less than sblk_start and greater than sblk_end.
  This situation can occur when the signed integer delta test has an
  overflow due to (sblk_end - seq) overflowing the sign bit verses
  (sblk_start - seq).

  The result is that sack_block_lookup() can crash on a NULL pointer
  indirection.

* Check for the case, complain, and try to allow it.  Though I suspect
  if the case occurs at all SACK will wind up with a broken list anyway.

* I don't think this case can occur under normal conditions since TCP
  buffers do not grow to 2GB+ in size, so the crash we got was triggered
  by either an accidently malformed packet or an intentional one.

5 years agokernel - Fix SMP race in procfs
Matthew Dillon [Tue, 13 Nov 2018 19:10:47 +0000 (11:10 -0800)]
kernel - Fix SMP race in procfs

* procfs was not locking its pid hash table.  Implement a per-slot
  spinlock.  The hash is populated only for pid directories that are
  pushed into (e.g. ls /proc/<pid> vs ls /proc).

* Fixes a fairly rare crash that can only occur when procfs is used
  heavily.

5 years agodrm/ttm: Sync ttm_execbuf_util.c with Linux
François Tigeot [Sun, 11 Nov 2018 08:18:03 +0000 (09:18 +0100)]
drm/ttm: Sync ttm_execbuf_util.c with Linux

5 years agodrm/ttm: Sync ttm_lock.c with Linux
François Tigeot [Sat, 10 Nov 2018 08:31:20 +0000 (09:31 +0100)]
drm/ttm: Sync ttm_lock.c with Linux

5 years agoterminfo: Build and install tmux and tmux-256color
Aaron LI [Sat, 10 Nov 2018 01:08:23 +0000 (09:08 +0800)]
terminfo: Build and install tmux and tmux-256color

5 years agodrm/linux: Add send_sig()
François Tigeot [Fri, 9 Nov 2018 17:34:19 +0000 (18:34 +0100)]
drm/linux: Add send_sig()

5 years agorc.conf.5: Document ip6addrctl_{policy,verbose} explicitly
Aaron LI [Thu, 8 Nov 2018 01:13:04 +0000 (09:13 +0800)]
rc.conf.5: Document ip6addrctl_{policy,verbose} explicitly

Suggested-by: swildner
5 years agodrm/ttm: Rework ttm_io_prot()
François Tigeot [Wed, 7 Nov 2018 22:18:51 +0000 (23:18 +0100)]
drm/ttm: Rework ttm_io_prot()

Change it to be as close to the Linux version as possible.

5 years agokernel - Fix typo from b227f3f50d5dc0f when filling in kpmap header.
Imre Vadász [Tue, 6 Nov 2018 19:52:36 +0000 (20:52 +0100)]
kernel - Fix typo from b227f3f50d5dc0f when filling in kpmap header.

5 years agocrypto - Avoid including opensslconf.h when using openssl/md5.h in kernel.
Imre Vadász [Mon, 5 Nov 2018 22:14:40 +0000 (23:14 +0100)]
crypto - Avoid including opensslconf.h when using openssl/md5.h in kernel.

5 years agokernel - Make the wdog.h and gpio.h includes conditional in kern_shutdown.c.
Imre Vadász [Mon, 5 Nov 2018 22:13:00 +0000 (23:13 +0100)]
kernel - Make the wdog.h and gpio.h includes conditional in kern_shutdown.c.

5 years agokernel - Fix build when neither INET nor INET6 options are set.
Imre Vadász [Sat, 3 Nov 2018 19:51:06 +0000 (20:51 +0100)]
kernel - Fix build when neither INET nor INET6 options are set.

5 years agodrm/linux: fix pgprot_xxx functions
François Tigeot [Tue, 6 Nov 2018 17:32:51 +0000 (18:32 +0100)]
drm/linux: fix pgprot_xxx functions

5 years agorc.d/Makefile: Break some long lines, sort dntpd.
Sascha Wildner [Tue, 6 Nov 2018 04:28:07 +0000 (05:28 +0100)]
rc.d/Makefile: Break some long lines, sort dntpd.

5 years agodrm/linux: Fix vmap()
François Tigeot [Mon, 5 Nov 2018 21:15:18 +0000 (22:15 +0100)]
drm/linux: Fix vmap()

Page protection information was not being used.

5 years agorc.subr: Add list_vars() function
Aaron LI [Mon, 5 Nov 2018 20:31:38 +0000 (04:31 +0800)]
rc.subr: Add list_vars() function

Taken-from: FreeBSD

5 years agorc.d: Add ip6addrctl (enabled by default with policy AUTO)
Aaron LI [Mon, 5 Nov 2018 20:25:17 +0000 (04:25 +0800)]
rc.d: Add ip6addrctl (enabled by default with policy AUTO)

Bring in the ip6addrctl rc script from FreeBSD.  It is enabled by
default with policy "AUTO", so the IPv4/IP6 preference is configured on
startup.  The rc variable "ip6addrctl_policy" is used to adjust the
preference (AUTO, ipv6_prefer, ipv6_prefer).

See the rc.conf(5) man page for more details.

5 years agoBring in ip6addrctl(8) from FreeBSD
Aaron LI [Mon, 5 Nov 2018 19:22:15 +0000 (03:22 +0800)]
Bring in ip6addrctl(8) from FreeBSD

The ip6addrctl(8) manages the policy table of source and destination
address selection for ougoing IPv4 and IPv6 packets.

For example, this utility can be used to configure that IPv4 is
preferred on a dual-stack machine, which by default prefers IPv6.

5 years agolibc/mktemp: Pass flags to open()
Simon Arlott [Sat, 3 Nov 2018 20:08:07 +0000 (20:08 +0000)]
libc/mktemp: Pass flags to open()

The flags from the functions that call _gettemp() are never used.

They should be included in the call to open(), otherwise features like
O_CLOEXEC don't work.

aly:
(1) Checked FreeBSD and it behaves the same way as this fix.
(2) Improve the style a bit.

5 years agonet/if: Call if_ioctl() if the protocol didn't handle the ioctl
Aaron LI [Sun, 4 Nov 2018 09:55:53 +0000 (17:55 +0800)]
net/if: Call if_ioctl() if the protocol didn't handle the ioctl

This allows for a non-interface socket (like AF_LOCAL which ifconfig(8)
now uses since commit d4e856128472e2e79172aebf65f19f527ac0010f) to use
a broader class of interface ioctls.

This fixes the regression in ifconfig(8) that is introduced by the above
mentioned commit, which changed ifconfig(8) to use AF_LOCAL socket by
default and thus caused some ioctls failures.  For example:

dfly# ifconfig tap0 create
dfly# ifconfig tap0 up
dfly# ifconfig bridge0 create
dfly# ifconfig bridge0 addm tap0

[before]
dfly# ifconfig bridge0
bridge0: flags=8002<BROADCAST,MULTICAST> mtu 1500
        ether be:48:6d:6d:a6:1f
        groups: bridge

[after]
dfly# ifconfig bridge0
bridge0: flags=8002<BROADCAST,MULTICAST> mtu 1500
        ether be:48:6d:6d:a6:1f
        priority 32768 hellotime 2 fwddelay 15 maxage 20
        member: tap0 flags=3<LEARNING,DISCOVER>
        groups: bridge

Do not pass the SIOCSIF{ADDR,BRDADDR,DSTADDR,NETMASK} iotcls to the
drivers because they may assume these ioctls come from an already
privileged layer and thus skip credentials check and input validation.

While there, improve a NULL check.

Taken-from: FreeBSD (r190151, r255442)
Reviewed-by: dillon, sephe
5 years agoboot - Slow down the nfs twiddle
Matthew Dillon [Sun, 4 Nov 2018 06:55:49 +0000 (23:55 -0700)]
boot - Slow down the nfs twiddle

* Slow down the twiddle rate when reading via nfs, it unnecessarily
  slows down the boot, by a lot.

5 years agodrm/ttm: Remove ttm_bo_unreserve_core()
François Tigeot [Sat, 3 Nov 2018 14:18:38 +0000 (15:18 +0100)]
drm/ttm: Remove ttm_bo_unreserve_core()

* This function was DragonFly-specific and apparently
  isn't even needed anymore

* Sync the changed code with Linux as of ecff665f5e3f1c6909353e00b9420e45ae23d995
  "drm/ttm: make ttm reservation calls behave like reservation calls"

5 years agodrm: Add linux/rwlock.h
François Tigeot [Sat, 3 Nov 2018 13:07:50 +0000 (14:07 +0100)]
drm: Add linux/rwlock.h