17032 Commits

Author SHA1 Message Date
Kyle Evans
e96e74de50 MFC r346254: config(8): replace opteq with a call to strcasecmp
This obscures the comparison slightly less; when option name appear in
files, they are case-insensitive.
2019-04-23 02:37:12 +00:00
Kyle Evans
a63460718d MFC r346427: cron(8): schedule interval jobs that loaded during execution
Jobs using the @<second> syntax currently only get executed if they exist
when cron is started. The simplest reproducer of this is:

echo '@20 root echo "Hello!"' >> /etc/cron.d/myjob

myjob will get loaded at the next second==0, but this echo job will not
run until cron restarts. These jobs are normally handled in
run_reboot_jobs(), which sets e->lastexit of INTERVAL jobs to the startup
time so they run 'n' seconds later.

Fix this by special-casing TargetTime > 0 in the database load. Preexisting
jobs will be handled at startup during run_reboot_jobs as normal, but if
we've reloaded a database during runtime we'll hit this case and set
e->lastexit to the current time when we process it. They will then run every
'n' seconds from that point, and a full restart of cron is no longer
required to make these jobs work.
2019-04-23 02:29:08 +00:00
Ian Lepore
19c7e6d7ce MFC r335527, r335529, r335593
r335527:
Add spi(8), a utility for communicating with a device on a SPI bus from
userland, conceptually similar to what i2c(8) provides for i2c devices.

Submitted by:	Bob Frazier
Differential Revision:	https://reviews.freebsd.org/D15029

r335529:
Eliminate gcc "shadowed declaration" warnings by using idx rather than
index as a variable name.

r335593:
Add an example for displaying the manufacturer and size info from a
standard spiflash chip.
2019-04-22 03:55:02 +00:00
Kyle Evans
c0d760d39e MFC r346252: cron(8): Add MAILFROM ability for crontabs
This changes the sender mail address in a similar fashion to how MAILTO may
change the recipient. The default from address remains unchanged.

PR:		140304
2019-04-22 03:06:12 +00:00
Kyle Evans
f2223460e1 MFC r334817, r334910
r334817:
Add new functionality and syntax to cron(1) to allow to run jobs at a
given interval, which is counted in seconds since exit of the previous
invocation of the job. Example user crontab entry:

@25	sleep 10

The example will launch 'sleep 10' every 35 seconds. This is a rather
useless example above, but clearly explains the functionality.

The practical goal here is to avoid overlap of previous job invocation
to a new one, or to avoid too short interval(s) for jobs that last long
and doesn't have any point of immediate launch soon after previous run.

Another useful effect of interval jobs can be noticed when a cluster of
machines periodically communicates with a single node. Running the task
time based creates too much load on the node. Running interval based
spreads invocations across machines in cluster. Note that -j/-J won't
help in this case.

r334910:
Remove old, dead compat code.

We no longer need to od these things conditionally, and the fallbacks
are to 4.2BSD era defaults, which nobody uses anymore. Vixie cron has
diverged from upstream anyway in our tree, and it's not clear there's
actually a viable upstream anymore. Plus, we don't follow the
vendor-supplied code pattern here.

I'm doing this to reduce false positives from grep.
2019-04-22 03:04:39 +00:00
Rick Macklem
af8a96374c MFC: r345995
Delete the BUGS entry related to failing when jails are enabled.

r345994 has finally fixed the bug that caused the nfsuserd(8) daemon to
fail when jails were enabled, so delete the BUGS entry from the man page.
2019-04-21 00:59:21 +00:00
Rick Macklem
ccee7e0f74 MFC: r345994
Fix nfsuserd so that it handles the mapped localhost address when jails
are enabled.

