Commit Graph

17298 Commits

Author SHA1 Message Date
Ed Maste
83b6064de1 makefs: use C standard memcpy/memset in userland
This file does not exist in NetBSD's makefs, but make the chance for
consistency with memcpy/memset used in the rest of makefs.

Sponsored by:	The FreeBSD Foundation
2017-06-12 13:49:57 +00:00
Xin LI
d5c2c66dba Fix buffer lengths.
After r319369, the RPC code validates caller supplied buffer length in
taddr2uaddr.  When no -h is specified, the sizeof(ai_addr) is used,
which is always smaller than the required size and therefore uaddr
would be NULL, causing the kernel to copyin() from userland NULL
and fail with EFAULT.

Reviewed by:	kevlo (via Telegram)
MFC after:	3 days
Differential Revision:	https://reviews.freebsd.org/D11151
2017-06-12 09:11:31 +00:00
Enji Cooper
c19afa1c20 Add more simple positive tests for chown(1)
The tests are largely symmetric with the tests for chmod(1)--added in r319642.

Remove chown-f_test (added in r268030) since the test coverage is now being
provided by `chown_test`.

MFC after:	1 month
Sponsored by:	Dell EMC Isilon
2017-06-11 19:31:42 +00:00
Marcelo Araujo
1d1a17a342 Make the VNC authentication build with LibreSSL on HardenedBSD and TrueOS.
PR:		219790
Submitted by:	Shirkdog <mshirk@daemon-security.com>
Reviewed by:	grehan and rgrimes
MFC after:	4 weeks.
Sponsored by:	iXsystems, Inc.
Differential Revision:	https://reviews.freebsd.org/D11071
2017-06-08 04:54:15 +00:00
Stephen J. Kiernan
63c1ff65d1 When the input parameter node is NULL, memory is allocated to it.
To later free the memory, introduce a new variable lnode to track when
this happens.

Submitted by:	Thomas Rix <trix@juniper.net>
Reviewed by:	emax
Approved by:	sjg (mentor)
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D9878
2017-06-06 22:17:55 +00:00
Stephen J. Kiernan
ba01ab64cc Before returning because of an memory allocation error, free the memory
already allocated to buf.

Found using clang's static analyzer - scan-build

Submitted by:	Thomas Rix <trix@juniper.net>
Reviewed by:	stevek
Approved by:	sjg (mentor)
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D9852
2017-06-06 21:51:04 +00:00
Allan Jude
e28f9b7d03 Jails: Optionally prevent jailed root from binding to privileged ports
You may now optionally specify allow.noreserved_ports to prevent root
inside a jail from using privileged ports (less than 1024)

PR:		217728
Submitted by:	Matt Miller <mattm916@pulsar.neomailbox.ch>
Reviewed by:	jamie, cem, smh
Relnotes:	yes
Differential Revision:	https://reviews.freebsd.org/D10202
2017-06-06 02:15:00 +00:00
Allan Jude
24ffc64926 usr.sbin/sesutil: 'locate all off' does not deactivate empty slots
PR:		217409
Reported by:	asomers
Reviewed by:	asomers, bapt
MFC after:	1 week
Sponsored by:	ScaleEngine Inc.
Differential Revision:	https://reviews.freebsd.org/D10458
2017-06-06 02:03:22 +00:00
Enji Cooper
649c9a25d5 Remove TODO for sub testcases added for bug 212160
On closer inspection, the past failures no longer occur on ^/head.

PR:		212160
Sponsored by:	Dell EMC Isilon
2017-06-03 18:20:23 +00:00
Enji Cooper
81341eb139 Fix the testplan after ^/head@r318960
The number of executed testcases is 128, not 126.

MFC after:	18 days
MFC with:	r318960
Sponsored by:	Dell EMC Isilon
2017-06-03 18:12:00 +00:00
Enji Cooper
f54f69008f Don't execute the TODO cases in a subshell
This messes up the testcase counter, as seen in bug 219756.

PR:		212160, 219756
Sponsored by:	Dell EMC Isilon
2017-06-03 18:10:04 +00:00
Ed Maste
423c834342 makefs: rename variable for NetBSD diff reduction 2017-06-03 14:28:19 +00:00
Marcelo Araujo
13eb5b4943 Bump manpage date. 2017-06-02 02:37:17 +00:00
Marcelo Araujo
f4d34383f9 Add VNC Authentication support based on RFC6143 section 7.2.2.
Submitted by:	Fabian Freyer <fabian.freyer@physik.tu-berlin.de>
Reworked by:	myself
Reviewed by:	grehan, rgrimes and jilles
MFC after:	1 week.
Relnotes:	Yes.
Sponsored by:	iXsystems, Inc.
Differential Revision:	https://reviews.freebsd.org/D10818
2017-06-02 02:35:16 +00:00
Eric van Gyzen
1f1ed24cc5 crashinfo: add "batch" mode and use it during boot
In batch mode, most messages go into the core.txt.N file instead of stdout.

Reviewed by:	jhb
MFC after:	3 days
Sponsored by:	Dell EMC
Differential Revision:	https://reviews.freebsd.org/D10429
2017-06-01 21:23:04 +00:00
Xin LI
6448ec89e7 * limit size of buffers to RPC_MAXDATASIZE
* don't leak memory
 * be more picky about bad parameters

From:

https://raw.githubusercontent.com/guidovranken/rpcbomb/master/libtirpc_patch.txt
https://github.com/guidovranken/rpcbomb/blob/master/rpcbind_patch.txt

via NetBSD.

Reviewed by:	emaste, cem (earlier version)
Differential Revision:	https://reviews.freebsd.org/D10922
MFC after:	3 days
2017-06-01 06:12:25 +00:00
Jung-uk Kim
af05116143 Merge ACPICA 20170531. 2017-06-01 00:01:19 +00:00
Ed Maste
5d7af8bb02 makefs: free buf in case of error
CID:		270190
Submitted by:	Siva Mahadevan <smahadevan@freebsdfoundation.org>
Reported by:	Coverity
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D11011
2017-05-31 16:28:29 +00:00
Alan Somers
43a251d687 Fix uninitialized variable in bootparamd.c
Restore line that was accidentally deleted in change 318790

Reported by:	Coverity
CID:		1375855
MFC after:	1 week
X-MFC-With:	318790
Sponsored by:	Spectra Logic Corp
2017-05-31 14:53:50 +00:00
Edward Tomasz Napierala
aa21218504 Minor tweaks to iscsi(4) and iscsid(8).
MFC after:	2 weeks
2017-05-28 17:02:29 +00:00
Edward Tomasz Napierala
33481e53e7 Make ctld(8) mention cfiscsi(4).
MFC after:	2 weeks
2017-05-28 16:41:42 +00:00
Enji Cooper
b8504cc0a6 pw: add some basic testcases for groupshow and usershow
- groupshow: test out -a/-g/-n .
- usershow: test out -a/-n/-u .

MFC after:	1 week
Sponsored by:	Dell EMC Isilon
2017-05-28 02:15:57 +00:00
David Bright
b326fec486 Add newsyslog capability to write RFC5424 compliant rotation message.
This modification adds the capability to newsyslog to write the
rotation message in a format that is compliant with RFC5424. This
capability is enabled on a per-log file basis through a new value
("T") in the flags field in newsyslog.conf. This is useful on systems
that use the RFC5424 format for log files so that the rotation message
format matches that of the other log messages. There has been recent
mention of adding an RFC5424 compliant mode to syslogd and at least
one alternative system log daemon (rsyslogd) that already has the
capability to use that format.

Reviewed by:	vangyzen, ngie
Approved by:	vangyzen (mentor)
MFC after:	2 months
Relnotes:	yes
Sponsored by:	Dell EMC
Differential Revision:	https://reviews.freebsd.org/D10253
2017-05-26 16:36:30 +00:00
Ed Maste
b79f050a88 makefs: add -O (offset) option
NetBSD revs:
ffs.c		1.60
makefs.8	1.44
makefs.c	1.48
makefs.h	1.33
ffs/buf.c	1.20
ffs/mkfs.c	1.27

Obtained from:	NetBSD
Relnotes:	Yes
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D10780
2017-05-26 15:49:20 +00:00
Marcelo Araujo
85a9cb4440 Simplify parseval() by allocating a buffer the size of the input string,
which will always be big enough to hold the output string.

Obtained from:	OpenBSD (revision 1.36)
2017-05-26 03:27:06 +00:00
Ed Maste
6160cc37f4 makefs: make buf generic
it has nothing to do with ffs and will eventually be moved.
gc sectorsize.

This is a corrected version of r317744.

NetBSD versions:
ffs.c		1.58
ffs/buf.c	1.14 1.18
ffs/buf.h	1.8

Submitted by:	Siva Mahadevan <smahadevan@freebsdfoundation.org>
Obtained from:	NetBSD
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D10803
2017-05-25 21:41:06 +00:00
Devin Teske
ab00ac327a Fix long standing issue in bsdconfig's keymap selection
Since the translation to vt as terminal emulator, the keymaps files
path has changed and this change does not get followed in bsdconfig.
This implicates boot time warnings about a wrong keymap file, what
is very confusing for the new users and for me too, so initialize
the default keymaps search path depending on terminal type.

