Commit Graph

17100 Commits

Author SHA1 Message Date
Sevan Janiyan
4d0e06e6e6 Extend manual to cover more commands and options.
PR:		203406
Submitted by:	Fehmi Noyan Isi (fnoyanisi AT yahoo DOT com)
Approved by:	wblock (mentor)
MFC after:	5 days
Differential Revision:	 https://reviews.freebsd.org/D8691
2017-01-24 08:56:54 +00:00
Baptiste Daroussin
b11244e721 Really restore the old behaviour for pw usermod -m
It again reinstall missing skel files without overwriting changed one
Add a regression test about it

Reported by:	ae
MFC after:	3 days
2017-01-22 20:03:18 +00:00
Baptiste Daroussin
6789e5acf2 Readd a feature lost in pw(8) refactoring
pw usermod foo -m

It used to be able to (re)create the home directory if it didn't exists

PR:		216224
Reported by:	ae
MFC after:	3 days
2017-01-22 18:55:01 +00:00
Alan Somers
5b1696c73f Fix misc Coverity defects in camdd(8)
CID 1341620	Fix a small memory leak
CID 1341630	Though this is technically a false positive, rearrange the
		code for clarity.
CID 1341635	Eliminate dead code
CID 1368663	Fix a double mutex unlock in the error path

Also:
* Use sig_atomic_t for variables accessed from signal handlers
* Don't conditionalize free(3) on its argument being non-null

Reported by:	Coverity
CID:		1341620 1341630 1341635 1368663
Reviewed by:	ken
MFC after:	4 weeks
Sponsored by:	Spectra Logic Corp
Differential Revision:	https://reviews.freebsd.org/D9237
2017-01-20 21:40:04 +00:00
Alexander Motin
04108b8b21 Fix build with ICL_KERNEL_PROXY.
MFC after:	2 weeks
2017-01-20 17:43:36 +00:00
Alexander Motin
625571de20 Remove ISCSI_MAX_DATA_SEGMENT_LENGTH, using negotiated value.
MFC after:	2 weeks
2017-01-20 17:14:10 +00:00
Enji Cooper
489b7fc0a4 Add smilint target to subdir targets so "make smilint" here will run
the smilint target in subdirs

While here, convert a path that's .CURDIR relative to SRCTOP

MFC after:	1 week
Sponsored by:	Dell EMC Isilon
2017-01-17 03:44:45 +00:00
Enji Cooper
0acfb04bce Remove ad hoc smilint targets made standard in bsd.snmpmod.mk in r312328
MFC after:	1 week
X-MFC with:	r312328
Sponsored by:	Dell EMC Isilon
2017-01-17 03:41:23 +00:00
Conrad Meyer
db4fcadf52 "Buses" is the preferred plural of "bus"
Replace archaic "busses" with modern form "buses."

Intentionally excluded:
* Old/random drivers I didn't recognize
  * Old hardware in general
* Use of "busses" in code as identifiers

No functional change.

http://grammarist.com/spelling/buses-busses/

PR:		216099
Reported by:	bltsrc at mail.ru
Sponsored by:	Dell EMC Isilon
2017-01-15 17:54:01 +00:00
Alexander Motin
a15fbc904a Alike to r312190 decouple iSCSI connection limits from defaults.
Connection parameters should remain at defaults until negotiated.

While there, remove sythetic limits, applied if kernel provided none.
iscsid has no own limitations, no configuration and no any idea what
values are good.  Assume kernel knows what it requests.
2017-01-14 20:41:44 +00:00
Alexander Motin
7aceb7fcd4 Fix wrong way assignment in r312190. 2017-01-14 19:58:51 +00:00
Alexander Motin
59c6e3a58f Decouple iSCSI connection limits from defaults.
If initiator does not negotiate some parameter, it expects one to get
default value, not some unknown remote hardware limit.  On the side side,
if some parameter is negotiated, its default value from RFC should not
be used for anything.
2017-01-14 18:04:12 +00:00
Enji Cooper
484b700751 Fix up r312105
- Only #include tcpd.h when LIBWRAP is true to avoid header include errors
- Only define whichaf when LIBWRAP is true to avoid -Wunused warning and
  to avoid issues with structs being defined that should only be defined
  when tcpd.h is included.

MFC after:	2 weeks
X-MFC with:	r312105
Pointyhat to:	ngie
Reported by:	gcc tinderbox
Sponsored by:	Dell EMC Isilon
2017-01-14 10:20:38 +00:00
Enji Cooper
63eca8f1dd Conditionalize libwrap support into inetd based on MK_TCP_WRAPPERS
This will allow inetd to stand by itself without libwrap.

MFC after:	2 weeks
Relnotes:	yes
Reviewed by:	hrs (earlier version)
Sponsored by:	Dell EMC Isilon
Differential Revision:	https://reviews.freebsd.org/D9056
2017-01-14 01:37:03 +00:00
Conrad Meyer
4a6ace7328 Fix broken fstyp exfat testcase
Introduced in r312010.

It helps to read the documentation before trying to test something.
2017-01-14 01:08:04 +00:00
Conrad Meyer
b632b00087 fstyp.8: Move initial exFAT blurb to the -u section
Didn't notice the second list in r312003.

Reported by:	trasz@
2017-01-13 16:46:01 +00:00
Hiroki Sato
373eea194d Purge varargs.h in favor of stdarg.h. 2017-01-13 08:01:27 +00:00
Hiroki Sato
1296e1b0b7 - Add static for functions and variables with internal linkage.
- Quiet down -Wcast-align warnings.
- Remove dead code.

There is no functionality change.
2017-01-13 06:22:49 +00:00
Enji Cooper
ef7ff3e308 Use dfr-01-xfat.img.bz2, not dfr-01-xfat.dd.bz2 (the latter
case was the full disk image from the website, which was never
checked in to svn)

Regardless, the testcase still fails

PR:		214908
Sponsored by:	Dell EMC Isilon
2017-01-13 04:04:48 +00:00
Enji Cooper
6f81c4d9bb Add testcase for exFAT that currently fails
Disk image obtained from:
http://www.cfreds.nist.gov/dfr-images/dfr-01-xfat.dd.bz2 -- was ripped off the
first GPT partition and verified to be a FAT-like partition with file(1)/hexdump.

This testcase currently fails

PR:		214908
Sponsored by:	Dell EMC Isilon
2017-01-13 04:02:09 +00:00
Enji Cooper
cebf8a2ca7 Add license preamble for r286964; credit to asomers
While here, clean up trailing whitespace

MFC after:	3 days
Sponsored by:	Dell EMC Isilon
2017-01-13 03:42:51 +00:00
Conrad Meyer
e266075649 fstyp(8): Detect exFAT filesystems
Simply detect the exFAT filesystem name in the Volume Boot Record
(superblock).

PR:		214908
Reported by:	<vermaden at interia.pl>
2017-01-13 02:12:58 +00:00
Hiroki Sato
c10340d440 - Fix dereference of NULL pointer which could cause a crash [1]
- Fix memory leak due to lack of freeaddrinfo() [2]

CID:	1018281 [1]
CID:	1225057 [2]
MFC after:	3 days
2017-01-12 18:44:58 +00:00
Alan Somers
c6e3715fbc Fix uninitialized variable CIDs in route6d
The variables in question are actually return arguments, but it's still good
form to initialize them.

Reported by:	Coverity
CID:		979679 979680
MFC after:	4 weeks
Sponsored by:	Spectra Logic Corp
2017-01-12 16:22:28 +00:00
Conrad Meyer
ca7d74d467 pciconf(8): Reallow trailing colon in selectors
Reallow device selectors to have a trailing colon, as documented in the
manual page.  This was broken along with some unrelated cleanups in
r295806.

PR:		215979
Reported by:	David Boyd <David.Boyd49 at twc.com>
Sponsored by:	Dell EMC Isilon
2017-01-12 00:34:37 +00:00
Hiroki Sato
b4d60f9802 Add more #ifdef INET and INET6. 2017-01-11 07:21:59 +00:00
Bjoern A. Zeeb
4a6768e64c Teach crunchide about EM_S390 to make bootstrapping from future
releases easier unless someone will fix the PR properly.

