Commit Graph

18487 Commits

Author SHA1 Message Date
Warner Losh
7047dceee3 Remove sparc64 ifdef
Now we default to setting the hardware clock to UTC
everywhere. sparc64 was the old odd-man out before.

Reivewed by: cy@, bcr@
Differential Revision: https://reviews.freebsd.org/D23593
2020-02-10 17:16:41 +00:00
Warner Losh
d2299c69ff Remove sparc64 example.
Reivewed by: cy@, bcr@
Differential Revision: https://reviews.freebsd.org/D23593
2020-02-10 17:16:26 +00:00
Kyle Evans
1709a13c7c cron(8): rip out do_univ
This was an old Dynix hack, the function is a NOP on FreeBSD. We have no
need to retain this; Dynix was discontinued long ago.
2020-02-10 02:44:29 +00:00
Kyle Evans
9b36723388 cron(8): convert vfork() usage to fork()
vfork() is error-prone, and the usage here definitely grew to not be
clearly OK given vfork-semantics; e.g. setusercontext(3) within the child.

Rip out vfork() and the rest of the references to it. fork is heavier, but
it's unclear that the difference will be all that obvious.

Reported by:	Andrew Gierth and sigsys@gmail.com
2020-02-10 02:40:23 +00:00
Ed Maste
5aa0576b33 Miscellaneous typo fixes
Submitted by:	Gordon Bergling <gbergling_gmail.com>
Differential Revision:	https://reviews.freebsd.org/D23453
2020-02-07 19:53:07 +00:00
Scott Long
69e85eb8ae Advertise the MPI Message Version that's contained in the IOCFacts message
in the sysctl block for the driver.  mpsutil/mprutil needs this so it can
know how big of a buffer to allocate when requesting the IOCFacts from the
controller.  This eliminates the kernel console messages about wrong
allocation sizes.

Reported by:	imp
2020-02-07 12:15:39 +00:00
Scott Long
b041593ae7 Touch up some of the iocfacts fields 2020-02-07 11:48:26 +00:00
Mateusz Piotrowski
89be2c1ee3 Improve documentation of bootconfig and PARTITIONS
- Mention bootconfig target in TARGETS section.
- Document PARTITIONS variable, which is only mentioned in the examples,
  but doesn't have its own point.

Submitted by:	arrowd@
Reviewed by:	bcr
Approved by:	bcr (mentor)
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D22927
2020-02-06 20:18:45 +00:00
Pedro F. Giffuni
9d529ed898 fstyp: sync HAMMER1/2 detection support with DragonFly BSD.
Submitted by:	Tomohiro Kusumi
PR:		243929
2020-02-06 18:04:15 +00:00
Luca Pizzamiglio
19bb4570ea mixer: call the cleanup function in a test
The set_empty_value test has a cleanup function, but is not called.
Fix it

Reviewed by:	0mp
Approved by:	kp
Differential Revision:	https://reviews.freebsd.org/D23498
2020-02-06 14:31:29 +00:00
Kyle Evans
7466dbd684 cron(8): set the environment variables of the user and/or login class
Prior to processing environment variable set in the crontab file as those
should be of higher precedent, pull in the user or login class environment.

This is another supporting feature for allowing one to configure system-wide
settings that may affect both regular cron jobs as well as services.

This is the final part of D21481.

Submitted by:	Andrew Gierth <andrew_tao173.riddles.org.uk>
2020-02-05 04:35:54 +00:00
Kyle Evans
736a5a6d1d service(8): set the environment of the "daemon" class before invoking
As mentioned in r357562, this gives the user a single place to configure
environment variables that need to be used for various services -- the
"daemon" class -- for, e.g., configuring a system-wide HTTP proxy.

This is a part of D21481.

Submitted by:	Andrew Gierth <andrew_tao173.riddles.org.uk>
2020-02-05 04:32:49 +00:00
Kyle Evans
504613f246 Remove simple_httpd
simple_httpd was granted a reprieve from the picobsd removal based on having
some reported user; it turns out this user isn't actually using the version
in base and merging their changes would be difficult at this point, so the
version in base will simply continue to rot. Retire it now, it may make a
comeback to ports with the improved version.

No notice issued because its current visibility has only been for ~3
months, and a notice has been previously issued about picobsd removal.
2020-02-04 21:27:39 +00:00
Pedro F. Giffuni
1cbd36ae1f services: Add PROFInet and EtherCAT.
Both are used in industrial networks.

MFC after:	1 week
2020-01-31 18:55:21 +00:00
Dimitry Andric
31868fab28 Merge r357339 from the clang1000-import branch:
Fix the following -Werror warning from clang 10.0.0 in bsnmpd:

usr.sbin/bsnmpd/modules/snmp_pf/pf_snmp.c:1661:4: error: misleading indentation; statement is not part of the previous 'else' [-Werror,-Wmisleading-indentation]
                        return (-1);
                        ^
usr.sbin/bsnmpd/modules/snmp_pf/pf_snmp.c:1658:5: note: previous statement is here
                } else
                  ^

The intent was to group the return statement with the previous syslog()
call.

MFC after:	3 days
2020-01-31 18:13:00 +00:00
Dimitry Andric
303c0aad7d Fix the following -Werror warning from clang 10.0.0 in bsnmpd:
usr.sbin/bsnmpd/modules/snmp_pf/pf_snmp.c:1661:4: error: misleading indentation; statement is not part of the previous 'else' [-Werror,-Wmisleading-indentation]
                        return (-1);
                        ^
usr.sbin/bsnmpd/modules/snmp_pf/pf_snmp.c:1658:5: note: previous statement is here
                } else
                  ^

The intent was to group the return statement with the previous syslog()
call.

MFC after:	3 days
2020-01-31 18:09:27 +00:00
Brooks Davis
10dd04d39f Fix an indentation bug in r357169. 2020-01-30 18:34:08 +00:00
Dimitry Andric
3fd49cf90e Fix the following -Werror warning from clang 10.0.0 in bsnmpd:
usr.sbin/bsnmpd/modules/snmp_bridge/bridge_port.c:1235:43: error: overlapping comparisons always evaluate to true [-Werror,-Wtautological-overlap-compare]
                            begemotBridgeStpPortEnable_enabled ||
                            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~

Work around it by casting the enum values to the type of val->v.integer.

MFC after:	3 days
2020-01-29 21:40:35 +00:00
Conrad Meyer
446bb222fb ypldap(8): Fix absent va_end() in 'goto fail' path
In this path, we used va_start() without pairing it with va_end().  Add the
va_end().  (va_start() without paired va_end() is undefined behavior per the C
standard.)

"In many implementations, [va_end] is a do-nothing operation; but those
implementations that need it probably need it badly." - Rationale for the ANSI
C Programming Language, § 4.8.1.3.

Reported by:	Coverity
CID:		1340539
2020-01-29 05:59:22 +00:00
Ben Woods
595373dd64 bsdinstall: Provide help text for partitioning options
Includes commentary of when ZFS works well by default (>= 8GB RAM),
and where to go for information on ZFS tuning if required.

Also hoist the options text to the top of script as variables
(will help with future international translations).