Differential Revision:	https://reviews.freebsd.org/D8734
Submitted by:	Oliver Pinter <oliver.pinter@hardenedbsd.org>
Reviewed by:	ed, jilles, dteske
MFC after:	3 days
X-MFC-to:	stable/11
Sponsored by:	HardenedBSD
Signed-off-by:	Oliver Pinter <oliver.pinter@hardenedbsd.org>
2017-05-25 18:16:17 +00:00
Edward Tomasz Napierala
a9a393b390 Don't end up manpage titles with a full stop.
MFC after:	2 weeks
2017-05-24 21:02:53 +00:00
Glen Barber
9a7af23f46 Update the "first appeared in" version in several manual pages.
MFC after:	3 days
Sponsored by:	The FreeBSD Foundation
2017-05-24 17:47:49 +00:00
Alan Somers
6e3c30637d Fix a buffer overflow in bootparamd(8)
If /etc/bootparams contains a line with an excessively long pathname, and a
client asks for that path, then bootparamd will overflow a buffer and crash
while parsing that line.  This is not remotely exploitable since it requires
a malformed /etc/bootparams file.

Reported by:	Coverity
CID:		1305954
MFC after:	1 week
Sponsored by:	Spectra Logic Corp
2017-05-24 16:30:38 +00:00
Pedro F. Giffuni
880f26f3eb bhyvegc_resize: make use of reallocarray(3) for bounds-checking.
Also add __FBSDID.

Reviewed by:	grehan

This file lacks a license(!) so for this change the following declaration
applies:

To the greatest extent permitted by, but not in contravention of,
applicable law, Affirmer hereby overtly, fully, permanently, irrevocably
and unconditionally waives, abandons, and surrenders all of Affirmer's
Copyright and Related Rights and associated claims and causes of action,
whether now known or unknown (including existing as well as future claims
and causes of action).
2017-05-24 14:24:47 +00:00
Konstantin Belousov
6992112349 Commit the 64-bit inode project.
Extend the ino_t, dev_t, nlink_t types to 64-bit ints.  Modify
struct dirent layout to add d_off, increase the size of d_fileno
to 64-bits, increase the size of d_namlen to 16-bits, and change
the required alignment.  Increase struct statfs f_mntfromname[] and
f_mntonname[] array length MNAMELEN to 1024.

ABI breakage is mitigated by providing compatibility using versioned
symbols, ingenious use of the existing padding in structures, and
by employing other tricks.  Unfortunately, not everything can be
fixed, especially outside the base system.  For instance, third-party
APIs which pass struct stat around are broken in backward and
forward incompatible ways.

Kinfo sysctl MIBs ABI is changed in backward-compatible way, but
there is no general mechanism to handle other sysctl MIBS which
return structures where the layout has changed. It was considered
that the breakage is either in the management interfaces, where we
usually allow ABI slip, or is not important.

Struct xvnode changed layout, no compat shims are provided.

For struct xtty, dev_t tty device member was reduced to uint32_t.
It was decided that keeping ABI compat in this case is more useful
than reporting 64-bit dev_t, for the sake of pstat.

Update note: strictly follow the instructions in UPDATING.  Build
and install the new kernel with COMPAT_FREEBSD11 option enabled,
then reboot, and only then install new world.

Credits: The 64-bit inode project, also known as ino64, started life
many years ago as a project by Gleb Kurtsou (gleb).  Kirk McKusick
(mckusick) then picked up and updated the patch, and acted as a
flag-waver.  Feedback, suggestions, and discussions were carried
by Ed Maste (emaste), John Baldwin (jhb), Jilles Tjoelker (jilles),
and Rick Macklem (rmacklem).  Kris Moore (kris) performed an initial
ports investigation followed by an exp-run by Antoine Brodin (antoine).
Essential and all-embracing testing was done by Peter Holm (pho).
The heavy lifting of coordinating all these efforts and bringing the
project to completion were done by Konstantin Belousov (kib).

Sponsored by:	The FreeBSD Foundation (emaste, kib)
Differential revision:	https://reviews.freebsd.org/D10439
2017-05-23 09:29:05 +00:00
Enji Cooper
5a7c7dc571 bsdinstall(8): fix manpage issues
- Start new sentences on new lines.
- Separate e.g. (more of an igor thing) with commas, and rewrite some examples
  not to be enclosed in parentheses.

Reported by:	igor, make manlint
MFC after:	2 weeks
Sponsored by:	Dell EMC Isilon
2017-05-23 08:01:11 +00:00
Enji Cooper
ab9ff47abc sade(8): start new sentence on new line
Reported by:	make manlint
MFC after:	2 weeks
Sponsored by:	Dell EMC Isilon
2017-05-23 07:50:42 +00:00
Enji Cooper
d6f6b20128 style(9): sort headers
MFC after:	2 weeks
MFC with:	r318693
Sponsored by:	Dell EMC Isilon
2017-05-23 06:05:54 +00:00
Enji Cooper
d547c56fdf Some minor style(9) fixes
- Wrap at <80 columns.
- Sort by type

MFC after:	2 weeks
Sponsored by:	Dell EMC Isilon
2017-05-23 06:04:38 +00:00
Glen Barber
f0c9042b38 Correct the "first appeared in" version for efivar(8).
MFC after:	3 days
Sponsored by:	The FreeBSD Foundation
2017-05-22 13:55:59 +00:00
Roger Pau Monné
d7640440fb bsdinstall: do not use distextract in scripted mode
It requires a tty, which might not be available in scripted installs. Instead
extract the sets manually using tar.

Reviewed by:		tsoome
Sponsored by:		Citrix Systems R&D
MFC after:		1 week
Differential revision:	https://reviews.freebsd.org/D10736
2017-05-22 11:41:17 +00:00
Roger Pau Monné
2f34d6c344 bsdinstall: mount is not needed for the ZFS install case
Because the datasets are already mounted by zfsboot, and the mount script
doesn't know anything about ZFS. Also do not execute the "umount" script for
ZFS for the same reasons.

Reviewed by:		dteske, tsoome
Sponsored by:		Citrix Systems R&D
MFC after:		1 week
Differential revision:	https://reviews.freebsd.org/D10738
2017-05-22 11:38:39 +00:00
Benjamin Kaduk
98120473ab Updates for efivar.8
Fix spelling [1], appease igor and mandoc -Tlint, and adopt the
language style to be more consistent with our corpus.

PR:		219434 [1]
Submitted by:	olgeni [1]
2017-05-21 22:10:08 +00:00
Rick Macklem
6ab9e0df87 Update the exports.5 man page to reflect the change in default uid/gid
made by r318262.

This is a content change.
2017-05-20 23:25:07 +00:00
Cy Schubert
1232628506 Fix up two assertions following malloc(). vangyzen@ notified me of
the second one. The first one is fixed as well.

Reported by:	vangyzen@
MFC after:	1 week
2017-05-20 18:16:26 +00:00
Cy Schubert
8af0c00bd6 Fix non-recoverable name resolution failures due to negative cache
entries never expiring. This patch honours the negative cache timeout.

To test/experience the failure do the following:

1. Edit /etc/ncd.conf to adjust the cache timeouts as follows:

	positive-time-to-live hosts 30
	negative-time-to-live hosts 1

2. Ensure that nsswitch.conf hosts line contains something like:

	hosts: files cache dns

	Note that cache must be specified before dns.

3. Start nscd.

4. Run the following command:

	while true; do nc -z -w 3 www.google.com 80; sleep 5; done

5. While running the command, remove or comment out all nameserver
   statements in /etc/resolv.conf. After a short while you will notice
   non-recoverable name rsolution failures.

6. Uncomment or replace all nameserver statements back into
   /etc/resolv.conf. Take note that name resolution never recovers.
   To recover nscd must be restarted. This patch fixes this.

PR:		207804
Submitted by:	Jov <amutu@amutu.com>
MFC after:	1 week
2017-05-20 16:58:48 +00:00
Maxim Konovalov
6dce7e9908 o Missed flag restored.
PR:		219395
Submitted by:	Tiwei Bie
2017-05-19 20:02:32 +00:00
Ed Maste
7092a907e5 makefs: drop WARNS back to 2
GCC warns about additional signed comparision issues compared to Clang.
Drop WARNS for now until the underlying issue is fixed.
2017-05-18 17:55:33 +00:00
Emmanuel Vadot
d91e611798 makefs: Add soft-updates option
Add the ffs option to enable soft-updates.
The option is only processed is ufs2 has been selected.

Reviewed by:	emaste, bapt (earlier version), allanjude (earlier version)
Sponsored by:	Gandi.net
Differential Revision:	https://reviews.freebsd.org/D10773
2017-05-18 14:19:06 +00:00
Ed Maste
3afe6a68e0 makefs: clean up signedness warnings and bump WARNS to 3
Reviewed by:	kib
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D10650
2017-05-18 14:05:29 +00:00
Rick Macklem
947572b4ee Change the default uid/gid values for nobody/nogroup to 65534/65533.
The default values found in /etc/passwd and /etc/group are 65534, 65533.
In mountd.c, the defaults were -2, which was 65534 back when uid_t was 16bits.
Without this patch, a file created by root on an NFS exported volume without
the "-root=" export option will end up owned by uid 4**32 - 2.
When discussed on freebsd-current@, it seemed that users preferred the
values being changed to 65534/65533.
I have not added code to acquire these values from the databases, since
the mountd daemon might get "stuck" during startup waiting for a non-responsive
password database server.

