Commit Graph

8198 Commits

Author SHA1 Message Date
Enji Cooper
170b1dd53e Fix leak in mkfs_msdos(..) by initializing img to NULL and free'ing at the end
of the function

Differential Revision: https://reviews.freebsd.org/D4405
MFC after: 1 week
PR: 204943
Reviewed by: emaste, jilles
Reported by: David Binderman <dcb314@hotmail.com>
Sponsored by: EMC / Isilon Storage Division
2015-12-06 21:07:33 +00:00
Bryan Drewery
eacae6dc66 Fix LDADD/DPADD that should be LIBADD.
Sponsored by:	EMC / Isilon Storage Division
2015-12-04 03:17:47 +00:00
Bryan Drewery
7aab86d59d For INTERNALLIB always add in the corresponding _DP_ and use LIBADD in
the real build file.

This lessens the need to define DPADD_<lib> and LDADD_<lib> to just very
special cases.

Sponsored by:	EMC / Isilon Storage Division
2015-12-04 03:17:17 +00:00
Bryan Drewery
9728842cf3 META MODE: Connect MK_NAND directories.
Sponsored by:	EMC / Isilon Storage Division
2015-12-02 05:31:01 +00:00
Bryan Drewery
b748535cc4 Don't add LIBADD=ipf to libipf itself.
This had no real impact since libipf is a static INTERNALLIB.  It does conflict
with an assertion I am adding for LIBADD though.

Sponsored by:	EMC / Isilon Storage Division
2015-12-01 22:39:19 +00:00
Craig Rodrigues
06691045ba Add more text to explain --libxo flag. 2015-12-01 19:18:53 +00:00
Bryan Drewery
b1f92fa229 META MODE: Update dependencies with 'the-lot' and add missing directories.
This is not properly respecting WITHOUT or ARCH dependencies in target/.
Doing so requires a massive effort to rework targets/ to do so.  A
better approach will be to either include the SUBDIR Makefiles directly
and map to DIRDEPS or just dynamically lookup the SUBDIR.  These lose
the benefit of having a userland/lib, userland/libexec, etc, though and
results in a massive package.  The current implementation of targets/ is
very unmaintainable.

Currently rescue/rescue and sys/modules are still not connected.

Sponsored by:	EMC / Isilon Storage Division
2015-12-01 05:23:19 +00:00
Bryan Drewery
cf990407e1 Update dependencies after r291406 added libelf to libkvm.
Unfortunately filemon/meta mode tracks all indirect dependencies here
since ld(1) is reading libelf when linking in libkvm.  Churn would be
reduced if this was able to be limited to direct dependencies.

Sponsored by:	EMC / Isilon Storage Division
2015-12-01 05:18:48 +00:00
Adrian Chadd
d01cb677ba Convert ifconfig to use lib80211.
* remove regdomain.[ch] - it's now part of lib80211.
* convert ifieee80211.c to use the ioctl routines in lib80211 and
  implement the "error? exit" wrapper behaviour the callers expect.
2015-11-30 06:34:16 +00:00
Ed Maste
64953dd1dd Use netbsd usage() implementation in newfs_msdos
In r289629 newfs_msdos option descriptions are available in
mkfs_msdos.h.

Obtained from:	NetBSD
2015-11-27 14:40:21 +00:00
Ed Maste
937744df07 mkfs_msdos: sync with NetBSD
Add a sanity test and clean up whitespace.

Obtained from:	NetBSD
2015-11-27 14:20:32 +00:00
Adrian Chadd
db4eb9fec2 [ifconfig] handle IBSS mediatype correctly.
Right now net80211 is configured as type IBSS but then treats it
as mediatype ADHOC.  This doesn't change that; it just correctly handles
being given a mediatype of IBSS.
2015-11-26 01:58:50 +00:00
Bryan Drewery
277fbb92d5 Remove redundant DPSRCS which were already in SRCS.
DPSRCS already contains all of SRCS.

MFC after:	1 week
Sponsored by:	EMC / Isilon Storage Division
2015-11-25 20:38:07 +00:00
Ed Maste
99f4158c82 newfs_msdos: rework error handling for eventual use in makefs
Return -1 on errors from mkfs_msdos() instead of err()/errx(), to
allow different consumers to handle errors as appropriate.

Obtained from:	NetBSD
Sponsored by:	The FreeBSD Foundation
2015-11-23 18:58:00 +00:00
Ed Maste
b3e7589994 Update $NetBSD$ ID
NetBSD mkfs_msdos.h rev 1.3 removed the no-endorsement clause from the
license block, which had already been done in the source I imported in
r289629.
2015-11-23 18:56:10 +00:00
Steven Hartland
45a9027de4 Fix dumpon compatibility with dumpdev kenv
The dumpdev kenv supports devices without the /dev/ prefix, fix dumpon to
also support this which is required after r288153.

MFC after:	1 week
Sponsored by:	Multiplay
2015-11-23 14:06:21 +00:00
Bryan Drewery
6f42d16f43 Convert to SUBDIR.yes format.
Reviewed by:	imp
Sponsored by:	EMC / Isilon Storage Division
Differential Revision:	https://reviews.freebsd.org/D4182
2015-11-18 17:52:38 +00:00
John-Mark Gurney
9ed7fa550e If you backup a large file that is mostly holes, previously we'd issue
a seek for every block...  For large (Exabyte sized files) this would
issue lots of unneeded seeks, so combine them...

Thanks for the work Jan, sorry took so long to commit...  And an item
completed off the IdeasPage!

Submitted by:	Jan Sucan
2015-11-16 01:29:58 +00:00
Edward Tomasz Napierala
b9124fc313 Fix resource leaks in error cases.
MFC after:	1 month
Sponsored by:	The FreeBSD Foundation
2015-11-11 23:00:57 +00:00
Edward Tomasz Napierala
3f5ac575ea Userspace part of reroot support. This makes it possible to change
the root filesystem without full reboot, using "reboot -r". This can
be used to to eg. boot from a temporary md_image preloaded by loader(8),
setup an iSCSI session, and continue booting from rootfs mounted over
iSCSI.

Reviewed by:	kib@, bapt@
MFC after:	1 month
Relnotes:	yes
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D3693
2015-11-08 17:33:48 +00:00
Conrad Meyer
fc6f845ec5 savecore(8): Be quiet unless the user asks for verbose
Make savecore(8) more suitable for init-time scripts; be quiet by default.

Sponsored by:	EMC / Isilon Storage Division
Differential Revision:	https://reviews.freebsd.org/D3229
2015-11-07 23:27:03 +00:00
Conrad Meyer
2a71f1ed95 Follow-up to r290475: Add sysctl(8) support for added types
Sponsored by:	EMC / Isilon Storage Division
2015-11-07 01:56:32 +00:00
Alan Somers
49f1692b78 Always check the return value of lseek.
This is a follow-up to r289845, which only fixed one occurence of CID
1009429.

Coverity CID:	1009429
Reviewed by:	markj
MFC after:	2 weeks
X-MFC-With:	r289845
Sponsored by:	Spectra Logic
Differential Revision:	https://reviews.freebsd.org/D4096
2015-11-06 19:18:20 +00:00
Steven Hartland
c1be893c44 Add sysctl to control LACP strict compliance default
Add net.link.lagg.lacp.default_strict_mode which defines
the default value for LACP strict compliance for created
lagg devices.

Also:
* Add lacp_strict option to ifconfig(8).
* Fix lagg(4) creation examples.
* Minor style(9) fix.

MFC after:	1 week
2015-11-06 15:33:27 +00:00
Andriy Voskoboinyk
db615b2bb1 ifconfig: fix padding for '<ifname> scan' command output
(S:N and beacon interval fields).

Approved by:	adrian (mentor)
Differential Revision:	https://reviews.freebsd.org/D4085
2015-11-06 11:17:23 +00:00
Andrey V. Elsukov
5dc5a0e0aa Implement ipfw internal olist command to list named objects.
Reviewed by:	melifaro
Obtained from:	Yandex LLC
Sponsored by:	Yandex LLC
2015-11-03 10:21:53 +00:00
Kristof Provost
3e768368d0 pfctl: Fix uninitialised veriable
In pfctl_set_debug() we used 'level' without ever initialising it.
We correctly parsed the option, but them failed to actually assign the parsed
value to 'level' before performing to ioctl() to configure the debug level.

PR:		202996
Submitted by:	Andrej Kolontai
2015-11-01 17:20:17 +00:00
Bryan Drewery
7d8f797b72 Use more appropriate ${SHAREDIR} rather than /usr/share.
MFC after:	2 weeks
Sponsored by:	EMC / Isilon Storage Division
2015-10-27 23:35:02 +00:00
Enji Cooper
ea36ade1d1 Limit RESOLUTION_MAX to INT_MAX, not UINT_MAX (all spelled out) so the
mode value isn't always clipped to -1 when (resolution * size) == 32, which
would have been the case with values => {4i,32b,32t}.

This seems to have been broken in r64382.

MFC after: 1 week
X-MFC with: r289915
PR: 200619
Reported by: Michael Baptist
Submitted by: Lars Skodje
Sponsored by: EMC / Isilon Storage Division
2015-10-25 04:37:00 +00:00
Alan Somers
6123d3f697 Fix various Coverity issues in sbin/savecore/savecore.c:
CID1009429: Fix unchecked return value from lseek while clearing dump
CID1007781: Fix file descriptor leak in DoFile
CID1007261: Don't send potentially unterminated string to syslog(3)

Coverity CID:	1009429
Coverity CID:	1007781
Coverity CID:	1007261
MFC after:	2 weeks
Sponsored by:	Spectra Logic
Differential Revision:	https://reviews.freebsd.org/D3991
2015-10-23 19:28:24 +00:00
Conrad Meyer
ec9f6de7d2 sysctl(8): Fix style nits
Suggested by:	bde
Sponsored by:	EMC / Isilon Storage Division
2015-10-23 15:40:44 +00:00
Conrad Meyer
c3220d0b6d Sysctl: Add common support for U8, U16 types
Sponsored by:	EMC / Isilon Storage Division
2015-10-22 23:03:06 +00:00
Eitan Adler
463a577b27 Fix a ton of speelling errors
arc lint is helpful

Reviewed By: allanjude, wblock, #manpages, chris@bsdjunk.com
Differential Revision: https://reviews.freebsd.org/D3337
2015-10-21 05:37:09 +00:00
Ed Maste
160309f2c2 newfs_msdos: use NetBSD's mkfs_msdos.h verbatim for makefs compatibility
Sponsored by:	The FreeBSD Foundation
2015-10-20 13:32:09 +00:00
Enji Cooper
550d2b80ec Make libxo depend on libutil because it uses humanize_number after r287111
Remove overlinking in lib/libxo/tests, sbin/savecore, and
usr.bin/{iscsictl,wc,xo}

PR: 203673
Sponsored by: EMC / Isilon Storage Division
2015-10-18 07:30:50 +00:00
Enji Cooper
3f18b7fa12 Replace /dev/acd0 with /dev/cd1
atapicd(4) has been removed since r249083, and if a system has more than one
optical drive, it will likely be /dev/cd1

Update mount.conf(8) to reflect the change in behavior

MFC after: never
Sponsored by: EMC / Isilon Storage Division
2015-10-17 08:51:10 +00:00
Ed Maste
59faa1e9fb newfs_msdos: prefer snprintf to sprintf
Obtained from:	NetBSD
Sponsored by:	The FreeBSD Foundation
2015-10-16 15:19:36 +00:00
Ed Maste
041b03daab newfs_msdos: move mkfs_msdos to separate file for later use in makefs
Sponsored by:	The FreeBSD Foundation
2015-10-15 19:00:33 +00:00
Ed Maste
4d45a6738a newfs_msdos: rework option parsing to match NetBSD
NetBSD split newfs_msdos in two so that they can reuse the file system
creation part in makefs. This change is a step on the path of bringing
that support to FreeBSD.

Reviewed by:	kib, pfg
Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D3905
2015-10-15 16:19:00 +00:00
Enji Cooper
0b0d825ad8 Replace references to /dev/acd0 with /dev/cd0
atapicd(4) was replaced by cd(4) with the atacam work done by
mav@ and then removed in r249083

X-MFC to: stable/10
MFC after: 2 weeks
2015-10-13 17:14:27 +00:00
Adrian Chadd
4052b8bc34 casperd: bump default socket queue length to SOMAXCONN; make length configurable.
The current default listen queue for casperd is too small (8) and
hard-coded.

This patch increases the default to SOMAXCONN, and introduces a command
line flag that can used to further increase or decrease the queue length.

PR:		bin/202147
Submitted by:	<lidl@pix.net>
2015-10-13 02:34:41 +00:00
Enji Cooper
b2d48be1bc Refactor the test/ Makefiles after recent changes to bsd.test.mk (r289158) and
netbsd-tests.test.mk (r289151)

- Eliminate explicit OBJTOP/SRCTOP setting
- Convert all ad hoc NetBSD test integration over to netbsd-tests.test.mk
- Remove unnecessary TESTSDIR setting
- Use SRCTOP where possible for clarity