The nfsuserd(8) daemon does not function correctly when jails are enabled,
since localhost gets mapped to another IP address and, as such, the upcall
RPC fails.
This patch fixes the problem by doing a getsockname(2) of a socket mapped
to localhost to find out what the correct address is for the comparison
test with the upcall's from IP address.
This patch also adds INET6 support and the required #ifdef's for INET and
INET6. It now uses INET6 by default for the upcalls, if the kernel has
INET6 support and the daemon is also built with INET6 support.
2019-04-21 00:51:43 +00:00
Mark Johnston
e5c45b133c MFC r346010:
Fix indentation.
2019-04-20 11:03:46 +00:00
Mark Johnston
8cb66cd0c4 MFC r346011:
Stop compiling bhyve(8) with -O0.
2019-04-20 11:03:16 +00:00
Bjoern A. Zeeb
005a443f43 MFC 344740:
Fix compilation of world with WITHOUT_{INET,INET6}_SUPPORT or both set.

  Buildworld failed when both WITHOUT_INET6_SUPPORT and INET equivalent were set.
  Fix netstat and syslogd by applying appropriate #ifdef INET/INET6 to make world
  compile again.
2019-04-19 17:29:20 +00:00
Konstantin Belousov
910aecad56 MFC r345966, r345968:
Implement devctl(8) command 'reset', using DEV_RESET /dev/devctl2 ioctl.
2019-04-19 13:18:54 +00:00
Michael Gmelin
b35e4f1af5 MFC r345512: Correct contradictory information on default syslog logging
priority.
2019-04-09 12:28:12 +00:00
Ed Maste
4ffb2df21c MFC r344280: freebsd-update: Clarify help text
Improve help text to include example release numbers for reference
and clarify the -F option.

PR:		231185, 214619
Submitted by:	Gerald Aryeetey <aryeeteygerald_rogers.com>
Reviewed by:	delphij, rgrimes
Sponsored by:	The FreeBSD Foundation
2019-04-02 13:58:31 +00:00
Eugene Grosbein
ec71047bf2 MFC r345130,r345184: trim(8): add another safety net and more user-friendly
error message in verbose mode.
2019-03-21 11:32:52 +00:00
Pietro Cerutti
f7fe3ffd6e MFC r34505: freebsd-update: restore old exit code when no updates are available
locally

This unbreaks ezjail and iocell, which get into an endless loop trying to
figure out how many times "freebsd-update install" needs to be called.

PR:		229346
Submitted by:	Mike Cole <mcole36 at gmail.com>
Approved by:	bapt
2019-03-20 10:20:48 +00:00
Ed Maste
b8fca41a43 MFC r344818: freebsd-update.8: update example to contemporary versions
PR:		235761
Reported by:	linimon
2019-03-12 17:04:48 +00:00
Cy Schubert
7af0d9337e MFC r344883:
(MFV r344878:)

4.2.8p12 --> 4.2.8p13

Security:       CVE-2019-8936
                VuXML: c2576e14-36e2-11e9-9eda-206a8a720317
Obtained from:  nwtime.org
2019-03-07 13:45:36 +00:00
David Bright
b514a724ca MFC r344470:
Fix several Coverity-detected issues in newsyslog.

- CID 1394815, CID 1305673: Dereference before null check - memory was
  allocated and the allocation checked for NULL with a call to errx()
  if it failed. Code below that was guaranteed that the pointer was
  non-NULL, but there was another check for NULL at the exit of the
  function (after the memory had already been referenced). Eliminate
  the useless NULL check.

- CID 1007452: Resource leak - Storage intended to be allocated and
  returned to the caller was never freed. This was the result of a
  regression in the function signature introduced in r208648 (2010)
  (thanks for that find, @cem!). Fixed by altering the function
  signature and passing the allocated memory to the caller as
  intended. This also fixes PR158794.

- CID 1008620: Logically dead code in newsyslog.c - This was a direct
  result of CID 1007452. Since the memory allocated as described there
  was not returned to the caller, a subsequent check for the memory
  having been allocated was dead code. Returning the memory
  re-animates the code that is the subject of this CID.

- CID 1006131: Unused value - in parsing a configuration file, a
  pointer to the end of the last field was saved, but not used after
  that. Rewrite to use the pointer value. This could have been fixed
  by avoiding the assignment altogether, but this solutions more
  closely follows the pattern used in the preceding code.

PR:             158794
Reported by:    Coverity, Ken-ichi EZURA <k.ezura@gmail.com> (PR158794)

Sponsored by:	Dell EMC Isilon
2019-03-07 13:10:48 +00:00
Ed Maste
1e9877fef1 MFC freebsd-update: Clarify unsupported release upgrade error message
MFC r343122:

freebsd-update: Clarify unsupported release upgrade error message