Discussed on:	freebsd-current
2017-05-14 00:38:41 +00:00
Alan Somers
0ce59aa848 Don't depend on assert(3) getting evaluated
Reported by:	imp
MFC after:	3 weeks
X-MFC-With:	318141, 318143
Sponsored by:	Spectra Logic Corp
2017-05-10 16:06:22 +00:00
Alan Somers
daccabe958 strcpy => strlcpy
Reported by:	Coverity
CID:		1006715
MFC after:	3 weeks
Sponsored by:	Spectra Logic Corp
2017-05-10 15:38:06 +00:00
Bryan Drewery
07676084ec DIRDEPS_BUILD: Update dependencies.
Sponsored by:	Dell EMC Isilon
2017-05-09 01:48:23 +00:00
Bryan Drewery
6106a50ee6 DIRDEPS_BUILD: Connect new directories.
Sponsored by:	Dell EMC Isilon
2017-05-09 01:48:14 +00:00
Enji Cooper
ca7f276c93 Restore sectorsize global to unbreak makefs after r317744
This also unbreaks the fstyp tests.

Reported by:	Alastair Hogge <agh@fastmail.fm>, Jenkins
Sponsored by:	Dell EMC Isilon
2017-05-08 18:42:38 +00:00
Ed Maste
c5a0915477 makefs: further size_t warning cleanup (missing from r317944)
Sponsored by:	The FreeBSD Foundation
2017-05-08 16:57:33 +00:00
Ed Maste
243a297a95 makefs: cast snprintf return value to size_t to clear warning
Sponsored by:	The FreeBSD Foundation
2017-05-08 16:34:39 +00:00
Ed Maste
856d87c5af makefs: use size_t as appropriate to clean up warnings
Sponsored by:	The FreeBSD Foundation
2017-05-08 13:09:27 +00:00
Scott Long
e8262ee824 Show more fields in the IOCFact message 2017-05-05 17:01:54 +00:00
Edward Tomasz Napierala
d4acedbc64 Revert r317804; apparently I forgot the auto_master syntax.
MFC after:	2 weeks
2017-05-04 19:55:32 +00:00
Edward Tomasz Napierala
1638f1d3e4 Make automount(8) error out when the map name is missing.
MFC after:	2 weeks
2017-05-04 19:41:19 +00:00
Gleb Smirnoff
5c3ec67603 Improve documentation of fbuf device.
Submitted by:	novel
Reviewed by:	grehan, bcr
Differential Revision:	https://reviews.freebsd.org/D10014
2017-05-03 21:44:04 +00:00
Poul-Henning Kamp
67c9f60e86 Flush stdout before yes/no confirmations, to force question
through pipes/tee(1)/whatever
2017-05-03 20:41:26 +00:00
Ed Maste
9e96f90b50 makefs: clean up warnings
- make functions and variables static where appropriate
- use const char * where appropriate
- remove unused variables

Sponsored by:	The FreeBSD Foundation
2017-05-03 14:57:04 +00:00
Ed Maste
15fc093acc makefs: make buf generic
it has nothing to do with ffs and will eventually be moved.
gc sectorsize.

NetBSD versions:
ffs.c		1.58
ffs/buf.c	1.14 1.18
ffs/buf.h	1.8

Obtained from:	NetBSD
Sponsored by:	The FreeBSD Foundation
2017-05-03 14:21:18 +00:00
Marcelo Araujo
63128851f3 Use nitems() from sys/param.h.
Reviewed by:	ngie
MFC after:	2 weeks.
Differential Revision:	https://reviews.freebsd.org/D9942
2017-05-03 14:03:46 +00:00
Marcelo Araujo
049e195404 Free the memory allocated to trackbuf before exiting, it might fix a potential
memory leak.

Submitted by:	trix@juniper.net
MFC after:	2 weeks.
Differential Revision:	https://reviews.freebsd.org/D9856
2017-05-03 13:57:31 +00:00
Ed Maste
e651540a68 makefs: remove unused cd9660_defaults_set global
Sponsored by:	The FreeBSD Foundation
2017-05-01 00:53:07 +00:00
Pedro F. Giffuni
2b223a01ef mixer(8): Prevent possible sscanf() overflow.
Fix %s buffer sizes in sscanf().

Obtained from:	DragonflyBSD (git dab952e2)
MFC after:	5 days
2017-04-29 19:12:44 +00:00
Maxim Konovalov
7c415819be o Clean the whole array of IPv4 addresses not just a local part.
PR:		218923
Submitted by:	Daniel McRobb
2017-04-28 09:17:16 +00:00
Gleb Smirnoff
6c87a2c0ee Document raw framebuffer device and XHCI device configurations. 2017-04-28 05:43:27 +00:00
Gleb Smirnoff
bc5d44ec53 - For security reasons by default listen on localhost address,
not on wildcard. [1]
- Move the default port assignment from pci_fbuf.c to rfb.c,
  to avoid polluting pci_fbuf.c with network things.

Suggested by:	grehan
2017-04-28 05:32:26 +00:00
Gleb Smirnoff
3909a600a5 When no "rfb" configuration specified bind to the default VNC
port instead of binding to a random one.
2017-04-28 05:13:27 +00:00
Gleb Smirnoff
60bfcbd605 Make comments match the code. No functional change. 2017-04-28 05:09:51 +00:00
Brooks Davis
0607c830b3 More ATM and NATM removal
Submitted by:	ak
Reviewed by:	ngie
Differential Revision:	https://reviews.freebsd.org/D10511
2017-04-27 16:05:12 +00:00
Takanori Watanabe
4aa92fe2f3 Make cached Bluetooth LE host advertise information visible from userland.
Differential Revision:	https://reviews.freebsd.org/D10362
2017-04-27 15:03:24 +00:00
Gleb Smirnoff
007e172d64 We need CAP_MMAP_RW on memfd, since init_msix_table() may call mmap(). 2017-04-27 05:48:52 +00:00
Edward Tomasz Napierala
56226f9c30 Make fstyp(8) recognize exFAT even without the -u option.
While it's not directly mountable with mount(8), it's something that's
mountable - differently from GELI or zpools.

MFC after:	2 weeks
2017-04-26 19:34:41 +00:00
John Baldwin
73ad3fb536 Add a new GDB_LIBEXEC option to install gdb and kgdb to /usr/libexec.
When this option is enabled, only gdb and kgdb are installed to
/usr/libexec for use by crashinfo(8). Other bits of GDB such as
gdbserver and gdbtui are not installed. For this option to be
effective, GDB must be enabled.

Rework r317094 to re-enable GDB on all platforms but enable
GDB_LIBEXEC on platforms for which the GDB in ports is a superset of
functionality.

Reviewed by:	emaste, kib
Suggested by:	kib
Relnotes:	yes
Differential Revision:	https://reviews.freebsd.org/D10449
2017-04-25 18:08:56 +00:00
Brooks Davis
5477372324 Use the approved syntax to build no man pages.
MFC after:	1 week
Sponsored by:	DARPA, AFRL
2017-04-24 21:55:59 +00:00
Brooks Davis
a7dc31283a Remove the NATM framework including the en(4), fatm(4), hatm(4), and
patm(4) devices.

Maintaining an address family and framework has real costs when we make
infrastructure improvements.  In the case of NATM we support no devices
manufactured in the last 20 years and some will not even work in modern
motherboards (some newer devices that patm(4) could be updated to
support apparently exist, but we do not currently have support).

With this change, support remains for some netgraph modules that don't
require NATM support code. It is unclear if all these should remain,
though ng_atmllc certainly stands alone.

Note well: FreeBSD 11 supports NATM and will continue to do so until at
least September 30, 2021.  Improvements to the code in FreeBSD 11 are
certainly welcome.

Reviewed by:	philip
Approved by:	harti
2017-04-24 21:21:49 +00:00
Rick Macklem
c1c63967cb Fix the default uid/gid values in nfsuserd.c
This patch sets the default uid/gid values for "nobody" and "nogroup"
to the values in the password and group databases. Normally nfsuserd(8)
will override these with whatever is in the password/group databases,
so these values are only used when the databases entries aren't available.
It would be nice to use the definitions in sys/conf.h, but those are
in the _KERNEL section of the file.

Reported by:	tez@pkgsrc.org
Submitted by:	tez@pkgsrc.org
MFC after:	2 weeks
2017-04-23 23:09:02 +00:00
Pedro F. Giffuni
780154cbaf pmcstat(8); unsign some allocation variables and use reallocarray(3).
Use unsigned values in some internal variables that will be used during
allocation. The variables are used in reduced scope and have no chance of
becoming negative.