MFC after: 2 weeks
Sponsored by: EMC / Isilon Storage Divison
2015-10-12 08:16:03 +00:00
Alexander Motin
4a3760bae6 Remove compatibility shims for legacy ATA device names.
We got new ATA stack in FreeBSD 8.x, switched to it at 9.x, completely
removed old stack at 10.x, so at 11.x it is time to remove compat shims.
2015-10-11 13:01:51 +00:00
Edward Tomasz Napierala
d5b0fb47eb Add 'p' postfix to mdconfig(8).
MFC after:	1 month
Sponsored by:	The FreeBSD Foundation
2015-10-10 09:37:31 +00:00
Edward Tomasz Napierala
45d7de1d37 Make geom_nop(4) collect statistics on all types of BIOs, not just
reads and writes.

PR:		kern/198405
Submitted by:	Matthew D. Fuller <fullermd at over-yonder dot net>
MFC after:	1 month
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D3679
2015-10-10 09:03:31 +00:00
Baptiste Daroussin
e1619d123e Only print the errno string in case sysctl(3) does not file with ENOENT
This reduces the noise in error reporing from sysctl(8):

Before:
$ sysctl bla=something
sysctl: unknown oid 'bla': No such file or directory

After:
$ sysctl bla=something
sysctl: unknown oid 'bla'

MFC after:	1 week
Sponsored by:	Gandi.net
2015-10-07 09:28:54 +00:00
Baptiste Daroussin
ca587fdaac Trim spaces at the end of the buffer before trying to convert it to an oid
This allows to write entries in sysctl.conf with spaces before the '=' like
kern.ipc.shmmax = 9663676416

MFC after:	1 week
Sponsored by:	Gandi.net
2015-10-07 08:56:01 +00:00
Xin LI
56160b2e67 Now that we own the code, use arc4random(3) unconditionally
and remove the corresponding HAVE_ARC4RANDOM conditions.

MFC after:	2 weeks
2015-10-06 23:42:58 +00:00
Andrey V. Elsukov
56afe65ca9 Fix possible segmentation fault.
PR:		203494
MFC after:	1 week
2015-10-03 03:12:57 +00:00
Bryan Drewery
10b83bb0e9 META_MODE: For some reason meta mode cannot generate the intermediate tab.c
files.  Split up all of the targets to be more clear on how they are generated
to fix the problem.

MFC after:	2 weeks
Sponsored by:	EMC / Isilon Storage Division
2015-10-02 07:00:43 +00:00
Colin Percival
2eb0015ab7 Disable suspend when we're shutting down. This solves the "tell FreeBSD
to shut down; close laptop lid" scenario which otherwise tended to end
with a laptop overheating or the battery dying.

The implementation uses a new sysctl, kern.suspend_blocked; init(8) sets
this while rc.suspend runs, and the ACPI sleep code ignores requests while
the sysctl is set.

Discussed on:	freebsd-acpi (35 emails)
MFC after:	1 week
2015-10-01 10:52:26 +00:00
Enji Cooper
abd7105060 Replace N #defines with nitems to simplify ifconfig code slightly
MFC after: 1 week
2015-09-27 07:51:18 +00:00
Bryan Drewery
6a8077f3d5 Add SUBDIR_PARALLEL.
MFC after:	2 weeks
Sponsored by:	EMC / Isilon Storage Division
2015-09-26 01:28:50 +00:00
Bryan Drewery
a98533d3e8 Remove disconnected directories.
These were added disconnected in 2005 in r145524.

Sponsored by:	EMC / Isilon Storage Division
2015-09-26 01:24:35 +00:00
Bryan Drewery
ec766071e3 META_MODE: Remove DEP_MACHINE from Makefile.depend files.
This has not been needed since r246865 in projects/bmake.

Sponsored by:	EMC / Isilon Storage Division
2015-09-25 19:44:01 +00:00
Bryan Drewery
54c7d75a06 META_MODE: Remove DEP_RELDIR from Makefile.depend files.
This has not been needed since r284171 in projects/bmake.

Sponsored by:	EMC / Isilon Storage Division
2015-09-25 19:26:08 +00:00
Poul-Henning Kamp
ef02f85c38 Fix two cases where "const" were washed off pointers with strchr(3) 2015-09-25 07:37:00 +00:00
Ryan Stone
60d978a75b Fix /sbin/route to never look up (invalid) interface names through DNS
/sbin/route has a bug where if it is passed an interface name that does
not exist, it falls through and winds up interpreting it as a hostname.
It fails out eventually, but on a system where DNS lookup is broken you
can end up waiting for up to 60 seconds waiting for the DNS lookup to
timeout.  I'm not quite sure what happens if the DNS lookup somehow
succeeds but I doubt that can end well.

Reviewed by:	markj, cem
MFC after:	2 weeks
Sponsored by:	EMC/Isilon Storage Division
2015-09-17 16:56:49 +00:00
Bryan Drewery
42c4cf86d4 Update META_MODE dependencies. 2015-09-17 05:06:34 +00:00
Allan Jude
cc59771c4a Make ifconfig always exit with an error code if an important ioctl fails
PR:		203062
Arm Twisting by:	Kristof Provost
Reviewed by:	kp
Approved by:	bapt (mentor)
MFC after:	2 weeks
Relnotes:	yes
Sponsored by:	ScaleEngine Inc.
Sponsored by:	vBSDCon
Differential Revision:	https://reviews.freebsd.org/D3644
2015-09-16 03:03:19 +00:00
Edward Tomasz Napierala
bb27d7ed90 Add a way to specify stripesize and stripeoffset to gnop(8). This makes
it possible to "simulate" 4K media, to eg test alignment handling.

Reviewed by:	mav@
MFC after:	1 month
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D3664
2015-09-15 18:01:59 +00:00
Hiroki Sato
f74237f5b6 - Remove #ifdef HAVE_POLL_H.
- Use nitems().

MFC after:	3 days
2015-09-10 06:40:28 +00:00
Hiroki Sato
b1c250ff3f - Remove GIF_{SEND,ACCEPT}_REVETHIP.
- Simplify EADDRNOTAVAIL and EAFNOSUPPORT conditions.

MFC after:	3 days
2015-09-10 05:59:39 +00:00
Edward Tomasz Napierala
2f221c70f9 The dumpfs(8) utility doesn't actually use disktab(5); remove it
from "SEE ALSO".

MFC after:	1 month
Sponsored by:	The FreeBSD Foundation
2015-09-03 11:40:47 +00:00
Edward Tomasz Napierala
74ecd2c0da Fix markup.
MFC after:	1 month
Sponsored by:	The FreeBSD Foundation
2015-09-02 14:10:09 +00:00
Edward Tomasz Napierala
b8c19fd719 It's 2015, and some people are still trying to use fdisk and then
go asking what debug flags to set for GEOM to make it work.  Advice
them to use gpart(8) instead.

Something similar should probably done with disklabel,
but I need to rewrite the disklabel examples first.

Reviewed by:	wblock@
MFC after:	1 month
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D3315
2015-09-02 14:08:43 +00:00
Kristof Provost
64b3b4d611 pf: Remove support for 'scrub fragment crop|drop-ovl'
The crop/drop-ovl fragment scrub modes are not very useful and likely to confuse
users into making poor choices.
It's also a fairly large amount of complex code, so just remove the support
altogether.

Users who have 'scrub fragment crop|drop-ovl' in their pf configuration will be
implicitly converted to 'scrub fragment reassemble'.

Reviewed by:	gnn, eri
Relnotes:	yes
Differential Revision:	https://reviews.freebsd.org/D3466
2015-08-27 21:27:47 +00:00
Marcelo Araujo
9ae278b077 Code cleanup unused-but-set-variable spotted by gcc.
Approved by:	bapt (mentor)
Differential Revision:	D3475
2015-08-25 15:33:09 +00:00
Marcelo Araujo
b7684f4b85 Code cleanup unused-but-set-variable spotted by gcc.
Reviewed by:	melifaro
Approved by:	bapt (mentor)
Differential Revision:	D3473
2015-08-25 15:32:08 +00:00
Marcel Moolenaar
d1a0d267b7 Upgrade libxo to 0.4.5.
Local changes incorporated by 0.4.5: r284340
Local changes retained: r276260, r282117

Obtained from:	https://github.com/Juniper/libxo
2015-08-24 16:26:20 +00:00
Luiz Otavio O Souza
0a70aaf8f5 Add ALTQ(9) support for the CoDel algorithm.
CoDel is a parameterless queue discipline that handles variable bandwidth
and RTT.

It can be used as the single queue discipline on an interface or as a sub
discipline of existing queue disciplines such as PRIQ, CBQ, HFSC, FAIRQ.

Differential Revision:	https://reviews.freebsd.org/D3272
Reviewd by:	rpaulo, gnn (previous version)
Obtained from:	pfSense
Sponsored by:	Rubicon Communications (Netgate)
2015-08-21 22:02:22 +00:00
Kenneth D. Merry
0e358df062 Revamp camcontrol(8) fwdownload support and add the opcodes subcommand.
The significant changes and bugs fixed here are:

1. Fixed a bug in the progress display code:

   When the user's filename is too big, or his terminal width is too
   small, the progress code could wind up using a negative number for
   the length of the "stars" that it uses to indicate progress.

   This negative value was assigned to an unsigned variable, resulting
   in a very large positive value.

   The result is that we wound up writing garbage from memory to the
   user's terminal.

   With an 80 column terminal, a file name length of more than 35
   characters would generate this problem.

   To address this, we now set a minimum progress bar length, and
   truncate the user's file name as needed.

   This has been tested with large filenames and small terminals, and
   at least produces reasonable results.  If the terminal is too
   narrow, the progress display takes up an additional line with each
   update, but this is more user friendly than writing garbage to the
   tty.

2. SATA drives connected via a SATA controller didn't have SCSI Inquiry
   data populated in struct cam_device.  This meant that the code in
   fw_get_vendor() in fwdownload.c would try to match a zero-length
   vendor ID, and so return the first entry in the vendor table.  (Which
   used to be HITACHI.)  Fixed by grabbing identify data, passing the
   identify buffer into fw_get_vendor(), and matching against the model
   name.

3. SATA drives connected via a SAS controller do have Inquiry data
   populated.  The table included a couple of entries -- "ATA ST" and
   "ATA HDS", intended to handle Seagate and Hitachi SATA drives attached
   via a SAS controller.  SCSI to ATA translation layers use a vendor
   ID of "ATA" (which is standard), and then the model name from the ATA
   identify data as the SCSI product name when they are returning data on
   SATA disks.  The cam_strmatch code will match the first part of the
   string (because the length it is given is the length of the vendor,
   "ATA"), and return 0 (i.e. a match).  So all SATA drives attached to
   a SAS controller would be programmed using the Seagate method
   (WRITE BUFFER mode 7) of SCSI firmware downloading.

4. Issue #2 above covered up a bug in fw_download_img() -- if the
   maximum packet size in the vendor table was 0, it tried to default
   to a packet size of 32K.  But then it didn't actually succeed in
   doing that, because it set the packet size to the value that was
   in the vendor table (0).  Now that we actually have ATA attached
   drives fall use the VENDOR_ATA case, we need a reasonable default
   packet size.  So this is fixed to properly set the default packet size.

5. Add support for downloading firmware to IBM LTO drives, and add a
   firmware file validation method to make sure that the firmware
   file matches the drive type.  IBM tape drives include a Load ID and
   RU name in their vendor-specific VPD page 0x3.  Those should match
   the IDs in the header of the firmware file to insure that the
   proper firmware file is loaded.

6. This also adds a new -q option to the camcontrol fwdownload
   subcommand to suppress informational output.  When -q is used in
   combination with -y, the firmware upgrade will happen without
   prompting and without output except if an error condition occurs.

7. Re-add support for printing out SCSI inquiry information when
   asking the user to confirm that they want to download firmware, and
   add printing of ATA Identify data if it is a SATA disk.  This was
   removed in r237281 when support for flashing ATA disks was added.

8. Add a new camcontrol(8) "opcodes" subcommand, and use the
   underlying code to get recommended timeout values for drive
   firmware downloads.

   Many SCSI devices support the REPORT SUPPORTED OPERATION CODES
   command, and some support the optional timeout descriptor that
   specifies nominal and recommended timeouts for the commands
   supported by the device.

   The new camcontrol opcodes subcommand allows displaying all
   opcodes supported by a drive, information about which fields
   in a SCSI CDB are actually used by a given SCSI device, and the
   nominal and recommended timeout values for each command.

   Since firmware downloads can take a long time in some devices, and
   the time varies greatly between different types of devices, take
   advantage of the infrastructure used by the camcontrol opcodes
   subcommand to determine the best timeout to use for the WRITE
   BUFFER command in SCSI device firmware downloads.

   If the device recommends a timeout, it is likely to be more
   accurate than the default 50 second timeout used by the firmware
   download code.  If the user specifies a timeout, it will override
   the default or device recommended timeout.  If the device doesn't
   support timeout descriptors, we fall back to the default.

9. Instead of downloading firmware to SATA drives behind a SAS controller
   using WRITE BUFFER, use the SCSI ATA PASS-THROUGH command to compose
   an ATA DOWNLOAD MICROCODE command and it to the drive.  The previous
   version of this code attempted to send a SCSI WRITE BUFFER command to
   SATA drives behind a SAS controller.  Although that is part of the
   SAT-3 spec, it doesn't work with the parameters used with LSI
   controllers at least.