Notify users that upgrading from -CURRENT or -STABLE is unsupported by
freebsd-update.

Also ensure --currently-running provides a correctly formatted release
(as done by -r).

Reported by:	yuri
Reviewed by:	bcran

MFC r343268:

frebsd-update: fix --currently-running after r343122

Reported by:	Brandon Schneider

MFC r343271:

freebsd-update: Allow upgrade from pre-release builds

Update r343122 to include -ALPHA, -BETA and -RC releases as
upgrade-able via freebsd-update.

Reported by:	delphij, des
Reviewed by:	delphij

MFC r343410:

freebsd-update: fix style from r343271 change

PR:		234771
Submitted by:	Gerald Aryeetey <aryeeteygerald_rogers.com>
Sponsored by:	The FreeBSD Foundation
2019-03-05 19:07:46 +00:00
Ed Maste
7ff2eeb747 freebsd-update: Use BASEDIR when checking for src componentfreebsd-update: Use BMFC r343152: freebsd-update: Use BASEDIR when checking for src component
src could potentially be installed under the based dir
and not under the root or vice versa.

PR:		224048
Submitted by:	Gerald Aryeetey <aryeeteygerald_rogers.com>
Reviewed by:	delphij
Sponsored by:	The FreeBSD Foundation
2019-03-05 18:54:47 +00:00
Ed Maste
bab6561d72 MFC r343270: freebsd-update: Update /etc/passwd after password db changes
Add -p to pwd_mkdb in order to ensure password db changes are also
included in /etc/passwd.

PR:		165954, 232921, 229487
Submitted by:	Gerald Aryeetey <aryeeteygerald_rogers.com>
Reviewed by:	jilles
Sponsored by:	The FreeBSD Foundation
2019-03-05 18:30:43 +00:00
Ed Maste
3a998fe437 MFC r343411: freebsd-update: Clarify unsupported upgrade message
PR:		204115
Submitted by:	Gerald Aryeetey <aryeeteygerald_rogers.com>
Reviewed by:	delphij
Sponsored by:	The FreeBSD Foundation
2019-03-05 18:27:29 +00:00
Ed Maste
1df566db23 MFC r343412: Fix a typo/wordsmith a description modified in [MFC of r343407] 2019-03-05 18:23:55 +00:00
Ed Maste
f3d7717ef5 MFC r343407: freebsd-update: open $PAGER only if necessary
PR:		194547, 208497
Submitted by:   Gerald Aryeetey <aryeeteygerald_rogers.com>
Reviewed by:	delphij
Sponsored by:	The FreeBSD Foundation
2019-03-05 18:20:16 +00:00
Ed Maste
150fc99c77 MFC r343409: freebsd-update: Stop installing empty component sets
Submitted by:	Gerald Aryeetey <aryeeteygerald_rogers.com>
Reported by:	rgrimes
Reviewed by:	delphij
Sponsored by:	The FreeBSD Foundation
2019-03-05 18:17:06 +00:00
Ed Maste
6c90e71672 MFC r343589: freebsd-update: regenerate man page database after update
These are currently not reproducible because they're built by the
makewhatis on the freebsd-update build host, not the one in the tree.
Regenerate after update, and later we can avoid including it in
freebsd-update data.

PR:		214545, 217389
Reviewed by:	delphij
Sponsored by:	The FreeBSD Foundation
2019-03-05 18:11:36 +00:00
Andriy Voskoboinyk
9ea69c9217 MFC r344245:
snmp_hostres(3): fix a typo in sanity checks in handle_chunk()

PR:		204253
Submitted by:	David Binderman <dcb314@hotmail.com>
2019-03-04 03:38:43 +00:00
Andriy Voskoboinyk
0bdaab82e7 MFC r344244:
Fix memory / resource leaks in usr.sbin/rpc.ypupdated/update.c

Re-apply r343909 to this file to get the issue fixed.

PR:		204956
Reported by:	David Binderman <dcb314@hotmail.com>
2019-03-04 03:30:39 +00:00
Hajimu UMEMOTO
47df76f2d1 MFC r344491: An IPv6 address matching should be fixed.
Specifying an IPv6 address by the -a option was broken
since r309933.
2019-03-03 03:42:51 +00:00
Eugene Grosbein
235f4643ab MFC r343118: new small tool trim(8) to delete contents for blocks
on flash based storage devices that use wear-leveling algorithms.
2019-03-01 05:04:29 +00:00
Kyle Evans
11881bff6c MFC Loader Interpreter Coexistance: r337806, r337868, r337914, r337927,
r337989, r338052, r338064, r338407, r338418, r338474