Provide bounds checking through reallocarray(3).

MFC after:	2 weeks
2017-04-22 16:02:40 +00:00
Rick Macklem
97662c7c33 Get rid of bogus statement in the nfsuserd.8 man page.
The nfsuserd.8 man page stated that a usertimeout of 0 would disable
the cache timeout. This was simply not true, so this patch deletes
the sentence.

This is a content change.

PR:		217406
MFC after:	2 weeks
2017-04-21 20:53:51 +00:00
Enji Cooper
609b7b269d Add a knob, WITH*_RPCBIND_WARMSTART_SUPPORT, to allow the end-user to build
rpcbind(8) with/without warmstart support.

The knob defaults to off to preserve POLA for the feature.

See rpcbind(8) for more details about the warmstart feature.

MFC after:	7 weeks
Relnotes:	yes
Sponsored by:	Dell EMC Isilon
2017-04-19 20:45:46 +00:00
Enji Cooper
ebb27fd055 Fix indentation per style.Makefile(5)
MFC after:	7 weeks
Sponsored by:	Dell EMC Isilon
2017-04-19 20:27:13 +00:00
Enji Cooper
bffe25839c rpcbind(8): post-humously document -w (warmstart) support added in r74462
warmstart support saves portmap/rpcbind(8) registration state on exit and
restores the saved registration state on restart.

MFC after:	7 weeks
Sponsored by:	Dell EMC Isilon
2017-04-19 20:23:27 +00:00
Enji Cooper
7e84e1cb45 rpcbind(8): add a description for /var/run/rpcbind.sock under the FILES section
MFC after:	7 weeks
Sponsored by:	Dell EMC Isilon
2017-04-19 20:04:45 +00:00
Enji Cooper
218d5aa052 rpcbind(8): wordsmith -h description and mention -W in the SYNOPSIS section
-W was already documented in the OPTIONS section.

MFC after:	7 weeks
Reported by:	igor (-h wordsmith'ing)
Sponsored by:	Dell EMC Isilon
2017-04-19 18:01:53 +00:00
Enji Cooper
fadafdfa69 Print out the signal number on exit in terminate(..) if WARMSTART is compiled
into rpcbind.

The signal number can provide helpful diagnostic info.

MFC after:	1 week
Obtained from:	Isilon OneFS
Sponsored by:	Dell EMC Isilon
2017-04-19 17:51:32 +00:00
Patrick Kelsey
2f8c6c0a58 Fix userland tools that don't check the format of routing socket
messages before accessing message fields that may not be present,
removing dead/duplicate/misleading code along the way.

Document the message format for each routing socket message in
route.h.

Fix a bug in usr.bin/netstat introduced in r287351 that resulted in
pointer computation with essentially random 16-bit offsets and
dereferencing of the results.

Reviewed by:	ae
MFC after:	1 month
Differential Revision:	https://reviews.freebsd.org/D10330
2017-04-16 19:17:10 +00:00
Baptiste Daroussin
1af6dc18b9 Add a new Y flag to newsyslog.conf
This makes newsyslog use zstandard to compress log files.

Given Z is already taken for gzip and zstandard compression level stands in
between gzip and xz (which has the X flag) chosing Y sounds ok :)
2017-04-15 20:37:34 +00:00
Maxim Sobolev
023653459a Fix another logic bug that came out of recent syslogd refactoring and exposed by
the r316874: don't call shutdown(2) on all sockets, but only net ones, which seems
to be the behaviour existed before that refactoring. Also don't call listen(2)
in datagram sockets and fix misplaced debug messages while I am here.

Reported by: peter
2017-04-15 18:20:11 +00:00
Maxim Sobolev
b98582b146 Since shutdown(2) on datagram socket is no longer a NOP after rev 316874
don't bother to select/recv on that socket. This prevents syslogd(8)
from spinning endlessly when started with the -s option (default).

Reported by:	peter
2017-04-15 02:24:22 +00:00
Conrad Meyer
6c546e77b6 bsdinstall(8): Sprinkle a snprintf to fixed size buffer
Use a snprintf to write an environment variable to a fixed-size buffer to
avoid stack overflow.

Reported by:	Coverity (CWE-120)
CID:		1238926
Sponsored by:	Dell EMC Isilon
2017-04-14 00:36:45 +00:00
Conrad Meyer
9c363a12fb ctm: Fix some trivial argv buffer overruns
It may not do the right thing with these obviously wrong inputs, but at
least it won't smash the stack.

Reported by:	Coverity (CWE-120)
CIDs:		1006697, 1006698
Sponsored by:	Dell EMC Isilon
2017-04-13 22:59:17 +00:00
Alexander Motin
9215e501b9 Do not register in CTL portal groups without portals.
From config synthax point of view such portal groups are not incorrect,
but they are useless since can not receive any connection.  And since
CTL port resource is very limited, it is good to save it.

MFC after:	2 weeks
2017-04-10 10:38:12 +00:00
Alexander Kabaev
e64aaeac2a Use int to receive the return value of getopt function.
getopt returns int and not char, so assigning the value to
char is not ideal, especially on platforms with unsigned
chars.
2017-04-07 22:58:31 +00:00
Sevan Janiyan
ea566940e1 Remove the last vestiges of FDC_DEBUG & FD_DEBUG
FDC_DEBUG is not referenced in any c or header files but traces of it
still remain in other files.

PR:		105608
Reported by:	Eugene Grosbein <ports AT grosbein DOT net>
Reviewed by:	imp
Approved by:	bcr (mentor)
MFC after:	7 days
Differential Revision:	https://reviews.freebsd.org/D10303
2017-04-07 16:14:25 +00:00
Ed Maste
37ca9f42fd makefs: Sync with NetBSD (fix unused variable warnings)
NetBSD revs:
cd9660.c		1.45
cd9660/cd9660_write.c	1.17

Obtained from:	NetBSD
2017-04-07 02:31:55 +00:00
Brooks Davis
08069ae688 Point out that -F probably does not do what the user expects.
Users attempting to create images from mtree METALOG files created by
installworld often use -F when they should be passing the METALOG file
in place of a directory. This is often produces difficult to debug
error reports.

Reviewed by:	emaste
MFC after:	1 week
Sponsored by:	DARPA, AFRL
Differential Revision:	https://reviews.freebsd.org/D10038
2017-04-06 23:35:10 +00:00
Renato Botelho
a2ac74c148 Introduce libxo support to arp(8)
Reviewed by:	wblock, gnn, allanjude, phil
Approved by:	allanjude
MFC after:	1 week
Sponsored by:	Rubicon Communications (Netgate)
Differential Revision:	https://reviews.freebsd.org/D9563
2017-04-06 22:50:28 +00:00
Ed Maste
5f5598b130 makefs: use emalloc and friends
The emalloc set of error-checking memory allocation routines were added
to libnetbsd in r316572. Use them in makefs to reduce differences with
NetBSD.

NetBSD revs:
cd9660.c			1.39
ffs.c				1.56
makefs.c			1.42
walk.c				1.27
cd9660/cd9660_archimedes.c	1.2
cd9660/cd9660_eltorito.c	1.20
cd9660/cd9660_write.c		1.16
cd9660/iso9660_rrip.c		1.12
ffs/buf.c			1.17
ffs/mkfs.c			1.26

Obtained from:	NetBSD
2017-04-06 16:18:42 +00:00
Ed Maste
07e89ad740 makefs: zero memory
NetBSD revs:
ffs/buf.c	1.14

Obtained from:	NetBSD
2017-04-06 00:07:11 +00:00
Enji Cooper
ba8c8a0ca2 Don't assume NAME_MAX is 255
Query the filesystem limit via getconf(3) instead

MFC after:	2 months
Sponsored by:	Dell EMC Isilon
2017-04-04 21:36:13 +00:00
Enji Cooper
d2d2a79c1a Clean up more trailing whitespace in the licensing tort that
happened to be spaces, not tabs

MFC after:	2 months
Sponsored by:	Dell EMC Isilon
2017-04-04 21:30:24 +00:00
Enji Cooper
9bf377826e Clean up trailing whitespace
MFC after:	2 months
Sponsored by:	Dell EMC Isilon
2017-04-04 21:29:37 +00:00
Bruce Evans
6be33b8301 Fix a missing const in my previous commit which broke the build at
normal WARNS.

Reported by:	lwhsu
2017-04-03 15:11:28 +00:00
Bruce Evans
b60e1b8142 Show high (blinking foreground/bright background) background colors. Format
output and source better for this.  Format output for 40 columns if there
are less than 80 columns.
2017-04-03 13:06:28 +00:00
Bruce Evans
8f92a81b81 Remove the global variable 'info' and fix associated bugs and style bugs.
This variable was used 4 times in 1 function and all uses were wrong.
The 4 uses were in he test_frame() (show) function, to try to restore
4 colors, 2 unnecessarily and these 2 now broken.  This was wrong
because it is the previous colors that must be restored, but the global
holds the original colors.  Excessive setting of colors at the end
restored the previous colors correctly in most cases, but I removed
this a couple of revisions ago.