10.Add a new mechanism for making common ATA passthrough and
   ATA-behind-SCSI passthrough commands.

   The existing camcontrol(8) ATA command mechanism checks the device
   type on every command executed.  That works fine for individual
   commands, but is cumbersome for things like a firmware download
   that send a number of commands.

   The fwdownload code detects the device type up front, and then
   sends the appropriate commands.

11.In simulation mode (-s), if the user specifies the -v flag, print out
   the SCSI CDB or ATA registers that would be sent to the drive.  This will
   aid in debugging any firmware download issues.

sbin/camcontrol/fwdownload.c:
	Add a device type to the fw_vendor structure, so that we can
	specify different download methods for different devices from the
	same vendor.  In this case, IBM hard drives (from when they
	still made hard drives) and tape drives.

	Add a tur_status field to the fw_vendor structure so that we can
	specify whether the drive to be upgraded should be ready, not
	ready, or whether it doesn't matter.  Add the corresponding
	capability in fw_download_img().

	Add comments describing each of the vendor table fields.

	Add HGST and SmrtStor to the supported SCSI vendors list.

	In fw_get_vendor(), look at ATA identify data if we have a SATA
	device to try to identify what the drive vendor is.

	Add IBM firmware file validation.  This gets VPD page 0x3, and
	compares the Load ID and RU name in the page to the values
	included in the header.  The validation code will refuse to load
	a firmware file if the values don't match.  This does allow the
	user to attempt a downgrade; whether or not it succeeds will
	likely depend on the drive settings.

	Add a -q option, and disable all informative output
	(progress bars, etc.) when this is enabled.

	Re-add the inquiry in the confirmation dialog so the user has
	a better idea of which device he is talking to.  Add support for
	displaying ATA identify data.

	Don't automatically disable confirmation in simulation (-s) mode.
	This allows the user to see the inquiry or identify data in the
	dialog, and see exactly what they would see when the command
	actually runs.  Also, in simulation mode, if the user specifies
	the -v flag, print out the SCSI CDB or ATA registers that would
	be sent to the drive.  This will aid in debugging any firmware
	download issues.

	Add a timeout field and timeout type to the firmware download
	vendor table.  This allows specifying a default timeout and allows
	specifying whether we should attempt to probe for a recommended
	timeout from the drive.

	Add a new fuction, fw_get_timeout(), that will determine
	which timeout to use for the WRITE BUFFER command.  If the
	user specifies a timeout, we always use that.  Otherwise,
	we will use the drive recommended timeout, if available,
	and fall back to the default when a drive recommended
	timeout isn't available.

	When we prompt the user, tell him what timeout we're going
	to use, and the source of the timeout.

	Revamp the way SATA devices are handled.

	In fwdownload(), use the new get_device_type() function to
	determine what kind of device we're talking to.

	Allow firmware downloads to any SATA device, but restrict
	SCSI downloads to known devices.  (The latter is not a
	change in behavior.)

	Break out the "ready" check from fw_download_img() into a
	new subfunction, fw_check_device_ready().  This sends the
	appropriate command to the device in question -- a TEST
	UNIT READY or an IDENTIFY.  The IDENTIFY for SATA devices
 	a SAT layer is done using the SCSI ATA PASS-THROUGH
	command.

	Use the new build_ata_cmd() function to build either a SCSI or
	ATA I/O CCB to issue the DOWNLOAD MICROCODE command to SATA
	devices.  build_ata_cmd() figures looks at the devtype argument
	and fills in the correct CCB type and CDB or ATA registers.

	Revamp the vendor table to remove the previous
	vendor-specific ATA entries and use a generic ATA vendor
	placeholder.  We currently use the same method for all ATA
	drives, although we may have to add vendor-specific
	behavior once we test this with more drives.