r337806:
Create a loader for each interpreter for x86 BIOS and all EFI

Create loader_{4th,lua,simp}{,.efi}. All of these are installed by
default. Create LOADER_DEFAULT_INTERP to specify the default
interpreter when no other is specified. LOADER_INTERP is the current
interpreter language building. Turn building of lua on by default to
match 4th. simploader is a simplified loader build w/o any interpreter
language (but with a simple loader).  This is the historic behavir you
got with WITHOUT_FORTH. Make a hard link to the default loader. This
has to be a hard link rather than the more desirable soft link because
older zfsboot blocks don't support symlinks.

r337868:
stand: Use -Oz/-Os for all loader/stand builds.

While we're not super size constrained, the x86 BIOS /boot/loader has
to be less than about 520k-530k to be reliable. The LUA loader is at
this size today. -Oz saves 15-20% on the size, keeping us safely small
enough (comparable to where we were with the 4th loader). This will
also help with sjg's work on bringing in bearssl, though we may again
be looking for space in the LUA loader.

Size table for clang 6.0.0:
	default		-O1		-Os		-Oz
4th	442368		417792		389120		376832
lua	524288		479232		446464		430080

r337914:
Install links for loader.efi.

r337927:
Add ashldi3 and ashrdi3 to mips.

Now that we're using -Os, mips needs these routines.

r337989:
Copy the boot loader from the new location for the co-existing
loaders.

r338052:
libsa: Add lshrdi3.c for powerpc* and mips

r338064:
Turn back the clock just a little: make userboot.so always be 4th