Reviewed by:	philip, dteske, karels, imp, emaste
Approved by:	rgrimes
Differential Revision:	https://reviews.freebsd.org/D23224
2020-01-27 22:45:49 +00:00
Alex Richardson
162ae9c834 Allow bootstrapping makefs on older FreeBSD hosts and Linux/macOS
In order to do so we need to install the msdosfs headers to the bootstrap
sysroot and avoid includes of kernel headers that may not exist on every
host (e.g. sys/lockmgr.h). This change should allow bootstrapping of makefs
on FreeBSD 11+ as well as Linux and macOS.

We also have to avoid using the IO_SYNC macro since that may not be
available. In makefs it is only used to switch between calling
bwrite() and bdwrite() which both call the same function. Therefore we
can simply always call bwrite().

For our CheriBSD builds we always bootstrap makefs by setting
LOCAL_XTOOL_DIRS='lib/libnetbsd usr.sbin/makefs' and use the makefs binary
from the build tree to create a bootable disk image.

Reviewed By:	brooks
Differential Revision: https://reviews.freebsd.org/D23201
2020-01-27 12:02:41 +00:00
Adrian Chadd
ab95087a0e [ntp] Don't compile in the ssl routines into libevent if MK_OPENSSL is no
Most of ntpd still handles MK_OPENSSL ok, but the libevent import brought
in the SSL bufferevent routines without checking MK_OPENSSL.

This doesn't completely fix WITHOUT_CRYPTO=YES building, but hey, it's one
less broken thing.
2020-01-24 06:24:40 +00:00
Cy Schubert
5a00480bb9 Fix build when WITHOUT_WPA_SUPPLICANT_EAPOL option used.
The build failure was discoved by Michael Dexter's recent Build Options
Survey run, at https://callfortesting.org/results/bos-2020-01-16/\
WITHOUT_WPA_SUPPLICANT_EAPOL-small.txt.

Reported by:	Michael Dexter <editor@callfortesting.org> via emaste
MFC after:	2 weeks
2020-01-21 20:21:52 +00:00
Ben Woods
2d482628aa Fix regression in bsdinstall post r356740 - partedit errno(2) 21 EISDIR
This resulted in the partitioning step failing if either of the
"Auto (UFS)" or "Manual" options were selected.

Reason: partedit was attempting to open a directory (TMPDIR) read/write,
which resulted in errno(2) 21 - EISDIR - Is a directory.

Reported by:	Clay Daniels <clay.daniels.jr@gmail.com>
Reviewed by:	Ryan Moeller <ryan@freqlabs.com>
Approved by:	emaste, bcran
Differential Revision:	https://reviews.freebsd.org/D23232
2020-01-17 22:26:41 +00:00
Kristof Provost
d8ffc21c5c Fix pfdenied not returning any results
When _a is empty we end up with an invalid invocation of pfctl, and no output.
We must add quotes to make it clear to pfctl that we're passing an empty anchor
name.

PR:		224415
Submitted by:	sigsys AT gmail.com
MFC after:	2 weeks
2020-01-16 22:08:05 +00:00
Alan Somers
1137d1a7e5 setextattr: Increase stdin buffer size to 4096
Extended attribute values can potentially be quite large. One test for ZFS
is supposed to set a 200MB xattr. However, the buffer size for reading
values from stdin with setextattr -i is so small that the test times out
waiting for tiny chunks of data to be buffered and appended to an sbuf.

Increasing the buffer size should help alleviate some of the burden of
reallocating larger sbufs when writing large extended attributes.

Submitted by:	Ryan Moeller <ryan@freqlabs.com>
MFC after:	2 weeks
Sponsored by:	iXsystems, Inc.
Differential Revision:	https://reviews.freebsd.org/D23211
2020-01-16 21:31:56 +00:00
Scott Long
92471f7ab7 Fix a spacing error from the previous commit for -ll mode. Add a little
more space padding to that mode to give the columns a consistent offset.
2020-01-15 16:47:44 +00:00
Ben Woods
d512033e2a bsdinstall: Change "default" (first) Partitioning method to ZFS
Reported by:	Ruben Schade (during his talk at linux.conf.au)
Approved by:	philip
Differential Revision:	https://reviews.freebsd.org/D23173
2020-01-15 07:47:52 +00:00
Rebecca Cran
a107ddbb83 bsdinstall: Use TMPDIR if set
Submitted by:	Ryan Moeller <ryan@freqlabs.com>
Reviewed by:	bcran, Nick Wolff <darkfiberiru@gmail.com>
Differential Revision:	https://reviews.freebsd.org/D22979/
2020-01-15 00:45:05 +00:00
Eric van Gyzen
5a12815327 fstyp hammer2: remove dead code
best_i will always be >= 0, so remove code to test otherwise.

Reported by:	Coverity
CID:		1412244
MFC after:	2 weeks
Sponsored by:	Dell EMC Isilon
Differential Revision:	https://reviews.freebsd.org/D23159
2020-01-13 22:36:29 +00:00
Eric van Gyzen
0ab52bd3eb fstyp hammer: use strlcpy
Use strlcpy to guarantee NUL termination.  Due to this, there is
no need for strncmp; simply use strcmp.

Reported by:	Coverity
CID:		1412242
MFC after:	2 weeks
Sponsored by:	Dell EMC Isilon
Differential Revision:	https://reviews.freebsd.org/D23159
2020-01-13 22:33:48 +00:00
Cy Schubert
6692aa840c Unbound's config.h is manually maintained, using a ./configure produced
config.h as a guide. In practice contributed software maintains a copy
of config.h within its build directory tree containing its Makefile.
usr.sbin/unbound is the home for its config.h.

MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D22983
2020-01-13 06:55:31 +00:00
Kyle Evans
6486ccfe2f camdd: initialize devs earlier
GCC9 points out that devs may be used initialized after the bailout label;
in-fact, if num_io_opts != 2 then it is. Move the initialization up a little
bit.

Reviewed by:	ken
MFC after:	3 days
2020-01-10 22:20:23 +00:00
Kyle Evans
525c896ba8 inetd: two more nits
Use __COPYRIGHT for copyright to simply either embed it via .ident or have
it properly marked __unused

Move an ipsec reference to IPSEC
2020-01-10 14:43:57 +00:00
Kyle Evans
36cac5570f inetd: free WITHOUT_INET6_SUPPORT build of warnings
If inetd is compiled without inet6 support, we need to error out on
rpc+inet6 services rather than attempting to call into rpc bits with an
uninitialized netid.

v4bind is only used with INET6 support, so move it under the proper #ifdefs
with v6bind.

Reported by:	Pavel Timofeev <timp87 gmail com>
MFC after:	3 days
2020-01-10 14:40:04 +00:00
Eugene Grosbein
693d381624 arp(8): avoid segfaulting due to out-of-bounds memory access
Fix obvious mistake that sometimes results in reading memory
past end of an array.

PR:		240825
MFC after:	1 week
2020-01-09 11:58:26 +00:00
Vincenzo Maffione
332eff95e3 bhyve: add wrapper for debug printf statements
Add printf() wrapper to use CR/CRLF terminators depending on whether
stdio is mapped to a tty open in raw mode.
Try to use the wrapper everywhere.
For now we leave the custom DPRINTF/WPRINTF defined by device
models, but we may remove them in the future.