MFC after:	3 days
PR:		215940
2017-01-10 14:40:30 +00:00
Dimitry Andric
3ac0e4769e Avoid taking the address of a packed struct member in mfiutil
Fix a clang 4.0.0 warning about taking the address of a packed member of
struct mfi_evt in mfiutil:

    usr.sbin/mfiutil/mfi_evt.c:583:30: error: taking address of packed
    member 'members' of class or structure 'mfi_evt' may result in an
    unaligned pointer value [-Werror,-Waddress-of-packed-member]
                            if (parse_locale(optarg, &filter.members.locale) < 0) {
                                                      ^~~~~~~~~~~~~~~~~~~~~

Use a local variable instead, and copy that into the struct.

Reviewed by:	jhb
MFC after:	3 days
Differential Revision:	https://reviews.freebsd.org/D9069
2017-01-09 19:39:35 +00:00
Enji Cooper
e9fcca6a8e Add a REVISION section to track changes for the BEGEMOT-NETGRAPH MIB file
This change also documents the modification harti made to a handful of
objects in r122758 (the max OCTET STRING width was increased from 15 to
31 octets)

MFC after:	1 week
2017-01-09 06:36:17 +00:00
Enji Cooper
0dc92aeeb0 Add a REVISION section to track changes for the BEGEMOT-ATM-FREEBSD-MIB MIB file
There haven't been any changes to the MIB definition, so the REVISION
remains static at the version it was imported at

MFC after:	1 week
2017-01-09 06:19:20 +00:00
Enji Cooper
3fab006f0b Add a REVISION section to track changes for the hostres module
There haven't been any changes to the MIB definition, so the REVISION remains
static at the version it was imported at

MFC after:	1 week
2017-01-09 03:18:19 +00:00
Enji Cooper
6fec23edd3 Improve the smilint target in the hostres and mibII modules
- Mark the smilint target .PHONY so it's always executed when requested
- Leverage .PATH for BMIBS instead of spelling the path out longhand
  for them

MFC after:	1 week
2017-01-09 03:14:04 +00:00
Enji Cooper
306324d7f2 Use SRCTOP instead of spelling out the full path with .CURDIR
This helps condense the output for CFLAGS and .PATH

MFC after:	3 days
2017-01-09 03:08:21 +00:00
Enji Cooper
074a0dcceb Use nitems(mib) instead of hardcoding mib's length
MFC after:	3 days
2017-01-09 00:38:19 +00:00
Enji Cooper
240ecb400f Sort #includes
MFC after:	3 days
2017-01-09 00:37:09 +00:00
Enji Cooper
b3b69d9980 Clean up trailing whitespace
MFC after:	3 days
2017-01-09 00:33:27 +00:00
Enji Cooper
cc94da1bea Style(9) fixes
- Sort sys/ #includes
- Use nitems instead of hardcoding the length of `mib`

MFC after:	3 days
2017-01-09 00:25:33 +00:00
Peter Grehan
26e6e3e65d Use correct PCI device id for virtio-rng.
This prevented the device from attaching with a
Windows guest (most other guests use the device type
for matching)

PR:	212711
Submitted by:	jbeich
MFC after:	3 days
2017-01-08 20:58:58 +00:00
Peter Grehan
6e616e4f4b Make sure the 'Always-one' bit is always set to one,
in the first byte of the 3-byte mouse data report.
Plan9/9front requires this.

Switch over to using #defines for the data report bits.

Verified no regression on Win10/Fedora-live.

Reported and tested by: Trent Thompson (trentnthompson at gmail com)
MFC after:	1 week
2017-01-08 20:29:35 +00:00
Conrad Meyer
bb577bb699 chown/chgrp: Add SIGINFO handler
PR:		191884
Submitted by:	Dan McGregor <dan.mcgregor at usask.ca>
Reviewed by:	mjg@ (earlier version)
2017-01-08 06:58:42 +00:00
Warren Block
5589c6def0 Show that the crunchgen configuration file name is not optional.
PR:		215087
Submitted by:	Iblis Lin <iblis@hs.ntnu.edu.tw>
MFC after:	1 week
Sponsored by:	iXsystems
2017-01-06 18:04:34 +00:00
Konstantin Belousov
1c32456953 Use type-independent formats for printing nlink_t and ino_t.
Extracted from:	ino64 work by gleb, mckusick
Discussed with:	mckusick
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2017-01-06 16:59:33 +00:00
Enji Cooper
c02129e1cc Conditionalize wrap(3) use based on MK_TCP_WRAPPERS instead of
always building support into amd(8).

MFC after:	2 weeks
2017-01-06 04:22:25 +00:00
Enji Cooper
2486c641e7 Conditionalize wrap(3) use based on MK_TCP_WRAPPERS instead of
always building support into sendmail.

MFC after:	2 weeks
2017-01-06 04:16:03 +00:00
Enji Cooper
74410f9362 Conditionalize wrap(3) use based on MK_TCP_WRAPPERS instead of
always building support into rpcbind.

MFC after:	2 weeks
2017-01-06 04:13:08 +00:00
Enji Cooper
35c0323c64 Conditionalize wrap(3) use based on MK_TCP_WRAPPERS instead of
always building support into ypserv.

MFC after:	2 weeks
2017-01-06 04:10:33 +00:00
Jung-uk Kim
284829482e Merge ACPICA 20161222. 2017-01-05 21:28:25 +00:00
Enji Cooper
18d124d977 OS_getSystemUptime: use nitems for calculating the number of elements
in a sysctl mib instead of hardcoding the number 2

MFC after:	3 days
2017-01-05 09:28:38 +00:00
Hiroki Sato
1232b86014 Fix build when WITHOUT_INET6 is defined. 2017-01-05 03:25:16 +00:00
Enji Cooper
640b69be3a style cleanup
- bridge_pf_dump: use nitems instead of spelling it out longhand
- bridge_do_pfctl: sort variables by alignment for type

MFC after:	1 week
2017-01-04 17:54:44 +00:00
Enji Cooper
9577c300d8 bridge_do_pfctl: allocate mib_name dynamically using asprintf
This is being done to reduce wasted space, simplify complexity in
the code, and to quell a Coverity warning about buffer overruns.
warning about buffer overruns.

MFC after:	1 week
Reported by:	Coverity
CID:		1006736
2017-01-04 17:50:52 +00:00
Enji Cooper
758268dcae bridge_get_pfval: use nitems instead of spelling it out longhand
MFC after:	3 days
2017-01-04 17:38:18 +00:00
Enji Cooper
a0cc1855e3 Use strlcpy instead of strcpy when copying the bridge name to ifr.ifr_name
to avoid buffer overflows

MFC after:	1 week
Reported by:	Coverity
CID:		1006735, 1006737, 1006738
2017-01-04 17:33:18 +00:00
Enji Cooper
b85e09dbf1 Fix logical inversion when checking result from calloc
in snmp_output_err_resp(..)

X-MFC with:	r310987
MFC after:	3 days
Reported by:	Coverity
CID:		1368195
2017-01-04 01:44:45 +00:00
Alan Somers
4c9f98e28a Quell Coverity for diskinfo(8)
* CID 1198994: Don't run the speed disk on a disk with no sectors
* CID 1011442: Don't call close(2) if open(2) fails
* CID 1011161: Use snprintf instead of sprintf
* CID 1009825: Check the return value of lseek

Reported by:	Coverity
CID:		1198994 1011442 1011161 1009825
MFC after:	4 weeks
Sponsored by:	Spectra Logic Corp
2017-01-04 00:39:06 +00:00
Enji Cooper
30dcd18b90 Swap parameters around with parse_syntax_strval(..) for consistency with
other parse_* APIs in bsnmp*

MFC after:	3 days
Noted by:	bz
2017-01-03 22:33:07 +00:00
Enji Cooper
71aa1443ea Make /usr/lib/libbsnmptools.so.0 into an INTERRNALLIB
Although it increases the size of the bsnmp{get,set,walk} binaries by
four on my [amd64] system, it removes the need for producing .debug
files, profiled libraries, and for installing the library itself,
reducing the overall size use on disk by the utilities noted
previously.

Plus, it guards against ABI/API compatibility issues with the library
as it's only used internal to the tools themselves.

MFC after:	3 weeks
2017-01-03 22:31:05 +00:00
Cy Schubert
d2aa1af629 Fix up grammar.
MFC after:	3 days
2017-01-01 10:37:10 +00:00
Enji Cooper
570afb920c Call snmp_pdu_free on req/resp with a consistent, correct pattern
- snmp_pdu_free should be called before snmp_pdu_create is called
  again
- snmp_pdu_free should be called on the resp to snmp_dialog when
  successful

Tested with the following bsnmp commands:

  % export SNMPUSER=bsnmp SNMPPASSWD=bsnmptest
  % SNMP_ARGS="-A proto=sha -C context='' -K -P proto=des -v 3 -r 0"
  % bsnmpset $SNMP_ARGS sysLocation="MyAgent"
  % bsnmpget $SNMP_ARGS sysLocation
  % bsnmpwalk $SNMP_ARGS

MFC after:	12 days
X-MFC with:	r310729, r310892, r310894
2017-01-01 00:23:43 +00:00
Enji Cooper
86b3c16952 snmp_output_err_resp, snmp_output_resp: allocate object using calloc, not
on the stack

Some of the callers try to determine whether or not `object` is valid by
testing the value for NULL, which will never be true if it's a stack value,
so in order to be clear and correct down the call stack, use a heap
allocated object.

This also addresses a Coverity issue by initializing all of `object` via
calloc

MFC after:	1 week
Reported by:	Coverity
CID:		1006392
2016-12-31 22:46:17 +00:00
Enji Cooper
09fe010ecf snmp_output_resp: style(9): sort variables by alignment
MFC after:	3 days
2016-12-31 22:18:33 +00:00
Hiroki Sato
8ffb87bf8c - Use more descriptive names for variables.
- Set O_CLOEXEC to the signal pipe and /dev/klog.
- Use a single signal handler to catch both SIGHUP and SIGCHLD.
- Fix a bug which did FD_SET() the writer-end of the pipe.
2016-12-31 13:15:52 +00:00
Enji Cooper
c4114bd1f5 Set value->v.octetstring.len to a correct value on malloc success/failure
The previous code always set value->v.octetstring.len to len, regardless
of the result from the malloc call. This misleads the caller on malloc
failure. Set .len to len on success and 0 on failure.

MFC after:	1 week
Reported by:	Coverity
CID:		1007590
2016-12-31 12:14:25 +00:00
Hiroki Sato
4909085f84 - Add static for symbols which need not to be exported.
- Clean up warnings to the WARNS=6 level.
2016-12-31 11:03:34 +00:00
Enji Cooper
1b135e4f47 snmp_pdu_free the right object at the right time in snmptool_walk
r310892 was on the right track, but unfortunately it was resolving
the problem incorrectly and accidentally leaking memory in the
process.

- Call snmp_pdu_free on req before calling snmp_pdu_create on it
  at the bottom of the outer while loop
- Call snmp_pdu_free on resp after calling snmpwalk_nextpdu_create
  in the inner loop

MFC after:	12 days
X-MFC with:	r310729, r310892
Reported by:	valgrind
2016-12-31 10:01:25 +00:00
Hiroki Sato
00f6082b98 Remove extra NULL-check before free(3). 2016-12-31 09:52:00 +00:00
Enji Cooper
bcf5255764 Don't call snmp_pdu_free(..) until finished with the pdu and when ready to
allocate a new one via snmp_pdu_create(..)

This fixes bsnmpwalk, so it no longer crashes after r310729

X-MFC with:	r310729
MFC after:	12 days
2016-12-31 09:43:35 +00:00
Hiroki Sato
34694ebe05 Replace two fat signal handlers with function calls in
the main I/O multiplex loop.  select() now watches
a pipe which is written by the new skinny signal
handlers and the received signals are handled inside
the loop sequencially.

This eliminates a complex signal mask to guarantee
async-signal safety.
2016-12-31 06:23:05 +00:00
Hiroki Sato
407cd97826 Retry to open an F_PIPE process when it dies unexpectedly.
Reported by:	Eugene Grosbein
PR:		215335
2016-12-31 03:07:48 +00:00
Enji Cooper
53c167f98f Don't explicitly build tcp wrappers support into bsnmpd; make it conditional
on MK_TCP_WRAPPERS != "no"

This likely fixes an issue seen where some of the USE_TCPWRAPPERS code didn't
work as advertised

MFC after:	1 week
2016-12-28 16:34:49 +00:00
Enji Cooper
c3f095c6da Fix the build by moving the initializers for len/nswapdev down below the
declarations

MFC after:	3 days
Pointyhat to:	ngie
2016-12-28 08:11:41 +00:00
Enji Cooper
c5cf639fd9 style(9): clean up whitespace
MFC after:	3 days
2016-12-28 06:10:58 +00:00
Enji Cooper
2229fa01bc style(9) fixes: clean up leading whitespace
MFC after:	3 days
2016-12-28 05:43:14 +00:00
Enji Cooper
6ebc234490 style(9) fixes: clean up leading whitespace
MFC after:	3 days
2016-12-28 05:42:41 +00:00
Enji Cooper
c4648c7562 style(9) fixes
- Clean up trailing whitespace
- Fix variable type alignment in storage_OS_get_swap(..)

MFC after:	3 days
2016-12-28 05:41:53 +00:00
Enji Cooper
4568bf74f4 Only build/install usr.sbin/bsnmpd/modules/snmp_hast if MK_HAST != no
MFC after:	1 week
2016-12-28 05:21:22 +00:00
Enji Cooper
38bf4fd787 Only build/install usr.sbin/bsnmpd/modules/snmp_wlan if MK_WIRELESS != no
MFC after:	1 week
2016-12-28 05:16:41 +00:00
Enji Cooper
f66b889d00 Install snmpmod.3 as all of the bsnmpd APIs it documents
MFC after:	3 days
2016-12-28 03:56:25 +00:00
Enji Cooper
e1d581b289 style(9): clean up trailing whitespace
MFC after:	3 weeks
2016-12-27 23:32:54 +00:00
Alexander Motin
dad99db247 Add MAX_LUNS overflow safety checks.
While this MAX_LUNS limitation is too synthetic and should be removed,
it is better to enforce it while it is here.

MFC after:	2 weeks
2016-12-27 17:13:31 +00:00
Xin LI
760f2905be Don't assign rtjp twice.
Reported by:	clang static analyzer
MFC after:	2 weeks
2016-12-26 19:27:12 +00:00
Xin LI
ed09c2c161 - pstat(8) does not accept any arguments other than getopt() args,
so don't bother to adjust argc/argv after getopt() loop.
 - Make a string pointer constant.

MFC after:	2 weeks
2016-12-26 17:34:27 +00:00
Jamie Gritton
8fd1ba2a5e Improve IP address list representation in libxo output.
Extract decision-making about special-case printing of certain
jail parameters into a function.

Refactor emitting of IPv4 and IPv6 address lists into a function.

Resulting user-facing changes:

XO_VERSION is bumped to 2.

In verbose mode (-v), IPv4 and IPv6-Addresses are now properly emitted
as separate lists.
This only affects the output in encoding styles, i.e. xml and json.

{                                    {
  "__version": "1",                    "__version": "2",
  "jail-information": {                "jail-information": {
    "jail": [                            "jail": [
      {                                    {
        "jid": 166,                          "jid": 166,
        "hostname": "foo.com",               "hostname": "foo.com",
        "path": "/var/jail/foo",             "path": "/var/jail/foo",
        "name": "foo",                       "name": "foo",
        "state": "ACTIVE",                   "state": "ACTIVE",
        "cpusetid": 2,                       "cpusetid": 2,
        "ipv4_addrs": [                      "ipv4_addrs": [
          "10.1.1.1",                          "10.1.1.1",
          "10.1.1.2",                          "10.1.1.2",
          "10.1.1.3",              |           "10.1.1.3"
                                   >         ],
                                   >         "ipv6_addrs": [
          "fe80::1000:1",                      "fe80::1000:1",
          "fe80::1000:2"                       "fe80::1000:2"
        ]                                    ]
      }                                    }
    ]                                    ]
  }                                    }
}                                    }

In -n mode, ip4.addr and ip6.addr are formatted in the encoding styles'
native list types, e.g. instead of comma-separated lists, JSON arrays
are printed.

jls -n all --libxo json
 ...
 "ip4.addr": [
    "10.1.1.1",
    "10.1.1.2",
    "10.1.1.3"
  ],
  "ip4.saddrsel": true,
  "ip6.addr": [
    "fe80::1000:1",
    "fe80::1000:2"
  ],
  ...

jls -n all --libxo xml
  ...
  <ip4.addr>10.1.1.1</ip4.addr>
  <ip4.addr>10.1.1.2</ip4.addr>
  <ip4.addr>10.1.1.3</ip4.addr>
  <ip4.saddrsel>true</ip4.saddrsel>
  <ip6.addr>fe80::1000:1</ip6.addr>
  <ip6.addr>fe80::1000:2</ip6.addr>
  ...

PR:		215008
Submitted by:	Christian Schwarz <me@cschwarz.com>
Differential Revision:	https://reviews.freebsd.org/D8766
2016-12-24 23:51:27 +00:00
Hiroki Sato
77e315c975 - Fix -N flag (NoBind) for AF_LOCAL sockets.
- Do setsockopt(SO_RCVBUF) for AF_LOCAL sockets regardless of -s flag.
2016-12-24 23:29:50 +00:00
Enji Cooper
d97b8afd73 Unbreak syslogd after r310494
Don't close all file descriptors greater than STDERR_FILENO (2) in
waitdaemon(..) -- only close fd (file descriptor for /dev/null used in
subsequent calls to dup2) if it's greater than STDERR_FILENO.

Reported by:	subbsd@gmail.com, danny@cs.huji.ac.il
Pointyhat to:	hrs
X-MFC with:	r310494
2016-12-24 12:50:17 +00:00
Enji Cooper
7c933da6ed Warning message cleanup
- Use warn instead of warnx + strerror(errno)
- Remove unnecessary trailing newline from a warnx call
- Add missing spaces following "," in syslog and warn* calls

MFC after:	2 weeks
2016-12-24 11:22:28 +00:00
Hiroki Sato
4c06e939f8 - Remove unused code.
- Use closefrom().
2016-12-24 07:13:33 +00:00
Hiroki Sato
acdd9d6a0d - More ifdef INET and INET6.
- Use STDERR_FILENO + 1 instead of "3".
- Fix dprintf() in cvthname().
2016-12-23 06:29:24 +00:00
Hiroki Sato
a3dc138e75 mdoc and style fixes. 2016-12-23 04:59:22 +00:00
Hiroki Sato
732c7a256c - Fix a use-after-free bug when dq_timeout == 1 and
sending SIGTERM to the process failed.  It is an
  unusual situation but it can happen.
- Split deadq_remove() into deadq_remove() and
  deadq_removebypid().
- Normalize variable names of struct deadq_entry *.
2016-12-22 13:46:17 +00:00
Hiroki Sato
066f8db8f3 Add a missing "default:" case. 2016-12-22 05:57:45 +00:00
Hiroki Sato
dd87e05952 Initialize a structure by using a compound literal to avoid forgetting
to zero unspecified members.
2016-12-22 05:55:44 +00:00
Hiroki Sato
1ef75d66c8 Fix debug log in the case of AF_INET6. 2016-12-22 05:28:30 +00:00
Hiroki Sato
cb7c842281 - Simplify masklen->netmask conversion for AF_INET6.
- Use iov[N] by array index instead of using pointer v = &iov[0] to
  make the compiler catch an out-of-range access of the array.
2016-12-22 05:23:38 +00:00
Alexander Motin
f383d6efd5 Add support for locally assigned RFC 4122 UUID LUN identifiers.
MFC after:	2 weeks
2016-12-21 09:05:30 +00:00
Ed Schouten
de44cbc21d Add a Prometheus exporter for sysctl values.
Now that we have our sysctl tree annotated with aggregation labels,
let's go ahead and provide a very simple utility for exporting the
sysctl tree in Prometheus' format. It can either be used in conjunction
with the Prometheus node exporter or run through inetd(8).

The reason why I'm opting for having it in the base system is because it
has a pretty strong integration with some of sysctl's innards, such as
access to iterators, name lookups, metadata and type information. As I
am investigating whether we can add histograms as native types to sysctl
as well, this integration will only get stronger as we go along. That's
why it would be safer to oversee the development of this exporter
ourselves, as opposed to having it as an external project.

This exporter is remarkably compact, especially when compared to the
official Linux binary of the Prometheus node exporter (16 KB vs 12 MB).
I guess this could be an interesting aspect for monitoring embedded
FreeBSD-based systems.

Differential Revision:	https://reviews.freebsd.org/D8792
2016-12-21 08:29:44 +00:00
Hiroki Sato
bbe85c3834 Simplify type casting of struct sockaddr_in. 2016-12-21 07:05:34 +00:00
Hiroki Sato
e46b059e46 - Initialize deadq_head statically.
- Fix indent.
- Add missing -S flag into usage().
- Use nitems() for an iov array instead of a macro.
2016-12-21 06:49:21 +00:00
Hiroki Sato
e5610451b2 - Add fklog into struct socklist. Files and local/remote sockets are
now processed in struct socklist in a consistent manner.
- Add helper functions to add a new entry of struct socklist, filed, or peer.
- Use the same routine for -l, -p, and -S.
- Close /dev/klog when read(2) failed.
2016-12-21 06:42:30 +00:00
Hiroki Sato
c532386291 - Use fnmatch(3) for domanname matching of -a options.
- Document the patten matching.
- Document -S flag in SYNOPSIS.
2016-12-21 05:45:59 +00:00
Conrad Meyer
d21656dcab Add a 'force' option for non-interactive crontab removal
Add a '-f' option to force crontab '-r' to be non-interactive.

Submitted by:	Sam Gwydir <sam at samgwydir.com>
Reviewed by:	me, wblock (previous version)
Sponsored by:	Dell EMC Isilon
Differential Revision:	https://reviews.freebsd.org/D8815
2016-12-20 17:12:17 +00:00
Hiroki Sato
97456b7413 Escape punctuation characters. 2016-12-20 08:49:13 +00:00
Hiroki Sato
2e0ef629ee Add a NULL check. 2016-12-20 04:05:21 +00:00
Hiroki Sato
27efdcd869 Add a default socket bound to *:514 when no -b option is specified.
This was accidentally removed at r309933.

Spotted by:	Michael Butler
2016-12-20 03:41:40 +00:00
Hiroki Sato
a5636d2a3e Add a missing STAILQ_INSERT_TAIL() for allowaddr rule. 2016-12-19 17:10:30 +00:00
Enji Cooper
f16a380f79 Clean up parse_ip(..)
- Clean up trailing whitespace
- Fix variable alignment

MFC after:	1 week
2016-12-18 05:36:04 +00:00
Enji Cooper
ddedf93534 Fix some minor typos with begemotBridgeTpLearnedEntryDiscards and
begemotBridgeTpMaxAddresses

Bump LAST-UPDATED for the MIB, per the change

MFC after:	1 week
2016-12-18 00:44:43 +00:00
Colin Percival
5b3b877f89 Avoid division by zero in the rare case that portsnap needs to fetch
zero patches.  (This avoids two "dc: divide by zero" warnings.)

MFC after:	3 days
2016-12-16 22:37:16 +00:00
Devin Teske
a7cc56803c Revert r309918 -- modern POSIX has deprecated -<#>/+<#> syntax
Special thanks to:	jilles
2016-12-13 22:31:49 +00:00
Hiroki Sato
442f3ba311 Remove an extra "break" which could incorrectly terminate an
STAILQ_FOREACH() loop when an AF_INET6 rule matched.

Spotted by:	cem
2016-12-13 20:55:46 +00:00
Devin Teske
f3a8471e5f It's completely pointless to replace newlines with space
(this is done automatically for you upon shell expansion)
2016-12-13 02:56:52 +00:00
Devin Teske
be094a3204 The flags of a WLAN need to be quoted (they contain things like brackets) 2016-12-13 02:54:44 +00:00
Devin Teske
19dbb0ba18 Simplify single-line if statements 2016-12-13 02:48:14 +00:00
Devin Teske
afcce2f52d Simplify loop by moving predicate to clause 2016-12-13 02:47:39 +00:00
Devin Teske
b46ca7cefe Wordsmithing 2016-12-13 02:46:36 +00:00
Devin Teske
a9d334210f Why test $? when you can test the command 2016-12-13 02:45:52 +00:00
Devin Teske
6ef8ca674f Restore previous comment 2016-12-13 02:45:07 +00:00
Devin Teske
94f5aec600 Both simplify bringup of interface after changes and catch errors in debug 2016-12-13 02:44:33 +00:00
Devin Teske
b9f60aba8b Calculate proper size of menu list dialog 2016-12-13 02:42:10 +00:00
Devin Teske
9a46c67aed There's an API function for catching errors and displaying them or
logging them to debug output
2016-12-13 02:40:54 +00:00
Devin Teske
7e1166de96 There's an API function for displaying pauses 2016-12-13 02:30:24 +00:00
Devin Teske
d79a135578 There's an API function for displaying yes/no dialogs 2016-12-13 02:29:20 +00:00
Devin Teske
1d92999c48 There's an API function for displaying errors 2016-12-13 02:27:38 +00:00
Devin Teske
35af83c188 Comment 2016-12-13 02:25:23 +00:00
Devin Teske
b45548a80e Whitespace alignment 2016-12-13 02:23:48 +00:00
Devin Teske
d5fddc4dcb Relying on dialog auto-sizing (width/height/rows = 0) is a mistake
Use the provided API for calculating the appropriate size of menus
2016-12-13 02:22:21 +00:00
Devin Teske
7599c85424 Remove unnecessary quotes 2016-12-13 02:16:00 +00:00
Devin Teske
1095816ec3 Add missing quotes 2016-12-13 02:15:36 +00:00
Devin Teske
01a2404c35 In awk, if you're going to append a newline to your printf
AND you're going to print only the argument, just use print
2016-12-13 02:14:40 +00:00
Devin Teske
dba958af5d This statement has too many backslashes 2016-12-13 02:13:20 +00:00
Devin Teske
be34885e2a Neither printf (and as is commonly known) nor print need parens in awk 2016-12-13 02:12:00 +00:00
Devin Teske
5943bcd19f Whitespace and alignment 2016-12-13 02:11:09 +00:00
Devin Teske
191441eed8 You don't need parentheses for awk's printf 2016-12-13 02:07:12 +00:00
Devin Teske
0724c87c95 Continued resolution of conveluted statement
We shouldn't be coding things like "x || (x && x) || x || x || x ..."
2016-12-13 02:04:50 +00:00
Devin Teske
32c34b0361 These two error messages have always been backwards since inception 2016-12-13 02:02:14 +00:00
Devin Teske
7f513d3675 Why use $? when you can use the command itself 2016-12-13 01:59:35 +00:00
Devin Teske
6b77f63e5d If the first ping succeeded, why on Earth should we ping it again? 2016-12-13 01:56:28 +00:00
Devin Teske
a1a6fec1c7 Start deconstructing a conveluted hunk of code 2016-12-13 01:54:44 +00:00
Devin Teske
19cae84e23 Remove completely unnecesary parentheses 2016-12-13 01:52:10 +00:00
Devin Teske
751993945a Why repeat yourself when you can send stderr to the same place as stdout? 2016-12-13 01:50:22 +00:00
Devin Teske
66ef7d9455 Properly quote variable 2016-12-13 01:44:18 +00:00
Devin Teske
a51195769a Use more generic f_yesno() from provided API 2016-12-13 01:42:13 +00:00
Devin Teske
f52733d46e The output of dialog needs to be sanitized
for portability/compatibility requirements
2016-12-13 01:41:06 +00:00
Devin Teske
f20b7768fc Whitespace alignment 2016-12-13 01:39:09 +00:00
Devin Teske
d401d36c04 Sort the domains 2016-12-13 01:36:46 +00:00
Devin Teske
95ee591e83 The --no-items and --stdout options are non-standard and should be avoided
From the dialog(1) manual:
using [--stdout] in portable scripts is not recommended
2016-12-13 01:35:26 +00:00
Devin Teske
6e038cc2eb More efficiently make use of the exit status 2016-12-13 00:27:56 +00:00
Devin Teske
1c61211223 Stop repeating strings (centralize prompt string)
NB: Changes to strings now only affect a single line
2016-12-13 00:22:01 +00:00
Devin Teske
e2577019ed Add missing backslash (no real effect; it's pedantic and correct for
the interpolation level)
2016-12-13 00:18:51 +00:00
Devin Teske
e7f2eb12c2 Use the oft-neglected awk syntax "startcondition, stopcondition { ... }" to
process the range of country labels which appear as columnar list from the
"ifconfig DEV list countries" command. Not only improving maintainability,
but also properly encapsulating arguments in single-quotes instead of
trying to escape whitespace. It is also completely unnecessary to collapse
newlines into whitespace (shell will do this for you automatically upon
expansion of the contents where necessary).

NB: This also changes the sorting algorithm to sort on the country code,
not the country name. The type-ahead feature of dialog is destroyed if the
tags are not sorted properly.
2016-12-13 00:02:59 +00:00
Devin Teske
49748e0a6d Quote WLAN_IFACE (pedantic) 2016-12-12 22:57:07 +00:00
Devin Teske
6c26775c2f In awk, casting a variable as a boolean condition is the same as testing if
the length of the variable contents is greater than zero

This allows us to also move the secondary condition into the action clause
2016-12-12 21:29:48 +00:00
Devin Teske
275c0c0741 Remove an unnecessary call to f_dialog_title_restore() 2016-12-12 21:27:29 +00:00
Devin Teske
1045858386 Whitespace 2016-12-12 21:26:36 +00:00
Devin Teske
d124dfc410 Utilize provided i18n strings 2016-12-12 21:23:47 +00:00
Devin Teske
877ea04721 Remove incomplete and unnecessary creation of fd3
The provided API already provides a passthru descriptor and even
gives you a varaible for referring to it.
2016-12-12 21:20:56 +00:00
Devin Teske
8bcf564644 Remove unnecessary semi-colons 2016-12-12 21:18:24 +00:00
Devin Teske
0b8f01fe99 Use awk the following (more succinct) awk syntax:
condition1 { action1 }
	condition2 { action2 }

instead of the following syntax:

	{
		if (condition1) { action1 }
		else if (condition2) { action2 }
	}
2016-12-12 21:16:37 +00:00
Devin Teske
d9f83eb9f4 1 is the default descriptor for redirects without an fd prefix 2016-12-12 21:11:55 +00:00
Devin Teske
bef42d18c5 Fix invalid parameter expansion (change $@ to "$@")
Without quotes, $@ loses its special meanining (see below)

% sh -c 'echo $@' /bin/sh "   1   " "   2   "
1 2
% sh -c 'echo "$@"' /bin/sh "   1   " "   2   "
   1       2

The quotes are required to get ARGV to be unperterped
2016-12-12 21:04:11 +00:00
Devin Teske
35c8d5eb1b Allow the script path to contain whitespace and special characters 2016-12-12 21:01:20 +00:00
Devin Teske
58ce2edc98 Use provided API to centralize dialog title strings 2016-12-12 21:00:09 +00:00
Devin Teske
7797a5973f Reorder dialog parameters based on commonality for readability 2016-12-12 20:54:20 +00:00
Devin Teske
6ea6e3fa7d Fix incorrect use of provided API
The result of which was incorrectly sized menu dialogs
2016-12-12 20:49:49 +00:00
Devin Teske
ea2e60b01c Use provided API (change "dialog" to "$DIALOG") 2016-12-12 20:43:09 +00:00
Devin Teske
2abc4c242e Whitespace (dialog options separated to minimize diffs) 2016-12-12 20:41:27 +00:00
Devin Teske
b5938e7da3 Consolidate redirects into here documents, with proper code indentation 2016-12-12 19:46:49 +00:00
Hiroki Sato
dc96a41b44 - Refactor listening socket list. All of the listening sockets are
now maintained in a single linked-list in a transport-independent manner.
- Use queue.h for linked-list structure.
- Use linked-list for AllowedPeers.
- Use getaddrinfo(8) even for Unix Domain sockets.
- Use macros to type-casting from/to struct sockaddr{,_in,_in6}.
- Define fu_* macro for union f_un to shorten the member names.
- Remove an extra #include <sys/type.h>.
- Add "static" to non-exported symbols.
- !INET support is still incomplete but will be fixed later.

There is no functional change except for some minor debug messages.
2016-12-12 19:33:40 +00:00
Devin Teske
15fadc4858 Remove an unnecessary "return $?" at end of function 2016-12-12 19:26:55 +00:00
Hiroki Sato
8555a6e0a4 Temporarily backout the previous commit because it was totally broken due to
unresolved merge conflicts.

Pointy hat to:	hrs
2016-12-12 19:24:52 +00:00
Devin Teske
7bcf4508be Use ternary operator 2016-12-12 19:24:32 +00:00
Devin Teske
0e638f57e6 If you're not going to make use of the products of a match() in awk
(e.g., RSTART and RLENGTH variables) then use ~ instead of match()
2016-12-12 19:12:31 +00:00
Devin Teske
71ef4d586a Now that these variables do not contain the --default-item flag itself,
change the name of the variable from $def_item_... to $default_...
2016-12-12 19:10:39 +00:00
Hiroki Sato
783e461c73 - Refactor listening socket list. All of the listening sockets are
now maintained in a single linked-list in a transport-independent manner.
- Use queue.h for linked-list structure.
- Use linked-list for AllowedPeers.
- Use getaddrinfo(8) even for Unix Domain sockets.
- Use macros to type-casting from/to struct sockaddr{,_in,_in6}.
- Define fu_* macro for union f_un to shorten the member names.
- Remove an extra #include <sys/type.h>.
- Add "static" to non-exported symbols.
- !INET support is still incomplete but will be fixed later.

There is no functional change except for some minor debug messages.
2016-12-12 19:10:14 +00:00
Devin Teske
86e1d2977f Always pass --default-item parameter to dialog 2016-12-12 19:09:17 +00:00
Devin Teske
48e9fce2f5 There is zero harm in always passing --default-item to dialog 2016-12-12 19:07:42 +00:00
Devin Teske
58dc38bd1c Centralize backtitle string 2016-12-12 19:01:04 +00:00
Devin Teske
5357f8f7c8 Use provided API instead of hard-coded status integers 2016-12-12 18:55:41 +00:00
Devin Teske
76b07bd950 Whitespace 2016-12-12 18:52:22 +00:00
Devin Teske
9ca8b7be34 Remove unnecessary `-n' parameter to head/tail 2016-12-12 18:48:00 +00:00
Devin Teske
3204364296 awk(1) match() takes a regex, use /.../ to remind ourselves of this
NB: The difference between "..." and /.../ for a regex in awk is that
quoted strings go through escape expansion first (e.g., \\ becomes \)
2016-12-12 18:45:52 +00:00
Devin Teske
4fa8c81cc3 Be internally consistent (": > ..." is used elsewhere in this file) 2016-12-12 18:43:42 +00:00
Devin Teske
edcf330372 "echo | sed | sed | awk" is silly (changed to "echo | awk") 2016-12-12 18:42:55 +00:00
Devin Teske
1cac9fc2a3 Add missing `-e' parameter to sed invocations 2016-12-12 18:39:26 +00:00
Devin Teske
8d5182d698 Allow $BSDINSTALL_TMPETC to contain whitespace or special chars 2016-12-12 18:38:18 +00:00
Devin Teske
c62801e26d Group fallbacks together 2016-12-12 18:34:21 +00:00
Devin Teske
0b04945dc0 Remove unnecessary quotes around number in test 2016-12-12 18:33:40 +00:00
Devin Teske
e9c843adc7 Change "[ ! ... ] && ..." to "[ ... ] || ..." 2016-12-12 18:29:24 +00:00
Devin Teske
e20253348d Collapse tiny if statements 2016-12-12 18:28:20 +00:00
Devin Teske
114a587e3b Replace funny block with something easy to digest 2016-12-12 18:24:41 +00:00
Devin Teske
bede070805 Consolidate locals 2016-12-12 18:21:56 +00:00
Devin Teske
5b57fabb45 Remove unnecessary local initializers 2016-12-12 18:20:56 +00:00
Devin Teske
38a9942347 Change "[ ! -z ... ]" => "[ ... ]" and "[ -z ... ]" => "[ ! ... ]" 2016-12-12 18:17:30 +00:00
Devin Teske
138ab67af4 Use $( ... ) instead of ... 2016-12-12 18:10:33 +00:00
Devin Teske
97a4c9f0dc Comments 2016-12-12 18:05:54 +00:00
Baptiste Daroussin
abd4699ce2 Fix pkg groupshow <gid>
PR:		204676
Submitted by:	longwitz@incore.de
MFC after:	2 days
2016-12-10 12:48:48 +00:00
Rick Macklem
df3e1050ff Patch the nfsd so that it doesn't register with rpcbind for an NFSv4 only
server.

This patch uses the sysctl vfs.nfsd.server_min_nfsvers to determine
if/what versions of NFS service should be registered with rpcbind.
For NFSv4 only, it does not register at all, since NFSv4 always uses 2049
and does not require rpcbind.
For NFSv3 minimum, it registers NFSv3 but not NFSv2.

Tested by:	jmader2@gmu.edu
Submitted by:	jmader2@gmu.edu (earlier version)
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D8696
2016-12-08 23:29:56 +00:00
Devin Teske
f18789d787 Functions in their own section 2016-12-08 19:28:12 +00:00
Devin Teske
3d2b0857bf Remove unnecessary trailing backslashes 2016-12-08 19:26:22 +00:00
Devin Teske
3220bdd85c Add support for "hidden" Wi-Fi networks
PR:		bin/214933
Submitted by:	Maxim Filimonov <che@bein.link>
Reviewed by:	dteske, allanjude, adrian
MFC after:	6 days
X-MFC-with:	Follow-up commit for style
2016-12-08 16:41:18 +00:00
Nick Hibma
a96032e552 More typos in strings.
Submitted by:	bde
MFC after:	3 days
2016-12-02 11:30:21 +00:00
Marcelo Araujo
bbdfc8f1ea Use memset(3) instead of bzero(3).
Obtained from:	OpenBSD (r1.12, r1.20, r1.18 and r1.37)
2016-12-02 06:07:27 +00:00
Marcelo Araujo
5902259135 String terminators are called NUL, not NULL, also the variable
mentioned in the comment is p and not u.

Obtained from:	OpenBSD (r1.34)
2016-12-02 05:49:22 +00:00
Nick Hibma
16e7325493 Speling fixes and fix line endings for err_msg output.
In some cases there was not \n, in other cases there was.
2016-12-01 09:14:58 +00:00
Andriy Gapon
9aaefb2c53 bhyve: stability and performance improvement for dbgport
The TCP server implementation in dbgport does not track clients, so it
may try to write to a disconected socket resulting in SIGPIPE.
Avoid that by setting SO_NOSIGPIPE socket option.

Because dbgport emulates an I/O port to guest, the communication is done
byte by byte.  Reduce latency of the TCP/IP transfers by using
TCP_NODELAY option.  In my tests that change improves performance of
kgdb commands with lots of output (e.g. info threads) by two orders of
magnitude.

A general note.  Since we have a uart emulation in bhyve, that can be
used for the console and gdb access to guests.  So, bvmconsole and bvmdebug
could be de-orbited now.  But there are many existing deployments that
still dependend on those.

Discussed with:	julian, jhb
MFC after:	2 weeks
Sponsored by:	Panzura
2016-11-29 13:11:00 +00:00
Xin LI
9a913ec291 Plug another leak with malformed IPv6 address.
MFC after:	2 weeks
2016-11-28 07:41:01 +00:00
Xin LI
203632f263 Don't leak 'str' when we see a malformed IPv6 address.
MFC after:	2 weeks
2016-11-28 07:33:26 +00:00
Baptiste Daroussin
8ecd7189a4 Properly initialize nextp
MFC after:	1 day
2016-11-27 19:27:13 +00:00
Baptiste Daroussin
dd83a7df85 initialize *nextp which could be left uninitialized in case the configuration
file cannot be open/read

Reported by:	Coverity via cem
MFC after:	2 days
CID:		1365665
2016-11-26 15:49:59 +00:00
Sevan Janiyan
a7b3f36393 Fix null dereference when running out of nodes during rename.
PR:		212370
Submitted by:	Sascha Wildner <swildner AT gmail>
Reviewed by:	bcr (mentor)
Approved by:	bapt
Obtained from:	NetBSD
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D8643
2016-11-26 13:26:29 +00:00
Jakub Wojciech Klama
d286418ee6 virtio_console: handle short writes to an Unix domain socket gracefully.
writev() can do a short write.  Retrying it results in a very convoluted
and complex code, so we iterate over iovec and do regular stream_write()
instead.

Approved by:	trasz
Sponsored by:	iXsystems, Inc.
2016-11-24 22:16:18 +00:00
Jakub Wojciech Klama
962094d52a Allow opening virtio-console ports from the host side before guest
enumerates them.

Approved by:	trasz
Sponsored by:	iXsystems, Inc.
2016-11-24 21:53:42 +00:00
Poul-Henning Kamp
e10312ca7b Pass the correct size argument to ioctl(DIOCGSECTORSIZE) 2016-11-22 22:10:58 +00:00
Xin LI
f391d6bc1d MFV r308954:
ntp 4.2.8p9.

Approved by:	so
2016-11-22 08:27:49 +00:00
Alan Somers
cbaba16b23 Speed up pw operations that edit /etc/group or /etc/passwd
r285050 fixed a bug in pw that could lead to /etc/passwd or /etc/group
corruption on power loss. However, it fixed it by opening those files with
O_SYNC, which is very slow, especially on ZFS. This change replaces O_SYNC
with appropriately placed fsync()s instead, which is much faster. Using a
ZFS tmpdir, the time to run pw's kyua tests drops from 245s to 35s.

Reviewed by:	allanjude, bapt, vangyzen, garga
Tested on pfSense by:	garga
MFC after:	4 weeks
Sponsored by:	Spectra Logic Corp
Differential Revision:	https://reviews.freebsd.org/D8319
2016-11-18 16:07:08 +00:00
Ed Maste
f513dfd44b crunchide: report explicit error for combined string table
Some tools produce objects with a combined strtab and shstrtab.
These objects are not supported by crunchide since it rewrites the
symtab and strtab to "hide" symbols. This invalidates section header
offsets into a combined strtab/shstrtab.

In the future we could support these objects (by ensuring that we retain
unmodified section name strings in the output .strtab, and then rewriting
each section header's sh_name).

MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
2016-11-17 18:12:17 +00:00
Sepherosa Ziehau
f4dc47c87b hyperv/vss: Install the userland daemon to /usr/sbin instead of /
Submitted by:	markj
Reported by:	markj
MFC after:	3 weeks
Sponsored by:	Microsoft
2016-11-17 03:02:35 +00:00
Ed Maste
69712279cc crunchide: remove obsolete a.out header and comment
crunchide(1) gained ELF support in r39172, and lost the unused a.out
and non-functional ECOFF suport in r281655.

Sponsored by:	The FreeBSD Foundation
2016-11-16 16:39:51 +00:00
Sepherosa Ziehau
168fce73b5 hyperv/vss: Add driver and tools for VSS
VSS stands for "Volume Shadow Copy Service".  Unlike virtual machine
snapshot, it only takes snapshot for the virtual disks, so both
filesystem and applications have to aware of it, and cooperate the
whole VSS process.

This driver exposes two device files to the userland:

    /dev/hv_fsvss_dev

    Normally userland programs should _not_ mess with this device file.
    It is currently used by the hv_vss_daemon(8), which freezes and
    thaws the filesystem.  NOTE: currently only UFS is supported, if
    the system mounts _any_ other filesystems, the hv_vss_daemon(8)
    will veto the VSS process.

    If hv_vss_daemon(8) was disabled, then this device file must be
    opened, and proper ioctls must be issued to keep the VSS working.

    /dev/hv_appvss_dev

    Userland application can opened this device file to receive the
    VSS freeze notification, hold the VSS for a while (mainly to flush
    application data to filesystem), release the VSS process, and
    receive the VSS thaw notification i.e. applications can run again.

    The VSS will still work, even if this device file is not opened.
    However, only filesystem consistency is promised, if this device
    file is not opened or is not operated properly.

hv_vss_daemon(8) is started by devd(8) by default.  It can be disabled
by editting /etc/devd/hyperv.conf.

Submitted by:	Hongjiang Zhang <honzhan microsoft com>
Reviewed by:	kib, mckusick
MFC after:	3 weeks
Sponsored by:	Microsoft
Differential Revision:	https://reviews.freebsd.org/D8224
2016-11-15 02:36:12 +00:00
Michael Tuexen
ab51358e76 Fix typo.
MFC after: 1 month
Sponsored by: Netflix
2016-11-13 17:55:27 +00:00
Bryan Drewery
490a8aa9a1 DIRDEPS_BUILD: Update dependencies.
MFC after:	2 weeks
Sponsored by:	Dell EMC Isilon
2016-11-13 00:11:30 +00:00
Bryan Drewery
d329c46cfa DIRDEPS_BUILD: Connect new dependencies.
MFC after:	2 weeks
Sponsored by:	Dell EMC Isilon
2016-11-13 00:11:23 +00:00
Gavin Atkinson
4a6db06fee Correct spelling in syslog: getttimeofday -> gettimeofday 2016-11-11 21:53:38 +00:00
Andriy Gapon
cf3a35a755 smbmsg: use a more convenient way of accessing data read from a slave
Developers writing code for accessing /dev/smb may use this base utility
as an example.  Now that SMB_READB, SMB_READW, SMB_PCALL behave as
documented, wwe can use them in a more convenient way than before.

MFC after:	4 weeks
X-MFC after:	r308527
2016-11-11 15:00:13 +00:00
Cy Schubert
449287a2a5 MFV r305100: Update amd from am-utils 6.1.5 to 6.2.
Used extensively on my network over the past month.

Reviewed by:	pfg, brooks
Suggested by:	pfg
Obtained from:	ftp://ftp.am-utils.org/pub/am-utils/
MFC after:	6 weeks
Relnotes:	yes
Differential Revision:	D8405
2016-11-11 02:42:53 +00:00
Andriy Gapon
a18f280538 fix a watchdogd regression introduced in r308040
The code assumed that 'timeout' and 'timeout_sec' are in sync
which they weren't if no '-t' option was passed to watchdogd.

Reported by:	Olivier Smedts <olivier@gid0.org>,
		Alex Deiter <alex.deiter@gmail.com>
Tested by:	Olivier Smedts <olivier@gid0.org>,
		Alex Deiter <alex.deiter@gmail.com>
MFC after:	5 days
X-MFC with:	r308040
2016-11-10 10:45:12 +00:00
Marcelo Araujo
712a6ae66e Add flag -B which does the same like batch mode but without exiting after
print. Also add a new flag -s that add blocks size to statistics.

PR:		198347, 212726
Submitted by:	Ben RUBSON <ben.rubson@gmail.com>
Tested by:	pi
MFC After:	2 weeks.
2016-11-09 07:31:39 +00:00
Bryan Drewery
28323add09 Fix improper use of "its".
Sponsored by:	Dell EMC Isilon
2016-11-08 23:59:41 +00:00
Hiroki Sato
374d225e54 Add link-layer address option in RA even for IFT_L2VLAN and IFT_BRIDGE.
Reported by:	philip
MFC after:	3 days
2016-11-05 19:51:13 +00:00
Hiroki Sato
161ab37d24 Fix an infinite loop at an non-responding hop when other echo replies
are kept arriving in the waittime time window.

Submitted by:	Denny Page
PR:		210286
MFC after:	3 days
2016-11-05 18:00:36 +00:00
Marcel Moolenaar
4ad8d73326 Assign a random number to di_gen (for FFS), instead of extracting it
from struct stat.  We don't necessarily have permissions to see the
generation number and the host OS may not have st_gen in struct stat
anyway.  Since the kernel assigns random numbers, there's nothing
meaningful about the generation that requires us to preserve it when
the file system image is created.  With this change, all generation
numbers come from random() and that makes it easier to add support
for reproducible builds at some time in the future (i.e. by adding
an argument to makefs that changes the behaviour of random() so that
it always returns 0 or some predictable sequence).

Differential Revision:	https://reviews.freebsd.org/D8418
2016-11-05 16:23:33 +00:00
Ed Maste
becf2d11e8 vidcontrol: use calloc where appropriate
Reported by:	kib
2016-11-05 11:19:55 +00:00
Ed Maste
aba6e41495 vidcontrol: improve error handling in vt(4) font loading
PR:		209078
Reported by:	ecturt@gmail.com
Reviewed by:	Oliver Pinter
Differential Revision:	https://reviews.freebsd.org/D8176
2016-11-04 20:32:49 +00:00
Andriy Gapon
0112b52b61 Add support for microcode update on newer AMD CPUs (10h+)
This includes new code for parsing microcode files as well as
the kernel-side change to apply the update on all processors
at the same time.

Developed with help from Borislav Petkov, formerly bp@amd64.org.

Tested using Athlon II X2 processor on a system where BIOS does
not have the latest microcode version:
/boot/firmware/microcode_amd.bin: updating cpu /dev/cpuctl0 to revision 0x10000c7... done.

The microcode file is taken from here:
https://web.archive.org/web/20160528230514/http://www.amd64.org/microcode.html
(note that the original site seems to be down at the moment)
It can also be found here:
https://git.kernel.org/cgit/linux/kernel/git/firmware/linux-firmware.git/tree/amd-ucode

Reviewed by:	kib, stas
MFC after:	2 weeks
Relnotes:	maybe
Differential Revision: https://reviews.freebsd.org/D8384
2016-11-02 16:15:49 +00:00
Fabien Thomas
5ffb56f057 In rtadvd, interface lookup calls if_indextoname() many times in a loop,
(it takes a long time on systems with many interfaces)
without reason and without checking its return value.

Reviewed by: cem
Obtained from: Maryse Levavasseur <maryse.levavasseur@stormshield.eu>
MFC after: 1 month
Sponsored by: Stormshield
Differential Revision: https://reviews.freebsd.org/D6979
2016-11-02 15:11:23 +00:00
Edward Tomasz Napierala
8379360aeb Make autounmountd(8) not die when traced with "truss -p".
MFC after:	1 month
2016-11-02 08:12:37 +00:00
Baptiste Daroussin
fdec22c37d syslogd(8): add an 'include' keyword
All the '.conf' files not beginning with a '.' contained int he directory
following the keyword will be included.

This keyword can only be used in the first level configuration files.

Modify the default syslogd.conf to 'include' /etc/syslog.d and
/usr/local/etc/syslog.d

It simplify a lot handling of syslog from automation tools.

Reviewed by:	markj, kib (via irc)
Approved by:	markj
MFC after:	2 weeks
Relnotes:	yes
Differential Revision:	https://reviews.freebsd.org/D8402
2016-11-01 01:41:24 +00:00
Baptiste Daroussin
569b917590 Allow symlinks to be followed in cron.d directories and fix detection of
regular files on NFS

Reported by:	jilles
2016-10-31 23:40:04 +00:00
Baptiste Daroussin
4eaecda2fa Fix typo in cron(8) date
Reported by:	jilles
2016-10-31 23:32:38 +00:00
Baptiste Daroussin
b2fd8384ff cron(8): add support for /etc/cron.d and /usr/local/etc/cron.d
For automation tools it is way easier to maintain files in directories rather
than modifying /etc/crontab.

The files in those directories are in the same format as /etc/crontab

Reviewed by:	adrian
MFC after:	2 weeks
Relnotes:	yes
Sponsored by:	Gandi.net
Differential Revision:	https://reviews.freebsd.org/D8400
2016-10-31 18:20:12 +00:00
Alexander Motin
2668ec0761 There appeared to be even more copy/pastes. :)
Submitted by:	Dmitry Luhtionov <dmitryluhtionov@gmail.com>
MFC after:	2 weeks
2016-10-31 16:06:57 +00:00
Alexander Motin
42f97fac5d Fix wrong copy/paste in error message.
Submitted by:	Dmitry Luhtionov <dmitryluhtionov@gmail.com>
MFC after:	2 weeks
2016-10-31 16:01:22 +00:00
Andriy Gapon
9cb44c5d21 nap time between pats is forced to be at most half of the timeout
Previously, if the timeout was less than 10 seconds, for example, about
8 seconds, then the watchdog timer would be let to expire before patting
the watchdog.

MFC after:	2 weeks
2016-10-28 14:49:54 +00:00
Marcel Moolenaar
5bdda834d5 Allow config to be compiled from another source directory, such as one
for building tools. This boils down to replacing ${.CURDIR} with
${SRCDIR}, where the latter is the directory in which this makefile
lives.

Also allow overriding where file2c comes from using ${FILE2C}.
2016-10-26 15:58:41 +00:00
Gleb Smirnoff
42854d99e8 Fix unchecked array reference in the VGA device emulation code.
Submitted by:   Ilja Van Sprundel <ivansprundel@ioactive.com>
Patch by:	tychon
Security:       SA-16:32
2016-10-25 17:13:58 +00:00
Marcel Moolenaar
5d71efbecd Be more precise when including headers so that we're less likely to
depend on namespace pollution and as such become more portable. This
means including headers like <sys/types.h> or <stdlib.h>, but also
making sure we include system/host headers before local headers.

While here: define ENOATTR as ENOMSG in mtree.c. There is no ENOATTR
on Linux.

With this, makefs is ready for compilation on macOS and Linux.
2016-10-25 16:29:15 +00:00
Marcel Moolenaar
46783b12e3 Allow building makefs(8) from another Makefile (such as one in
a seperate directory hierarchy used to build tools). This boils
down to replacing the use of ${.CURDIR} with either ${SRCDIR}
or ${SRCTOP}. SRCDIR is defined as the directory in which the
Makefile lives that bmake(1) is currently reading. Use SRCTOP
when reaching outside of makefs's directory.
2016-10-25 16:21:38 +00:00
Baptiste Daroussin
a146e36c02 accept4 actually expect SOCK_NONBLOCK and not O_NONBLOCK
Reported by:	jhb
Pointyhat to:	bapt
2016-10-25 15:20:06 +00:00
Rick Macklem
a4a1709728 Fix the man page to reflect the change done by r307890 to mountd.c
so that the "-n" option uses the sysctl for the new NFS server.
This is a content change.

PR:		213450
Submitted by:	rs@bytecamp.net
MFC after:	2 weeks
2016-10-25 00:59:23 +00:00
Rick Macklem
5ebee88d80 mountd(8) was erroneously setting the sysctl for the old NFS server
when the new/default NFS server was running, for the "-n" option.

This patch fixes the problem for head and stable/11. For stable/10 the
patch will need to be modified when MFC'd, since the stable/10 mountd.c
handles both old and new NFS servers.
Since the new NFS server uses vfs.nfsd.nfs_privport == 0 by default,
there wouldn't have been many users affected by the code not setting
it to 0 when the "-n" option was specified.

PR:		213450
Submitted by:	rs@bytecamp.net
MFC after:	2 weeks
2016-10-25 00:52:42 +00:00