Turns out there was a hidden dependency we hasn't counted upon.  The
host load /boot/userboot.so to boot the VMs it runs. This means that
the change to lua meant suddently that nobody could run their older
VMs because LUA wasn't in 10.0, last month's HardenedBSD, 11.2 or
whatever.  Even more than for the /boot/loader* binaries, we need a
good coexistance strategy for this. While that's being designed and
implemented, drop back to always 4th for userboot.so. This will fail
safe in all but the most extreme environments (but lua-only hacks
to .lua files won't be processes in VMs until we fix it).

r338407:
lualoader: Print error messages from command failures at the prompt

Previously lualoader would remain silent, rather than printing
command_errmsg or noting that a command had failed or was not found.

r338418:
userboot: handle guest interpreter mismatches more intelligently

The switch to lualoader creates a problem with userboot: the host is
inclined to build userboot with Lua, but the host userboot's interpreter
must match what's available on the guest. For almost all FreeBSD guests in
the wild, Lua is not yet available and a Lua-based userboot will fail.

This revision updates userboot protocol to version 5, which adds a
swap_interpreter callback to request a different interpreter, and tries to
determine the proper interpreter to be used based on how the guest
/boot/loader is compiled. This is still a bit of a guess, but it's likely
the best possible guess we can make in order to get it right. The
interpreter is now embedded in the resulting executable, so we can open
/boot/loader on the guest and hunt that down to derive the interpreter it
was built with.

Using -l with bhyveload will not allow an intepreter swap, even if the
loader specified happens to be a userboot with the wrong interpreter. We'll
simply complain about the mismatch and bail out.

For legacy guests without the interpreter marker, we assume they're 4th.
For new guests with the interpreter marker, we'll read it and swap over
to the proper interpreter if it doesn't match what the userboot we're using
was compiled with.

Both flavors of userboot are installed by default, userboot_4th.so and
userboot_lua.so. This fixes the build WITHOUT_FORTH as a coincidence, which
was broken by userboot being forced to 4th.

r338474:
Be a little conservative about when to force size optimizations.

Reports have come in that there's issue with powerpc and sparc64 since
we've switched to using -Oz / -Os. We don't strictly need them for
!x86, so be conservative about when we enable them.
2019-02-21 03:18:12 +00:00
Edward Tomasz Napierala
cf38579724 MFC r339214:
Remove BUGS section from nscd.conf(5) man page.  This was missed in r339194.

Sponsored by:	DARPA, AFRL
2019-02-18 16:03:48 +00:00
Edward Tomasz Napierala
22ba70127b MFC r339194:
Remove the BUGS section of nscd(8) man page.  According to bushman@'s
reponse quoted in PR, he no longer maintains it.

PR:		210590
Sponsored by:	DARPA, AFRL
2019-02-18 16:02:50 +00:00
Dmitry Morozovsky
b22898db3b MFC: r343164
Clarify error messages a bit.

X-Found-With:	r343112
Reviewed by:	eugen (implicitly, when r343112 analysis)
2019-02-18 10:13:52 +00:00
Eugene Grosbein
fd475ef333 MFC r343112: jail(8): stop crashing with SIGSEGV inside run_command()
function while processing not entirely correct jail.conf(5) file
having something like "ip4.addr = 127.0.0.1;" and no "ip4 = ...;"
so extrap variable stays NULL.

Reported by:    marck
2019-02-16 00:40:03 +00:00
Hans Petter Selasky
005bc9cfe0 MFC r343905:
Improve Bluetooth device discovery support for Android and Microsoft devices.

Tested using the virtual_bt_speaker(8) tool from the virtual_oss(8)
project at github.com.

PR:			210089
Sponsored by:		Mellanox Technologies
2019-02-15 09:21:16 +00:00
Stefan Eßer
9af85693a6 MFC r343339: Silence Clang Scan warning about use of unitialized variable.
The logic is changed to depend on actual "beep" parameters instead of on a
flag that may be set for invalid parameters.

An embedded literal escape character has been replaced by "\e", since it
could confuse terminals when displaying the affected line.
2019-02-14 15:33:04 +00:00
Benedict Reuschling
3d50817c51 MFC r343921:
Add an example to pw.8 about how to add an existing user to a group.

Instead of using pw to modify group membership, users often edit
/etc/group by hand, which is discouraged.  Provide an example of
adding a user to the wheel group, which is a common use case.
I'm using a different user here as in the previous example as that
deleted the user (although the examples don't necessarily have to
be followed in order).

Reviewed by:	rgrimes,0mp
Approved by:    0mp
Differential Revision:	https://reviews.freebsd.org/D19123
2019-02-11 17:48:52 +00:00
Alexander Motin
524230db14 MFC r343728: Check element type before setting LEDs.
With r319610, sesutil started twiddling the bits of every SES device.
Not everything is a disk slot, there are also fan controllers, temperature
sensors, even power supplies, among other things controlled by SES.

Add a type check to make sure we are only operating on device slot and array
device slot elements.  Other type elements will be skipped, but it would be
simple to add additional cases for controlling the ident LEDs of other
element types (which are not necessarily the same bits).

Rather than doing raw bit manipulation of an unstructured byte array using
unnamed numeric constants, leverage existing code abstractions.

Submitted by:   Ryan Moeller <ryan@freqlabs.com>
Sponsored by:   iXsystems, Inc.
2019-02-11 14:49:10 +00:00
Hans Petter Selasky
f5e2fdb900 MFC r343572:
Add support for Audio Sink and Audio Source profiles to sdpd(8).

This allows user-space programs like virtual_oss(8) to act
as a Bluetooth speaker device.

Sponsored by:		Mellanox Technologies
2019-02-08 10:27:02 +00:00
Andriy Voskoboinyk
863d1cb03c MFC r343576:
ndiscvt(8): abort if no IDs were found during conversion.

PR:		69268
Submitted by:	<darius@dons.net.au>
2019-02-04 03:44:07 +00:00
Ed Maste
fd88fdbde5 MFC r343153: freebsd-update.8: mandoc -Tlint fixes
PR:		185389
2019-01-21 18:35:39 +00:00
Andriy Voskoboinyk
2abea457f3 MFC r342810:
powerd(8): allow to force a method of battery state query

This change allows to determine power source via sysctl or /dev/apm
when devd(8) is running (used by default).

Based on patch from PR; other changes on top of it:
- '-f' (force) -> '-s' (source) parameter renaming;
- allow 'apm' -> 'devd' transition when '-s devd' is set
(if APM is enabled);
- man page update.

PR:		125707
Submitted by:	Konstantin Stepanov <milezv@yandex.ru>
Reviewed by:	bcr, imp
Differential Revision:	https://reviews.freebsd.org/D18742
2019-01-13 02:23:18 +00:00
Kyle Evans
4ab62d45ed MFC r342362-r342363: config(8) duplicate option handling
r342362:
config(8): Allow duplicate options to be specified

config(8)'s option handling has been written to allow duplicate options; if
the value changes, then the latest value is used and an informative message
is printed to stderr like so:

/usr/src/sys/amd64/conf/TEST: option "VERBOSE_SYSINIT" redefined from 0 to 1

Currently, this is only a possibility for cpu types, MAXUSERS, and
MACHINE_ARCH. Anything else duplicated in a config file will use the first
value set and error about duplicated options on subsequent appearances,
which is arguably unfriendly since one could specify:

include GENERIC
nooptions VERBOSE_SYSINIT
options VERBOSE_SYSINIT

to redefine the value later anyways.

Reported by:	mmacy

r342363:
config(8): Remove all instances of an option when opting out

Quick follow-up to r342362: options can appear multiple times now, so
clean up all of them as needed. For non-OPTIONS options, this has no effect
since they're already de-duplicated.
2019-01-06 02:17:18 +00:00
Kyle Evans
bbbaf03688 Revert r342807, mistakenly including libbe(3)/bectl(8) MFC 2019-01-06 02:15:09 +00:00
Kyle Evans
557183abd1 MFC r342362-r342363: config(8) duplicate option handling
r342362:
config(8): Allow duplicate options to be specified

config(8)'s option handling has been written to allow duplicate options; if
the value changes, then the latest value is used and an informative message
is printed to stderr like so:

/usr/src/sys/amd64/conf/TEST: option "VERBOSE_SYSINIT" redefined from 0 to 1

Currently, this is only a possibility for cpu types, MAXUSERS, and
MACHINE_ARCH. Anything else duplicated in a config file will use the first
value set and error about duplicated options on subsequent appearances,
which is arguably unfriendly since one could specify:

include GENERIC
nooptions VERBOSE_SYSINIT
options VERBOSE_SYSINIT

to redefine the value later anyways.

Reported by:	mmacy

r342363:
config(8): Remove all instances of an option when opting out

Quick follow-up to r342362: options can appear multiple times now, so
clean up all of them as needed. For non-OPTIONS options, this has no effect
since they're already de-duplicated.
2019-01-06 02:13:16 +00:00
Eugene Grosbein
d877639f34 MFC r340319: jail(8): introduce new command option -e to exhibit
a list of configured non-wildcard jails with their parameters,
no matter running or not.

The option -e takes separator argument that is used
to separate printed parameters. It will be used with following
additions to system periodic scripts to differentiate parts
of directory tree belonging jails as opposed to host's.
2018-12-10 13:47:05 +00:00
Marcelo Araujo
ec1a1cac5f MFC r340046, r340050
r340046:
Add support ps/2 scancodes for NumLock, ScrollLock and numerical keypad
keys.

PR:		213835
Submitted by:	Vasily Postnicov <ivan.zhmudo@gmail.com>
Relnotes:	Yes
Sponsored by:	iXsystems Inc.

r340050:
Remove printf for debug purpose forgotten on r340046.

Reported by:	Dmitry Luhtionov <dmitryluhtionov@gmail.com>
2018-12-09 06:42:06 +00:00
Baptiste Daroussin
13872d0138 MFC r340111:
nfsd: Factorize code

Factorize code by using struct sockaddr_storage to handle both ipv6 and ipv4

Discussed with: rmacklem
Reviewed by: manu
Sponsored by: Gandi.net
Differential Revision: https://reviews.freebsd.org/D13223
2018-12-06 08:27:56 +00:00
Gordon Tetlow
28e817d86b MFC r341484
Always treat firmware request and response sizes as unsigned.

This fixes an incomplete bounds check on the guest-supplied request
size where a very large request size could be interpreted as a negative
value and not be caught by the bounds check.

Submitted by: jhb
Reported by:  Reno Robert
Approved by:  so
Security:     FreeBSD-SA-18:14.bhyve
Security:     CVE-2018-17160
2018-12-04 18:32:50 +00:00