Reviewed by:	grehan, jhb
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D22657
2020-01-08 22:55:22 +00:00
Maxim Konovalov
4a3c7e6718 o Spell "Redundancy" and "Remember" correctly.
PR:		243187
Submitted by:	mikael.urankar@gmail.com (partially)
2020-01-08 14:01:15 +00:00
Ed Maste
9a3e2f583f inetd: fix WITHOUT_TCP_WRAPPERS build after r356248
After increasing WARNS, building WITHOUT_TCP_WRAPPERS failed because of
some unused variables.

Reported by:	Cirrus-CI (against my WIP branch)
MFC with:	r356248
Sponsored by:	The FreeBSD Foundation
2020-01-03 15:29:32 +00:00
Scott Long
eb51967b50 Add a compact columnar output format, available by specifying a second '-l'
command line option.  Thanks to the removal of unnecessary information and
the organization into columns, this helps the output be more legible on
both 80 column displays and non-80 column displays.  imp@ provided the
idea on this.
2020-01-02 06:56:28 +00:00
Kyle Evans
705d79b4bd inetd: final round of trivial cleanup, NFC
Highlights:
- Use MAX() for maxsock raising; small readability improvement IMO
- malloc(3) + memset(3) -> calloc(3) where appropriate
- stop casting the return value of malloc(3)
- mallloc(3) -> reallocarray(3) where appropriate

A future change may enter capability mode when forking for some of the
built-in handlers.
2020-01-01 18:49:57 +00:00
Kyle Evans
c8863d0590 inetd: convert remaining bzero(3) to memset(3), NFC
This change is purely in the name of noise reduction from static analyzers
that want to complain that bzero(3) is obsolete in favor of memset(3).

With this, clang-analyze at least is now noise free. WARNS= 6 also appears
to have been OK for some time now, so drop the current setting and opt for
the default.
2020-01-01 04:29:08 +00:00
Kyle Evans
c53b0f40f3 inetd: track all child pids, regardless of maxchild spec
Currently, child pids are only tracked if maxchildren is specified. As a
consequence, without a maxchild limit we do not get a notice in syslog on
children aborting abnormally. This turns out to be a great debugging aide at
times.

Children are now tracked in a LIST; the management interface is decidedly
less painful when there's no upper bound on the number of entries we may
have at the cost of one small allocation per connection.

PR:		70335
2020-01-01 04:22:04 +00:00
Kyle Evans
d6272fce7c inetd: add some macros for checking child limits, NFC
The main point here is capturing the maxchild > 0 check. A future change to
inetd will start tracking all of the child pids so that it can give proper
and consistent notification of process exit/signalling.
2020-01-01 03:59:54 +00:00
Kyle Evans
a1cedb80c6 inetd: prefer strlcpy to strlen(3) check + strcpy(3), NFC
This is again functionally equivalent but more concise.
2019-12-31 04:53:50 +00:00
Kyle Evans
1c3b9acf2e inetd: prefer strtonum(3) to strspn(3)+atoi(3), NFC
strtonum(3) does effectively the same validation as we had, but it's more
concise.
2019-12-31 04:36:14 +00:00
Kyle Evans
f23df31975 inetd: knock out some clang analyze warnings
chargen_dg: clang-analyze is convinced that endring could be non-NULL at
entry, and thus wants to assume that rs == NULL. Just independently
initialize rs if it's NULL to appease the analyzer.

getconfigent: policy leaks on return

free_connlist: reorganize the loop to make it clear that we're not going to
access `conn` after it's been freed.

cpmip/hashval: left-shifts performed will result in UB as we take
signed 0xABC3D20F and left shift it by 5.
2019-12-31 04:00:24 +00:00
Kyle Evans
f930f30f60 inetd: don't leak policy on return
sep->se_policy gets a strdup'd version of policy, so we don't need it to
stick around afterwards.

While here, remove a couple of NULL checks prior to free(policy).

CID:		1006865
MFC after:	3 days
2019-12-30 15:54:36 +00:00
Mark Johnston
2a73387f1c powerd(8): Fix a memory leak when we fail to read frequency levels.
PR:		242967
Submitted by:	Hans Christian Woithe <chwoithe@yahoo.com>
MFC after:	3 days
2019-12-29 20:57:49 +00:00
Adrian Chadd
350bfebba9 Make this compile under external gcc toolchain if WITH_ICONV isn't defined.
This quietens a bunch of unused variable warnings that are treated as errors.
2019-12-29 06:59:09 +00:00
Hans Petter Selasky
fa6d8b65d3 Implement dump_stats command for usbconfig(8).
This command is useful when debugging USB device issues.

MFC after:	1 week
Sponsored by:	Mellanox Technologies
2019-12-27 20:37:14 +00:00
Kyle Evans
6795e26b8a cron(8): use proper variable to determine mailer process status
While the mailer is normally opened/set if the mailto is set, this is not
the case if the grandchild actually didn't produce any output. This change
corrects the situation to only attempt to kill/close the mail process if it
was actually opened in the first place.

The reporter initially stumbled on the -n (suppress mail on success) flag
leading to a SIGKILL of the process group, but simultaneously
discovered/reported the behavior with !-n jobs if MAILTO was set and no
output happened.

All of these places that are checking mailto should actually be checking
whether mail is set, so do that for consistency+correctness.

This set of bugs were introduced by r352668.

Submitted by:	sigsys@gmail.com
Reported by:	sigsys@gmail.com
2019-12-26 22:49:19 +00:00
Pedro F. Giffuni
509798ea65 sbin/fstyp: recgonize Dragonfly's hammer and hammer2.
This is based on DragonFly's implementation from about 2019-09-13. It
only contains the basic code and header information to identify the
disks.

Relnotes:		yes
Differential Revision:	https://reviews.freebsd.org/D13369
2019-12-24 19:00:20 +00:00
Conrad Meyer
5ab1cb52b2 fstyp(8): Fix WITHOUT_ICONV build
Reported by:	olivier
2019-12-23 20:23:02 +00:00
Conrad Meyer
e41d62768d fstyp(8): Detect APFS containers
APFS NXSBs are more like slices (or zvols?) than individual filesystem,
but go ahead and detect them nicely as well.
2019-12-23 05:43:18 +00:00
Conrad Meyer
50c59bbb53 fstyp(8): Detect HFS+ / HFSX volumes 2019-12-23 05:43:01 +00:00
Conrad Meyer
ec80d2eedd fstyp(8): Use iconv(3) to convert NTFS vol labels correctly
Rather than hackily extracting only the ASCII subset of UTF-16LE, go ahead
and convert the label to the user's locale correctly.
2019-12-23 02:41:13 +00:00
Conrad Meyer
85b4c344c8 fstyp(8): Show exFAT volume labels with -l flag
exfat is fundamentally the same design as fat32.  The superblock differs
marginally, and there are some additional optional features irrelevant to
fstype(8); the structure of dirents has changed slightly to enable, among
other things, larger files; the directory entries are no longer DOS 8.3
ASCII or local 8-bit encoding, but instead explicitly UCS-2-LE.