Originally, this variable had 1 correct use, to test for being on a vty
as a side effect of initializing it.  This is now down in init(), and
init() also leaves a better-named global with the same contents.

Fix this by reading the current console info into a local variable in
test_frame(), as is done for several other functions.  Fix style bugs
in this reading for all callers:
- extra blank lines
- all error messages different.  The first one now in init() is not as
  specific as the old one, but it is after a different specific one for
  another ioctl and is unlikely to be reached when the first ioctl
  succeeds.  Ones after the first are to repeat the ioctl, so are even
  more likely to be reached.  The correctness of full removal of the
  old global depends on the error handling for failure to initialize
  it being unreachable.
- err() instead of warn() for failure in load_font().  This is almost
  unreachable, and it makes no sense to continue after undoing previous
  changes with revert().
- unreachable return after err() for failure in dump_screen().

Undo large renaming of local variables from the good name 'info' to the
bad name _info, which was done to protect the buggy global's bad name
from -Wshadow warnings.
2017-04-03 10:47:01 +00:00
Bruce Evans
2b881cf4c6 Save errno across revert().
Change 25 uses of errc() to err().  2 of these were correct.  23 used
errno for the arg so were just a verbose spelling of err().  5 of these
were just style bugs, and 18 depended on revert() saving errno.

1 warn() also depended on revert() saving errno.

Remove 2 warnx()'s that duplicate the message from a later errx().
These used to be before returns, and should have reported errno in
some cases.  errno is also not reported for for openguess() failures.

Only "restore" the video mode in revert() if the mode was just set
(necessarily partially).  Setting the mode to its current setting
doesn't "restore" it, but resets it, with the least harmful change
being to clear the screen.  revert() is called even for some harmless
syntax errors and usually did nothing except reset the mode.  Now it
usually does nothing.  The only things that it tries to restore apart
from the mode are the active vty number, the screen map, 2 colors that
only need to be restored (only after a mode change) to fix kernel bugs,
and 3 colors that can't be restored due to kernel bugs.  (This is
mostly for sc, since vt doesn't support mode changes.)

revert() is not called for syntax and setting errors after [mode], so
the mode reset is only done for failures to set raster mode after
setting graphics mode.  normal colors can only be set after [mode],
and that is why reverting them should be unnecessary.
2017-04-03 09:21:00 +00:00
Bruce Evans
1b8c842e06 Fix some parsing and error handling bugs.
r146736 added an undocumented syntax and many bugs handling it.  The
documented syntax is "... [mode] [fg [bg]] [show]", where it is critical
for reducing ambiguity and keeping things simple that the mode is
parsed first.  r146736 added buggy support for "... [mode] [fg [bg]]
[show] [mode] [fg [bg]]".  One error was that after for failing to set
a partially-supported graphics mode, argv[optind] remains pointing to
the mode so doesn't match the first [fg [bg]], so the setting is
attempted again, with slightly worse error handling.

Fix this by removing it (support for the trailing '[mode] [fg [bg]]')
and cleaning up.  The cleanups are mostly to remove convolutions and
bugs that didn't work to handle the ambiguous syntax '[fg [bg]] [fg [bg]]'
when [mode] and [show] are not present.  Globals were set to allow
repeating the color settings at the end.  The functions that set the
colors earlier were misnamed from set* to get*.  All that they "got" is
is settings from argv.  They applied the settings to the kernel and
the globals.

Fix restoration of colors in revert() by restoring 2 after the mode
change.  Colors should not need to be restored, but a bug in scteken
clobbers them on any mode change, including ones for restoration.  Don't
move the restoration of the other 3.  Teken doesn't clobber them on
mode changes because it doesn't support them at all (sc still supports
the border color, but only using a non-teken ioctl).

Add restoration of colors after a successful mode change to work around
the scteken bug there too.  The bug was previously masked by the general
setting of colors at the end.

Fix a longstanding parsing/error handling bug by exiting almost immediately
after matching the [mode] arg but failing to set the mode.  Just revert
if necessary.  Don't return to continue parsing but do it wrong.  This
bug caused spamming the output with a usage() message and exiting with
status 1 whenever [mode] is not present bug [fg [bg]] or [show].  The
exit code 1 was actualy an ambiguous internal code for failure to match
[mode] or failure to set [mode].  This 1 was obfuscated by spelling it
EXIT_FAILURE, but actual exit codes spell EXIT_FAILURE as 1.  Remove
another global which could have been used to disambiguate this but was
only used to micro-optimize the (unnecessary except for other bugs)
setting of colors at the end.
2017-04-03 06:52:02 +00:00
Alexander Motin
ec46b9208d Fix variable for sizeof() in previous commit.
MFC after:	2 weeks
2017-04-02 20:57:59 +00:00
Alexander Motin
4e183a48fe Add Log directory and SATA NCQ Send and Receive Log.
Those are used at least by Linux guests to detect queued TRIM support.

MFC after:	2 weeks
Sponsored by:	iXsystems, Inc.
2017-04-02 20:39:51 +00:00
Bruce Evans
12dd1cd388 Remove checks that background (bg) colors are not bright and buggy
attempts to keep them that way.  The bg brightness bit is interpreted
as blinking in some modes, but it would barely be useful to disallow
setting it when it would give blinking in code which knew when that
is.  The old code mostly knew this wrong, and added handling errors.
It is in fact impossible to know, since future mode switches may
change the meaning of the bit many times on the screen and in history.

Old versions of vidcontrol disallowed bg color numbers >= 8 in all
cases.  This is very VGA/syscons-centric.  Syscons uses the VGA defaults
of blinking fg instead of bright bg in text mode and bright bg in
graphics mode.  On VGA, this is very easy to toggle at any time, and
vt blows away the VGA text mode default at boot time.

r146736 changed this to try to allow bg color numbers in graphics mode
only.  This is even more VGA/syscons-centric, and there are many bugs
in this, and many nearby bugs in the parser.  These are increased or
decreased by differences and bugs in vt and teken.

Perhaps the most obvious bug was that almost any vidcontrol command
which changes any color or the mode causes an error if the initial fg
color is bright.  E.g., in syscons text mode, after "vidcontrol
lightwhite" to make the fg bright, another "vidcontrol lightwhite" is
rejected and buggy fixup code changes the fg to white.  This is because
the bright fg color creates a bright bg color for the phantom reverse
video attribute, so was rejected.  (The reverse video attribute is
phantom because teken ignores the user's setting of it and simply
reverses the fg attributes to create the bg attributes.  Sometimes
some layer masks off the brightness/blinking bit, but not here.)

Perhaps the next most obvious one was that "vidcontrol lightgreen
lightblue" was misparsed as 2 settings of the fg instead of 1 setting
of the fg and 1 invalid setting of the bg.  This is because the
parser supports an undocumented syntax with many parsing bugs (an
ambiguity gives this one).

I recently fix bugs in teken that broke setting of bright fg's and
bg's in the normal way.  This gave more settings of then, so the old
bugs showed up more often.
2017-04-02 16:39:39 +00:00
Roman Bogorodskiy
0ee3a4b4ae Minor style improvements in bhyve.8
Replace "as of now" with "at present". As the change is a really minor one,
don't bump .Dd.

Suggested by:	wblock
Approved by:	wblock (implicit)
2017-04-01 15:01:10 +00:00
Alan Somers
86571b9c01 Consolidate random sleeps in periodic scripts
Multiple periodic scripts sleep for a random amount of time in order to
mitigate the thundering herd problem. This is bad, because the sum of
multiple uniformly distributed random variables approaches a normal
distribution, so the problem isn't mitigated as effectively as it would be
with a single sleep.

This change creates a single configurable anticongestion sleep. periodic
will only sleep if at least one script requires it, and it will never sleep
more than once per invocation. It also won't sleep if periodic was run
interactively, fixing an unrelated longstanding bug.

PR:		217055
PR:		210188
Reviewed by:	cy
MFC after:	3 weeks
Differential Revision:	https://reviews.freebsd.org/D10211
2017-04-01 04:42:35 +00:00
Enji Cooper
653e7d6396 Split iscsi(4) ctl frontend off of ctl(4) as cfiscsi(4)
The goal of this work is to remove the explicit dependency for ctl(4)
on iscsi(4), so end-users without iscsi(4) support in the kernel can
use ctl(4) for its other functions.

This allows those without iscsi(4) support built into the kernel to use
ctl(4) as a test mechanism. As a sidenote, this was possible around the
10.0-RELEASE period, but made impossible for end-users without iscsi(4)
between 10.0-RELEASE and 11.0-RELEASE.

Automatically load cfiscsi(4) from ctladm(8) and ctld(8) for backwards
compatibility with previously releases. The automatic loading feature is
compiled into the beforementioned tools if MK_ISCSI == yes when building
world.

Add a manpage for cfiscsi(4) and refer to it in ctl(4).

Differential Revision:	D10099
MFC after:	2 months
Relnotes:	yes
Reviewed by:	mav, trasz
Sponsored by:	Dell EMC Isilon
2017-03-30 04:56:27 +00:00
Conrad Meyer
34a1b5b258 rrenumd(8): Fix a trivial Coverity warning
Coverity warns that it is invalid to access following struct members by
accessing the current struct member pointer plus one.  Assuming the
compilers aren't abusing this kind of UB yet, this cleanup isn't a
functional change.