sbin/camcontrol/progress.c:
	In progress_draw(), make barlength a signed value so that
	we can easily detect a negative value.

	If barlength (the length of the progress bar) would wind up
	negative due to a small TTY width or a large filename,
	set the bar length to the new minimum (10 stars) and
	truncate the user's filename.  We will truncate it down to
	0 characters if necessary.

	Calculate a new prefix_len variable (user's filename length)
	and use it as the precision when printing the filename.

sbin/camcontrol/camcontrol.c:
	Implement a new camcontrol(8) subcommand, "opcodes".  The
	opcodes subcommand allows displaying the entire list of
	SCSI commands supported by a device, or details on an
	individual command.  In either case, it can display
	nominal and recommended timeout values.

	Add the scsiopcodes() function, which calls the new
	scsigetopcodes() function to fetch opcode data from a
	drive.

	Add two new functions, scsiprintoneopcode() and
	scsiprintopcodes(), which print information about one
	opcode or all opcodes, respectively.

	Remove the get_disk_type() function.  It is no longer used.

	Add a new function, dev_has_vpd_page(), that fetches the
	supported INQUIRY VPD list from a device and tells the
	caller whether the requested VPD page is available.

	Add a new function, get_device_type(), that returns a more
	precise device type than the old get_disk_type() function.
	The get_disk_type() function only distinguished between
	SCSI and ATA devices, and SATA devices behind a SCSI to ATA
	translation layer were considered to be "SCSI".

	get_device_type() offers a third type, CC_DT_ATA_BEHIND_SCSI.
	We need to know this to know whether to attempt to send ATA
	passthrough commands.  If the device has the ATA
	Information VPD page (0x89), then it is an ATA device
	behind a SCSI to ATA translation layer.

	Remove the type argument from the fwdownload() subcommand.

	Add a new function, build_ata_cmd(), that will take one set
	of common arguments and build either a SCSI or ATA I/O CCB,
	depending on the device type passed in.

sbin/camcontrol/camcontrol.h:
	Add a prototype for scsigetopcodes().

	Add a new enumeration, camcontrol_devtype.

	Add prototypes for dev_has_vpd_page(), get_device_type()
	and build_ata_cmd().

	Remove the type argument from the fwdownload() subcommand.

sbin/camcontrol/camcontrol.8
	Explain that the fwdownload subcommand will use the drive
	recommended timeout if available, and that the user can
	override the timeout.

	Document the new opcodes subcommand.

	Explain that we will attempt to download firmware to any
	SATA device.

	Document supported SCSI vendors, and models tested if known.

	Explain the commands used to download firmware for the
	three different drive and controller combinations.

	Document that the -v flag in simulation mode for the fwdownload
	subcommand will print out the SCSI CDBs or ATA registers that would
	be used.

sys/cam/scsi/scsi_all.h:
	Add new bit definitions for the one opcode descriptor for
	the REPORT SUPPORTED OPCODES command.

	Add a function prototype for scsi_report_supported_opcodes().

sys/cam/scsi/scsi_all.c:
	Add a new CDB building function, scsi_report_supported_opcodes().

Sponsored by:	Spectra Logic
MFC after:	1 week
2015-08-20 16:07:51 +00:00
Xin LI
1ae1bd497f Use arc4random_buf(). While there, unifdef the code for HAVE_ARC4RANDOM.
MFC after:	2 weeks
2015-08-16 23:23:58 +00:00
Dimitry Andric
dbe90f04b4 In ipfw2, avoid left-shifting negative integers, which is undefined.
While here, make some other arguments to htonl(3) unsigned too.

MFC after:	3 days
2015-08-12 21:07:57 +00:00
Hiren Panchasara
0e02b43a07 Make LAG LACP fast timeout tunable through IOCTL.
Differential Revision:	D3300
Submitted by:		LN Sundararajan <lakshmi.n at msystechnologies>
Reviewed by:		wblock, smh, gnn, hiren, rpokala at panasas
MFC after:		2 weeks
Sponsored by:		Panasas
2015-08-12 20:21:04 +00:00
Christian Brueffer
99d43aee11 Fix a few mandoc warnings.
MFC after:	1 week
2015-08-12 10:34:05 +00:00
Mark Felder
f5846f166c sbin/ipfw fix typo: info -> into
example:

DEPRECATED: inserting data into non-existent table sshguard. (auto-created)

Approved by:	bdrewery
2015-08-10 22:02:01 +00:00
Pawel Jakub Dawidek
445bda3f4f Allow to disable BIO_DELETE passthru in fstab for swap-on-geli devices by
passing 'notrim' option.

PR:		198863
Submitted by:	Matthew D. Fuller fullermd at over-yonder dot net
2015-08-08 09:57:38 +00:00
Pawel Jakub Dawidek
46e3447026 Enable BIO_DELETE passthru in GELI, so TRIM/UNMAP can work as expected when
GELI is used on a SSD or inside virtual machine, so that guest can tell
host that it is no longer using some of the storage.

Enabling BIO_DELETE passthru comes with a small security consequence - an
attacker can tell how much space is being really used on encrypted device and
has less data no analyse then. This is why the -T option can be given to the
init subcommand to turn off this behaviour and -t/T options for the configure
subcommand can be used to adjust this setting later.

PR:		198863
Submitted by:	Matthew D. Fuller fullermd at over-yonder dot net

This commit also includes a fix from Fabian Keil freebsd-listen at
fabiankeil.de for 'configure' on onetime providers which is not strictly
related, but is entangled in the same code, so would cause conflicts if
separated out.
2015-08-08 09:51:38 +00:00
Edward Tomasz Napierala
3bb6078985 Whoops, wrong flag.
MFC after:	1 month
Sponsored by:	The FreeBSD Foundation
2015-08-06 07:49:34 +00:00
Edward Tomasz Napierala
6be30a3001 Tweak mdconfig(8) manual page, in particular revise the EXAMPLES
section.  This removes stuff that doesn't really belong there,
and simplifies examples for the basic operations.

Reviewed by:	wblock@
MFC after:	1 month
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D3198
2015-08-06 07:47:13 +00:00
Xin LI
b07d93f538 Fix a bug which could make routed(8) daemon exit by sending a special RIP
query from a remote machine, similar to SA-14:21.routed.

Submitted by:	hrs
2015-08-05 22:04:56 +00:00
Alexander V. Chernikov
0b501d960c Fix ipfw range deletion.
Spotted by:	ian,julian
2015-08-03 14:31:06 +00:00
George V. Neville-Neil
afd010c196 Add support for keys that include 4 byte SALT values,
including GCM and ICM/CTR modes for AES.

Reviewed by:	jmg
MFC after:	1 week
Sponsored by:	Rubicon Communications (Netgate)
2015-07-31 23:40:18 +00:00
George V. Neville-Neil
2deb37542b Summary: Remove unsupported 3des-deriv encryption algorithm from documentation. 2015-07-31 17:41:53 +00:00
Warner Losh
aa255ef6dd Teach sysctl about the new optional suffix after IK to specify
precision. Update input as well. Add IK to the manual (it was missing
completely).

Differential Revision: https://reviews.freebsd.org/D3181
2015-07-29 02:34:25 +00:00
Edward Tomasz Napierala
ef159a1b45 Add missing SIGUSR1 description.
MFC after:	2 weeks
Sponsored by:	The FreeBSD Foundation
2015-07-24 18:14:57 +00:00
Conrad Meyer
773e56519d mount_nfs: Be more clear on nmount(2) error with errmsg unset
Differential Revision:	https://reviews.freebsd.org/D3147
Reviewed by:	rmacklem
Approved by:	markj (mentor)
MFC after:	2 weeks
Sponsored by:	EMC / Isilon Storage Division
2015-07-22 22:53:40 +00:00
Jim Harris
628683cb81 nvmecontrol: read controller identify data before any log page operations
MFC after:	3 days
Sponsored by:	Intel
2015-07-22 16:10:29 +00:00
Andrey V. Elsukov
109f7a27c4 lseek() allows an offset to be set beyond the end of file. Using
it to check that partition has enough space to write bootcode doesn't
work. Use the known size of provider instead.

PR:		201504
MFC after:	1 week
2015-07-21 06:18:42 +00:00
George V. Neville-Neil
a413464757 Only report the lack of ALTQ support if pfctl is using verbose (-v) mode.
PR:		194935
Submitted by:	Jim Thompson
MFC after:	2 weeks
2015-07-20 23:24:25 +00:00
Edward Tomasz Napierala
4a2a044965 Document suspend/resume notification in devd.conf(5).
MFC after:	2 weeks
Sponsored by:	The FreeBSD Foundation
2015-07-18 12:24:54 +00:00
Edward Tomasz Napierala
cdff99588e Add CARP events description to devd.conf(5).
MFC after:	2 weeks
Sponsored by:	The FreeBSD Foundation
2015-07-18 12:17:59 +00:00
Marcelo Araujo
c283159997 Fix contraction spotted by igor(1) and remove 2 .Ed spotted by mandoc(1).
Also, don't capitalize "module" and remove a redundant phrase introduced
in my previous commit.

Differential Revision:	D3112
Reviewed by:		wblock
Sponsored by:		gandi.net
2015-07-18 03:14:49 +00:00
Marcelo Araujo
a8d65cade5 Describe how to load gmultipath at boot time.
Differential Revision:	D3112
Reviewed by:		allanjude, bapt
Sponsored by:		gandi.net
2015-07-17 06:34:46 +00:00
John-Mark Gurney
57198f08d3 fix the docs, the number of frags per inode (NFPI) changed in r228794
to 2 from 4, but the man page didn't get updated...

other minor changes to make igor happy...

MFC after:	3 days
2015-07-15 21:35:09 +00:00
Allan Jude
ce808c7ad8 Add a new option to gpart(8) to fix Lenovo BIOS boot issue
PR:		184910
Reviewed by:	ae, wblock
Approved by:	marcel
MFC after:	3 days
Relnotes:	yes
Sponsored by:	ScaleEngine Inc.
Differential Revision:	https://reviews.freebsd.org/D3065
2015-07-15 02:23:55 +00:00
Christian Brueffer
b29fdbd8ea Cleanup; mostly language with a little bit of mdoc style.
MFC after:	1 week
2015-07-14 14:01:33 +00:00
Christian Brueffer
74a2f2e85c Unbreak ggatec and ggatel on i386 after r238119, which added two more
'struct g_gate_ctl_create' fields.

While the behaviour was technically undefined on other architectures
as well, on the reporter's amd64 systems the uninitialized bytes the
kernel cares about were always zero so everything worked as expected.

PR:		197309, 199559
Submitted by:	ota@j.email.ne.jp, Fabian Keil
Reviewed by:	pjd
MFC after:	1 week
2015-07-14 10:49:36 +00:00
Christian Brueffer
b4a355e2f3 If ggated's exports_find() fails, the connection is removed before
(trying to) report the problem to the client.

sendfail() is called with an already closed socket and thus it
fails to inform the client about the problem.

Fix this by calling sendfail() before connection_remove().

PR:		195944
Submitted by:	Fabian Keil
Reviewed by:	pjd
MFC after:	1 week
2015-07-14 09:25:10 +00:00
Rick Macklem
c088e62e34 Since the case where secflavor < 0 indicates the security flavor is
to be negotiated, it could be a Kerberized mount. As such, filling
in the "principal" argument using the canonized host name makes sense.
If it is negotiated as AUTH_SYS, the "principal" argument is meaningless
but harmless.

Requested by:	masato@itc.naist.jp
Tested by:	masato@itc.naist.jp
PR:		201073
MFC after:	1 month
2015-07-07 23:41:25 +00:00
Marcelo Araujo
a6c4189636 Remove unused variable flags reported by clang. The function zygote_clone()
always receive the flags with value 0 and this flags is never checked on
zygote_main().

Differential Revision:	D2689
Reviewed by:		rodrigc, oshogbo
2015-07-04 17:38:56 +00:00
George V. Neville-Neil
7c160e33d7 Update the date on the manual page.
Noticed by: bz
2015-07-03 20:42:31 +00:00
George V. Neville-Neil
987de84445 New AES modes for IPSec, user space components.
Update setkey and libipsec to understand aes-gcm-16 as an
encryption method.

A partial commit of the work in review D2936.

Submitted by:	eri
Reviewed by:	jmg
MFC after:	2 weeks
Sponsored by:	Rubicon Communications (Netgate)
2015-07-03 20:09:14 +00:00
Mariusz Zaborski
c36e54bb32 Let the nv.h and dnv.h includes be only in sys directory.
Change consumers to include those files from sys.
Add duplicated files to ObsoleteFiles.

Approved by:	pjd (mentor)
2015-07-02 21:58:10 +00:00
Christian Brueffer
fa6e0e5334 Add -b to the devlist usage info, forgotten in r260059.
PR:		195094
Submitted by:	robin.hahling@gw-computing.net
MFC after:	1 week
2015-07-02 13:57:26 +00:00
Christian Brueffer
faf2d8305c Fix an obviously wrong boolean operator.
PR:		200983
Submitted by:	David Bindeman
MFC after:	1 week
2015-07-02 12:14:48 +00:00
Pawel Jakub Dawidek
edaa9008ff Allow to omit keyfile number for the first keyfile. 2015-07-02 10:55:32 +00:00
George V. Neville-Neil
54bf2ef806 Fix support for the null encryption algorithm which now requires
a key.

Sponsored by: Rubicon Communications (Netgate)
2015-06-25 18:38:58 +00:00
Ermal Luçi
a5b789f65a ALTQ FAIRQ discipline import from DragonFLY
Differential Revision:  https://reviews.freebsd.org/D2847
Reviewed by:    glebius, wblock(manpage)
Approved by:    gnn(mentor)
Obtained from:  pfSense
Sponsored by:   Netgate
2015-06-24 19:16:41 +00:00
Rick Macklem
1e68ee21e0 Document that a forced dismount of an NFSv3 mount when the
NLM (rpc.lockd) is running can crash the system.
Unfortunately this is not easy to fix, but I have left
PR#200585 open.

PR:		200585
MFC after:	3 days
2015-06-17 23:24:46 +00:00
Simon J. Gerraty
2ef6d5a7b9 new depends 2015-06-16 23:37:19 +00:00
Baptiste Daroussin
18b2ee82db Revert r284417 it is not necessary anymore 2015-06-15 19:28:07 +00:00
Baptiste Daroussin
4232f82668 Enforce overwritting SHLIBDIR
Since METAMODE has been added, sys.mk loads bsd.mkopt.mk which ends load loading
bsd.own.mk which then defines SHLIBDIR before all the Makefile.inc everywhere.

This makes /lib being populated again.

Reported by:	many
2015-06-15 15:34:20 +00:00
Simon J. Gerraty
ccfb965433 Add META_MODE support.
Off by default, build behaves normally.
WITH_META_MODE we get auto objdir creation, the ability to
start build from anywhere in the tree.

Still need to add real targets under targets/ to build packages.

Differential Revision:       D2796
Reviewed by: brooks imp
2015-06-13 19:20:56 +00:00
Christian Brueffer
0031bf7501 Add a missing word, should have been in r284290.
Submitted by:	Fabian Keil
2015-06-12 15:03:59 +00:00
Christian Brueffer
7ff1ea8bdd Improve grammar.
PR:		200673
Submitted by:	Fabian Keil
Obtained from:	ElectroBSD
2015-06-11 23:05:49 +00:00
Christian Brueffer
c06d629a24 Consistently use trailing whitespace in passphrase prompts.
PR:		193496
Submitted by:	Fabian Keil
MFC after:	1 week
2015-06-11 00:24:33 +00:00
Simon J. Gerraty
8bbb3bbab5 Revert unneeded change 2015-06-10 13:57:11 +00:00
Kenneth D. Merry
5672fac935 Add support for reading MAM attributes to camcontrol(8) and libcam(3).
MAM is Medium Auxiliary Memory and is most commonly found as flash
chips on tapes.

This includes support for reading attributes and decoding most
known attributes, but does not yet include support for writing
attributes or reporting attributes in XML format.

libsbuf/Makefile:
	Add subr_prf.c for the new sbuf_hexdump() function.  This
	function is essentially the same function.

libsbuf/Symbol.map:
	Add a new shared library minor version, and include the
	sbuf_hexdump() function.

libsbuf/Version.def:
	Add version 1.4 of the libsbuf library.

libutil/hexdump.3:
	Document sbuf_hexdump() alongside hexdump(3), since it is
	essentially the same function.

camcontrol/Makefile:
	Add attrib.c.

camcontrol/attrib.c:
	Implementation of READ ATTRIBUTE support for camcontrol(8).

camcontrol/camcontrol.8:
	Document the new 'camcontrol attrib' subcommand.

camcontrol/camcontrol.c:
	Add the new 'camcontrol attrib' subcommand.

camcontrol/camcontrol.h:
	Add a function prototype for scsiattrib().

share/man/man9/sbuf.9:
	Document the existence of sbuf_hexdump() and point users to
	the hexdump(3) man page for more details.

sys/cam/scsi/scsi_all.c:
	Add a table of known attributes, text descriptions and
	handler functions.

	Add a new scsi_attrib_sbuf() function along with a number
	of other related functions that help decode attributes.

	scsi_attrib_ascii_sbuf() decodes ASCII format attributes.

	scsi_attrib_int_sbuf() decodes binary format attributes, and
	will pass them off to scsi_attrib_hexdump_sbuf() if they're
	bigger than 8 bytes.

	scsi_attrib_vendser_sbuf() decodes the vendor and drive
	serial number attribute.

	scsi_attrib_volcoh_sbuf() decodes the Volume Coherency
	Information attribute that LTFS writes out.

sys/cam/scsi/scsi_all.h:
	Add a number of attribute-related structure definitions and
	other defines.

	Add function prototypes for all of the functions added in
	scsi_all.c.

sys/kern/subr_prf.c:
	Add a new function, sbuf_hexdump().  This is the same as
	the existing hexdump(9) function, except that it puts the
	result in an sbuf.

	This also changes subr_prf.c so that it can be compiled in
	userland for includsion in libsbuf.

	We should work to change this so that the kernel hexdump
	implementation is a wrapper around sbuf_hexdump() with a
	statically allocated sbuf with a drain.  That will require
	a drain function that goes to the kernel printf() buffer
	that can take a non-NUL terminated string as input.
	That is because an sbuf isn't NUL-terminated until it is
	finished, and we don't want to finish it while we're still
	using it.

	We should also work to consolidate the userland hexdump and
	kernel hexdump implemenatations, which are currently
	separate.  This would also mean making applications that
	currently link in libutil link in libsbuf.

sys/sys/sbuf.h:
	Add the prototype for sbuf_hexdump(), and add another copy
	of the hexdump flag values if they aren't already defined.

	Ideally the flags should be defined in one place but the
	implemenation makes it difficult to do properly.  (See
	above.)

Sponsored by:	Spectra Logic Corporation
MFC after:	1 week
2015-06-09 21:39:38 +00:00
Simon J. Gerraty
44d314f704 dirdeps.mk now sets DEP_RELDIR 2015-06-08 23:35:17 +00:00
Baptiste Daroussin
d5ce1c7713 Remove useless WARNS 2015-06-06 13:49:54 +00:00
Marcelo Araujo
1bfa92ba85 Remove unused variables reported by clang.
Differential Revision:	D2688
Reviewed by:		rodrigc, mav
2015-06-02 09:05:45 +00:00
Patrick Kelsey
19342eee9d Add CAP_FCNTL to the lease file capsicum rights, and limit to
CAP_FCNTL_GETFL.  Without CAP_FCNTL_GETFL, the lease file truncation
in rewrite_client_leases() will fail to trim old data when rewriting
the file with a lesser amount of data.

Reviewed by: pjd, rwatson
Approved by: jmallett (mentor)
MFC after: 1 week
2015-05-28 05:38:07 +00:00
Simon J. Gerraty
98e0ffaefb Merge sync of head 2015-05-27 01:19:58 +00:00
Andrey V. Elsukov
24211a0afc Print leading zeroes of UFS2 fs_id like we do for UFS1.
PR:		156908
MFC after:	1 week
2015-05-26 18:27:38 +00:00
Alexander V. Chernikov
8755aff6c9 Bring back support for checking tables via "ipfw -n".
Currently we have different table key types which can easily interfere
with each other (numbers and IPv4 address, interface names and hostnames,
  flows and hostnames/addresses).
This conflicts are solved by [auto-]creating _typed_ tables, so after
table is created, only keys of given type can be inserted to that table.
ipfw(8) consults with kernel about key/value type for particular table so
it knows key/value interpretation.
However, we have 2 cases (adding entries to non-existing table and
  parsing configuration file via `ipfw -n`) when kernel is unable to
  provide us table info we need. Fix the latter case by partially importing
  old `table_fill_xentry()` parse function responsible for guessing key type.

Sponsored by:	Yandex LLC
2015-05-19 18:29:13 +00:00
Allan Jude
38eb219c75 Fix error in gmountver(8) man page
Also fixes the usage statement for the binary to use the correct terms (provider and geom name, rather than dev and prov, which is incorrect in the latter case)
Sync the man page summary with the new usage statement

PR:		199540
Differential Revision:	https://reviews.freebsd.org/D2329
Submitted by:	Fabian Keil
Reviewed by:	trasz
Approved by:	eadler (mentor)
Obtained from:	ElectroBSD (original)
MFC after:	1 week
Sponsored by:	ScaleEngine Inc.
2015-05-18 19:37:55 +00:00
Alexander V. Chernikov
5446b3f1d4 * Update SFF-8024 Identifier constants.
* Fix SFF_8436_CC_EXT in SFF-8436 memory map.
* Add SFF-8436/8636 bits (revision compliance/nominal bitrate).
* Do some small style/type fixes.
2015-05-16 13:11:35 +00:00
Alexander V. Chernikov
3d2f502bab Simplify i2c reader: we don't need per-NIC handler anymore.
Make code use read_i2c() function instead of callback.
Simplify&document struct i2c_info.
Consistently use uint8_t to read from i2c.
2015-05-15 12:32:17 +00:00
Andrey V. Elsukov
c1b4f79dfa Add an ability accept encapsulated packets from different sources by one
gif(4) interface. Add new option "ignore_source" for gif(4) interface.
When it is enabled, gif's encapcheck function requires match only for
packet's destination address.

Differential Revision:	https://reviews.freebsd.org/D2004
Obtained from:	Yandex LLC
MFC after:	2 weeks
Sponsored by:	Yandex LLC
2015-05-15 12:19:45 +00:00
Edward Tomasz Napierala
28616c3cc1 Document RCTL events in devd.conf(5).
MFC after:	1 month
Sponsored by:	The FreeBSD Foundation
2015-05-13 12:02:51 +00:00
Andrey V. Elsukov
eccfe69a5c Add new socket ioctls SIOC[SG]TUNFIB to set FIB number of encapsulated
packets on tunnel interfaces. Add support of these ioctls to gre(4),
gif(4) and me(4) interfaces. For incoming packets M_SETFIB() should use
if_fib value from ifnet structure, use proper value in gre(4) and me(4).

Differential Revision:	https://reviews.freebsd.org/D2462
No objection from:	#network
MFC after:	2 weeks
Sponsored by:	Yandex LLC
2015-05-12 07:37:27 +00:00
Hiroki Sato
59333867ff - Remove ND6_IFF_IGNORELOOP. This functionality was useless in practice
because a link where looped back NS messages are permanently observed
  does not work with either NDP or ARP for IPv4.

- draft-ietf-6man-enhanced-dad is now RFC 7527.

Discussed with:	hiren
MFC after:	3 days
2015-05-12 03:31:57 +00:00
Enji Cooper
4f34db2d70 Use MIN from sys/param.h instead of handrolling the macro
Replace sys/types.h with sys/param.h per-style(9)

MFC after: 3 days
Sponsored by: EMC / Isilon Storage Division
2015-05-11 04:54:56 +00:00
Alexander V. Chernikov
8a6dbb6455 Correctly print valtype for empty bitmask. 2015-05-06 11:23:14 +00:00
Andrey V. Elsukov
4b8d4f97b0 Add apple-boot, apple-hfs and apple-ufs aliases to MBR scheme.
Sort DOSPTYP_* entries in diskmbr.h by value.
Document these scheme-specific types in gpart(8).

MFC after:	1 week
2015-05-05 09:33:02 +00:00
Brooks Davis
5743dcb3c2 Remove "capability mode sandbox enabled" messages.
These messages serve little purpose and break some consumers.

PR:		199855
Differential Revision:	https://reviews.freebsd.org/D2440
Reviewed by:	rwatson
Approved by:	pjd
MFC after:	1 week
Sponsored by:	DARPA, AFRL
2015-05-04 21:44:51 +00:00
Glen Barber
d7149f4e51 MFV r225523, r282431:
r225523 (hrs):
  Import openresolv-3.4.4.

 r282431:
  Import openresolv-3.7.0.

PR:		199854
Submitted by:	yuri@rawbw.com
MFC after:	1 week
Relnotes:	yes
Sponsored by:	The FreeBSD Foundation
2015-05-04 21:07:20 +00:00
Mariusz Zaborski
bd1da0a002 Approved, oprócz użycie RESTORE_ERRNO() do ustawiania errno.
Change the nvlist_recv() function to take additional argument that
specifies flags expected on the received nvlist. Receiving a nvlist with
different set of flags than the ones we expect might lead to undefined
behaviour, which might be potentially dangerous.

Update consumers of this and related functions and update the tests.

Approved by:	pjd (mentor)

Update man page for nvlist_unpack, nvlist_recv, nvlist_xfer, cap_recv_nvlist
and cap_xfer_nvlist.

Reviewed by:	AllanJude
Approved by:	pjd (mentor)
2015-05-02 17:45:52 +00:00
Alexander V. Chernikov
8963c5055d Generalize object reference handling in ipfw rules.
No ABI changes.
2015-04-26 10:53:35 +00:00
Baptiste Daroussin
59d67bba3e Remove End Of Line whitespaces 2015-04-26 10:20:11 +00:00
Baptiste Daroussin
6c0b382d56 Fix 2 rendering issue with mandoc 2015-04-26 10:18:44 +00:00
Joel Dahl
952364486a Fix minor mdoc issues. 2015-04-24 14:36:06 +00:00
Edward Tomasz Napierala
a44ba043c9 Fix growfs(8) build with debug enabled (make -DGFSDBG).
PR:		199641
Submitted by:	Willem Jan Withagen <wjw at digiware dot nl>
MFC after:	1 month
Sponsored by:	The FreeBSD Foundation
2015-04-24 12:48:48 +00:00
Eric van Gyzen
f8ee95484e dmesg: accommodate message buffer growth between the sysctl calls
Allocate 12.5% extra space to avoid ENOMEM when the message buffer
is growing steadily.

Reported by:	Steve Wahl <steve_wahl@dell.com> (and tested)
Approved by:	kib (mentor)
Obtained from:	Dell Inc.
MFC after:	1 week
2015-04-20 20:07:39 +00:00
Alexander V. Chernikov
0577d6e0d5 Fix use-after-free.
Reported by:	Coverity Scan, pfg
CID:		1245747
2015-04-19 12:49:30 +00:00
Edward Tomasz Napierala
4e25c86f4c Remove some oldnfs remnants.
Differential Revision:	https://reviews.freebsd.org/D2287
Reviewed by:	rmacklem@
Sponsored by:	The FreeBSD Foundation
2015-04-18 16:08:06 +00:00
Gleb Smirnoff
772e66a6fc Move ALTQ from contrib to net/altq. The ALTQ code is for many years
discontinued by its initial authors. In FreeBSD the code was already
slightly edited during the pf(4) SMP project. It is about to be edited
more in the projects/ifnet. Moving out of contrib also allows to remove
several hacks to the make glue.

Reviewed by:	net@
2015-04-16 20:22:40 +00:00
Jason Helfman
7d49cdeb2b - ggatel.8 currently doesn't mention the 'rescue' command and
documents a non-existing 'attach' command instead.
- while here address a spelling error

PR:		199111
Differential Revision:	https://reviews.freebsd.org/D2259
Submitted by:	fk@fabiankeil.de
Obtained from: ElectroBSD
Approved by:	wblock (mentor)
MFC after:	1 week
2015-04-09 20:58:38 +00:00
Pedro F. Giffuni
67128bdc88 Update documented OEM string in newfs_msdos(8).
This was updated in r203868 to better match the naming scheme
in other OSs that use FAT.

MFC after:	3 days
2015-04-09 19:07:01 +00:00
Eric Joyner
eb7e25b22f ifmedia changes:
- Extend the number of available subtypes for Ethernet media by using some
of the ifmedia word's option bits to help denote subtypes. As a result, the
number of possible Ethernet subtype values increases from 31 to 511.

- Use some of those new values to define new media types.

- lacp_compose_key() recgonizes the new Ethernet media types added.
  (Change made as required by a comment in if_media.h)

- New ioctl, SIOGIFXMEDIA, to handle getting the new extended media types.
  SIOCGIFMEDIA is retained for backwards compatibility.

- Changes to ifconfig to allow it to handle the new extended media types.

Submitted by:	mike@karels.net (original), hselasky
Reviewed by:	jfvogel, gnn, hselasky
Approved by:	jfvogel (mentor), gnn (mentor)
Differential Revision: http://reviews.freebsd.org/D1965
2015-04-07 21:31:17 +00:00
Gleb Smirnoff
56d5e0967c Stop including if_var.h from userland.
Sponsored by:	Nginx, Inc.
2015-04-06 09:42:23 +00:00
Warren Block
487e821d89 Add articles, avoid use of "you", simplify a few sentences.
MFC after:	1 week
2015-04-02 13:51:06 +00:00
Xin LI
a2f9ce8a69 Constify.
Suggested by:	rdivacky
MFC after:	2 weeks
2015-03-31 19:12:13 +00:00
Xin LI
11500c4eaa Fix remaining warnings.
MFC after:	2 weeks
2015-03-27 18:23:06 +00:00
Xin LI
16945d8950 - Correct type for checkAgainst.
- Staticify flags that are not used outside the file scope.

PR:		bin/193471
Submitted by:	Robert Sprowson <webpages sprow.co.uk>
MFC after:	2 weeks
2015-03-26 22:34:27 +00:00
Alexander Motin
5523c82c1a Make GEOM_PART work in presence of previous withered self.
MFC after:	2 weeks
Sponsored by:	iXsystems, Inc.
2015-03-26 12:17:47 +00:00
Scott Long
d16528b2da Convert savecore to libxo. The 'verbose' paths still use printf since they're
meant for interactivity on the command line and contain a lot of redundant
information.

Obtained from:	Netflix, Inc.
2015-03-22 17:29:14 +00:00
Alexander Motin
e7affda584 Add camcontrol subcommands to control APM and AAM levels.
MFC after:	1 week
Sponsored by:	iXsystems, Inc.
2015-03-19 12:22:57 +00:00
Allan Jude
1596158c05 Document that nextboot(8) doesn't work as expected with ZFS
Differential Revision:	https://reviews.freebsd.org/D2087
Submitted by:	feld (request)
Reviewed by:	feld
Approved by:	bcr (mentor)
Sponsored by:	ScaleEngine Inc.
2015-03-17 20:15:49 +00:00
Alexander Motin
c0a3ee8450 Make ATA power management commands to work on SCSI HBAs via PASS THROUGH.
MFC after:	2 weeks
Sponsored by:	iXsystems, Inc.
2015-03-17 09:21:31 +00:00
Ian Lepore
93c3ad10f1 Fix minor fallout from sysctl strings being nulterminated now. The dmesg
code can read the buffer via sysctl or from a core file.  In the core file
case there will be no nulterm, and the code copes with that, but now in the
sysctl case there is a nulterm (there didn't used to be).  The least
disruptive way to restore the old behavior (and eliminate a spurious '\000'
at the end of the output) is to remove the nulterm (by decrementing the
buffer length) in the sysctl case.
2015-03-16 21:09:11 +00:00
Jilles Tjoelker
59966d51c6 restore: Preserve timestamps to the nanosecond.
The restore utility already knows the full-resolution timestamps, so the
only thing to do is to stop converting the timespecs to timevals and use
futimens() and utimensat().

Differential Revision:	https://reviews.freebsd.org/D2020
Reviewed by:	jhb
2015-03-14 13:45:43 +00:00
Andrey V. Elsukov
dc9fa19b3b Properly initialize scope zone id when next hop address stored
directly in the O_FORWARD_IP6 opcode. Use getnameinfo(3) to formatting
the IPv6 addresses of such opcodes.

Obtained from:	Yandex LLC
Sponsored by:	Yandex LLC
2015-03-13 13:46:50 +00:00
John Baldwin
07bf9879f3 Simplify string mangling in ifmaybeload().
- Use strlcpy() instead of strcpy().
- Use strlcat() instead of a strlcpy() with a magic number subtracted
  from the length.
- Replace strncmp(..., strlen(foo) + 1) with strcmp(...).

Differential Revision:	https://reviews.freebsd.org/D1814
Reviewed by:	rpaulo
MFC after:	2 weeks
2015-03-13 09:45:06 +00:00
Andrey V. Elsukov
2530ed9e70 Fix `ipfw fwd tablearg'. Use dedicated field nh4 in struct table_value
to obtain IPv4 next hop address in tablearg case.

Add `fwd tablearg' support for IPv6. ipfw(8) uses INADDR_ANY as next hop
address in O_FORWARD_IP opcode for specifying tablearg case. For IPv6 we
still use this opcode, but when packet identified as IPv6 packet, we
obtain next hop address from dedicated field nh6 in struct table_value.

Replace hopstore field in struct ip_fw_args with anonymous union and add
hopstore6 field. Use this field to copy tablearg value for IPv6.

Replace spare1 field in struct table_value with zoneid. Use it to keep
scope zone id for link-local IPv6 addresses. Since spare1 was used
internally, replace spare0 array with two variables spare0 and spare1.

Use getaddrinfo(3)/getnameinfo(3) functions for parsing and formatting
IPv6 addresses in table_value. Use zoneid field in struct table_value
to store sin6_scope_id value.

Since the kernel still uses embedded scope zone id to represent
link-local addresses, convert next_hop6 address into this form before
return from pfil processing. This also fixes in6_localip() check
for link-local addresses.

Differential Revision:	https://reviews.freebsd.org/D2015
Obtained from:	Yandex LLC
Sponsored by:	Yandex LLC
2015-03-13 09:03:25 +00:00
Andrey V. Elsukov
4fb4ebe0a4 Add GUID and alias for Apple Core Storage partition.
PR:		196241
MFC after:	1 week
2015-03-12 18:51:31 +00:00
Hiroki Sato
23e9ffb0e1 - Implement loopback probing state in enhanced DAD algorithm.
- Add no_dad and ignoreloop per-IF knob.  no_dad disables DAD completely,
  and ignoreloop is to prevent infinite loop in loopback probing state when
  loopback is permanently expected.
2015-03-05 21:27:49 +00:00
Edward Tomasz Napierala
5e252f6402 Make the "automounted" flag work for FUSE filesystems.
PR:		192852
Submitted by:	taku at tackymt.homeip.net (earlier version)
MFC after:	1 month
Sponsored by:	The FreeBSD Foundation
2015-03-01 18:26:26 +00:00
Andrey V. Elsukov
771d671beb When gpart(8) is trying automatically determine the first available
block of free space after existing partition, take into account
provider's stripeoffset, since the result will be adjusted to this
value.

PR:		197989
MFC after:	1 week
2015-02-26 15:59:45 +00:00
Kenneth D. Merry
e8577fb489 Make sure that the flags for the XPT_DEV_ADVINFO CCB are initialized
properly.

If there is garbage in the flags field, it can sometimes include a
set CDAI_FLAG_STORE flag, which may cause either an error or
perhaps result in overwriting the field that was intended to be
read.

sys/cam/cam_ccb.h:
	Add a new flag to the XPT_DEV_ADVINFO CCB, CDAI_FLAG_NONE,
	that callers can use to set the flags field when no store
	is desired.

sys/cam/scsi/scsi_enc_ses.c:
	In ses_setphyspath_callback(), explicitly set the
	XPT_DEV_ADVINFO flags to CDAI_FLAG_NONE when fetching the
	physical path information.  Instead of ORing in the
	CDAI_FLAG_STORE flag when storing the physical path, set
	the flags field to CDAI_FLAG_STORE.

sys/cam/scsi/scsi_sa.c:
	Set the XPT_DEV_ADVINFO flags field to CDAI_FLAG_NONE when
	fetching extended inquiry information.

sys/cam/scsi/scsi_da.c:
	When storing extended READ CAPACITY information, set the
	XPT_DEV_ADVINFO flags field to CDAI_FLAG_STORE instead of
	ORing it into a field that isn't initialized.

sys/dev/mpr/mpr_sas.c,
sys/dev/mps/mps_sas.c:
	When fetching extended READ CAPACITY information, set the
	XPT_DEV_ADVINFO flags field to CDAI_FLAG_NONE instead of
	setting it to 0.

sbin/camcontrol/camcontrol.c:
	When fetching a device ID, set the XPT_DEV_ADVINFO flags
	field to CDAI_FLAG_NONE instead of 0.

sys/sys/param.h:
	Bump __FreeBSD_version to 1100061 for the new XPT_DEV_ADVINFO
	CCB flag, CDAI_FLAG_NONE.

Sponsored by:	Spectra Logic
MFC after:	1 week
2015-02-18 18:30:19 +00:00
John-Mark Gurney
7582000531 add support for specifying an initial buffer size when fetching a
sysctl... This is useful for kern.arandom which (without -B) will
happily return 0 bytes, which isn't too useful or random...

fix spelling (thanks igor!) of settable while I'm here...
2015-02-13 01:20:37 +00:00
Alexander V. Chernikov
5d43946785 Retrieve counters from kernel if rule timstamping is requested.
PR:		kern/197271
Submitted by:	lev
Sponsored by:	Yandex LLC
2015-02-05 14:08:33 +00:00
Vsevolod Stakhov
976e494514 Revert the change of flowid output format. [1]
Reverse the sorting order of the interfaces addresses familise so it should be
the same as getifaddrs(3) order. [2]

Suggested by:	hrs [1], bz [2]
Approved by:	hrs, bapt
2015-02-02 19:00:18 +00:00
Vsevolod Stakhov
07a51db9e2 Style(9) fixes.
Approved by:	bapt, ae
X-MFC-With:	r278080
2015-02-02 14:37:45 +00:00
Vsevolod Stakhov
35c73e51cc Reorganize the list of addresses associated with an interface and group them
based on the address family. This should help to recognize interfaces with
multiple AF (e.g. ipv4 and ipv6) with many aliases or additional addresses. The
order of addresses inside a single group is strictly preserved.

Improve the scope_id output for AF_INET6 families, as the
current approach uses hexadecimal string that is basically the ID of an
interface, whilst this information is already depicted by getnameinfo(3) call.
Therefore, now ifconfig just prints the scope of address as it is defined in
2.4 of RFC 2373.

PR:		197270
Approved by:	bapt
MFC after:	2 weeks
2015-02-02 13:03:04 +00:00
Enji Cooper
87d352d5c6 Remove duplicate MK_ISCSI block and sort the conditional blocks so this error
won't crop up again in the future

Reported by: gjb
MFC after: 1 week
2015-02-02 10:31:35 +00:00
Edward Tomasz Napierala
da8e209f33 Fix sysctl name.
MFC after:	1 month
Sponsored by:	The FreeBSD Foundation
2015-01-27 18:27:07 +00:00
Enji Cooper
c01f300b7f Build sbin/iscontrol again if MK_ISCSI != no
MFC after: 13 days
X-MFC with: r277675
Pointyhat to: me
2015-01-26 06:29:07 +00:00
Enji Cooper
4e39505449 Add MK_HAST knob for building and installing hastd(8), et al
MFC after: 2 weeks
Sponsored by: EMC / Isilon Storage Division
2015-01-26 06:27:07 +00:00
John Baldwin
2aa533b91d natd(8) will work with an unconfigured interface and effectively not do
anything until the interface is assigned an address.  This fixes
ipfw_nat to do the same by using an IP of INADDR_ANY instead of
aborting the nat setup if the requested interface is not yet configured.

Differential Revision:	https://reviews.freebsd.org/D1539
Reviewed by:	melifaro, glebius, gnn
MFC after:	1 week
2015-01-25 20:37:32 +00:00
Enji Cooper
18cc317233 Add MK_CCD knob for building and installing ccd(4), ccdconfig, etc
MFC after: 2 weeks
Sponsored by: EMC / Isilon Storage Division
2015-01-25 04:52:48 +00:00
Enji Cooper
b29d6977f3 Add MK_ISCSI knob for building the iscsi initiator, iscsi daemon, kernel
modules, etc

MFC after: 2 weeks
Sponsored by: EMC / Isilon Storage Division
2015-01-25 04:20:11 +00:00
Enji Cooper
60e03a568c Fix building rcorder with -DDEBUG by using libutil.h instead of util.h from
usr.bin/make

MFC after: 1 week
Sponsored by: EMC / Isilon Storage Division
2015-01-25 03:08:21 +00:00
Enji Cooper
9a1f476703 - Revert r277670 (#include order is required for fparseln)
- Remove unnecessary CFLAGS+= -I now that make is no longer required to make
  rcorder build
2015-01-25 03:02:29 +00:00
Enji Cooper
6251a2629c Sort #include order 2015-01-25 02:30:44 +00:00
Enji Cooper
bfd71a93e3 MFhead @ r277659 2015-01-24 21:21:39 +00:00
Andrey V. Elsukov
ffc610b221 After r270929 RAW IP code assumes that all IP fields are in network
byte order. Fix ping(8) to pass an IP header with converted ip_off
and ip_len fields, when IP_HDRINCL socket option used.
2015-01-23 13:26:35 +00:00
Enji Cooper
51dd214c84 MFhead @ r277403 2015-01-19 22:18:00 +00:00
Alexander V. Chernikov
69c4b56a74 Eliminate incorrect IPv6 mask guessing:
RFC 2374 concept of 'IPv6 Aggregatable Global Unicast Address Format' was
deprecated by RFC 3587 12 years ago.

Before:

15:06 [1] edge# netstat -rn6 | grep 2a02:6b8::
2a02:6b8::/32                     2a02:978:2::1                 UGS         em0
15:06 [1] edge# route -6n get 2a02:6b8::
route: writing to routing socket: No such process

After:
15:07 [1] edge# /usr/obj/usr/src/sbin/route/route -n6 get 2a02:6b8::
   route to: 2a02:6b8::
destination: 2a02:6b8::
       mask: ffff:ffff::
    gateway: 2a02:978:2::1
        fib: 0
  interface: em0
      flags: <UP,GATEWAY,DONE,STATIC>
 recvpipe  sendpipe  ssthresh  rtt,msec    mtu        weight    expire
       0         0         0         0      1500         1         0

MFC after:	2 weeks
2015-01-16 11:17:30 +00:00
Edward Tomasz Napierala
01de1a0650 Add devd(8) notifications for creation and destruction of GEOM devices.
Differential Revision:	https://reviews.freebsd.org/D1211
MFC after:	1 month
Sponsored by:	The FreeBSD Foundation
2015-01-14 11:15:57 +00:00
Kenneth D. Merry
a1736be349 Improve camcontrol(8) handling of drive defect data.
This includes a new summary mode (-s) for camcontrol defects that
quickly tells the user the most important thing: how many defects
are in the requested list.  The actual location of the defects is
less important.

Modern drives frequently have more than the 8191 defects that can
be reported by the READ DEFECT DATA (10) command.  If they don't
have that many grown defects, they certainly have more than 8191
defects in the primary (i.e. factory) defect list.

The READ DEFECT DATA (12) command allows for longer parameter
lists, as well as indexing into the list of defects, and so allows
reporting many more defects.

This has been tested with HGST drives and Seagate drives, but
does not fully work with Seagate drives.  Once I have a Seagate
spec I may be able to determine whether it is possible to make it
work with Seagate drives.

scsi_da.h:	Add a definition for the new long block defect
		format.

		Add bit and mask definitions for the new extended
		physical sector and bytes from index defect
		formats.

		Add a prototype for the new scsi_read_defects() CDB
		building function.

scsi_da.c:	Add a new scsi_read_defects() CDB building function.
		camcontrol(8) was previously composing CDBs manually.
		This is long overdue.

camcontrol.c:	Revamp the camcontrol defects subcommand.  We now
		go through multiple stages in trying to get defect
		data off the drive while avoiding various drive
		firmware quirks.

		We start off by requesting the defect header with
		the 10 byte command.  If we're in summary mode (-s)
		and the drive reports fewer defects than can be
		represented in the 10 byte header, we're done.
		Otherwise, we know that we need to issue the
		12 byte command if the drive reports the maximum
		number of defects.

		If we're in summary mode, we're done if we get a
		good response back when asking for the 12 byte header.

		If the user has asked for the full list, then we
		use the address descriptor index field in the 12
		byte CDB to step through the list in 64K chunks.
		64K is small enough to work with most any ancient
		or modern SCSI controller.

		Add support for printing the new long block defect
		format, as well as the extended physical sector and
		bytes from index formats.  I don't have any drives
		that support the new formats.

		Add a hexadecimal output format that can be turned
		on with -X.

		Add a quiet mode (-q) that can be turned on with
		the summary mode (-s) to just print out a number.

		Revamp the error detection and recovery code for
		the defects command to work with HGST drives.

		Call the new scsi_read_defects() CDB building
		function instead of rolling the CDB ourselves.

		Pay attention to the residual from the defect list
		request when printing it out, so we don't run off
		the end of the list.

		Use the new scsi_nv library routines to convert
		from strings to numbers and back.

camcontrol.8:	Document the new defect formats (longblock, extbfi,
		extphys) and command line options (-q, -s, -S and
		-X) for the defects subcommand.

		Explain a little more about what drives generally
		do and don't support.

Sponsored by:	Spectra Logic
MFC after:	1 week
2015-01-08 16:58:40 +00:00
Warner Losh
a91275f72f Remove old ioctl use and support, once and for all. 2015-01-06 05:28:37 +00:00
Enji Cooper
b219c275cc Integrate sbin/ifconfig/tests from NetBSD into atf/kyua
Sponsored by: EMC / Isilon Storage Division
2015-01-04 22:25:16 +00:00
Joel Dahl
f636caf195 mdoc: paragraph improvements. 2015-01-04 12:49:24 +00:00
Dag-Erling Smørgrav
e331584127 Belatedly commit the patch for SA-14:21 to head. It was not committed to
head at the time because it's a band-aid, rather than a complete fix, but
the complete fix never materialized.
2015-01-03 01:52:06 +00:00
Enji Cooper
a4ed727666 MFhead @ r276594 2015-01-02 23:27:16 +00:00
Joel Dahl
f7e00d4bbd mdoc: remove EOL whitespace. 2014-12-29 13:50:59 +00:00
Joel Dahl
c09eb46601 mdoc: improvements to SEE ALSO. 2014-12-27 08:22:58 +00:00
Enji Cooper
afbe8aa46f MFhead @ r275911 (also, sort out MK_* flags in BMAKE, etc on this branch) 2014-12-18 18:46:08 +00:00
Gleb Kurtsou
9b33705411 Adjust printf format specifiers for dev_t and ino_t in user space.
ino_t and dev_t are about to become uint64_t.

Reviewed by:	kib, mckusick
2014-12-17 07:10:48 +00:00
Bryan Venteicher
c6e32006e1 Prefix all the vxlan ifconfig commands so they are unique
And rehook ifvxlan back into the build.
2014-12-17 05:36:34 +00:00
Andrey V. Elsukov
8150c3ec36 Add ability to not specify a zone identifier twice, when both source and
destination addresses are specified.
For example:
	# ping6 -S fe80::1%ix0 ff02::1
or
	# ping6 -S fe80::1 fe80::2%ix0

Obtained from:	Yandex LLC
Sponsored by:	Yandex LLC
2014-12-16 14:59:20 +00:00
Gleb Kurtsou
c7d73a4d23 sbin/shutdown: Support time units as in 'shutdown -r +5sec'
Units supported: s, sec, m, min, h, hour.

Differential Revision:	https://reviews.freebsd.org/D1272
2014-12-16 08:29:02 +00:00
Enji Cooper
d455aba884 MFhead @ r275688 2014-12-10 20:44:51 +00:00
Edward Tomasz Napierala
be3a49ee62 Add fstyp(8). This utility, named after its SVR4 counterpart, detects
filesystems.  It differs from file(1) in that it gives machine-parseable
output, it outputs filesystem labels, doesn't get confused by other
formats metadata, and runs in Capsicum sandbox.

Differential Revision:	https://reviews.freebsd.org/D1255
Relnotes:	yes
Sponsored by:	The FreeBSD Foundation
2014-12-10 14:14:16 +00:00
Enji Cooper
2c3f939cab MFhead @ r275589 2014-12-08 03:36:43 +00:00
Edward Tomasz Napierala
de29f585af Move iscsi.conf.5 from sbin/iscontrol/ to usr.bin/iscsictl/, as the
former is obsolete.

MFC after:	2 weeks
Sponsored by:	The FreeBSD Foundation
2014-12-05 12:38:01 +00:00
Enji Cooper
da976f9d68 MFhead @ r275496 2014-12-05 07:48:25 +00:00
Enji Cooper
210607205f Make ccd(4), et al conditional based on MK_CCD 2014-12-02 19:53:55 +00:00
Xin LI
689c8e8b46 Fix inverted logic introduced in r272154.
Noticed by:	trasz
MFC after:	2 weeks
2014-12-01 20:51:01 +00:00
Dag-Erling Smørgrav
5d083d287b Disable the vxlan code until the people reponsible for it can come up with
new command names that don't conflict with existing commands.

Pointy hat to:	bryanv
2014-12-01 12:59:16 +00:00
Enji Cooper
9779edfbd3 Remove the unnecessary glob 2014-11-30 09:04:24 +00:00
Enji Cooper
d370dc47a1 Fix CFLAGS+=-DDEBUG by using the right header for libutil (libutil.h, not
util.h)
2014-11-30 09:03:34 +00:00
Enji Cooper
317fdbc621 Build spppcontrol if MK_PPP != no 2014-11-30 08:34:46 +00:00
Enji Cooper
840e70929b MFHead @ r275232 2014-11-29 05:28:40 +00:00
Enji Cooper
66ca0717df Convert sbin/mdconfig/tests from prove format tests to ATF format tests
As a side effect...
1. The tests now checks for the root user before continuing with kyua, which is
   more visible than the test being skipped with the TAP protocol
2. The tests work with devices that aren't /dev/md0 by caching the device
   attached during the test to a file, and later use the cached information to
   detach the device in the cleanup routine
3. The tests no longer require perl to run

MFC after: 1 week
PR: 191191
Sponsored by: EMC / Isilon Storage Division
2014-11-27 06:04:00 +00:00
Enji Cooper
466046ec0d Conditionalize a number of components in the tree
- bootparamd
- bootpd
- finger/fingerd
- ftp/ftpd
- hastctl/hastd
- iscsid, et al
- rbootd
- talk/talkd
- tcpd, et al
- tftp/tftpd

Add src.conf entries for the various components and do a best effort
at adding components to tools/build/mk/OptionalObsoleteFiles.inc
2014-11-26 08:44:05 +00:00
Baptiste Daroussin
13eb765f2d Convert sbin/ to LIBADD
Reduce overlinking
2014-11-25 11:23:12 +00:00
Joel Dahl
d4d112e34a Misc mdoc fixes:
- Remove superfluous paragraph macros.
- Remove/fix empty or incorrect macros.
- Sort sections into conventional order.
- Terminate quoted strings properly.
- Remove EOL whitespace.
2014-11-23 21:00:00 +00:00
Edward Tomasz Napierala
a0252a0a82 Cross-reference autounmountd(8) from umount(8).
MFC after:	1 month
Sponsored by:	The FreeBSD Foundation
2014-11-22 16:46:00 +00:00
Edward Tomasz Napierala
9df66c85e3 Cross-reference automount(8) from mount(8).
MFC after:	1 month
Sponsored by:	The FreeBSD Foundation
2014-11-22 16:43:36 +00:00
Warner Losh
009ad003a2 Recommit r274750. 2014-11-21 01:43:55 +00:00
Warner Losh
adafc9d6e7 Back our r274750 until discussions on proper fix are over. 2014-11-20 21:18:19 +00:00
Andrey V. Elsukov
681a5b28a4 Use geom attribute "PART::type" to determine partition type and choose
relevant fsck_xxx utility.

MFC after:	1 week
2014-11-20 16:31:31 +00:00
Edward Tomasz Napierala
579a4f031e Uniformly refer to a file system as "file system".
MFC after:	1 month
Sponsored by:	The FreeBSD Foundation
2014-11-20 06:14:40 +00:00
Edward Tomasz Napierala
85941ebd33 Add example on how to use gpart before growfs. While here, reorder examples
so that the simplest one comes first.

MFC after:	1 month
Sponsored by:	The FreeBSD Foundation
2014-11-20 06:12:11 +00:00
Edward Tomasz Napierala
7550bae5d8 Document growfs(8) feature apparently nobody knows about.
MFC after:	1 month
Sponsored by:	The FreeBSD Foundation
2014-11-20 05:31:41 +00:00
Edward Tomasz Napierala
d888bdf640 Use proper ordering in EXAMPLES section in growfs(8).
MFC after:	1 month
Sponsored by:	The FreeBSD Foundation
2014-11-20 05:25:52 +00:00
Mark Felder
46ad509bf8 Expose groups by default in ifconfig output. This was never hidden by
OpenBSD; unsure why we chose to do so. As groups are a requirement for
pf, exposing them by default will make our pf implementation less
confusing.

While here add a missing free() that OpenBSD fixed 7 years ago.

PR:		194925
Differential Revision:	https://reviews.freebsd.org/D1185
Approved by:	des
Obtained from:	OpenBSD
2014-11-19 13:57:39 +00:00
Simon J. Gerraty
488c975a1f Updated/new dependencies 2014-11-19 07:10:38 +00:00
Simon J. Gerraty
9268022b74 Merge from head@274682 2014-11-19 01:07:58 +00:00
Mark Felder
e2d52f146f Fix geom's "usage" generation to not fabricate usage/help output for any
imaginary class we give it.

Differential Revision:	https://reviews.freebsd.org/D1150
Submitted by:	homerj
Approved by:	pjd
2014-11-17 15:19:57 +00:00
Alexander V. Chernikov
7f948f12f6 Finish r274175: do control plane MTU tracking.
Update route MTU in case of ifnet MTU change.
Add new RTF_FIXEDMTU to track explicitly specified MTU.

Old behavior:
ifconfig em0 mtu 1500->9000 -> all routes traversing em0 do not change MTU.
User has to manually update all routes.
ifconfig em0 mtu 9000->1500 -> all routes traversing em0 do not change MTU.
However, if ip[6]_output finds route with rt_mtu > interface mtu, rt_mtu
gets updated.

New behavior:
ifconfig em0 mtu 1500->9000 -> all interface routes in all fibs gets updated
with new MTU unless RTF_FIXEDMTU flag set on them.
ifconfig em0 mtu 9000->1500 -> all routes in all fibs gets updated with new
MTU unless RTF_FIXEDMTU flag set on them AND rt_mtu is less than ifp mtu.

route add ... -mtu XXX automatically sets RTF_FIXEDMTU flag.
route change .. -mtu 0 automatically removes RTF_FIXEDMTU flag.

PR:		194238
MFC after:	1 month
CR:		D1125
2014-11-17 01:05:29 +00:00
Ed Maste
9d1334e076 Reference uefi(8) from i386 boot(8)
Suggested by trasz.

Differential Revision: https://reviews.freebsd.org/D1162
2014-11-14 20:12:33 +00:00
Alexander V. Chernikov
670e8b3b8c Kill custom in_matroute() radix mathing function removing one rte mutex lock.
Initially in_matrote() in_clsroute() in their current state was introduced by
r4105 20 years ago. Instead of deleting inactive routes immediately, we kept them
in route table, setting RTPRF_OURS flag and some expire time. After that, either
GC came or RTPRF_OURS got removed on first-packet. It was a good solution
in that days (and probably another decade after that) to keep TCP metrics.
However, after moving metrics to TCP hostcache in r122922, most of in_rmx
functionality became unused. It might had been used for flushing icmp-originated
routes before rte mutexes/refcounting, but I'm not sure about that.

So it looks like this is nearly impossible to make GC do its work nowadays:

in_rtkill() ignores non-RTPRF_OURS routes.
route can only become RTPRF_OURS after dropping last reference via rtfree()
which calls in_clsroute(), which, it turn, ignores UP and non-RTF_DYNAMIC routes.

Dynamic routes can still be installed via received redirect, but they
have default lifetime (no specific rt_expire) and no one has another trie walker
to call RTFREE() on them.

So, the changelist:
* remove custom rnh_match / rnh_close matching function.
* remove all GC functions
* partially revert r256695 (proto3 is no more used inside kernel,
  it is not possible to use rt_expire from user point of view, proto3 support
  is not complete)
* Finish r241884 (similar to this commit) and remove remaining IPv6 parts

MFC after:	1 month
2014-11-11 02:52:40 +00:00
Bryan Venteicher
eccc99cb3e Attempt to report a better error if sanitize is not supported
MFC after:	1 month
2014-11-09 18:13:08 +00:00
Poul-Henning Kamp
89cbe4e288 Report the 1-based key numbers rather than the 0-based ones to be consistent.
Fix documentation for destroy command.  Not sure how the wrong explanation
happened.

Spotted by:	mwlucas
2014-11-09 15:53:29 +00:00
Andrey V. Elsukov
f325335caf Overhaul if_gre(4).
Split it into two modules: if_gre(4) for GRE encapsulation and
if_me(4) for minimal encapsulation within IP.

gre(4) changes:
* convert to if_transmit;
* rework locking: protect access to softc with rmlock,
  protect from concurrent ioctls with sx lock;
* correct interface accounting for outgoing datagramms (count only payload size);
* implement generic support for using IPv6 as delivery header;
* make implementation conform to the RFC 2784 and partially to RFC 2890;
* add support for GRE checksums - calculate for outgoing datagramms and check
  for inconming datagramms;
* add support for sending sequence number in GRE header;
* remove support of cached routes. This fixes problem, when gre(4) doesn't
  work at system startup. But this also removes support for having tunnels with
  the same addresses for inner and outer header.
* deprecate support for various GREXXX ioctls, that doesn't used in FreeBSD.
  Use our standard ioctls for tunnels.

me(4):
* implementation conform to RFC 2004;
* use if_transmit;
* use the same locking model as gre(4);

PR:		164475
Differential Revision:	D1023
No objections from:	net@
Relnotes:	yes
Sponsored by:	Yandex LLC
2014-11-07 19:13:19 +00:00
Baptiste Daroussin
b7f7b35fd3 fsirand does not actually use libutil 2014-11-05 22:46:11 +00:00
Alexander V. Chernikov
c8dce4fe5a Put "break" after err() to please coverity.
Reported by:	Coverity
CID:		1250795
2014-11-04 10:21:34 +00:00
Alexander V. Chernikov
ad4278e8fd Print human-readable error for "route not found" case.
Submitted by:	vsevolod (initial version)
MFC after:	2 weeks
Sponsored by:	Yandex LLC
2014-10-31 13:37:47 +00:00
Edward Tomasz Napierala
6575d18476 Build mount_nfs(8) with WARNS=6.
Reviewed by:	rmacklem@
MFC after:	1 month
Sponsored by:	The FreeBSD Foundation
2014-10-31 09:51:54 +00:00
Doug Ambrisko
db0b8e10a7 Make UEFI booting of 4Kn disks work:
-	convert boot1.efi to corrrectly calculate the lba for what the
	media reports and convert the size based on what FreeBSD uses.
	The existing code would use the 512 byte lba and convert the
	size using 4K byte size.
      -	make fsck_msdosfs read the boot block as 4K so the read doesn't
	fail on a 4Kn drive since FreeBSD will error out parition reads
	of a block.  Make the bpbBytesPerSec check a multiple of 512 since
	it can be 512 or 4K depending on the disk.  This allows fsck to
	pass checking the EFI partition on a 4Kn disk.

To create the EFI file system I used:
	newfs_msdos -F 32 -S 4096 -c 1 -m 0xf8 <partition>
This works for booting 512 and 4Kn disks.

Caveat is that loader.efi cannot read the 4Kn EFI partition.  This isn't
critical right now since boot1.efi will read loader.efi from the ufs
partition.  It looks like loader.efi can be fixed via making some of the
512 bytes reads more flexible.  loader.efi doesn't have trouble reading
the ufs partition.  This is probably a simple fix.

I now have FreeBSD installed on a system with 4Kn drives and tested the
same code works on 512.

MFC after:	1 week
2014-10-30 15:52:01 +00:00
Edward Tomasz Napierala
b5019d3a0c Remove two functions unused after r273848. Would be nice if clang
or at least scan-build yelled about it.

MFC after:	1 month
Sponsored by:	The FreeBSD Foundation
2014-10-30 14:05:48 +00:00
Edward Tomasz Napierala
2a9b29b395 Note that the "timeout" nfs option is in tenths of a second.
MFC after:	1 month
Sponsored by:	The FreeBSD Foundation
2014-10-30 09:06:52 +00:00
Edward Tomasz Napierala
5a06ac3540 Add support for "timeo", "actimeo", "noac", and "proto" options
to mount_nfs(8).  They are implemented on Linux, OS X, and Solaris,
and thus can be expected to appear in automounter maps.

Reviewed by:	rmacklem@
MFC after:	1 month
Sponsored by:	The FreeBSD Foundation
2014-10-30 08:50:01 +00:00
Edward Tomasz Napierala
2795d7de01 Get rid of obsolete code in mount_nfs(8).
Reviewed by:	rmacklem@
Sponsored by:	The FreeBSD Foundation
2014-10-30 08:05:51 +00:00
Alexander V. Chernikov
ca807c8a88 Fix documentation issue.
PR:		194581
Submitted by:	madpilot
2014-10-24 17:06:56 +00:00
Alexander V. Chernikov
382a5cbf42 Fix displaying non-contiguous netmasks.
Found by:	ae
Sponsored by:	Yandex LLC
2014-10-24 13:29:12 +00:00
Alexander V. Chernikov
34bad16f60 Show SFP+/QSFP memory map dump on higher verbose levels.
Sponsored by:	Yandex LLC
MFC after:	1 week
2014-10-23 11:01:49 +00:00
Bryan Venteicher
007054f070 Add vxlan interface
vxlan creates a virtual LAN by encapsulating the inner Ethernet frame in
a UDP packet. This implementation is based on RFC7348.

Currently, the IPv6 support is not fully compliant with the specification:
we should be able to receive UPDv6 packets with a zero checksum, but we
need to support RFC6935 first. Patches for this should come soon.

Encapsulation protocols such as vxlan emphasize the need for the FreeBSD
network stack to support batching, GRO, and GSO. Each frame has to make
two trips through the network stack, and each frame will be at most MTU
sized. Performance suffers accordingly.

Some latest generation NICs have begun to support vxlan HW offloads that
we should also take advantage of. VIMAGE support should also be added soon.

Differential Revision:	https://reviews.freebsd.org/D384
Reviewed by:	gnn
Relnotes:	yes
2014-10-20 14:42:42 +00:00
Hiroki Sato
7e9489e0f6 WARNS=3 and style fixes. No functionality change. 2014-10-20 00:27:40 +00:00
Alexander V. Chernikov
6ff33bb6aa * Zero rule buffer.
* Rename 'read' variable.

Pointed by:	luigi
2014-10-18 15:18:31 +00:00
Alexander V. Chernikov
d3de6c1d2f * Fix table sets handling.
* Simplify formatting.

Suggested by:	luigi
2014-10-17 20:47:55 +00:00
Hiroki Sato
b021de9cd7 Add -x waittime and -X timeout options for feature parity. These are
equivalent to -W and -t options of ping(8).  Different letters are used
because both have already been used for another purposes in ping6(8).
2014-10-17 09:33:09 +00:00
Alexander V. Chernikov
6ca0dd05f4 Show error when deleting non-existing rule number.
Found by:	Oleg Ginzburg
2014-10-13 12:49:04 +00:00
Alexander V. Chernikov
60f485ca9f * Fix zeroing individual entries via ipfw(8).
* Report error and return non-zero exit code if zeroing non-matched entries

Found by:	Oleg Ginzburg
2014-10-13 11:26:17 +00:00
Edward Tomasz Napierala
d32789d95c Mark iscontrol(8) and iscsi_initiator(4) obsolete.
Differential Revision:	https://reviews.freebsd.org/D931
Reviewed by:	wblock@
MFC after:	3 days
Sponsored by:	The FreeBSD Foundation
2014-10-11 05:18:22 +00:00
Alexander V. Chernikov
9fe15d0612 Partially fix build on !amd64
Pointed by:	bz
2014-10-10 17:24:56 +00:00
Hiroki Sato
1482f98247 Do not add late flag when file= is specified because it has a bad
side-effect.  The specified file should exist before the fstab line.

Reported by:	wblock (long time ago)
MFC after:	1 day
2014-10-10 03:20:12 +00:00
Alexander V. Chernikov
779b53d008 Sync to HEAD@r272825. 2014-10-09 15:35:28 +00:00
Alexander V. Chernikov
68bde59ebe * Fix use-after-free in table printing code.
* Fix showing human-readable error in table cmds code.
2014-10-09 12:54:56 +00:00
Andrey V. Elsukov
a62c8c6a99 Revert r156046. We support setting dumpdev via loader tunable again.
Also change default disk name to ada.

MFC after:	3 weeks
2014-10-08 12:19:48 +00:00
Alexander V. Chernikov
a5fedf11fc Sync to HEAD@r272609. 2014-10-06 11:29:50 +00:00
Alexander V. Chernikov
9bb47e7068 Improve "reserved keywords" hack:
we can't easily predict (in current parsing model)
if the keyword is ipfw(8) reserved keyword or port name.
Checking proto database via getprotobyname() consumes a lot of
CPU and leads to tens of seconds for parsing large ruleset.
Use list of reserved keywords and check them as pre-requisite
before doing getprotobyname().

Obtained from:	Yandex LLC
2014-10-06 11:00:47 +00:00
Alexander V. Chernikov
4deb9c9287 Fix tracked interface list retrieval. 2014-10-05 10:20:47 +00:00
Hiroki Sato
7eb756fab1 Use printb() for boolean flags in ro_opts and actor_state for LACP. 2014-10-05 02:37:01 +00:00
Alexander V. Chernikov
d91c61c364 Fix GCC wardnings. 2014-10-04 17:21:30 +00:00
Alexander V. Chernikov
1ce4b35740 Sync to HEAD@r272516. 2014-10-04 12:42:37 +00:00
Alexander V. Chernikov
5371ab1408 Document new table values.
Sponsored by:	Yandex LLC
2014-10-03 15:36:58 +00:00
Hiroki Sato
4f7bf7a846 Revert r272390.
Pointed out by:	glebius
2014-10-02 20:17:16 +00:00
Hiroki Sato
9732189ca9 Separate option handling from SIOC[SG]LAGG to SIOC[SG]LAGGOPTS for
backward compatibility with old ifconfig(8).
2014-10-02 20:01:13 +00:00
Hiroki Sato
394c813d06 Add IFCAP_HWSTATS. 2014-10-02 00:19:24 +00:00
Hiroki Sato
939a050ad9 Virtualize lagg(4) cloner. This change fixes a panic when tearing down
if_lagg(4) interfaces which were cloned in a vnet jail.

Sysctl nodes which are dynamically generated for each cloned interface
(net.link.lagg.N.*) have been removed, and use_flowid and flowid_shift
ifconfig(8) parameters have been added instead.  Flags and per-interface
statistics counters are displayed in "ifconfig -v".

CR:	D842
2014-10-01 21:37:32 +00:00
Yoshihiro Takahashi
3754eb026e Merged from r183296.
Add missing library dependencies.
2014-09-28 08:23:26 +00:00
Xin LI
e267e00eef Refactor the code a little bit to reduce duplicated code.
Reviewed by:	mjg
MFC after:	2 weeks
2014-09-26 05:05:34 +00:00
Xin LI
4b8740cd0a Explicitly set errno to 0 before calling strto*.
Suggested by:	mjg
MFC after:	2 weeks
2014-09-25 22:47:19 +00:00
Xin LI
9e4ed37219 The strtol(3) family of functions would set errno when it hits one.
Check errno and handle it as invalid input.

Obtained from:	HardenedBSD
Submitted by:	David CARLIER <devnexen@gmail.com>
MFC after:	2 weeks
2014-09-25 22:37:27 +00:00
Xin LI
c58f8df6e7 Constify a parameter of name2oid. No functional change.
MFC after:	2 months
2014-09-23 22:15:00 +00:00
Hiroki Sato
ebb03f0b57 Fix a typo. 2014-09-21 05:03:04 +00:00
Hiroki Sato
b9f70ced25 Fix a bug which could make routed(8) daemon exit by sending a special RIP
query from a remote machine, and disable accepting it by default.  This
requests a routed(8) daemon to dump routing information base for debugging
purpose.  An -i flag to enable it has been added.
2014-09-21 04:00:28 +00:00
Hiroki Sato
0ecaa7ed05 Fix a problem that reply packets are not received when -i T option is set
and (T < RTT).

- Use select(2) for timeout instead of interval timer. Remove poll(2) support.
- Use sigaction(2) instead of signal(3).
- Exit in SIGINT handler when two signals are received and doing reverse DNS
  lookup as ping(8) does.
- Remove redundant variables used for getaddrinfo(3).

PR:	151023
2014-09-20 19:54:19 +00:00
Hiroki Sato
58da716138 Revert changes in r269180. It could cause -c N option to enter an
infinite loop if no reply packet is received.

PR:	151023
2014-09-20 18:48:50 +00:00
Marcelo Araujo
44a9271b49 The lagg(4) interface is based on trunk(4) interface from OpenBSD.
The FreeBSD is the only system that has the FEC protocol, that is a simple alias
to loadbalance protocol and does not implement the ancient Cisco FEC standard.

From now on, we remove the fec protocol from the documentation and keep the FEC
code only for compatibility.

Phabric:	D539
Reviewed by:	glebius, thompsa
Approved by:	glebius
Sponsored by:	QNAP Systems Inc.
2014-09-18 02:22:02 +00:00
Marcelo Araujo
99cdd96163 Add laggproto broadcast, it allows sends frames to all ports of the lagg(4) group
and receives frames on any port of the lagg(4).

Phabric:	D549
Reviewed by:	glebius, thompsa
Approved by:	glebius
Obtained from:	OpenBSD
Sponsored by:	QNAP Systems Inc.
2014-09-18 02:12:48 +00:00
Bryan Drewery
5e93a4b46b If fgets(3) fails in getbounds(), show strerror(3) if not an EOF. Also fix
a FILE* leak in getbounds().

Submitted by:	Conrad Meyer <conrad.meyer@isilon.com>
PR:		192032
Sponsored by:	EMC / Isilon Storage Division
MFC after:	1 week
2014-09-17 19:09:58 +00:00
Bryan Venteicher
759e01ce9a Add DEF_CLONE_CMD_ARG2
This will be used in the forthcoming vxlan import.

Reviewed by:	gnn
Phabric:	https://reviews.freebsd.org/D382
2014-09-14 22:10:35 +00:00
Alexander Motin
959ec2581b Update CAM CCB accounting for the new status quo.
devq_openings counter lost its meaning after allocation queues has gone.
held counter is still meaningful, but problematic to update due to separate
locking of CCB allocation and queuing.

To fix that replace devq_openings counter with allocated counter.  held is
now calculated on request as difference between number of allocated, queued
and active CCBs.

MFC after:	1 month
2014-09-14 11:59:49 +00:00
Alexander V. Chernikov
b2100781b8 Do not try to read i2c info when no transceiver is present.
MFC with:	r270064
Sponsored by:	Yandex LLC
2014-09-13 16:04:55 +00:00
John Baldwin
7d8312cc92 Add a sysctl to export the EFI memory map along with a handler in the
sysctl(8) binary to format it.

Reviewed by:	emaste
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D771
2014-09-13 03:10:02 +00:00
John Baldwin
59101c5d95 Pass the length of an structure to the pretty-printer backends as a
size_t instead of an int.
2014-09-12 21:01:39 +00:00
Gleb Smirnoff
b249f3c575 Since r270929 raw sockets expect network byte order.
Submitted by:	avg
2014-09-11 05:48:39 +00:00
Hiroki Sato
adbc0311a3 Fix a bug which could break extended attributes in a dump output.
This occurred when a file was >892kB long and had a large data (>1kB)
in the extended attributes.

Reported by:	Masashi Toriumi
Reviewed by:	mckusick
2014-09-10 22:37:20 +00:00
Andrey V. Elsukov
5dbfa43f65 Add the ability to set `prefer_source' flag to an IPv6 address.
It affects the IPv6 source address selection algorithm (RFC 6724)
and allows override the last rule ("longest matching prefix") for
choosing among equivalent addresses. The address with `prefer_source'
will be preferred source address.

Obtained from:	Yandex LLC
MFC after:	1 month
Sponsored by:	Yandex LLC
2014-09-09 10:52:50 +00:00
Alexander V. Chernikov
d6164b77f8 Make ipfw_nat module use IP_FW3 codes.
Kernel changes:
* Split kernel/userland nat structures eliminating IPFW_INTERNAL hack.
* Add IP_FW_NAT44_* codes resemblin old ones.
* Assume that instances can be named (no kernel support currently).
* Use both UH+WLOCK locks for all configuration changes.
* Provide full ABI support for old sockopts.

Userland changes:
* Use IP_FW_NAT44_* codes for nat operations.
* Remove undocumented ability to show ranges of nat "log" entries.
2014-09-07 18:30:29 +00:00
Alexander V. Chernikov
1a33e79969 Change copyrights to the proper one. 2014-09-05 14:19:02 +00:00
Alexander V. Chernikov
7779879625 Return setsockopt() directly.
Suggested by:	Steven Hartland  at killing@multiplay.co.uk.
2014-09-05 13:56:05 +00:00
Alexander V. Chernikov
c9daea0b86 Sync to HEAD@r271160. 2014-09-05 13:52:39 +00:00