(As a result, this change uses iconv to convert a found exfat volume label
to the user's locale.)

Locating the volume label is identical to FAT32: locate the root directory
and walk through dirents until you find a volume label.  Like FAT32, follow
the FAT chain between root directory clusters as necessary.

PR:		242225
Reported by:	Victor Sudakov <vas AT sibptus.ru>
2019-12-22 03:19:17 +00:00
Rick Macklem
9449898858 Update the man page to reflect the addition of NFSv4.2 (r355677).
Update all the references to NFSv4.1, so that they apply to NFSv4.1 and
NFSv4.2. Also, change the MDS->DS mounts to use NFSv4.2, so that both
versions of the protocol can be used against the server with pNFS enabled.

This is a content change.
2019-12-20 21:45:20 +00:00
Rick Macklem
452588d3e5 Update the man page to reflect the addition of NFSv4.2 (r355677).
Include references to NFSv4.2 and Flexible File layout, plus clarify
when vfs.nfsd.flexlinuxhack needs to be set for Linux pNFS clients.
Also update the man page to reflect the addition of SpaceUsed to the
attributes stored in the extended attribute on the MDS (r354158).

This is a content change.
2019-12-20 21:41:33 +00:00
Rick Macklem
fa40c59d21 Update the man page to reflect the addition of NFSv4.2 (r355677).
Include references to NFSv4.2 and associated RFCs and note new features
present in NFSv4.2.

This is a content change.
2019-12-20 21:31:08 +00:00
Rick Macklem
1fd129c9ff Update the man page to reflect the addition of NFSv4.2 (r355677).
Include references to NFSv4.2 and associated RFCs.
Also clarify when a Linux client needs to set vfs.nfsd.flexlinuxhack if
a pNFS server is in use.

This is a content change.
2019-12-20 21:25:51 +00:00
John Baldwin
9b078661c4 Trim a spurious carriage return from the RFB signature string added in r355301.
Submitted by:	Yamagi <lists@yamagi.org>
2019-12-19 15:36:00 +00:00
Warner Losh
6ee8575cd7 Remove all the RELEASE_CRUNCH defines, they are useless.
RELEASE_CRUNCH has been broken for a very long time. Remove the
last remants from the tree.
2019-12-16 21:06:24 +00:00
Edward Tomasz Napierala
8ad16e5541 Add 'sesutil show' subcommand to show enclosure and its contents
in a user-friendly way.

Reviewed by:	allanjude, bcr (manpages)
MFC after:	2 weeks
Relnotes:	yes
Sponsored by:	Klara Inc.
Differential Revision:	https://reviews.freebsd.org/D22567
2019-12-14 10:58:06 +00:00
Scott Long
97faa4c470 Add accessors for the Vendor Specific Extended Capability (VSEC)
Parse out the VSEC.  If the user invokes a second -c command line option,
do a hex dump of the vendor data.

Reviewed by:	imp
MFC after:	3 days
Sponsored by:	Intel
Differential Revision:	http://reviews.freebsd.org/D22808
2019-12-13 23:46:59 +00:00
John Baldwin
cbd03a9df2 Support software breakpoints in the debug server on Intel CPUs.
- Allow the userland hypervisor to intercept breakpoint exceptions
  (BP#) in the guest.  A new capability (VM_CAP_BPT_EXIT) is used to
  enable this feature.  These exceptions are reported to userland via
  a new VM_EXITCODE_BPT that includes the length of the original
  breakpoint instruction.  If userland wishes to pass the exception
  through to the guest, it must be explicitly re-injected via
  vm_inject_exception().

- Export VMCS_ENTRY_INST_LENGTH as a VM_REG_GUEST_ENTRY_INST_LENGTH
  pseudo-register.  Injecting a BP# on Intel requires setting this to
  the length of the breakpoint instruction.  AMD SVM currently ignores
  writes to this register (but reports success) and fails to read it.

- Rework the per-vCPU state tracked by the debug server.  Rather than
  a single 'stepping_vcpu' global, add a structure for each vCPU that
  tracks state about that vCPU ('stepping', 'stepped', and
  'hit_swbreak').  A global 'stopped_vcpu' tracks which vCPU is
  currently reporting an event.  Event handlers for MTRAP and
  breakpoint exits loop until the associated event is reported to the
  debugger.

  Breakpoint events are discarded if the breakpoint is not present
  when a vCPU resumes in the breakpoint handler to retry submitting
  the breakpoint event.

- Maintain a linked-list of active breakpoints in response to the GDB
  'Z0' and 'z0' packets.

Reviewed by:	markj (earlier version)
MFC after:	2 months
Differential Revision:	https://reviews.freebsd.org/D20309
2019-12-13 19:21:58 +00:00
Conrad Meyer
15da83398e ntpd(8): Don't use OpenSSL's RAND API
The !USE_OPENSSL_CRYPTO_RAND path uses arc4random_buf() correctly.

In general, we should prefer to avoid things OpenSSL does poorly when a good
alternative exists in libc.
2019-12-13 05:54:38 +00:00
Conrad Meyer
6425a52feb keyserv(8): unifdef out __FreeBSD__ and KEYSERV_RANDOM
This doesn't appear to have some active upstream (and it's a steaming pile of
bad 90s crypto design).  Rip out the completely horrible bits and leave the
only mildly less horrible bits.  The whole thing should probably be deleted; to
the extent it purports to provide a security feature: it doesn't.
2019-12-13 04:03:05 +00:00
John Baldwin
976ba8c6b2 Document that the debug server supports writing to guest memory.
This was added in r348212.
2019-12-13 02:18:44 +00:00
John Baldwin
dd58314395 Fix a mismerge in r355683 and remove the local gdb_port from main. 2019-12-13 02:15:34 +00:00
John Baldwin
cd333f156c Don't call into the debug server if it isn't configured.
Reviewed by:	markj (as part of a larger diff)
MFC after:	1 month
Differential Revision:	https://reviews.freebsd.org/D20309
2019-12-13 01:17:20 +00:00
Kyle Evans
5bff36fe81 usr.sbin/ntp: don't emit versions w/ make -s
<sys.mk> defines ECHO=echo when not using make -s, and ECHO=true when using
make -s.

export ECHO for ntp products and use it in the mkver script to echo the
version. This suppresses the output as appropriate. ECHO is given a default
value to make sure things still work as expected for anyone that isn't
redefining ECHO.

Reviewed by:	cy
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D22101
2019-12-12 01:33:45 +00:00
John Baldwin
c7ba149dba Emulate reads of the PCI command register for passthrough devices.
VFs return zero for the memory enable bit even if it has been set by a
prior write.  After r348779 this caused the annoying behavior that a
guest OS would unintentionally disable memory decoding on a future
read-modify-write operation on the command register.  Instead, return
the shadow value of the command register for reads.  This ensures that
the guest will only toggle the state of the memory enable bit when it
specifically intends to do so.

MFC after:	2 weeks
Sponsored by:	Chelsio Communications
2019-12-11 23:41:39 +00:00
Simon J. Gerraty
2c9a9dfc18 Update Makefile.depend files
Update a bunch of Makefile.depend files as
a result of adding Makefile.depend.options files

Reviewed by:	 bdrewery
MFC after:	1 week
Sponsored by:   Juniper Networks
Differential Revision:  https://reviews.freebsd.org/D22494
2019-12-11 17:37:53 +00:00
Simon J. Gerraty
5ab1c5846f Add Makefile.depend.options
Leaf directories that have dependencies impacted
by options need a Makefile.depend.options file
to avoid churn in Makefile.depend

DIRDEPS for cases such as OPENSSL, TCP_WRAPPERS etc
can be set in local.dirdeps-options.mk
which can add to those set in Makefile.depend.options

See share/mk/dirdeps-options.mk

Reviewed by:	 bdrewery
MFC after:	1 week
Sponsored by:   Juniper Networks
Differential Revision:  https://reviews.freebsd.org/D22469
2019-12-11 17:37:37 +00:00
Ed Maste
29f64e28ba kbdmap: allow INDEX.keymaps to provide the dialog title
Previously kbdmap had a localized menu heading ("Choose your keyboard
layout") but not the dialog title ("Keyboard Menu").

MFC after:	2 weeks
Sponsored by:	The FreeBSD Foundation
2019-12-11 17:19:36 +00:00
Warner Losh
f86e60008b Regularize my copyright notice
o Remove All Rights Reserved from my notices
o imp@FreeBSD.org everywhere
o regularize punctiation, eliminate date ranges
o Make sure that it's clear that I don't claim All Rights reserved by listing
  All Rights Reserved on same line as other copyright holders (but not
  me). Other such holders are also listed last where it's clear.
2019-12-04 16:56:11 +00:00
Cy Schubert
d48778bb2a Chase r352304. The default rlimit memlock is no memory locking.
Reported by:	egypcio@
MFC after:	3 days
2019-12-04 15:04:06 +00:00
Bryan Drewery
efdd39d20d Use full path to sysctl(8) since /sbin is not in PATH.
X-MFC-With:	r355379
MFC after:	2 weeks
2019-12-04 04:01:53 +00:00
Bryan Drewery
3701dbc859 Run make in parallel.
This is mostly targetting the 'installconfig' phase of 'distribution'
which does a full tree walk.

MFC after:	 2 weeks
2019-12-04 03:44:50 +00:00
Emmanuel Vadot
e213223c9b Remove "all rights reserved" from copyright for the file I own.
Some of the files have both me and Jared McNeill and he gave me
permission to remove it from his files too.
2019-12-03 21:00:45 +00:00
Vincenzo Maffione
79c1428ed6 bhyve: uniform printf format string newlines
Some of the printf statements only use LF to get a newline. However, a CR character is also required for the serial console to print debug logs in a nice way.
Fix those code locations that only use LF, by adding a CR character.

Reviewed by:	markj, aleksandr.fedorov@itglobal.com
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D22552
2019-12-02 20:51:46 +00:00
Devin Teske
e19a2226fe Fix spurious error from sysrc
When using sysrc to modify a file, the file should be created silently.
However, with the introduction of SVN r335280, an error of "No such file
or directory" would appear despite everything else working as-expected.

The nature of this spurious error is that SVN r335280 did not check if
the file exists first, before trying to fixup the line-endings in the
file just prior to modification.

PR:		bin/240875
Reported by:	Jose Luis Duran
MFC after:	3 days
2019-12-02 05:24:16 +00:00
Edward Tomasz Napierala
2b2710a70b Fix typos.
MFC after:	2 weeks
Sponsored by:	Klara, Inc
2019-11-27 10:26:37 +00:00
Xin LI
1861313623 Update leap-seconds to leap-seconds.3676924800.
Obtained from:	ftp://ftp.nist.gov/pub/time/leap-seconds.3676924800
MFC after:	3 days
2019-11-27 07:51:29 +00:00
Ravi Pokala
90e43b446d Add and document options to allow rpc.lockd and rpc.statd to run in the
foreground.

This allows a separate process to monitor when and how those programs exit.
That process can then restart them if needed.

Submitted by:	Alex Burlyga
Reviewed by:	bcr, imp
MFC after:	1 week
Sponsored by:	Panasas
Differential Revision:	https://reviews.freebsd.org/D22474
2019-11-22 16:53:30 +00:00
Cy Schubert
964c4a37b0 Chase r344883. ntp is 4.2.8p13.
MFC after:	3 days
2019-11-21 20:15:22 +00:00
Mateusz Piotrowski
6e02be63f4 bsdinstall.8: Fix description of DISTRIBUTIONS environment variable
Reviewed by:	bcr
Approved by:	bcr (mentor)
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D22478
2019-11-21 15:54:56 +00:00
Ed Maste
1da495d063 revert r354935 and apply fix for cleandir failure
This reapplies the RISC-V GNU ld workaround from r354896, r354899, and
354900, along with a fix for the build failure during cleandir.

LINKER_TYPE was not being set during cleandir, resulting in
Malformed conditional (${LINKER_TYPE} == "bfd" && ${MACHINE} == "riscv")
from Cirrus-CI.

PR:		242109
Sponsored by:	The FreeBSD Foundation
2019-11-21 13:56:16 +00:00
Glen Barber
fb1c294d47 Revert r354896, r354899, r354900:
Fix build.

Sponsored by:	Rubicon Communications, LLC (netgate.com)
2019-11-21 04:12:08 +00:00
Gleb Smirnoff
71f0077631 Remove sio(4).
It had been disconnected from build in r181233 in 2008.

Reviewed by:	imp
2019-11-21 01:24:49 +00:00
Mark Johnston
e7485a436b Avoid relying on pollution from libcasper.h.
Reported by:	sjg
Sponsored by:	The FreeBSD Foundation
2019-11-21 00:17:14 +00:00
Warner Losh
1cdb8eb8fe Add --esp/-E argument to print the currently booted ESP
Add code to decode the BootCurrent and BootXXXX variable it points at
to deduce the ESP used to boot the system. By default, it prints the
path to that device. With --unix-path (-p) it will instead print the
current mount point for the ESP, if any (or an error). With
--device-path (-d) it wil print the UEFI device path for the ESP.

Note: This is the best guess based on the UEFI variables. If the ESP
is part of a gmirror, etc, that won't be reported. If by some weird
chance there was a complicated series of chain boots, this may not be
what you want. For setups that don't add layers on top of the raw
devices, it is accurate.

Differential Revision: https://reviews.freebsd.org/D22432
2019-11-20 23:58:36 +00:00
Li-Wen Hsu
7cef5cac04 Use the correct variable, also limit the scope to bfd
PR:		242109
Reported by:	jhb
Sponsored by:	The FreeBSD Foundation
2019-11-20 16:54:21 +00:00
Li-Wen Hsu
f10ddee841 Limit the workaround to riscv only
PR:		242109
Sponsored by:	The FreeBSD Foundation
2019-11-20 16:35:58 +00:00
Li-Wen Hsu
53c772bbd7 Workaround riscv64 build when using binutils 2.33.1
PR:		242109
Reviewed by:	bapt
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D22457
2019-11-20 16:20:49 +00:00
Vincenzo Maffione
d70b206955 bhyve: virtio-net: disable receive until features are negotiated
This patch fixes a race condition where the receive callback is called
while the device is being reset. Since the rx_merge variable may change
during reset, the receive callback may operate inconsistently with what
the guest expects.
Also, get rid of the unused rx_vhdrlen variable.

PR:	242023
Reported by:	aleksandr.fedorov@itglobal.com
Reviewed by:	markj, jhb
MFC with:	r354552
Differential Revision:	https://reviews.freebsd.org/D22440
2019-11-19 21:10:44 +00:00
Alex Richardson
21697a7a3a Fix error found by new clang operator precendence warning
error: operator '?:' has lower precedence than '|'; '|' will be evaluated first

I discovered this in CheriBSD after updating our fork of clang to the latest
upstream master.

Reviewed By:	ian
Differential Revision: https://reviews.freebsd.org/D22433
2019-11-17 19:04:02 +00:00
Alex Richardson
1e9f67e2e4 makefs: Also set UFS di_birthtime when building on Linux
Since st_birthtime doesn't exists on Linux (unless you use statx(2)), we
instead populate it with the st_ctime value.

Reviewed By:	emaste
Differential Revision: https://reviews.freebsd.org/D22386
2019-11-15 18:34:30 +00:00
Alex Richardson
62a3510f1f Fix contents= being ignored in msdosfs makefs mtree
I noticed this while trying to build an EFI boot image

Reviewed By:	emaste
Differential Revision: https://reviews.freebsd.org/D22387
2019-11-15 18:34:23 +00:00
Konstantin Belousov
7672c254eb cpucontrol: print more useful information when MSR access fails.
Instead of providing ioctl cmd value, which has no meaning to user,
print MSR number.  The later is what the user expects in this place
even.

Reported by:	pstef
Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
2019-11-13 22:43:11 +00:00
Alan Somers
9f96f106f8 sesutil: fix another memory leak
Instead of calloc()ing (and forgetting to free) in a tight loop, just put
this small array on the stack.

Reported by:	Coverity
Coverity CID:	1331665
MFC after:	2 weeks
Sponsored by:	Axcient
2019-11-12 23:57:57 +00:00
Alan Somers
a221b104de sesutil: fix some memory leaks
Reported by:	Coverity
Coverity CID:	1331665
MFC after:	2 weeks
Sponsored by:	Axcient
2019-11-12 23:09:55 +00:00
Alan Somers
691a834cb7 sesutil: fix an out-of-bounds array access
sesutil would allow the user to toggle an LED that was one past the maximum
element.  If he tried, ENCIOC_GETELMSTAT would return EINVAL.

Reported by:	Coverity
Coverity CID:	1398940
MFC after:	2 weeks
Sponsored by:	Axcient
2019-11-12 23:03:52 +00:00
Vincenzo Maffione
07b35f77c0 bhyve: rework mevent processing to fix a race condition
At the end of both mevent_add() and mevent_update(), mevent_notify()
is called to wakeup the I/O thread, that will call kevent(changelist)
to update the kernel.
A race condition is possible where the client calls mevent_add() and
mevent_update(EV_ENABLE) before the I/O thread has the chance to wake
up and call mevent_build()+kevent(changelist) in response to mevent_add().
The mevent_add() is therefore ignored by the I/O thread, and
kevent(fd, EV_ENABLE) is called before kevent(fd, EV_ADD), resuliting
in a failure of the kevent(fd, EV_ENABLE) call.

PR:	241808
Reviewed by:	jhb, markj
MFC with:	r354288
Differential Revision:	https://reviews.freebsd.org/D22286
2019-11-12 21:07:51 +00:00
Edward Tomasz Napierala
b5961be1ab Add GEOM attribute to report physical device name, and report it
via 'diskinfo -v'.  This avoids the need to track it down via CAM,
and should also work for disks that don't use CAM.  And since it's
inherited thru the GEOM hierarchy, in most cases one doesn't need
to walk the GEOM graph either, eg you can use it on a partition
instead of disk itself.

Reviewed by:	allanjude, imp
Sponsored by:	Klara Inc
Differential Revision:	https://reviews.freebsd.org/D22249
2019-11-09 17:30:19 +00:00
Vincenzo Maffione
d55e0373f1 bhyve: add support for virtio-net mergeable rx buffers
Mergeable rx buffers is a virtio-net feature that allows the hypervisor
to use multiple RX descriptor chains to receive a single receive packet.
Without this feature, a TSO-enabled guest is compelled to publish only
64K (or 32K) long chains, and each of these large buffers is consumed
to receive a single packet, even a very short one. This is a waste of
memory, as a RX queue has room for 256 chains, which means up to 16MB
of buffer memory for each (single-queue) vtnet device.
With the feature on, the guest can publish 2K long chains, and the
hypervisor will merge them as needed.

This change also enables the feature in the netmap backend, which
supports virtio-net offloads. We plan to add support for the
tap backend too.
Note that differently from QEMU/KVM, here we implement one-copy receive,
while QEMU uses two copies.

Reviewed by:    jhb
MFC after:      3 weeks
Differential Revision:	https://reviews.freebsd.org/D21007
2019-11-08 17:57:03 +00:00
Vincenzo Maffione
3e11768ee1 bhyve: add backend rx backpressure to virtio-net
If a VM is flooded with more ingress packets than the guest OS
can handle, the current virtio-net code will keep reading those
packets and drop most of them as no space is available in the
receive queue. This is an undesirable receive livelock, which
is a waste of CPU and memory resources and potentially opens to
DoS attacks.
With this change, virtio-net uses the new netbe_rx_disable()
function to disable ingress operation in the backend while the
guest is short on RX buffers. Once the guest makes more buffers
available to the RX virtqueue, ingress operation is enabled again
by calling netbe_rx_enable().

Reviewed by:	bryanv, jhb
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D20987
2019-11-03 19:02:32 +00:00
Vincenzo Maffione
14d726374b bhyve: fix mistake introduced by r352841
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D20973
2019-11-03 18:53:42 +00:00
Vincenzo Maffione
c7c7805531 add valectl to the system commands
The valectl(4) program is used to manage vale(4) switches.
Add it to the system commands so that it can be used right away.
This program was previously called vale-ctl, and stored in
tools/tools/netmap

Reviewed by:	hrs, bcr, lwhsu, kevans
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D22146
2019-10-31 21:01:34 +00:00
Jung-uk Kim
412d13d559 Catch up with ACPICA 20191018.
PR:		241467
XMFC with:	r353764
2019-10-24 22:33:46 +00:00
Jung-uk Kim
a009b7dcab Merge ACPICA 20191018. 2019-10-19 14:56:44 +00:00
Scott Long
fe1c359603 Fix the botched field ordering in the last commit. While here, fix
whitespace, and also reorder the fields so they are easier to read on
an 80 column display (the lines wrapped even before these changes).
Also fix non-standard nomenclature in the Caps code, and update the
man page.

Reported by:	rpokala
2019-10-13 05:11:53 +00:00
Scott Long
635cfe5b81 Change from the non-standard nomenclature of "chip" and "card" to the
standard nomenclature of "device" and "vendor" with the "sub" variants.
This changes the printed format, so anything that scrapes and parses
this will need to be adapted.  No compatibility shims are provided,
but this will not be MFC'd.

Reviewed by:	jhb, emaste, gtetlow
Approved by:	jhb, emaste, gtetlow
2019-10-12 22:27:57 +00:00
Yuri Pankov
a89559c269 bsdinstall: fix ESP detection for auto ZFS layout
Pass the list of user selected disks from zfsboot to bootconfig so that
the latter doesn't rely on ESP autodetection that apparently fails for
some cases, e.g. memstick installation with nvme (boot) and sata drives.

While here, fix printing of debug messages in bootconfig.

Reviewed by:	bcran, imp, tsoome
Differential Revision:	https://reviews.freebsd.org/D21930
2019-10-09 05:28:10 +00:00
Brooks Davis
f189761366 Fix various -Wpointer-compare warnings
This warning (comparing a pointer against a zero character literal
rather than NULL) has existed since GCC 7.1.0, and was recently added to
Clang trunk.

Almost all of these are harmless, except for fwcontrol's str2node, which
needs to both guard against dereferencing a NULL pointer (though in
practice it appears none of the callers will ever pass one in), as well
as ensure it doesn't parse the empty string as node 0 due to strtol's
awkward interface.

Submitted by:	James Clarke <jtrc27@jrtc27.com>
Obtained from:	CheriBSD
Sponsored by:	DARPA, AFRL
Differential Revision:	https://reviews.freebsd.org/D21914
2019-10-08 21:14:09 +00:00
Glen Barber
48c8f7d454 Rework the logic for installing the pkg(8) configuration.
'quarterly' package sets do not exist for head, so explicitly
install the 'latest' configuration file there.  Otherwise,
fall back to the original conditional evaluation to determine
if the 'latest' or 'quarterly' configuration file should be
installed.

Reported by:	manu
Reviewed by:	manu
MFC after:	3 days
Sponsored by:	Rubicon Communications, LLC (Netgate)
2019-10-08 18:58:23 +00:00
Kyle Evans
94a5245c4c certctl(8): let one blacklist based on hashed filenames
It seems reasonable to allow, for instance:

$ certctl list
# reviews output -- ah, yeah, I don't trust that one
$ certctl blacklist ce5e74ef.0
$ certctl rehash

We can unambiguously determine what cert "ce5e74ef.0" refers to, and we've
described it to them in `certctl list` output -- I see little sense in
forcing another level of filesystem inspection to determien what cert file
this physically corresponds to.
2019-10-03 20:45:52 +00:00
Kyle Evans
fa0e0c0269 certctl(8): realpath the file before creating the symlink
Otherwise we end up creating broken relative symlinks in
/etc/ssl/blacklisted.
2019-10-03 20:05:46 +00:00
Andriy Gapon
5fda0d60c1 add ability to set watchdog timeout for a shutdown
This change allows to specify a watchdog(9) timeout for a system
shutdown.  The timeout is activated when the watchdogd daemon is
stopped.  The idea is to a prevent any indefinite hang during late
stages of the shutdown.  The feature is implemented in rc.d/watchdogd,
it builds upon watchdogd -x option.

Note that the shutdown timeout is not actiavted when the watchdogd
service is individually stopped by an operator.  It is also not
activated for the 'shutdown' to the single-user mode.  In those cases it
is assumed that the operator knows what they are doing and they have
means to recover the system should it hang.

Significant subchanges and implementation details:
- the argument to rc.shutdown, completely unused before, is assigned to
  rc_shutdown variable that can be inspected by rc scripts
- init(8) passes "single" or "reboot" as the argument, this is not
  changed
- the argument is not mandatory and if it is not set then rc_shutdown is
  set to "unspecified"
- however, the default jail management scripts and jail configuration
  examples have been updated to pass "jail" to rc.shutdown, just in case
- the new timeout can be set via watchdogd_shutdown_timeout rc option
- for consistency, the regular timeout can now be set via
  watchdogd_timeout rc option
- watchdogd_shutdown_timeout and watchdogd_timeout override timeout
  specifications in watchdogd_flags
- existing configurations, where the new rc options are not set, should
  keep working as before

I am not particularly wed to any of the implementation specifics.
I am open to changing or removing any of them as long as the provided
functionality is the same (or very close) to the proposed one.
For example, I think it can be implemented without using watchdogd -x,
by means of watchdog(1) alone.  In that case there would be a small
window between stopping watchdogd and running watchdog, but I think that
that is acceptable.

Reviewed by:	bcr (man page changes)
MFC after:	5 weeks
Relnotes:	yes
Differential Revision: https://reviews.freebsd.org/D21221
2019-10-03 11:23:10 +00:00
Ian Lepore
b6fa976de2 Bump .Dd for earlier update (should have been part of r353024). 2019-10-02 23:19:34 +00:00
Ian Lepore
0ec0f10d66 Clarify how the -f option for daemon(8) interacts with other options
related to redirecting stdout and stderr.
2019-10-02 23:06:17 +00:00
Glen Barber
e7a71e6d1b Add a comment explaining why the opensolaris_load line in loader.conf
is explicitly added.

Requested by:	rgrimes
MFC after:	3 days
MFC with:	r353004
Sponsored by:	Rubicon Communications, LLC (Netgate)
2019-10-02 16:09:28 +00:00
Glen Barber
8cdae52ef6 Explicitly add opensolaris_load="YES" to loader.conf through the
installer when installing the system on a ZFS root filesystem.

For arm64, zfs_load="YES" does not add opensolaris.ko as a kld
dependency, so add it explicitly to prevent boot-time failures
out-of-box.

PR:		240478
MFC after:	3 days
Sponsored by:	Rubicon Communications, LLC (Netgate)
2019-10-02 13:30:17 +00:00
Kyle Evans
0da4b4089c Unbreak etcupdate(8) and mergemaster(8) after r352950
r352950 introduced improper case fall-through for shell scripts. Fix it with
a pipe.

Reported by:	lwhsu, David Wolfskill
2019-10-02 12:46:28 +00:00
Hans Petter Selasky
eff4361d88 Use size_t for byte_to_write variable when comparing to eeprom_info_out_len
which is also size_t in mlx5tool(8).

Submitted by:	slavash@
MFC after:	3 days
Sponsored by:	Mellanox Technologies
2019-10-02 10:58:27 +00:00
Hans Petter Selasky
133fc15cf3 Add the ability to query the EEPROM information in mlx5tool(8).
Submitted by:	slavash@
MFC after:	3 days
Sponsored by:	Mellanox Technologies
2019-10-02 10:19:17 +00:00
Kyle Evans
bbb8014f09 [3/3] etcupdate and mergemaster support for certctl
This commit add support for certctl in mergemaster and etcupdate. Both will
either rehash or prompt for rehash as new certificates are
trusted/blacklisted.

This work was done primarily by allanjude@, with minor contributions by
myself.

No objection from:	secteam
Differential Revision:	https://reviews.freebsd.org/D17389
2019-10-02 01:06:37 +00:00
Kyle Evans
ccdcb388ba [2/3] Add certctl(8)
This is a simple utility to hash all trusted on the system into
/etc/ssl/certs. It also allows the user to blacklist certificates they do
not trust.

This work was done primarily by allanjude@, with minor contributions by
myself.

No objection from:	secteam
Differential Revision:	https://reviews.freebsd.org/D16857
2019-10-02 01:05:53 +00:00
Kyle Evans
546d30b94b Move httpd to simple_httpd...
This avoids PATH conflicts with a real httpd, as a user will likely almost
always prefer the more fully-featured httpd. This also lines up with the
historical name of the program.
2019-10-01 18:14:37 +00:00
Kyle Evans
2d0a92c9ab Move simple_httpd out of picobsd, add HTTPD option (default OFF)
picobsd/tinyware has had this compact HTTPD server for a long time, and some
people do use it. Move it out into usr.sbin well in advance of any action
being taken on picobsd.

This has been gated behind an HTTPD option defaulted to *off*, primarily for
two reasons:
1.) This code likely needs a good audit, as it's been living off in picobsd
    land for a long time, and
2.) We don't currently ship an httpd and this may not be a welcome surprise.