Reported by:	Coverity
CID:		1368713
Sponsored by:	Dell EMC Isilon
2017-03-29 21:04:39 +00:00
Ed Maste
cfa6282553 makefs: sync with NetBSD
This is a collection of minor changes as diff reduction against NetBSD.

NetBSD revs:
cd9660.c		1.39
cd9660.h		1.19
makefs.c		1.34

Obtained from:	NetBSD
Sponsored by:	The FreeBSD Foundation
2017-03-29 20:49:41 +00:00
Ed Maste
10d64b7788 makefs: free specfile structure once it has been applied
NetBSD revs:
walk.c		1.21

Obtained from:	NetBSD
Sponsored by:	The FreeBSD Foundation
2017-03-29 15:45:19 +00:00
Ed Maste
6c5f7c4725 makefs: sort roundup with the other off_t members in fsinfo_t
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
2017-03-27 20:24:18 +00:00
Enji Cooper
ced3474819 ctldadm: sort #includes per style(9)
- Only include sys/types.h or sys/param.h, not both.
- Sort alphabetically.

MFC after:	3 days
Sponsored by:	Dell EMC Isilon
2017-03-27 19:01:34 +00:00
Enji Cooper
9118b1b092 ctld: sort #includes per style(9)
- Only include sys/types.h or sys/param.h, not both.
- Sort alphabetically.

MFC after:	3 days
Sponsored by:	Dell EMC Isilon
2017-03-27 18:59:49 +00:00
Enji Cooper
f040054c54 Allow WARNS to be overridden by the end-user
MFC after:	3 days
Sponsored by:	Dell EMC Isilon
2017-03-27 18:40:20 +00:00
Brad Davis
f43b687262 Check to see if the kernel has cd9660 before running tests that require it
Approved by:	ngie
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D10096
2017-03-27 15:20:31 +00:00
Jamie Gritton
6bd211bb87 Same as r316022 (Fix hexadecimal escape codes in jail.conf(5)),
but do it right this time.

Reported by:	Kyle Evans <Kyle Evans>
MFC after:	3 days
2017-03-27 13:37:40 +00:00
Jamie Gritton
acf8ec5684 Fix hexadecimal escape codes in jail.conf(5).
PR:		218154
Submitted by:	Masahiro Konishi <mkonishi@sea.plala.or.jp>
MFC after:	3 days
2017-03-27 13:27:39 +00:00
Robert Watson
5e386598a6 Merge OpenBSM 1.2-alpha5 from vendor branch to FreeBSD -CURRENT:
- Add a new "qsize" parameter in audit_control and the getacqsize(3) API to
  query it, allowing to set the kernel's maximum audit queue length.
- Add support to push a mapping between audit event names and event numbers
  into the kernel (where supported) using new A_GETEVENT and A_SETEVENT
  auditon(2) operations.
- Add audit event identifiers for a number of new (and not-so-new) FreeBSD
  system calls including those for asynchronous I/O, thread management, SCTP,
  jails, multi-FIB support, and misc. POSIX interfaces such as
  posix_fallocate(2) and posix_fadvise(2).
- On operating systems supporting Capsicum, auditreduce(1) and praudit(1) now
  run sandboxed.
- Empty "flags" and "naflags" fields are now permitted in audit_control(5).

Many thanks to Christian Brueffer for producing the OpenBSM release and
importing/tagging it in the vendor branch.  This release will allow improved
auditing of a range of new FreeBSD functionality, as well as non-traditional
events (e.g., fine-grained I/O auditing) not required by the Orange Book or
Common Criteria.

Obtained from:	TrustedBSD Project
Sponsored by:	DARPA, AFRL
MFC after:	3 weeks
2017-03-26 21:14:49 +00:00
Sevan Janiyan
56e4d8d5f6 ftp.microsoft.com is dead and the document was not archived, point to the full
protocol spec document instead.
Fix spelling mistake flagged by igor.
Rephrase bad sentence flagged by igor.

Approved by:	bcr (mentor)
MFC after:	5 days
Differential Revision:	 https://reviews.freebsd.org/D10111
2017-03-25 21:33:48 +00:00
Baptiste Daroussin
d1005f6a13 Add a regression test for r31512 fix
PR:		217934
MFC after:	1 week
2017-03-25 10:47:58 +00:00
Eugene Grosbein
92bb425e4e Properly initialise with content of pw.conf(5) that was mistakenly ignored.
Also, respect "defaultgroup" if specified there.

PR:		217934
Reported by:	Victor Sudakov <vas@mpeks.tomsk.su>
Reviewed by:	bapt
Approved by:	bapt, vsevolod (mentor)
MFC after:	1 week
2017-03-24 16:18:57 +00:00
Xin LI
f0574f5cf6 MFV r315791: ntp 4.2.8p10. 2017-03-23 22:06:06 +00:00
Enji Cooper
458cbf0ae6 Rename tests from <foo> to <foo>_test to match the FreeBSD test suite
naming scheme

usr.bin/diff/diff_test was renamed to usr.bin/diff/netbsd_diff_test
to avoid collisions with the renamed FreeBSD test.

MFC after:	1 week
Sponsored by:	Dell EMC Isilon
2017-03-23 03:28:24 +00:00
Enji Cooper
84eb6b9887 ctm: fix memory leaks in Pass1(..)
Call `Delete(..)` (a free(3) wrapper) on `name` when bailing from the
function.

Submitted by:	Tom Rix <trix@juniper.net>
Reviewed by:	ngie
Differential Revision:	D10097
Sponsored by:	Dell EMC Isilon, Juniper
2017-03-22 17:28:53 +00:00
Peter Grehan
b9c1cdd190 This fixes a typo in bhyve's USB mouse emulation.
There is no behavioral difference, as it's just swapping
out the name of two identically-valued constants.

Submitted by:	Vicki Pfau (vi AT endrift.com)
MFC after:	3 days
Differential Revision:	https://reviews.freebsd.org/D9597
2017-03-22 16:53:03 +00:00
Gleb Smirnoff
cc65eb4e79 Hide struct inpcb, struct tcpcb from the userland.
This is a painful change, but it is needed.  On the one hand, we avoid
modifying them, and this slows down some ideas, on the other hand we still
eventually modify them and tools like netstat(1) never work on next version of
FreeBSD.  We maintain a ton of spares in them, and we already got some ifdef
hell at the end of tcpcb.

Details:
- Hide struct inpcb, struct tcpcb under _KERNEL || _WANT_FOO.
- Make struct xinpcb, struct xtcpcb pure API structures, not including
  kernel structures inpcb and tcpcb inside.  Export into these structures
  the fields from inpcb and tcpcb that are known to be used, and put there
  a ton of spare space.
- Make kernel and userland utilities compilable after these changes.
- Bump __FreeBSD_version.

Reviewed by:	rrs, gnn
Differential Revision:	D10018
2017-03-21 06:39:49 +00:00
Garance A Drosehn
e550d65c85 Fixes to chkprintcap:
- Check the return from a call to malloc() in skim_printcap(), and
  return a NULL if that fails.
- Fix a small memory leak in main() that happens if skim_printcap()
  returns an error, including the new error-return of NULL.

Submitted by:	Tom Rix <trix@juniper.net>
Reviewed by:	pfg, ngie
MFC after:	4 weeks
Sponsored by:	Dell EMC Isilon, Juniper
Differential Revision:	D9954, D9982
2017-03-20 22:36:28 +00:00
Hiroki Sato
d31d87b0a7 Simplify a pipe for signal handling. 2017-03-20 17:57:24 +00:00
Hiroki Sato
f7f99edf3f Fix a regression which prevented an IPv6 address in a -b option from
working.

PR:	217939
Differential Revision:	https://reviews.freebsd.org/D10064
2017-03-20 17:46:33 +00:00
Enji Cooper
b79299b5e7 syslogd: try to print out a more helpful message in socksetup(..) if/when
getaddrinfo fails

If the asprintf call fails, fall back to the old code (as a last ditch effort
to provide the end-user with helpful output).

Sponsored by:	Dell EMC Isilon
2017-03-20 06:12:55 +00:00
Enji Cooper
9c2aa0a0a3 syslogd: fix dprintf in socksetup(..)
- Make the explanation more complete
- Correct a minor grammar nit with verb tense.
- Don't emit the message if `pe->pe_name` is NULL (it doesn't
  have much value).

MFC after:	1 week
Sponsored by:	Dell EMC Isilon
2017-03-20 05:12:27 +00:00
Enji Cooper
4863f2fc55 syslogd: don't leak f on failure in cfline(..)
Free `f` if an unknown priority or facility is parsed with the function.