Reviewed by:	eugen
Differential Revision:	https://reviews.freebsd.org/D21724
2019-10-01 14:55:16 +00:00
Vincenzo Maffione
d12c5ef640 bhyve: support for enabling/disabling the net backend
Extend the net backend interface with two functions, namely netbe_rx_disable()
and netbe_rx_enable(), which can be used by the net device emulators to stop
the backend from invoking the receive callback. This is useful for device
emulators, i.e., on hardware resets or to implement receive backpressure.
The mevent module has been extendede to support the addition of a disabled
event. To prevent race conditions, the net backends will start with receive
operation disabled. A follow-up patch will use the new functionalities in
the virtio-net device.

Reviewed by:	jhb, markj
MFC after:	1 week
Differential Revision: https://reviews.freebsd.org/D20973
2019-09-28 12:02:43 +00:00
Yuri Pankov
736dcdb75a efibootmgr(8): fix markup and style issues
- split synopsis into separate options that can't be used together
- sort options
- fix (style) issues reported by mandoc lint

Reviewed by:	imp
Differential Revision:	https://reviews.freebsd.org/D21710
2019-09-25 21:23:30 +00:00
Kyle Evans
5b80de237b cron: add log suppression and mail suppression for successful runs
This commit adds two new extensions to crontab, ported from OpenBSD:
- -n: suppress mail on succesful run
- -q: suppress logging of command execution