MFC after:	1 week
Reported by:	Coverity
CID:		1368068
Sponsored by:	Dell EMC Isilon
2017-03-20 04:25:40 +00:00
Edward Tomasz Napierala
4bcdaf7651 Improve formatting.
MFC after:	2 weeks
2017-03-19 16:17:42 +00:00
Bartek Rutkowski
2434a0528a Revert changes introduced in r314036 on demand by jhb and bapt.
Approved by:	bapt, jhb
2017-03-17 11:45:46 +00:00
Enji Cooper
a393b6c82f syslogd: fix memory leaks in main(..) and allowaddr(..)
- main(..): free memory assigned to fdsr before calling die(..).
- allowaddr(..): free memory assigned to ap before returning from the
  function early. Add a `err` goto label to reduce freeaddrinfo/free(ap)
  logic duplication.

MFC after:	1 week
X-MFC notes:	some of this is dependent on refactoring not MFCed
Reported by:	clang static analyzer, Coverity
CID:		1367750 (ap leakage in allowaddr(..))
Submitted by:	Tom Rix <trix@juniper.net>
Reviewed by:	ngie
Sponsored by:	Dell EMC Isilon, Juniper
Differential Revision:	D10004
2017-03-15 18:15:30 +00:00
Ed Maste
870952f562 makefs: improve error messages
- remove \n
- use __func__
- err adds the error string itself

NetBSD revs:
cd9660.c	1.48 1.49
ffs/buf.c	1.21
ffs/mkfs.c	1.27

Obtained from:	NetBSD
2017-03-15 18:14:54 +00:00
Ed Maste
538ab9e64e makefs: don't print pointers in debugging messages
NetBSD revisions:
ffs/buf.c	1.14

Obtained from:	NetBSD
2017-03-15 17:26:19 +00:00
Ed Maste
babca35cb2 makefs: use 'm' for cd9660 allow-multidot, per NetBSD
NetBSD revisions:
cd9660.c	1.55

Obtained from:	NetBSD
2017-03-15 16:16:30 +00:00
Ed Maste
776c68249b makefs: sync option parsing with NetBSD
- add support for parsing different types; not just int
- homogenize option parsing
- fix single letter parsing
- remove duplicated code

NetBSD revisions:
cd9660.c        1.36 1.37 1.38 1.41 1.42 1.43
ffs.c           1.50 1.51 1.52 1.53 1.56 1.57
makefs.c        1.36 1.37 1.38 1.39 1.40 1.42 1.43 1.44 1.46
makefs.h        1.28 1.29 1.31 1.32

Obtained from:	NetBSD
Sponsored by:	The FreeBSD Foundation
2017-03-15 13:34:51 +00:00
Ed Maste
f490b9b3bf makefs: sync -T timestamp with NetBSD
NetBSD revision:
makefs.c	1.51

Obtained from:	NetBSD
2017-03-14 18:08:32 +00:00
Ed Maste
f7d3963023 makefs: remove unused variable
NetBSD revisions:
mkfs.c 1.32

Obtained from:	NetBSD
2017-03-14 16:40:18 +00:00
Pedro F. Giffuni
85f104954a ypbind(8): let calloc(3) do the multiplying. 2017-03-13 20:51:00 +00:00
Pedro F. Giffuni
4b6fa244b2 mpsutil(8): let calloc(3) do the multiplying. 2017-03-13 20:49:31 +00:00
Pedro F. Giffuni
87959e27fd nscd(8): let calloc(3) do the multiplying.
MFC after:	1 week
2017-03-13 20:34:53 +00:00
Scott Long
286ab2b514 Add constants and descriptions for some new PCI class definitions 2017-03-13 07:45:15 +00:00
Marcelo Araujo
21a973f499 Use nitems() from sys/param.h.
Reviewed by:	ngie
Differential Revision:	https://reviews.freebsd.org/D9943
2017-03-12 03:43:28 +00:00
Marcelo Araujo
56eeadd845 Use nitems() from sys/param.h.
MFC after:	3 weeks.
2017-03-11 04:03:13 +00:00
Marcelo Araujo
5116725078 Use nitems() from sys/param.h.
Reviewed by:	np
MFC after:	3 weeks.
Differential Revision:	https://reviews.freebsd.org/D9945
2017-03-11 04:01:35 +00:00
Marcelo Araujo
793128cc2c Use nitems() from sys/param.h
Reviewed by:	jhb
MFC after:	3 weeks.
Differential Revision:	https://reviews.freebsd.org/D9941
2017-03-11 04:00:27 +00:00
Alan Somers
58fbd700fa Increase WARNS for pw tests
ATF tests have a default WARNS of 0, unlike other usermode programs.

Reviewed by:  ngie, julian
MFC after:    3 weeks
Sponsored by: Spectra Logic Corporation
Differential Revision:        https://reviews.freebsd.org/D9933
2017-03-11 00:11:20 +00:00
Marcelo Araujo
c86932b61b Use nitems() from sys/param.h.
Reviewed by:	ngie
MFC after:	3 weeks.
Differential Revision:	https://reviews.freebsd.org/D9940
2017-03-10 06:25:54 +00:00
Marcelo Araujo
a0fb90916a Use nitems() from sys/param.h.
Reviewed by:	asomers
MFC after:	3 weeks.
Differential Revision:	https://reviews.freebsd.org/D9944
2017-03-10 04:24:21 +00:00
Alan Somers
f5c4d58f4a Fix harmless mismerge from r286964
MFC after:	3 days
Sponsored by:	Spectra Logic Corp
2017-03-09 16:22:21 +00:00
Cy Schubert
6a1588c0a4 Configure leap-second smearing (always).
Leap-second smearing is an experimental option that may be specified in
ntp.conf(5) and the -x option on the command line to spread the effect
of a leap-second over an interval as specified by the leapsmearinterval
config file statement. Recommended values are between 7200 (2 hours) and
86400 (24 hours).

It is advised that leap-second smearing not be used for public NTP
servers (https://www.meinbergglobal.com/download/burnicki/Leap\
%20Second%20Smearing%20With%20NTP.pdf). It is also advised that NTP
clients not use a mix of NTP servers using leap-second smearing with
NTP servers not using leap-second smearing as that could cause
undefined client behaviour.

Leap-second smearing was committed to ports net/ntp and net/ntp-devel
by r426825 on 2016-11-22.

Suggested by:	des
MFC after:	4 weeks
2017-03-09 05:29:24 +00:00
Warner Losh
2bcbcb593d efidp manipulates UEFI Device Paths in various ways. At the moment, it
formats and parses UEFI standard Device Paths. In the future it will
also translate between FreeBSD driver names and UEFI Device Paths.

Sponsored by: Netflix
2017-03-09 00:33:38 +00:00
Warner Losh
2f2f5c6728 Finish implementing -d/--device/--device-path flag to print variable
as if it were a device path.

Remove language about a=b syntax on the command line. This will not be
implemented due to its limited usefulness. UEFI variables are binary
blobs, on the whole, and a simple work around exists for
strings. Clarify that the new value of the variable is taken from
stdin. Update manual with history.

Sponsored by: Netflix
2017-03-09 00:31:36 +00:00
Cy Schubert
3779ab7a36 Remove extraneous arguments and options, which don't make sense for
a file documented in volume 5.

MFC after:	3 days
2017-03-08 07:02:39 +00:00
Pedro F. Giffuni
4fd444b072 lpr(1): small bounds check with reallocarray(3).
While here plug a memory leak upon error and postpose a multiplication
until after reallocation has succeded.

Hinted partially by:	OpenBSD
Reviewed by:		gad
MFC after:		2 weeks
2017-03-07 19:30:22 +00:00
Rodney W. Grimes
ce9f2d31b3 Convert absolute links to relative links.
Style.Makefile(9) has been ignored to produce minimal diffs.

Approved by:	grehan (mentor)
MFC after:	1 week
2017-03-07 05:10:38 +00:00
Enji Cooper
ed8251f888 mergemaster: fix description of -p
-p only handles updating /etc/master.passwd and /etc/group . No more,
no less.

Also, mergemaster (and no other portions of the vanilla FreeBSD build
process) should be messing with __MAKECONF or SRCCONF as part of the
installworld or distribution process. Don't insinuate that mergemaster
does that as it's a false claim.

MFC after:	1 week
Sponsored by:	Dell EMC Isilon
2017-03-07 04:13:22 +00:00
Enji Cooper
59daefd7eb Fix some trivial manlint warnings
Sentences should begin on new lines, per manlint.

Bump .Dd for the change

MFC after:	1 month
Reviewed by:	bcr
Reported by:	make manlint
Sponsored by:	Dell EMC Isilon
2017-03-06 19:33:15 +00:00
Cy Schubert
dae3dadc43 Fix mismerge of r280849.
Reported by:	des
MFC after:	3 days
2017-03-06 07:11:23 +00:00
Rodney W. Grimes
793cc4b409 Change /etc/rmt symlink from absolute to relative path,
correcting the mistake made in r6499

Approved by:	grehan
MFC after:	1 week
2017-03-05 04:09:18 +00:00
Enji Cooper
81a687a7ff Fix build after r314656
Some of the changes I introduced to use .ALLSRC were correct in spirit,
but incorrect in reality -- in particular, ../Makefile.inc hadn't been
pulled in via bsd.init.mk (via bsd.lib.mk, bsd.prog.mk), so the value
of .ALLSRC (evaluated immediately) was empty. .include bsd.init.mk
explicitly so we can be certain that the values used as dependencies in
the targets are defined when the target recipe has been evaluated.