The -q option appears decades old, but -n is relatively new. The
original proposal by Job Snijder can be found here [1], and gives very
convincing reasons for inclusion in base.

This patch is a nearly identical port of OpenBSD cron for -q and -n
features. It is written to follow existing conventions and style of the
existing codebase.

Example usage:

# should only send email, but won't show up in log
* * * * * -q date

# should not send email
* * * * * -n date

# should not send email or log
* * * * * -n -q date

# should send email because of ping failure
* * * * * -n -q ping -c 1 5.5.5.5

[1]: https://marc.info/?l=openbsd-tech&m=152874866117948&w=2

PR:		237538
Submitted by:	Naveen Nathan <freebsd_t.lastninja.net>
Reviewed by:	bcr (manpages)
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D20046
2019-09-25 02:37:40 +00:00
Michael Gmelin
8cfda118cb freebsd-update: Add updatesready' and showconfig' commands
`freebsd-update updatesready' can be used to check if there are any pending
fetched updates that can be installed.

`freebsd-update showconfig' writes freebsd-update's configuration to
stdout.

This also changes the exit code of `freebsd-update install' to 2 in case
there are no updates pending to be installed and there wasn't a fetch phase
in the same invocation. This allows scripts to tell apart these error
conditions without breaking existing jail managers.

See freebsd-update(8) for details.

PR:		240757, 240177, 229346
Reviewed by:	manpages (bcr), sectam (emaste), yuripv
Differential Revision:	https://reviews.freebsd.org/D21473
2019-09-24 20:49:33 +00:00
Hiroki Sato
34302d266a - Revert WARNS to 2 because of mismatch between (xdrproc_t) and xdr_void().
- Add prototype of from_addr().
2019-09-21 13:34:06 +00:00
Hiroki Sato
aec74e0ce0 Fix warnings and set WARNS=6. 2019-09-21 12:33:41 +00:00
Hiroki Sato
685e059d94 Fix build errors of test.c, which had been broken for a long time.
This is a temporary fix and should be converted to a complete
test scenarios by using this tool.
2019-09-21 01:29:59 +00:00
Michael Gmelin
12294db4ac Fix src component detection
Reviewed by:	emaste
MFC after:	3 days
Differential Revision:	https://reviews.freebsd.org/D21579
2019-09-19 21:13:51 +00:00
Glen Barber
5f6bb72e7f Apply r346792 (cperciva) from stable/12 to head. The original commit
message:

 On non-x86 systems, use "quarterly" packages.

 x86 architectures have "latest" package builds on stable/*, so keep using
 those (they'll get switched over to "quarterly" during releases).

The original commit was a direct commit to stable/12, as at the time it
was presumed it would not be necessary for head.  However, when it is time
to create a releng branch or switch from PRERELEASE/STABLE to BETA/RC, the
pkg(7) Makefile needs further adjusting.  This commit includes those
further adjustments, evaluating the BRANCH variable from release/Makefile
to determine the pkg(7) repository to use.

MFC after:	immediate (if possible)
Sponsored by:	Rubicon Communications, LLC (Netgate)
2019-09-19 16:43:12 +00:00
Cy Schubert
1e8687d261 Reduce calls to close(2) at startup through the use of closefrom(2).
Submitted by:	pawel.biernacki@gmail.com
Reviewed by:	mjg, cy
MFC after:	3 days
Differential Revision:	https://reviews.freebsd.org/D21715
2019-09-19 14:45:04 +00:00
Ed Maste
75cb6429f5 freebsd-update: make usage output consistent
Drop trailing . which appeared only on description of IDS.

Submitted by:	grembo
Event:		EuroBSDCon Norway FreeBSD DevSummit
2019-09-19 11:46:43 +00:00
Ed Maste
18a52cf418 freebsd-update.8: appease igor
igor follows American style guides in the belief that abbreviations i.e.
and e.g. are always followed by a comma.  Make that change now so that
future updates to freebsd-update.8 do not complain about this.

Submitted by:	grembo
Event:		EuroBSDCon Norway FreeBSD DevSummit
2019-09-19 11:34:35 +00:00
Steve Wills
6cc4a3c970 Use correct filename in newsyslog.conf
Approved by:		bapt (implicit)
Differential Revision:	https://reviews.freebsd.org/D21561
2019-09-17 20:05:06 +00:00
Steve Wills
cd4b2a3c08 log daemon.info to /var/log/daemon.log by default
log daemon facility now that daemon(8) has syslog support which defaults to
daemon facility, info priority

Reviewed by:		bapt
Approved by:		bapt
Differential Revision:	https://reviews.freebsd.org/D21561
2019-09-17 20:03:20 +00:00
Cy Schubert
854cab511e No longer mlock() ntpd pages by default in memory thus allowing its
pages to page as necessary.

To restore historic BSD behaviour add the following to ntp.conf:
	rlimit memlock 32

Discussed on:	freebsd-current@ between Sept 6-9, 2019
Reported by:	Users using ASLR with stack gap != 0
Reviewed by:	ian, kib, rgrimes (all previous versions)
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D21581
2019-09-13 20:20:05 +00:00
Michael Zhilin
cd38a86c63 [jail] removal by jid doesn't trigger pre/post stop scripts
This commit fixes bug: command "jail -r" didn't trigger pre/post stop
commands (and others) defined in config file if jid is specified insted of
name. Also it adds basic tests for usr.sbin/jail to avoid regression.

Reviewed by:	jamie, kevans, ray
MFC after:      5 days
Differential Revision: https://reviews.freebsd.org/D21328
2019-09-12 18:53:29 +00:00
Bryan Drewery
4f4b548b1d mtree: Fix -f -f not considering type changes.
This only lists the changed type and not other attributes so that it
matches the behavior of -C as done in r66747 for fmtree. The NetBSD
-ff implementation was copied from fmtree.

Reviewed by:	imp
MFC after:	2 weeks
Relnotes:	yes
Differential Revision:	https://reviews.freebsd.org/D21623
2019-09-12 18:44:48 +00:00
Baptiste Daroussin
469ce69391 Get the readline header from the installed header instead of the from the source
location.

With newer import of libedit, the path to be able to access readline/readline.h
will also include header which name will conflict with some expected by ntp in
another path and end up breaking the build.
2019-09-12 15:46:58 +00:00