Reminder: thou shalt separate out separate functional changes before
          committing them.

(YUGE) Pointyhat to:	ngie
In collaboration with:	bdrewery
MFC after:	1 month
Reported by:	Jenkins, cy, ler, O. Hartmann, Michael Butler
Sponsored by:	Dell EMC Isilon
2017-03-04 20:35:34 +00:00
Enji Cooper
64a0982bee usr.sbin: normalize paths using SRCTOP-relative paths or :H when possible
This simplifies make logic/output

MFC after:	1 month
Sponsored by:	Dell EMC Isilon
2017-03-04 11:38:03 +00:00
Enji Cooper
6dbd2714db Correct nuance of -a :service -> "*" in r314563, r314585
My attempt to correct the sender/receiver behavior was incorrect.
The source port of the sender for forwarded datagrams is filtered
with -a, and my change in r314585 didn't clarify that point at all.

Wording is based on suggestion by hrs.

MFC after:	28 days
X-MFC with:	r314563, r314585
Reported by:	hrs
In collaboration with:	hrs, rgrimes
Sponsored by:	Dell EMC Isilon
2017-03-04 06:19:41 +00:00
Warner Losh
f2d626ab0e If the guid specified can't be decoded as a GUID, try looking it up in
the known guid to name table.

Sponsored by: Netflix
2017-03-03 20:23:18 +00:00
Warner Losh
9e4a51a860 Implement -d / --device-path to print the ascii representation of a variable that contains a UEFI device path.
Sponsored by: Netflix
2017-03-03 20:23:14 +00:00
Warner Losh
1644567051 Implement --guid/-g to print the known GUIDs as human readable. The
list of known GUIDs can be found with --list-guids.

Sponsored by: Netflix
2017-03-03 20:23:10 +00:00
Warner Losh
4a110fbfa7 Actually implement efivar -L
Sponsored by: Netflix
2017-03-03 20:23:05 +00:00
Warner Losh
902af7c6f5 Print just the variables when we're not printing the values.
Sponsored by: Netflix
2017-03-03 20:23:01 +00:00
Jung-uk Kim
0d84335f99 Merge ACPICA 20170303. 2017-03-03 18:56:15 +00:00
Enji Cooper
3dd94b6769 Correct verb change for service => * after r314563
`*` means that packets will be received from a remote peer on any port.
Since the point of interest is the syslogd instance (not the remote peer),
the appropriate verb is "received", not "sent".

MFC after:	1 month
X-MFC with:	r314563
Sponsored by:	Dell EMC Isilon
2017-03-03 06:13:59 +00:00
Navdeep Parhar
54912308c8 Add cxgbetool(8) to the base system.
Move cxgbetool from tools/tools to usr.sbin. Compile and install it on
platforms where cxgbe(4) is built by default.  Knobs (WITH_CXGBETOOL and
WITHOUT_CXGBETOOL) have been added so that the user can override the
default setting.

Reviewed by:	ngie@, gnn@, bdrewery@
MFC after:	1 month
Sponsored by:	Chelsio Communications
Differential Revision:	https://reviews.freebsd.org/D9854
2017-03-03 03:11:58 +00:00
Enji Cooper
bc4536df9d Wordsmith syslogd(8)
- Clarify -p/-S options by using appropriate subject-verb modifiers
  (verb and modifiers suggested that the subject should have been
  singular).
- Simplify/correct -a description:
-- Be more terse when describing IPv4 (the "usual dotted notation"
   isn't necessarily well understood by the reader). Being blunt and
   saying "IPv4 address" with an optional netmask is.
-- prefixlen is the appropriate terminology for IPv6.
-- mask/prefixlen is optional, not required (as noted later on in the
   section).
-- split up IPv4/IPv6 use so to clarify both forms.
-- Fix wordiness when describing the optional "service" specifier.
- -T: Use "cannot" instead of "can't" [*].

Bump .Dd for the changes.

MFC after:	1 month
Reported by:	igor [*]
Reviewed by:	hrs
Sponsored by:	Dell EMC Isilon
Differential Revision:	https://reviews.freebsd.org/D9855
2017-03-02 18:07:19 +00:00
Enji Cooper
0023765382 Use SRCTOP-relative paths to other directories instead of .CURDIR-relative ones
This simplifies pathing in make/displayed output.

MFC after:	1 week
Sponsored by:	Dell EMC Isilon
2017-03-02 05:04:45 +00:00
Ed Maste
8c71aecd10 makefs: remove clause 3 & 4 from Manuel Bouyer license
ffs_bswap.c 1.34
ufs_bswap.h 1.34

Obtained from:	NetBSD
Sponsored by:	The FreeBSD Foundation
2017-03-02 04:11:18 +00:00
Ed Maste
50c088a006 makefs: remove archaic __P prototypes from ufs_bswap.h
This reduces differences with NetBSD

Sponsored by:	The FreeBSD Foundation
2017-03-02 04:08:14 +00:00
Enji Cooper
568123e100 Use :H to manipulate .CURDIR-relative paths instead of ../
This simplifies make output

MFC after:	1 week
Sponsored by:	Dell EMC Isilon
2017-03-01 05:21:21 +00:00
Enji Cooper
982a915f13 Simplify idioms in Makefiles further
- Use SRCTOP-relative paths instead of .CURDIR-relative ones where possible
- Use :H to manipulate .CURDIR in areas instead of ..-relative paths.

MFC after:	1 week
Sponsored by:	Dell EMC Isilon
2017-03-01 05:19:35 +00:00
Enji Cooper
7fec199b3b Simplify idioms in usr.sbin/lpr Makefiles
Use :H instead of .CURDIR-relative pathing to simplify make output, etc.

MFC after:	1 week
Sponsored by:	Dell EMC Isilon
2017-03-01 05:14:45 +00:00
Enji Cooper
af6a5351a1 Simplify/improve idioms in usr.sbin/ntp Makefiles
- Use SRCTOP-relative paths to other directories instead of
  .CURDIR-relative ones. This simplifies pathing in make/displayed output.
- Also, use :H where possible/sensical to manipulate .CURDIR-relative
  paths
- Remove superfluous bsd.own.mk .includes which are already handled via
  src.opts.mk .includes

MFC after:	1 week
Sponsored by:	Dell EMC Isilon
2017-03-01 04:54:06 +00:00
Enji Cooper
62f32e06bc Use SRCTOP-relative paths to other directories instead of .CURDIR-relative ones
This simplifies pathing in make/displayed output.

MFC after:	1 week
Sponsored by:	Dell EMC Isilon
2017-03-01 04:41:59 +00:00
Enji Cooper
40a54564e4 Use SRCTOP-relative paths to other directories instead of .CURDIR-relative ones
Also, use :H where possible/sensical to manipulate .CURDIR-relative paths

This simplifies pathing in make/displayed output.

MFC after:	1 week
Sponsored by:	Dell EMC Isilon
2017-03-01 04:35:21 +00:00
Enji Cooper
7b8810a816 Use SRCTOP-relative paths to other directories instead of .CURDIR-relative ones
This simplifies pathing in make/displayed output.

MFC after:	1 week
Sponsored by:	Dell EMC Isilon
2017-03-01 04:24:56 +00:00
Enji Cooper
c3f658c181 Use SRCTOP-relative paths to other directories instead of .CURDIR-relative ones
This simplifies pathing in make/displayed output.

MFC after:	1 week
Sponsored by:	Dell EMC Isilon
2017-03-01 04:24:24 +00:00
Enji Cooper
eca186c4c2 Use SRCTOP-relative paths to other directories instead of .CURDIR-relative ones
This simplifies pathing in make/displayed output.

MFC after:	1 week
Sponsored by:	Dell EMC Isilon
2017-03-01 04:23:53 +00:00
Enji Cooper
33bfdd500b Use SRCTOP-relative paths to other directories instead of .CURDIR-relative ones
The SRCTOP conversion simplifies pathing in make/displayed output.

Also, while here, change a hardcoded path to ${RPCDIR}/ypxfrd.x in
the make targets with ${.ALLSRC} .

MFC after:	1 week
Sponsored by:	Dell EMC Isilon
2017-03-01 04:22:23 +00:00
Enji Cooper
1de134e528 Use SRCTOP-relative paths to other directories instead of .CURDIR-relative ones
This simplifies pathing in make/displayed output.

MFC after:	1 week
Sponsored by:	Dell EMC Isilon
2017-03-01 04:19:04 +00:00
Enji Cooper
5855f96f80 Use SRCTOP-relative paths to other directories instead of .CURDIR-relative ones
This simplifies pathing in make/displayed output.

MFC after:	1 week
Sponsored by:	Dell EMC Isilon
2017-03-01 04:18:28 +00:00
Enji Cooper
e8d2762fd3 Use SRCTOP-relative paths to other directories instead of .CURDIR-relative ones
This simplifies pathing in make/displayed output.

MFC after:	1 week
Sponsored by:	Dell EMC Isilon
2017-03-01 04:17:59 +00:00