Commit Graph

6982 Commits

Author SHA1 Message Date
Ed Schouten
5111cde131 Add missing static keywords to global variables in camcontrol.
While there, make the vendor list const and add appropriate keywords to
functions that use this list.
2011-12-11 11:38:50 +00:00
Jean-Sébastien Pédron
409139f051 Support domain-search in dhclient(8)
The "domain-search" option (option 119) allows a DHCP server to publish
a list of implicit domain suffixes used during name lookup. This option
is described in RFC 3397.

For instance, if the domain-search option says:
    ".example.org .example.com"
and one wants to resolve "foobar", the resolver will try:
    1. "foobar.example.org"
    2. "foobar.example.com"

The file /etc/resolv.conf is updated with a "search" directive if the
DHCP server provides "domain-search".

A regression test suite is included in this patch under
tools/regression/sbin/dhclient.

PR:		bin/151940
Sponsored by	Yakaz (http://www.yakaz.com)
2011-12-04 14:44:31 +00:00
Ed Maste
2c418c0083 Restore comment with credit to Marc Frajola.
fwdownload.c is derived from Andre Albsmeier's fwdownload.c, which was
written from scratch but was inspired by Marc's original idea and code.
2011-12-02 15:47:05 +00:00
John Baldwin
0b6230f135 If the -d flag is specified, ignore any new values specified and only
display the descriptions of specified nodes.

Reported by:	Jason Hellenthal  jhell of dataix net
MFC after:	2 weeks
2011-12-01 15:01:23 +00:00
Xin LI
53f48302de Fix build. 2011-11-25 07:11:02 +00:00
Ed Maste
1f4782a4c1 Add firmware update support for SCSI devices.
Firmware can be reprogrammed on devices from Hitachi, HP, IBM, Plextor,
Quantum, and Seagate.  At least one device from each manufacturer has
been tested with some version of this code, and it has been used to
update thousands of drives so far.

The man page suggests having a backup of the drive's data, and the
operation must be confirmed, either interactively or on the command
line.  (This is the same as the confirmation on the format command.)

This work is largely derived from fwprog.c by Andre Albsmeier.

Submitted by:	Nima Misaghian
Sponsored by:	Sandvine Incorporated
MFC after:	3 months
2011-11-25 04:03:37 +00:00
Gleb Smirnoff
8d913bf8e8 Fix parsing of redirect_addr argument.
PR:		kern/162739
MFC after:	3 days
2011-11-23 18:38:08 +00:00
Warren Block
c05923c2a0 Correct and expand BSD partitioning scheme description.
Correct GUID to GPT in RECOVERING section.

Reviewed by:	ae
Approved by:	gjb (mentor)
MFC after:	1 week
2011-11-21 18:04:37 +00:00
Warren Block
292271d4c0 Fix date.
Approved by:	gjb (mentor)
MFC after:	1 week
2011-11-21 02:03:18 +00:00
Warren Block
97982fcc82 Add a section that explicitly describes partitioning schemes. Modify
existing sections to refer to the new one.  Rearrange partitioning scheme
list so MBR and EBR types are together.  Also add several corrections for
grammar, clarity, and consistency.

Approved by:	gjb (mentor)
MFC after:	1 week
2011-11-21 00:02:49 +00:00
Gleb Smirnoff
8d7813e7e9 For unknown reason, since rev 1.1 of ifconfig.c, sin_family isn't
set properly for the mask argument.

Since I'd like to improve argument sanity checking in kernel
side, in in_control(), fix this.
2011-11-19 19:06:08 +00:00
John Baldwin
840fb1c02b Finish making 'wcommitsize' an NFS client mount option.
Reviewed by:	rmacklem
MFC after:	1 week
2011-11-14 18:52:07 +00:00
Eitan Adler
c72006871d - new sentence should start on new line.
PR:		bin/146541
Submitted by:	bjk
Approved by:	bjk
2011-11-13 17:07:43 +00:00
Eitan Adler
3b6dc18ef5 - fix duplicate "a a" in some comments
Submitted by:	eadler
Approved by:	simon
MFC after:	3 days
2011-11-13 17:06:33 +00:00
Eitan Adler
745253594b - add "check" option to MD5 and friends to compare files against known hash.
PR:		bin/146541
Submitted by:	eadler
Reviewed by:	jhell@dataix.net
Approved by:	secteam (cperciva)
Approved by:	cperciva
MFC after:	3 weeks
2011-11-13 16:35:47 +00:00
Adrian Chadd
fab8a49218 Bump date. 2011-11-12 23:30:57 +00:00
Adrian Chadd
6edc611e9d Add documentation for the new quiet time IE options.
Submitted by:	Himali Patel <himali.patel@sibridgetech.com>
Sponsored by:	Sibridge Technologies
2011-11-12 23:17:01 +00:00
Alexander Motin
1446ecce65 Fix build on some archs after r227464. 2011-11-12 20:01:30 +00:00
Dimitry Andric
59cfaa640c Fix buildworld breakage due after r227464.
Pointy hat to:	mav
2011-11-12 19:45:56 +00:00
Alexander Motin
0c883cef45 Major GEOM MULTIPATH class rewrite:
- Improved locking and destruction process to fix crashes.
 - Improved "automatic" configuration method to make it consistent and safe
by reading metadata back from all specified paths after writing to one.
 - Added provider size check to reduce chance of ordering conflict with
other GEOM classes.
 - Added "manual" configuration method without using on-disk metadata.
 - Added "add" and "remove" commands to allow manage paths manually.
 - Failed paths are no longer dropped from geom, but only marked as FAIL
and excluded from I/O operations.
 - Automatically restore failed paths when all others paths are marked
as failed, for example, because of device-caused (not transport) errors.
 - Added "fail" and "restore" commands to manually control FAIL flag.
 - geom is now destroyed on last path disconnection.
 - Added optional Active/Active mode support. Unlike Active/Passive
mode, load evenly distributed between all working paths. If supported by
the device, it allows to significantly improve performance, utilizing
bandwidth of all paths. It is controlled by -A option during creation.
Disabled by default now.
 - Improved `status` and `list` commands output.

Sponsored by:	iXsystems, inc.
MFC after:	1 month
2011-11-12 09:52:27 +00:00
Xin LI
658029e0d8 Use __packed to prevent alignment from taking place, which otherwise may
change the on-disk format in an incompatible way.  Without this change,
msdosfs created on FreeBSD/arm would not be mountable.

PR:		bin/162486
Submitted by:	Ian Lepore <freebsd damnhippie dyndns org>
Reported by:	Mattia Rossi <mrossi at swin.edu.au>
MFC after:	3 days
2011-11-11 20:31:48 +00:00
Gleb Smirnoff
0809c540f4 Note that NAT instance argument can be tablearg.
PR:		misc/162265
Submitted by:	Paul Procacci <pprocacci gmail.com>
2011-11-10 12:05:26 +00:00
Ed Schouten
f44afd26af Remove trailing whitespace. 2011-11-09 21:01:50 +00:00
Adrian Chadd
dd21aaf873 Add quiet time element configuration support to ifconfig.
This allows a hostap to specify to a set of stations that they
should not transmit for a certain period of time after each
beacon interval has expired. This is used when searching for
radar pulses or general interference.

Submitted by:	Himali Patel <himali.patel@sibridgetech.com>
Sponsored by:	Sibridge Technologies
2011-11-08 14:22:40 +00:00
Andrey V. Elsukov
b06ce6855c Fix multi-line comment formatting.
MFC after:	2 weeks
2011-11-07 07:51:10 +00:00
Andrey V. Elsukov
39e9a28fdf Fix multi-line comment formatting.
Pointed by:	jh
MFC after:	1 week
2011-11-07 07:50:35 +00:00
Andrey V. Elsukov
fd1ca22afb Improve error reporting when MBR can not be written.
Remove obsolete code which uses DIOCSMBR ioctl.
When writing MBR first check that GEOM_MBR is available, if it is not
available, then try write MBR directly to provider. If both are failed,
then recommend to use gpart(8).

MFC after:	2 week
2011-11-07 06:24:35 +00:00
Andrey V. Elsukov
1b100fd31b Initialize "acc" value inside the loop to reset failed attempts.
PR:		misc/162262
MFC after:	3 days
2011-11-06 21:12:52 +00:00
Andrey V. Elsukov
99e57974a6 Add reference to gpart(8).
MFC after:	3 days
2011-11-06 20:39:35 +00:00
Andrey V. Elsukov
9a5e36b804 Add reference to gpart(8).
MFC after:	3 days
2011-11-06 20:38:27 +00:00
Andrey V. Elsukov
fd4bbf84f2 Add recommendation to use gpart(8) when user tries write disklabel
or bootcode to already opened provider.

MFC after:	1 week
2011-11-06 20:32:55 +00:00
Andrey V. Elsukov
b11075cdeb Remove unneeded checks.
MFC after:	1 week
2011-11-06 19:03:07 +00:00
Andrey V. Elsukov
982e6e69cd bsdlabel(8) could automatically fill many of disklabel's deprecated
fields, but user could specify some of those fields when edits disklabel
with `bsdlabel -e`. But without -A flag these fields might be
overwritten with default values from the virgin disklabel.
So, don't overwrite such fields if they are not zero. Also add checks
to prevent creating disklabel with less than DEFPARTITIONS and more
than MAXPARTITIONS partitions.

PR:		bin/162332
Tested by:	Eugene Grosbein
MFC after:	1 week
2011-11-06 18:59:42 +00:00
Andrey V. Elsukov
1fd45acda6 To be in sync with GEOM_PART_BSD limit the maximum number of supported
partitions to 20.

MFC after:	1 week
2011-11-06 17:30:32 +00:00
Ed Schouten
1efe3c6b58 Add missing static keywords for global variables to tools in sbin/.
These tools declare global variables without using the static keyword,
even though their use is limited to a single C-file, or without placing
an extern declaration of them in the proper header file.
2011-11-04 13:36:02 +00:00
John-Mark Gurney
21fa393279 remove trailing whitespace...
MFC after:	1 week
2011-10-29 17:30:57 +00:00
John-Mark Gurney
469a1218c0 error if /boot/mbr is empty... This can happen on a system like arm
that doesn't have a /boot/mbr, and you touch it to get past the previous
error message...

MFC after:	1 week
2011-10-29 17:28:59 +00:00
Pawel Jakub Dawidek
0ebcf9e6cb Remove redundant space.
MFC after:	3 days
2011-10-27 20:36:35 +00:00
Pawel Jakub Dawidek
07ebc3626e Implement 'async' mode for HAST.
MFC after:	3 days
2011-10-27 20:32:57 +00:00
Pawel Jakub Dawidek
3f5bce1822 Minor cleanups.
MFC after:	3 days
2011-10-27 20:15:37 +00:00
Pawel Jakub Dawidek
43b8675beb Reduce indentation.
MFC after:	3 days
2011-10-27 20:13:39 +00:00
Pawel Jakub Dawidek
5a58d22a84 Improve comment so it doesn't suggest race is possible, but that we handle
the race.

MFC after:	3 days
2011-10-27 20:10:21 +00:00
Pawel Jakub Dawidek
949350bb1f - Eliminate the need for hio_nv.
- Introduce hio_clear() function for clearing hio before returning it
  onto free queue.

MFC after:	3 days
2011-10-27 20:01:23 +00:00
Pawel Jakub Dawidek
1212a85c4a Monor cleanups.
MFC after:	3 days
2011-10-27 18:49:16 +00:00
Pawel Jakub Dawidek
8a34134ac2 Delay resuid generation until first connection to secondary, not until first
write. This way on first connection we will synchronize only the extents that
were modified during the lifetime of primary node, not entire GEOM provider.

MFC after:	3 days
2011-10-27 18:45:01 +00:00
Pawel Jakub Dawidek
982369192e Correct comments.
MFC after:	3 days
2011-10-27 16:22:17 +00:00
Alexander Motin
733a1f3f52 Clarify disks/volumes above 2TiB support in geom_raid:
- add support for volumes above 2TiB with Promise metadata format;
 - enforse and document other limitations:
   - Intel and Promise metadata formats do not support disks above 2TiB;
   - NVIDIA metadata format does not support volumes above 2TiB.

Sponsored by:	iXsystems, Inc.
MFC after:	2 weeks
2011-10-26 21:50:10 +00:00
Hiroki Sato
0321b694c7 - Add support for a "!" character in regex matching in devd(8). It inverts
the logic (true/false) of the matching.

- Add "!usbus[0-9]+" to IFNET ATTACH notification handler in the default
  devd.conf to prevent rc.d/netif from running when usbus[0-9]+ is attached.

Reviewed by:	imp
2011-10-26 02:11:28 +00:00
Ed Schouten
ce458f4239 Build swapon with WARNS=6.
Don't use a variable called stat, because it collides with stat(2).
2011-10-25 17:10:15 +00:00
Pawel Jakub Dawidek
1f8c92e6fa Add support for creating GELI devices with older metadata version for use
with older FreeBSD versions:
- Add -V option to 'geli init' to specify version number. If no -V is given
  the most recent version is used.
- If -V is given don't allow to use features not supported by this version.
- Print version in 'geli list' output.
- Update manual page and add table describing which GELI version is
  supported by which FreeBSD version, so one can use it when preparing GELI
  device for older FreeBSD version.

Inspired by:	Garrett Cooper <yanegomi@gmail.com>
MFC after:	3 days
2011-10-25 13:57:50 +00:00
Pawel Jakub Dawidek
74ef73007a Revert r226726. The line was not duplicated.
Spotted by:	pluknet
MFC after:	3 days
2011-10-25 13:49:48 +00:00
Pawel Jakub Dawidek
bf5ad81592 Remove duplicated line.
MFC after:	3 days
2011-10-25 12:26:19 +00:00
Pawel Jakub Dawidek
ef055009c2 Add 'geli version' subcommand, which will print GELI metadata version of each
given GEOM provider or if not providers are given it will print versions
supported by userland geli(8) utility and by ELI GEOM class.

MFC after:	3 days
2011-10-25 08:03:51 +00:00
Pawel Jakub Dawidek
3bddbd0f3b When we detect GELI metadata version that is newer than the highest we
support, inform the user about that instead of 'MD5 hash mismatch'.

Suggested by:	Garrett Cooper <yanegomi@gmail.com>
MFC after:	3 days
2011-10-25 07:56:27 +00:00
Pawel Jakub Dawidek
79e6fcac83 Simplify eli_resize() function.
MFC after:	3 days
2011-10-25 07:44:10 +00:00
Pawel Jakub Dawidek
f1a465000f Simplify eli_dump() function and allow to dump metadata stored in backup file.
MFC after:	3 days
2011-10-25 07:37:02 +00:00
Pawel Jakub Dawidek
275ae453d6 If 'req' is NULL, print error on stderr.
MFC after:	3 days
2011-10-25 07:34:35 +00:00
Pawel Jakub Dawidek
c99a654256 Simplify eli_is_attached() function and make it return boot instead of int.
MFC after:	3 days
2011-10-25 07:32:43 +00:00
Pawel Jakub Dawidek
34c4866250 Simplify eli_backup_create() and eli_backup_restore() functions.
As a side-effect it is now possible to backup unsupported (newer)
GELI metadata versions.

MFC after:	3 days
2011-10-25 07:31:13 +00:00
Pawel Jakub Dawidek
3ab01ecf56 Sort includes.
MFC after:	3 days
2011-10-25 07:24:51 +00:00
Maxim Sobolev
633d2bc579 Add new option -F to specify alternative location of the /etc/fstab
file.

MFC after:	1 month
2011-10-25 01:47:33 +00:00
Maxim Sobolev
f2104fc0ad Add new option -c to specify alternatve location of the /etc/fstab
file.

MFC after:	1 month
2011-10-25 01:46:42 +00:00
Kirk McKusick
23ad9069cb The current /etc/dumpdates file restricts device names to 32 characters.
With the addition of various GEOM layers some device names now exceed
this length, for example /dev/mirror/encrypted.elig.journal. This
change expands the field to 53 bytes which brings the /etc/dumpdates
lines to 80 characters. Exceeding 80 characters makes the /etc/dumpdates
file much less human readable. A test is added to dump so that it
verifies that the device name will fit in the 53 character field
failing the dump if it is too long.

This change has been checked to verify that its /etc/dumpdates file
is compatible with older versions of dump.

Reported by: Martin Sugioarto <martin@sugioarto.com>
PR:          kern/160678
MFC after:   3 weeks
2011-10-18 18:42:26 +00:00
Pawel Jakub Dawidek
bd738d630c Allow to specify pidfile in HAST configuration file.
MFC after:	1 week
2011-10-17 12:22:09 +00:00
Pawel Jakub Dawidek
89da1a23cd Remove redundant space.
MFC after:	1 week
2011-10-17 09:59:04 +00:00
Pawel Jakub Dawidek
6fea20e297 When path to the configuration file is relative, obtain full path,
so we can always find the file, even after daemonizing and changing
working directory to /.

MFC after:	1 week
2011-10-17 09:54:07 +00:00
Olivier Houchard
10f94f86f5 Unbreak NO_DYNAMICROOT by explicitely linking to libcrypto if MK_OPENSSL isn't
set to no, as libbsnmp needs it.
2011-10-16 16:58:28 +00:00
Eitan Adler
36daf0495a - change "is is" to "is" or "it is"
- change "the the" to "the"

Approved by:	lstewart
Approved by:	sahil (mentor)
MFC after:	3 days
2011-10-16 14:30:28 +00:00
Dag-Erling Smørgrav
23f39c906b Make dhclient use a pid file. Modify the rc script accordingly; while
there, clean it up and add some error checks.

Glanced at by:	brooks@
MFC after:	3 weeks
2011-10-13 17:20:45 +00:00
Kirk McKusick
8ee53ea3a1 After creating a filesystem using newfs -j the time stamps are all
zero and thus report as having been made in January 1970. Apart
from looking a bit silly, it also triggers alarms from scripts
that detect weird time stamps. This update sets all 4 (or 3, in
the case of UFS1) time stamps to the current time when enabling
journaling during newfs or later when enabling it with tunefs.

Reported by: Hans Ottevanger <hans@beastielabs.net>
MFC after:   1 week
2011-10-11 19:03:57 +00:00
Craig Rodrigues
8d1a3b6998 Add a "kern.features.ata_cam" sysctl in the kernel when the ATA_CAM kernel
option is defined.  This sysctl can be queried by feature_present(3).

Query for this feature in /sbin/atacontrol and /usr/sbin/burncd.
If these utilities detect that ATA_CAM is enabled, then these utilities
will error out.  These utilities are compatible with the old ATA
driver, but are incomptible with the new ATA_CAM driver.  By erroring out,
we give end-users an idea as to what remedies to use, and reduce the need for them
to file PR's.  For atacontrol, camcontrol must be used instead,
and for burncd, alternative utilties from the ports collection must be used
such as sysutils/cdrtools.

In future, maybe someone can re-write burncd to work with ATA_CAM,
but at least for now, we give a somewhat useful error message to end users.

PR:		160979
Reviewed by:	jh, Arnaud Lacombe <lacombar at gmail dot com>
Reported by:	Joe Barbish <fbsd8 at a1poweruser dot com>
MFC after:	3 days
2011-10-09 21:42:02 +00:00
Kenneth D. Merry
1cc052e80f Add descriptor sense support to CAM, and honor sense residuals properly in
CAM.

Desriptor sense is a new sense data format that originated in SPC-3.  Among
other things, it allows for an 8-byte info field, which is necessary to
pass back block numbers larger than 4 bytes.

This change adds a number of new functions to scsi_all.c (and therefore
libcam) that abstract out most access to sense data.

This includes a bump of CAM_VERSION, because the CCB ABI has changed.
Userland programs that use the CAM pass(4) driver will need to be
recompiled.

camcontrol.c:	Change uses of scsi_extract_sense() to use
		scsi_extract_sense_len().

		Use scsi_get_sks() instead of accessing sense key specific
		data directly.

scsi_modes:	Update the control mode page to the latest version (SPC-4).

scsi_cmds.c,
scsi_target.c:	Change references to struct scsi_sense_data to struct
		scsi_sense_data_fixed.  This should be changed to allow the
		user to specify fixed or descriptor sense, and then use
		scsi_set_sense_data() to build the sense data.

ps3cdrom.c:	Use scsi_set_sense_data() instead of setting sense data
		manually.

cam_periph.c:	Use scsi_extract_sense_len() instead of using
		scsi_extract_sense() or accessing sense data directly.

cam_ccb.h:	Bump the CAM_VERSION from 0x15 to 0x16.  The change of
		struct scsi_sense_data from 32 to 252 bytes changes the
		size of struct ccb_scsiio, but not the size of union ccb.
		So the version must be bumped to prevent structure
		mis-matches.

scsi_all.h:	Lots of updated SCSI sense data and other structures.

		Add function prototypes for the new sense data functions.

		Take out the inline implementation of scsi_extract_sense().
		It is now too large to put in a header file.

		Add macros to calculate whether fields are present and
		filled in fixed and descriptor sense data

scsi_all.c:	In scsi_op_desc(), allow the user to pass in NULL inquiry
		data, and we'll assume a direct access device in that case.

		Changed the SCSI RESERVED sense key name and description
		to COMPLETED, as it is now defined in the spec.

		Change the error recovery action for a number of read errors
		to prevent lots of retries when the drive has said that the
		block isn't accessible.  This speeds up reconstruction of
		the block by any RAID software running on top of the drive
		(e.g. ZFS).

		In scsi_sense_desc(), allow for invalid sense key numbers.
		This allows calling this routine without checking the input
		values first.

		Change scsi_error_action() to use scsi_extract_sense_len(),
		and handle things when invalid asc/ascq values are
		encountered.

		Add a new routine, scsi_desc_iterate(), that will call the
		supplied function for every descriptor in descriptor format
		sense data.

		Add scsi_set_sense_data(), and scsi_set_sense_data_va(),
		which build descriptor and fixed format sense data.  They
		currently default to fixed format sense data.

		Add a number of scsi_get_*() functions, which get different
		types of sense data fields from either fixed or descriptor
		format sense data, if the data is present.

		Add a number of scsi_*_sbuf() functions, which print
		formatted versions of various sense data fields.  These
		functions work for either fixed or descriptor sense.

		Add a number of scsi_sense_*_sbuf() functions, which have a
		standard calling interface and print the indicated field.
		These functions take descriptors only.

		Add scsi_sense_desc_sbuf(), which will print a formatted
		version of the given sense descriptor.

		Pull out a majority of the scsi_sense_sbuf() function and
		put it into scsi_sense_only_sbuf().  This allows callers
		that don't use struct ccb_scsiio to easily utilize the
		printing routines.  Revamp that function to handle
		descriptor sense and use the new sense fetching and
		printing routines.

		Move scsi_extract_sense() into scsi_all.c, and implement it
		in terms of the new function, scsi_extract_sense_len().
		The _len() version takes a length (which should be the
		sense length - residual) and can indicate which fields are
		present and valid in the sense data.

		Add a couple of new scsi_get_*() routines to get the sense
		key, asc, and ascq only.

mly.c:		Rename struct scsi_sense_data to struct
		scsi_sense_data_fixed.

sbp_targ.c:	Use the new sense fetching routines to get sense data
		instead of accessing it directly.

sbp.c:		Change the firewire/SCSI sense data transformation code to
		use struct scsi_sense_data_fixed instead of struct
		scsi_sense_data.  This should be changed later to use
		scsi_set_sense_data().

ciss.c:		Calculate the sense residual properly.  Use
		scsi_get_sense_key() to fetch the sense key.

mps_sas.c,
mpt_cam.c:	Set the sense residual properly.

iir.c:		Use scsi_set_sense_data() instead of building sense data by
		hand.

iscsi_subr.c:	Use scsi_extract_sense_len() instead of grabbing sense data
		directly.

umass.c:	Use scsi_set_sense_data() to build sense data.

		Grab the sense key using scsi_get_sense_key().

		Calculate the sense residual properly.

isp_freebsd.h:	Use scsi_get_*() routines to grab asc, ascq, and sense key
		values.

		Calculate and set the sense residual.

MFC after:	3 days
Sponsored by:	Spectra Logic Corporation
2011-10-03 20:32:55 +00:00
Ed Schouten
9f365aa1d6 Get rid of major/minor number distinction.
As of FreeBSD 6, devices can only be opened through devfs. These device
nodes don't have major and minor numbers anymore. The st_rdev field in
struct stat is simply based a copy of st_ino.

Simply display device numbers as hexadecimal, using "%#jx". This is
allowed by POSIX, since it explicitly states things like the following
(example taken from ls(1)):

	"If the file is a character special or block special file, the
	size of the file may be replaced with implementation-defined
	information associated with the device in question."

This makes the output of these commands more compact. For example, ls(1)
now uses approximately four columns less. While there, simplify the
column length calculation from ls(1) by calling snprintf() with a NULL
buffer.

Don't be afraid; if needed one can still obtain individual major/minor
numbers using stat(1).
2011-09-28 18:53:36 +00:00
Pawel Jakub Dawidek
e3feec94eb Correct typo.
MFC after:	3 days
2011-09-28 13:25:27 +00:00
Pawel Jakub Dawidek
12daf727f6 If the underlying provider doesn't support BIO_FLUSH, log it only once
and don't bother trying in the future.

MFC after:	3 days
2011-09-28 13:19:47 +00:00
Pawel Jakub Dawidek
39852ce89e Break a bit earlier.
MFC after:	3 days
2011-09-28 13:13:43 +00:00
Pawel Jakub Dawidek
518dd4c0d9 After every activemap change flush disk's write cache, so that write
reordering won't make the actual write to be committed before marking
the coresponding extent as dirty.

It can be disabled in configuration file.

If BIO_FLUSH is not supported by the underlying file system we log a warning
and never send BIO_FLUSH again to that GEOM provider.

MFC after:	3 days
2011-09-28 13:08:51 +00:00
Pawel Jakub Dawidek
adf8002bac Use PJDLOG_ASSERT() and PJDLOG_ABORT() everywhere instead of assert().
MFC after:	3 days
2011-09-27 08:50:37 +00:00
Pawel Jakub Dawidek
be1143efb9 No need to wrap pjdlog functions around with KEEP_ERRNO() macro.
MFC after:	3 days
2011-09-27 08:26:09 +00:00
Pawel Jakub Dawidek
00bddd18b3 Prefer PJDLOG_ASSERT()/PJDLOG_ABORT() over assert().
MFC after:	3 days
2011-09-27 08:21:00 +00:00
Pawel Jakub Dawidek
7f46e21d82 - Convert some impossible conditions into assertions.
- Add missing 'if' in comment.

MFC after:	3 days
2011-09-27 08:04:01 +00:00
Pawel Jakub Dawidek
09c2e8431a Correct two mistakes when converting asserts to PJDLOG_ASSERT()/PJDLOG_ABORT().
MFC after:	3 days
2011-09-27 07:59:10 +00:00
Pawel Jakub Dawidek
571fdd7e47 Prefer PJDLOG_ASSERT() and PJDLOG_ABORT() over assert() and abort().
pjdlog versions will log problem to syslog when application is running in
background.

MFC after:	3 days
2011-09-27 07:57:15 +00:00
Pawel Jakub Dawidek
1ebc0407fc No need to use KEEP_ERRNO() macro around pjdlog functions, as they don't
modify errno.

MFC after:	3 days
2011-09-27 07:52:39 +00:00
Pawel Jakub Dawidek
80c9ebc27e Ensure that pjdlog functions don't modify errno.
MFC after:	3 days
2011-09-27 06:43:51 +00:00
Hiroki Sato
5ed6597742 - Document inet6 no_radr flag.
- Add descriptions of sysctl(8) variables which can control the default
  configuration of the inet6 flags.

Approved by:	re (kib)
2011-09-19 16:01:53 +00:00
Konstantin Belousov
e50e74d8aa Do not try to change the mode or ownership of the root of the mountpoint
when newly established mdmfs mount is readonly.

PR:	bin/128427
Tested and reviewed by:	jchandra
MFC after:	1 week
Approved by:	re (bz)
2011-09-13 20:16:11 +00:00
Andrey V. Elsukov
6a0a87741b Don't use the whole free space when resizing partition to a larger size
on a disk with non zero stripesize (e.g. disks with 4k sector size)[1].
Also do not use automatic alignment when size is exactly specified, but
an alignment is not. Use automatic alignment only for case when user
omits both "-s" and "-a" options.

Reported by:	Mikael Fridh <frimik at gmail> [1]
Approved by:	re (kib)
MFC after:	1 week
2011-09-08 04:14:16 +00:00
Konstantin Belousov
bf6619ba88 dd -t switch for mdmfs to enable TRIM on the configured filesystem.
While there, fix minor style issues.

Submitted by:	Alex Kozlov <spam rm-rf kiev ua>
MFC after:	1 week
Approved by:	re (bz)
2011-09-06 10:19:01 +00:00
Dag-Erling Smørgrav
1d449f95f2 Forgot this nit in r221107.
Approved by:	re (kib)
2011-09-03 03:12:33 +00:00
John Baldwin
d2e17ce906 Clear the mountprog variable after each mountfs() call so that mountprog
options don't leak over into subsequent mounts listed in /etc/fstab.
While here, fix a memory leak in debug mode.

Reported by:	rank1seeker @ gmail
Approved by:	re (kib)
MFC after:	1 week
2011-09-02 17:11:59 +00:00
Xin LI
fdc61a888d Fix the check in dircheck() on namlen.
The value of namlen is copied from on-disk d_namlen, which is a 8-bit
unsigned integer which can never exceed MAXNAMLEN (255) so the test is
always true.  Moreover, UFS does not allow d_namelen being zero.

Change namlen from u_int to u_int8_t, and replace the unneeded test
with a useful test.

PR:		bin/160339
Submitted by:	Eugene Grosbein <eugen grosbein.pp.ru>
MFC after:	2 weeks
Approved by:	re (kib)
2011-09-02 17:05:34 +00:00
Bjoern A. Zeeb
8a006adb24 Add support for IPv6 to ipfw fwd:
Distinguish IPv4 and IPv6 addresses and optional port numbers in
user space to set the option for the correct protocol family.
Add support in the kernel for carrying the new IPv6 destination
address and port.
Add support to TCP and UDP for IPv6 and fix UDP IPv4 to not change
the address in the IP header.
Add support for IPv6 forwarding to a non-local destination.
Add a regession test uitilizing VIMAGE to check all 20 possible
combinations I could think of.

Obtained from:	David Dolson at Sandvine Incorporated
		(original version for ipfw fwd IPv6 support)
Sponsored by:	Sandvine Incorporated
PR:		bin/117214
MFC after:	4 weeks
Approved by:	re (kib)
2011-08-20 17:05:11 +00:00
Andrey V. Elsukov
25b233372d o Fix mdoc formatting for the '.Fx' macro. [1]
o Add information about APM scheme and fix typos. [2]

Submitted by:	gjb [1], nwhitehorn [2]
Approved by:	re (kib)
MFC after:	1 week
2011-08-20 08:20:10 +00:00
Alexander Motin
bda13729a4 Fix WWN printing in camcontrol identify output.
Approved by:	re (kib)
MFC after:	1 week
2011-08-19 21:33:46 +00:00
Andrey V. Elsukov
6bfcd9c37b The decimal() function was changed in r217808 to take the
maximum value instead of number of bits. But for case when
limitation is not needed it erroneously skips conversion to
number and always returns zero. So, don't skip conversion
for case when limitation is not needed.

PR:		bin/159765
Approved by:	re (kib)
2011-08-19 12:48:06 +00:00
Andrey V. Elsukov
15d837d8a0 Add new section "BOOTSTRAPPING" to the gpart(8), that describes
bootstrap code images used to boot from MBR, GPT, BSD and VTOC8
schemes.

Reviewed by:	marius (previous version)
Approved by:	re (kib)
MFC after:	1 week
2011-08-19 10:12:02 +00:00
John Baldwin
e89359c21e Fix a regression where a rule containing a source port option after a
destination IP would incorrectly display the source port as a destination
port.

Reviewed by:	luigi
Approved by:	re (kib)
MFC after:	1 week
2011-08-17 14:39:45 +00:00
Doug Barton
7fab6043a0 Gavin documented these alternate options in good faith in r222751
based on the patch in the PR, however he was unaware that they were
undocumented intentionally. This patch moves the information about
these alternates into a comment which also explains why they are
undocumented.

Approved by:	re (hrs)
2011-08-06 09:13:09 +00:00
Kirk McKusick
fddf7baebe Update to -r224294 to ensure that only one of MNT_SUJ or MNT_SOFTDEP
is set so that mount can revert back to using MNT_NOWAIT when doing
getmntinfo.

Approved by: re (kib)
2011-07-30 00:43:18 +00:00
Kirk McKusick
d716efa9f7 Move the MNTK_SUJ flag in mnt_kern_flag to MNT_SUJ in mnt_flag
so that it is visible to userland programs. This change enables
the `mount' command with no arguments to be able to show if a
filesystem is mounted using journaled soft updates as opposed
to just normal soft updates.

Approved by: re (bz)
2011-07-24 18:27:09 +00:00
Adrian Chadd
2168aaa506 This patch removes a check in ifconfig which disables HT/40 channels
on frequency bands with DFS. All Atheros chipsets >= AR9001 support
radar event detection on HT40 extension channels.

This should be a chipset specific item rather than enforced in the
regulatory domain database.

In addition, it's irrelevant for STA mode, as the radar detection is
done by the access point, not the STA.

Approved by:	re (kib)
2011-07-20 05:59:28 +00:00
Adrian Chadd
2ad10b365c This patch enables listing DFS related flags when 'ifconfig -v wlanX
list channel' is run. The following new options are introduced:

* D: channel requires DFS
* R: channel has a radar event
* I: channel has detected inteference
* C: the CAC period has completed on a channel that requires it (ie,
  DFS + PASSIVE.)

It's relevant for developing, debugging and using the DFS and
interference options.

Approved by:	re (bz)
2011-07-19 15:22:35 +00:00
Bjoern A. Zeeb
ad2571a225 If compiling RESCUE always ignore feature_present(3) calls so that
a /rescue/ifconfig more modern than the kernel could still configure
IPv4 or IPv6 addresses.

Reported by:	Andrzej Tobola (ato iem.pw.edu.pl)
Reported by:	gcooper
MFC after:	1 day
X-MFC:		will not MFC any time soon, just reminder for r222527
2011-07-18 10:29:16 +00:00
Ryan Stone
f9373bbdac The MBR uses a 32-bit unsigned integer to store the size of a slice, but
fdisk(1) internally uses a signed int.  Should a user attempt to specify
a slice containing more than 2^31 - 1 sectors, an error will be reported
on systems with sizeof(long) == 4 and the slice size will be silently
truncated on systems with sizeof(long) > 4.

Instead use an unsigned long to store the slice size in fdisk(1).  This
allows the user to specify a slice size up to the maximum permitted by
the MBR on-disk format and does not have any problems with silent
truncation should the use specify an slice size larger than 2^32 on systems
with sizeof(long) > 4.

Submitted by:	Mark Johnston (markjdb AT gmail DOT com)
MFC after:	2 weeks
2011-07-17 21:08:16 +00:00
Kirk McKusick
d2404f0470 Break out the pass 5 inode and block map updating into a separate function
so that the function can be used by the journaling soft updates recovery.
2011-07-15 15:43:40 +00:00
Kirk McKusick
80bbaeb540 When using -A option (unmount all mounted filesystems), do not attempt
to unmount /dev as it will always fail.
2011-07-14 20:17:05 +00:00
Xin LI
ef84bb4cd7 Use _PATH_DEV and make the format more consistent with GEOM_LABEL.
Submitted by:	ivoras
2011-07-14 17:43:23 +00:00
Xin LI
e293d08775 Add a -l option to show file system's corresponding /dev/ufsid path.
This is useful for scripts that converts existing system's fstab to
use their /dev/ufsid devices.

MFC after:	2 weeks
2011-07-14 08:06:03 +00:00
Glen Barber
a9cf8de239 Remove trailing whitespace in the shutdown(8) manual.
MFC after:	 1 week
2011-07-14 03:08:10 +00:00
Glen Barber
54d3d7c01c Improvements to the shutdown(8) manual.
PR:		158807
Submitted by:	arundel
MFC after:	1 week
2011-07-14 02:41:45 +00:00
Mikolaj Golub
1332d29cbc When exiting with error because of an invalid command line argument
use errx(3), not err(3), and the exit code from sysexits(3).

Approved by:	pjd (mentor)
2011-07-13 05:56:51 +00:00
Mikolaj Golub
adca96f861 Fix indentation.
Approved by:	pjd (mentor)
2011-07-13 05:32:55 +00:00
Andrey V. Elsukov
20ddb07906 Use NULL instead of 0 for third argument of sigaction(2).
Pointed by:	kib
MFC after:	2 weeks
2011-07-12 10:07:07 +00:00
Andrey V. Elsukov
40be4bee6f Add SIGINFO handler.
Reviewed by:	kib
Obtained from:	NetBSD (partly)
MFC after:	2 weeks
2011-07-12 09:03:38 +00:00
Mikolaj Golub
0687d71e40 Remove useless initialization.
Approved by:	pjd (mentor)
MFC after:	3 days
2011-07-05 06:12:28 +00:00
Bjoern A. Zeeb
35fd7bc020 Add infrastructure to allow all frames/packets received on an interface
to be assigned to a non-default FIB instance.

You may need to recompile world or ports due to the change of struct ifnet.

Submitted by:	cjsp
Submitted by:	Alexander V. Chernikov (melifaro ipfw.ru)
		(original versions)
Reviewed by:	julian
Reviewed by:	Alexander V. Chernikov (melifaro ipfw.ru)
MFC after:	2 weeks
X-MFC:		use spare in struct ifnet
2011-07-03 12:22:02 +00:00
Sergey Matveychuk
606b32f64c Fix a typo.
Approved by:	kib
2011-07-01 19:22:27 +00:00
Jeff Roberson
85e9da38fe - Handle the JOP_SYNC case as appropriate.
Reported by:	pho
2011-06-30 05:28:10 +00:00
Andrey V. Elsukov
9527ec6e52 Add new rule actions "call" and "return" to ipfw. They make
possible to organize subroutines with rules.

The "call" action saves the current rule number in the internal
stack and rules processing continues from the first rule with
specified number (similar to skipto action). If later a rule with
"return" action is encountered, the processing returns to the first
rule with number of "call" rule saved in the stack plus one or higher.

Submitted by:	Vadim Goncharov
Discussed by:	ipfw@, luigi@
2011-06-29 10:06:58 +00:00
Andrey V. Elsukov
0dba401da6 Improve error reporting. Use corresponding error message when file to be
preprocessed is missing. Also suggest to use absolute pathname if -p option
is specified.

PR:             bin/156653
MFC after:      2 weeks
2011-06-29 06:45:44 +00:00
Mikolaj Golub
d9f039e0b3 Check the returned value of activemap_write_complete() and update matadata on
disk if needed. This should fix a potential case when extents are cleared in
activemap but metadata is not updated on disk.

Suggested by:	pjd
Approved by:	pjd (mentor)
2011-06-28 21:01:32 +00:00
Mikolaj Golub
aa64b2f494 Make activemap_write_start/complete check the keepdirty list, when
stating if we need to update activemap on disk. This makes keepdirty
serve its purpose -- to reduce number of metadata updates.

Discussed with:	pjd
Approved by:	pjd (mentor)
2011-06-28 20:57:54 +00:00
Edward Tomasz Napierala
8857bdbc59 Revert the mechanical change from 'file system' to 'filesystem', committed
in r223429.  As bde@ pointed out, it was mostly backwards.
2011-06-28 19:59:46 +00:00
Bjoern A. Zeeb
e0bfbfce79 Update packet filter (pf) code to OpenBSD 4.5.
You need to update userland (world and ports) tools
to be in sync with the kernel.

Submitted by:	mlaier
Submitted by:	eri
2011-06-28 11:57:25 +00:00
Pawel Jakub Dawidek
a6de1e5c85 Compile hastd and hastctl with capsicum support.
X-MFC after:	capsicum merge
2011-06-27 09:15:41 +00:00
Pawel Jakub Dawidek
699b26bdce Compile capsicum support only if HAVE_CAPSICUM is defined.
MFC after:	3 days
2011-06-27 09:14:25 +00:00
Pawel Jakub Dawidek
133d75ed18 Log a warning if we cannot sandbox using capsicum, but only under debug level 1.
It would be too noisy to log it as a proper warning as CAPABILITIES are not
compiled into GENERIC by default.

MFC after:	3 days
2011-06-27 09:10:48 +00:00
Gleb Smirnoff
6ca60beb25 Actually, if code had followed style(9), there would be less stupid errors
like the one fixed in r223416.

Noticed by:	julian
2011-06-24 12:55:16 +00:00
Kevin Lo
ecd9e552d0 Remove duplicated header files 2011-06-24 07:29:04 +00:00
Edward Tomasz Napierala
89d8548ce6 Advertise growfs(8) a little better. 2011-06-22 18:02:28 +00:00
Edward Tomasz Napierala
b2168df843 Cosmetic fixes; mostly s/file system/filesystem/g and removing weird indent
from messages.
2011-06-22 17:59:53 +00:00
Gleb Smirnoff
0103912db8 One more braino from me.
Pointy hat to:	glebius
Submitted by:	Alexander V. Chernikov <melifaro ipfw.ru>
2011-06-22 08:20:01 +00:00
Andrey V. Elsukov
8fb2868c61 When user specifies the bootcode with size smaller than VTOC_BOOTCODE,
gpart_write_partcode_vtoc8 does access out of range of allocated memory.
Check size of bootcode before writing it.

Pointed out by:		ru
MFC after:		1 week
2011-06-21 10:35:20 +00:00
Xin LI
4c82b916fc Mod the offset padding by alignment. Without this change we may
pad too much when underlying GEOM object have a zero stripesize.

MFC after:	1 month
2011-06-21 04:46:00 +00:00
Andrey V. Elsukov
621f3e6d9c The "size" param needs no adjusting to stripeoffset.
Reported by:	Kris Moore
2011-06-21 04:06:39 +00:00
Pawel Jakub Dawidek
7fc6a8aef6 Correct subcommand name 'unset' -> 'unscript'. 2011-06-18 22:32:55 +00:00
Ben Laurie
5f301949ef Fix clang warnings.
Approved by:	philip (mentor)
2011-06-18 13:56:33 +00:00
Gleb Smirnoff
ce97208218 - Fix my braino in the 220835, when I used strtok(). It isn't
applicable here, since modifies the string. Switch to strchr().
- Restore support for undocumented optional parameters of
  redir_port and redir_proto, that were disabled in 220835.
- While here, change !isalpha() checks on optinal parameters
  for isdigit().

Submitted by:	Alexander V. Chernikov <melifaro ipfw.ru>
PR:		kern/143653
2011-06-17 12:12:52 +00:00
Mikolaj Golub
ba2a822490 In HAST we use two sockets - one for only sending the data and one for
only receiving the data. In r220271 the unused directions were
disabled using shutdown(2).

Unfortunately, this broke automatic receive buffer sizing, which
currently works only for connections in ETASBLISHED state. It was a
root cause of the issue reported by users, when connection between
primary and secondary could get stuck.

Disable the code introduced in r220271 until the issue with automatic
buffer sizing is not resolved.

Reported by:	Daniel Kalchev <daniel@digsys.bg>, danger, sobomax
Tested by:	Daniel Kalchev <daniel@digsys.bg>, danger
Approved by:	pjd (mentor)
MFC after:	1 week
2011-06-17 07:07:26 +00:00
Andrey V. Elsukov
beeca17d4c Add "alignment" param to the request before calling gpart_autofill(). 2011-06-16 19:42:03 +00:00
Maxim Sobolev
e0455434b4 Revert r222688.
Requested by:	Mikolaj Golub
2011-06-16 08:31:06 +00:00
Justin T. Gibbs
3501942bbe Lay groundwork in CAM for recording and reporting physical path and
other device attributes stored in the CAM Existing Device Table (EDT).
This includes some infrastructure requried by the enclosure services
driver to export physical path information.

Make the CAM device advanced info interface accept store requests.

  sys/cam/scsi/scsi_all.c:
  sys/cam/scsi/scsi_all.h:
	- Replace scsi_get_sas_addr() with a scsi_get_devid() which takes
	  a callback that decides whether to accept a particular descriptor.
	  Provide callbacks for NAA IEEE Registered addresses and for SAS
	  addresses, replacing the old function.  This is needed because
	  the old function doesn't work for an enclosure address for a SAS
	  device, which is not flagged as a SAS address, but is NAA IEEE
	  Registered.  It may be worthwhile merging this interface with the
	  devid match interface.
	- Add a few more defines for some device ID fields.

  sbin/camcontrol/camcontrol.c:
	- Update for the CCB_DEV_ADVINFO interface change.

  cam/cam_xpt_internal.h:
	- Add the new fields for the physical path string to the CAM EDT.
  cam/cam_ccb.h:
	- Rename CCB_GDEV_ADVINFO to simply CCB_DEV_ADVINFO, and the ccb
	  structure to ccb_dev_advinfo.
	- Add a flag that changes this CCB's action to store, rather than
	  the default, retrieve.
	- Add a new buffer type, CDAI_TYPE_PHYS_PATH, for the new CAM EDT
	  physpath field.
	- Remove the never-implemented transport & proto flags.
  cam/cam_xpt.c:
  cam/cam_xpt.h:
	- Add xpt_getattr(), which provides a wrapper for fetching a device's
	  attribute using the GEOM strings as key.  This method currently
	  supports "GEOM::ident" and "GEOM::physpath".

Submitted by: will
Reviewed by : gibbs

Extend the XPT_DEV_MATCH api to allow a device search by device ID.
As far as the API is concerned, device ID is a binary blob to be
interpreted by the transport layer.  The SCSI implementation assumes
it is an array of VPD device ID descriptors.

  sys/cam/cam_ccb.h:
	Create a new structure, device_id_match_pattern, and
	update the XPT_DEV_MATCH datastructures and flags so
	that this pattern type can be used.

  sys/cam/cam_xpt.c:
	- A single pattern matching on both inquiry data and device
	  ID is invalid.  Report any violators.
	- Pass device ID match requests through to the new routine
	  scsi_devid_match().  The direct call of a SCSI routine is
	  a layering violation, but no worse than the one a few
	  lines up that checks inquiry data.  Defer cleaning this
	  up until our future, larger, rototilling of CAM.
	- Zero out cam_ed and cam_et nodes on allocation.  Prior to
	  this change, device_id_len and device_id were not inialized,
	  preventing proper detection of the presence of this
	  information.

  sys/cam/scsi/scsi_all.c:
  sys/cam/scsi/scsi_all.h:
	Add the scsi_match_devid() routine.

Add a helper function for extracting peripherial driver names

  sys/cam/cam_periph.c:
  sys/cam/cam_periph.h:
	Add the cam_periph_list() method which fills an sbuf
	with a comma delimited list of the peripheral instances
	associated with a given CAM path.

Add a helper functions for SCSI commands used by the SES driver.

  sys/cam/scsi/scsi_all.c:
  sys/cam/scsi/scsi_all.h:
	Add structure definitions and csio filling functions for
	the receive diagnostic results and send diagnostic commands.

Misc CAM XPT cleanups.

  sys/cam/cam_xpt.c:
	Broadcast AC_FOUND_DEVICE and AC_PATH_REGISTERED
	events at the time async event handlers are attached
	even when registering just for events on a partitular
	SIM.  Previously, you had to register for these
	events on all SIMs in the system in order to get
	the initial broadcast even though subsequent device
	and path arrivals would be delivered.

  sys/cam/cam_xpt.c:
	Remove SIM mutex held asserts from path accessors.
	CAM paths are reference counted and it is this
	reference count, not the sim mutex, that garantees
	they are stable.

Sponsored by: Spectra Logic Corporation
2011-06-14 14:53:17 +00:00
Andrey V. Elsukov
1875bbfe54 Implement "global" mode for ipfw nat. It is similar to natd(8)
"globalport" option for multiple NAT instances.

If ipfw rule contains "global" keyword instead of nat_number, then
for each outgoing packet ipfw_nat looks up translation state in all
configured nat instances. If an entry is found, packet aliased
according to that entry, otherwise packet is passed unchanged.

User can specify "skip_global" option in NAT configuration to exclude
an instance from the lookup in global mode.

PR:		kern/157867
Submitted by:	Alexander V. Chernikov (previous version)
Tested by:	Eugene Grosbein
2011-06-14 13:35:24 +00:00
Andrey V. Elsukov
980ccceb94 Check nat id a bit more strictly. 2011-06-14 13:02:26 +00:00
Luigi Rizzo
c9d658e9f7 Grab one of the ifcap bits for netmap, and enable printing in ifconfig.
Document the fact that we might want an IFCAP_CANTCHANGE mask,
even though the value is not yet used in sys/net/if.c

(asked on -current a week ago, no feedback so i assume no objection).
2011-06-14 12:40:55 +00:00
Jeff Roberson
280e091a99 Implement fully asynchronous partial truncation with softupdates journaling
to resolve errors which can cause corruption on recovery with the old
synchronous mechanism.

 - Append partial truncation freework structures to indirdeps while
   truncation is proceeding.  These prevent new block pointers from
   becoming valid until truncation completes and serialize truncations.
 - On completion of a partial truncate journal work waits for zeroed
   pointers to hit indirects.
 - softdep_journal_freeblocks() handles last frag allocation and last
   block zeroing.
 - vtruncbuf/ffs_page_remove moved into softdep_*_freeblocks() so it
   is only implemented in one place.
 - Block allocation failure handling moved up one level so it does not
   proceed with buf locks held.  This permits us to do more extensive
   reclaims when filesystem space is exhausted.
 - softdep_sync_metadata() is broken into two parts, the first executes
   once at the start of ffs_syncvnode() and flushes truncations and
   inode dependencies.  The second is called on each locked buf.  This
   eliminates excessive looping and rollbacks.
 - Improve the mechanism in process_worklist_item() that handles
   acquiring vnode locks for handle_workitem_remove() so that it works
   more generally and does not loop excessively over the same worklist
   items on each call.
 - Don't corrupt directories by zeroing the tail in fsck.  This is only
   done for regular files.
 - Push a fsync complete record for files that need it so the checker
   knows a truncation in the journal is no longer valid.

Discussed with:	mckusick, kib (ffs_pages_remove and ffs_truncate parts)
Tested by:	pho
2011-06-10 22:48:35 +00:00
Kenneth D. Merry
b4775b4c1d Add dump.c to the rtsol build. It is needed now that sec2str is non-static
and used in rtsold.c.
2011-06-08 21:59:07 +00:00
Xin LI
c73830758a Add a special mount option "failok" to indicate that the administrator wants
the system to proceed to boot without bailing out into single user mode,
even when the file system can not be successfully mounted.

This option is implemented in mount(8) and not passed into kernel.

MFC after:	1 month
2011-06-07 18:48:49 +00:00
Andrey V. Elsukov
08892bf4bf Do not use LCM from stripesize and user specified alignment value.
When user wants have specific alignment - do what user wants.
Use stripesize as alignment value in case, when some of gpart's
arguments are ommitted for automatic calculation.

Suggested by:	mav
2011-06-07 11:11:11 +00:00
Gavin Atkinson
8a7fca58aa Rework parts of this man page to improve grammar.
Inspired by, and parts submitted by...
PR:		docs/157467
Submitted by:	Ben Kaduk <kaduk mit.edu>
MFC after:	2 weeks
2011-06-06 21:02:26 +00:00
Ed Schouten
48a16a34d8 Remove redundant assignments to WARNS.
For these directories, WARNS is already implied to be 6.
2011-06-06 20:24:17 +00:00
Gavin Atkinson
d452fb8af7 Add another example to mount(8) on using the "-o" argument.
PR:		docs/157389
Submitted by:	Warren Block <wblock wonkity.com>
MFC after:	1 week
2011-06-06 13:24:54 +00:00
Gavin Atkinson
6fbdd4e705 Bump .Dd
Forgotten by:	gavin
MFC after:	1 week
2011-06-06 13:18:29 +00:00
Gavin Atkinson
c6852de31b Document that REQUIRES, PROVIDES and KEYWORDS are alos accepted. This
chnage is different to the one suggested in the PR to try to avoid
cluttering the man page too much.

PR:		docs/154494
Submitted by:	kilian <kilian.klimek googlemail.com>
MFC after:	1 week
2011-06-06 13:13:48 +00:00
Andrey V. Elsukov
71f3650a41 Initialize co.use_set variable before parsing each new rule.
PR:		bin/134975
MFC after:	2 weeks
2011-06-06 11:10:38 +00:00
Andrey V. Elsukov
796051d664 Increase buffer size for the command line.
PR:		bin/125370
Submitted by:	sem
MFC after:	2 weeks
2011-06-06 10:52:26 +00:00
Hiroki Sato
e7fa8d0ada - Accept Router Advertisement messages even when net.inet6.ip6.forwarding=1.
- A new per-interface knob IFF_ND6_NO_RADR and sysctl IPV6CTL_NO_RADR.
  This controls if accepting a route in an RA message as the default route.
  The default value for each interface can be set by net.inet6.ip6.no_radr.
  The system wide default value is 0.

- A new sysctl: net.inet6.ip6.norbit_raif.  This controls if setting R-bit in
  NA on RA accepting interfaces.  The default is 0 (R-bit is set based on
  net.inet6.ip6.forwarding).

Background:

 IPv6 host/router model suggests a router sends an RA and a host accepts it for
 router discovery.  Because of that, KAME implementation does not allow
 accepting RAs when net.inet6.ip6.forwarding=1.  Accepting RAs on a router can
 make the routing table confused since it can change the default router
 unintentionally.

 However, in practice there are cases where we cannot distinguish a host from
 a router clearly.  For example, a customer edge router often works as a host
 against the ISP, and as a router against the LAN at the same time.  Another
 example is a complex network configurations like an L2TP tunnel for IPv6
 connection to Internet over an Ethernet link with another native IPv6 subnet.
 In this case, the physical interface for the native IPv6 subnet works as a
 host, and the pseudo-interface for L2TP works as the default IP forwarding
 route.

Problem:

 Disabling processing RA messages when net.inet6.ip6.forwarding=1 and
 accepting them when net.inet6.ip6.forward=0 cause the following practical
 issues:

 - A router cannot perform SLAAC.  It becomes a problem if a box has
   multiple interfaces and you want to use SLAAC on some of them, for
   example.  A customer edge router for IPv6 Internet access service
   using an IPv6-over-IPv6 tunnel sometimes needs SLAAC on the
   physical interface for administration purpose; updating firmware
   and so on (link-local addresses can be used there, but GUAs by
   SLAAC are often used for scalability).

 - When a host has multiple IPv6 interfaces and it receives multiple RAs on
   them, controlling the default route is difficult.  Router preferences
   defined in RFC 4191 works only when the routers on the links are
   under your control.

Details of Implementation Changes:

 Router Advertisement messages will be accepted even when
 net.inet6.ip6.forwarding=1.  More precisely, the conditions are as
 follow:

 (ACCEPT_RTADV && !NO_RADR && !ip6.forwarding)
	=> Normal RA processing on that interface. (as IPv6 host)

 (ACCEPT_RTADV && (NO_RADR || ip6.forwarding))
	=> Accept RA but add the router to the defroute list with
	   rtlifetime=0 unconditionally.  This effectively prevents
	   from setting the received router address as the box's
	   default route.

 (!ACCEPT_RTADV)
	=> No RA processing on that interface.

 ACCEPT_RTADV and NO_RADR are per-interface knob.  In short, all interface
 are classified as "RA-accepting" or not.  An RA-accepting interface always
 processes RA messages regardless of ip6.forwarding.  The difference caused by
 NO_RADR or ip6.forwarding is whether the RA source address is considered as
 the default router or not.

 R-bit in NA on the RA accepting interfaces is set based on
 net.inet6.ip6.forwarding.  While RFC 6204 W-1 rule (for CPE case) suggests
 a router should disable the R-bit completely even when the box has
 net.inet6.ip6.forwarding=1, I believe there is no technical reason with
 doing so.  This behavior can be set by a new sysctl net.inet6.ip6.norbit_raif
 (the default is 0).

Usage:

 # ifconfig fxp0 inet6 accept_rtadv
	=> accept RA on fxp0
 # ifconfig fxp0 inet6 accept_rtadv no_radr
	=> accept RA on fxp0 but ignore default route information in it.
 # sysctl net.inet6.ip6.norbit_no_radr=1
	=> R-bit in NAs on RA accepting interfaces will always be set to 0.
2011-06-06 02:14:23 +00:00
Hiroki Sato
c3cc3217bc Add the "nd6 options" line handler as af_other_status() of AF_INET6, not as an
own address family.

Reviewed by:	bz
2011-06-05 11:37:20 +00:00
Maxim Sobolev
98453c81af Read from the socket using the same max buffer size as we use while
sending. What happens otherwise is that the sender splits all the
traffic into 32k chunks, while the receiver is waiting for the whole
packet. Then for a certain packet sizes, particularly 66607 bytes in
my case, the communication stucks to secondary is expecting to
read one chunk of 66607 bytes, while primary is sending two chunks
of 32768 bytes and third chunk of 1071. Probably due to TCP windowing
and buffering the final chunk gets stuck somewhere, so neither server
not client can make any progress.

This patch also protect from short reads, as according to the manual
page there are some cases when MSG_WAITALL can give less data than
expected.

MFC after:	3 days
2011-06-04 16:01:30 +00:00
Ruslan Ermilov
8bf9aaabf9 Generally clean up markup. 2011-06-03 10:39:36 +00:00
Andrey V. Elsukov
57512b16ae Always use LCM when stripesize > 0. 2011-06-02 22:15:19 +00:00
Andrey V. Elsukov
a6c21ef2d1 Use stripesize and stripeoffset in the automatic calculation of
partition offsets. If user requests specific alignment and
provider's stripesize is not zero, then use a least common multiple
from the stripesize and user specified value.
Also fix "gpart resize" implementation: do not try to align the partition
size, because the start offset may be not aligned. Instead align the
end offset and then calculate size. Also use stripesize and stripeoffset
for "gpart resize" command.
2011-06-02 21:59:21 +00:00
Ulrich Spörlein
b2e52ced25 mdoc: fix markup 2011-06-02 09:56:42 +00:00
Rick Macklem
6b43e31fe7 Add a sentence to the umount.8 man page to clarify the behaviour
for forced dismount when used on an NFS mount point. Requested by
Jeremy Chadwick.
This is a content change.

MFC after:	2 weeks
2011-05-31 18:27:18 +00:00
Bjoern A. Zeeb
5af3fa9a5f Conditionally compile in the af_inet and af_inet6, af_nd6 modules.
If compiled in for dual-stack use, test with feature_present(3)
to see if we should register the IPv4/IPv6 address family related
options.

In case there is no "inet" support we would love to go with the
usage() and make the address family mandatory (as it is for anything
but inet in theory).  Unfortunately people are used to
  ifconfig IF up/down
etc. as well, so use a fallback of "link".  Adjust the man page
to reflect these minor details.

Improve error handling printing a warning in addition to the usage
telling that we do not know the given address family in two places.

Reviewed by:	hrs, rwatson
Sponsored by:	The FreeBSD Foundation
Sponsored by:	iXsystems
MFC after:	2 weeks
2011-05-31 14:40:21 +00:00
Andrey V. Elsukov
6f5286dca6 Document kern.geom.part.check_integrity sysctl variable. 2011-05-30 11:17:42 +00:00
Andrey V. Elsukov
41b6083752 Add tablearg support for ipfw setfib.
PR:		kern/156410
MFC after:	2 weeks
2011-05-30 05:37:26 +00:00
Mikolaj Golub
a01a750f32 If READ from the local node failed we send the request to the remote
node. There is no use in doing this for synchronization requests.

Approved by:	pjd (mentor)
MFC after:	1 week
2011-05-29 21:20:47 +00:00
Rick Macklem
b37ce15446 Modify the umount(8) command so that it doesn't do
a sync(2) syscall before unmount(2) for the "-f" case.
This avoids a forced dismount from getting stuck for
an NFS mountpoint in sync() when the server is not
responsive. With this commit, forced dismounts should
normally work for the NFS clients, but can take up to
about 1minute to complete.

PR:		kern/157365
Reviewed by:	kib
MFC after:	2 weeks
2011-05-29 21:13:53 +00:00
Kirk McKusick
3fa3e267de Update the manual page to reflect the new 32K/4K defaults.
Reminded by: Ivan Voras
2011-05-28 15:14:50 +00:00
Andrey V. Elsukov
ca203c4faa Add example how to create MBR and BSD schemes and install boot code. 2011-05-27 15:29:39 +00:00
Andrey V. Elsukov
cbcc2a4fd6 Synchronize manpage's synopsis with program's usage. Since -l and -r
keys are mutually exclusive for the `gpart show` command, then mark
them so.

Requested by:	ru
2011-05-27 14:30:13 +00:00
Kirk McKusick
20f2694aa9 Raise the default blocksize for UFS/FFS filesystems from
16K to 32K and the default fragment size from 2K to 4K.

The rational is that most disks are now running with 4K
sectors.  While they can (slowly) simulate 512-byte sectors
by doing a read-modify-write, it is desirable to avoid this
functionality.  By raising the minimum filesystem allocation
to 4K, the filesystem will never trigger the small sector
emulation.

Also, the growth of disk sizes has lead us to double the
default block size about every ten years.  The rise from 8K
to 16K blocks was done in 2001.  So, by the 10-year metric,
the time has come for 32K blocks.

Discussed at: May 2011 BSDCan Developer Summit
Reference: http://wiki.freebsd.org/201105DevSummit/FileSystems
2011-05-26 18:22:49 +00:00
Andrey V. Elsukov
53fb12dbef Simplify ALIGNDOWN macro. 2011-05-24 17:03:46 +00:00
Andrey V. Elsukov
72b066244c Fix calculation of alignment for odd values. Also do not change value
when it is already aligned.
2011-05-24 16:49:34 +00:00
Pawel Jakub Dawidek
3db86c39ae Keep statistics on number of BIO_READ, BIO_WRITE, BIO_DELETE and BIO_FLUSH
requests as well as number of activemap updates.

Number of BIO_WRITEs and activemap updates are especially interesting, because
if those two are too close to each other, it means that your workload needs
bigger number of dirty extents. Activemap should be updated as rarely as
possible.

MFC after:	1 week
2011-05-23 21:15:19 +00:00
Pawel Jakub Dawidek
1c6689d58d To handle BIO_FLUSH and BIO_DELETE requests in secondary worker we need
to use ioctl(2). This is why we can't use capsicum for now to sandbox
secondary. Capsicum is still used to sandbox hastctl.

MFC after:	1 week
2011-05-23 20:59:50 +00:00
Ulrich Spörlein
6e18fca127 Re-encode files from ISO-8859-1 to UTF-8 2011-05-22 14:03:30 +00:00
Pawel Jakub Dawidek
aa27d9ef94 Recognize HIO_FLUSH requests.
MFC after:	1 week
2011-05-21 20:21:20 +00:00
Pawel Jakub Dawidek
588e8623d0 Document IPv6 support.
MFC after:	3 weeks
2011-05-20 11:21:39 +00:00
Pawel Jakub Dawidek
89bad89a59 If no listen address is specified, bind by default to:
tcp4://0.0.0.0:8457
	tcp6://[::]:8457

MFC after:	3 weeks
2011-05-20 11:16:25 +00:00
Pawel Jakub Dawidek
a87399ba7f Rename ipv4/ipv6 to tcp4/tcp6.
MFC after:	3 weeks
2011-05-20 11:15:27 +00:00
Pawel Jakub Dawidek
dc18c8ae6c Now that hell is fully frozen it is good time to add IPv6 support to HAST.
MFC after:	3 weeks
2011-05-20 11:14:05 +00:00
Pawel Jakub Dawidek
496a87aa30 Allow [ ] characters in strings. They might be used in IPv6 addresses.
MFC after:	3 weeks
2011-05-20 11:10:39 +00:00
Pawel Jakub Dawidek
bdbd046b35 Rename tcp4 to tcp in preparation for IPv6 support.
MFC after:	3 weeks
2011-05-20 11:09:02 +00:00
Pawel Jakub Dawidek
933728eea2 Rename proto_tcp4.c to proto_tcp.c in preparation for IPv6 support.
MFC after:	2 weeks
2011-05-20 11:06:17 +00:00
Pawel Jakub Dawidek
d4cb6369e6 In preparation for IPv6 support allow to specify multiple addresses to
listen on.

MFC after:	3 weeks
2011-05-19 23:18:42 +00:00
Pawel Jakub Dawidek
0855e42386 - Add support for AF_INET6 sockets for %S format character.
- Use inet_ntop(3) instead of reimplementing it.
- Use %hhu for unsigned char instead of casting it to unsigned int and
  using %u.

MFC after:	1 week
2011-05-18 22:43:56 +00:00
Sergey Kandaurov
3e71d7d04e mdoc:
- use a proper macro for interface name ipfw0.
- add missing section number for bpf cross reference.
2011-05-17 12:58:19 +00:00
Andrey V. Elsukov
6c7e04f0f3 Some partitioning schemes want to have partitions that are aligned
with geometry. And they do recalculation of user specified parameters.
MBR, PC98, VTOC8, EBR schemes are doing that. For these schemes an
auto alignment feature (ie. gpart add -a alignment) would not work.
But it can work for GPT and BSD schemes. BSD scheme usualy is created
inside MBR, so we can use knowledge about offset of MBR partition to
calculate aligned values for BSD partitions.

Use "offset" attribute of the parent provider for better alignment.

MFC after:	2 weeks
2011-05-15 16:16:48 +00:00
Marius Strobl
6f135a7584 When setting media always and not just in case of switching to IFM_AUTO
clear the options of the current media, i.e. only inherit the instance,
which matches what NetBSD does. Without this it's really non-intuitive
that the following sequence:
	ifconfig bge0 media 1000baseT mediaopt full-duplex
	ifconfig bge0 media 100baseTX
results in 100baseTX full-duplex to be set or that:
	ifconfig bge0 media autoselect mediaopt flowcontrol
	ifconfig bge0 media 1000baseT mediaopt full-duplex
tries to set 1000baseT full-duplex with flowcontrol, which isn't suported
und thus fails while the following:
	ifconfig re0 media 1000baseT mediaopt flowcontrol,full-duplex
	ifconfig re0 media autoselect
just switches to autoselection without flowcontrol.

MFC after:	2 weeks
2011-05-15 12:51:00 +00:00
Andrey V. Elsukov
cb86ada75d Simplify the code a bit. For own providers GEOM_PART always provides
"start" and "end" config attributes.

MFC after:	1 week
2011-05-15 11:45:13 +00:00
Pawel Jakub Dawidek
0cddb12ffd Currently we are unable to use capsicum for the primary worker process,
because we need to do ioctl(2)s, which are not permitted in the capability
mode. What we do now is to chroot(2) to /var/empty, which restricts access
to file system name space and we drop privileges to hast user and hast
group.

This still allows to access to other name spaces, like list of processes,
network and sysvipc.

To address that, use jail(2) instead of chroot(2). Using jail(2) will restrict
access to process table, network (we use ip-less jails) and sysvipc (if
security.jail.sysvipc_allowed is turned off). This provides much better
separation.

MFC after:	1 week
2011-05-14 17:02:03 +00:00
Pawel Jakub Dawidek
bcc9f32110 When using capsicum to sanbox, still use other methods first, just in case
one of them have some problems.
2011-05-14 16:55:24 +00:00
Bruce M Simpson
e1e3c30189 Typo. For USB devices, 'serial' should be 'sernum'.
See sys/dev/usb/usb_device.c for what devctl_notify() gets.
2011-05-10 02:34:11 +00:00
Gavin Atkinson
275e1cf79b We now have multiple filesystems (UFS, ZFS, ...), so for tools that only
operate on one type of filesystem, mention this.
While here, capitalise the use of "UFS" in growfs.8 to match other uses of
the term in other man pages.

MFC after:	1 week
2011-05-08 12:34:31 +00:00
Pawel Jakub Dawidek
b64a692b64 Allow to specify remote as 'none' again which was broken by r219351, where
'none' was defined as a value for checksum.

Reported by:	trasz
MFC after:	1 week
2011-05-08 11:10:56 +00:00
Pawel Jakub Dawidek
1b93915ff2 Document the following sysctls:
kern.geom.eli.version
kern.geom.eli.key_cache_limit
kern.geom.eli.key_cache_hits
kern.geom.eli.key_cache_misses

MFC after:	1 week
2011-05-08 09:46:09 +00:00
Mikolaj Golub
0d9d733c57 Fix isitme(), which is used to check if node-specific configuration
belongs to our node, and was returning false positive if the first
part of a node name matches short hostname.

Approved by:	pjd (mentor)
2011-05-08 09:31:17 +00:00
Ruslan Ermilov
e2f2b37089 Implemented a mount option "nocto" that disables cache coherency
checking at open time.  It may improve performance for read-only
NFS mounts.  Use deliberately.

MFC after:	1 week
Reviewed by:	rmacklem, jhb (earlier version)
2011-05-04 13:27:45 +00:00
Andrey V. Elsukov
d9711c28ef Add "-a alignment" option to gpart(8). When it specified gpart(8)
tries to align partition start offset and size to be multiple of
alignment value.

MFC after:	2 weeks
2011-05-03 07:33:39 +00:00
Ulrich Spörlein
5df69e92de recoverdisk(8): treat output file consistently and abort on EINVAL
This improves usability a little as we no longer require using touch.
Also reword the manpage wrt. parameters and fix usage() [1]

With no media in a cd(4) drive, the reads will loop producing EINVAL,
abort in that case [2].

Document the shortcoming of sectorsize and MAXPHYS (a quick solution
to this might be having MAXPHYS as the "bigsize", in short testing it
didn't make a difference on throughput).

Submitted by:	arundel [1]
PR:		bin/154528 [2]
2011-05-01 20:14:10 +00:00
Rick Macklem
b8ca07bd23 Fix the Makefile for mount_nfs so that it creates a
link for mount_oldnfs.8 instead of mount_newnfs.8.
2011-05-01 01:34:22 +00:00
Dag-Erling Smørgrav
8d3dfc2691 Add an -E option to mirror newfs's. The idea is that if you have a system
that was built before ffs grew support for TRIM, your filesystem will have
plenty of free blocks that the flash chip doesn't know are free, so it
can't take advantage of them for wear leveling.  Once you've upgraded your
kernel, you enable TRIM on the filesystem (tunefs -t enable), then run
fsck_ffs -E on it before mounting it.

I tested this patch by half-filling an mdconfig'ed filesystem image,
running fsck_ffs -E on it, then verifying that the contents were not
damaged by comparing them to a pristine copy using rsync's checksum
functionality.  There is no reliable way to test it on real hardware.

Many thanks to mckusick@, who provided the tricky parts of this patch and
reviewed the final version.

Reviewed by:	mckusick@
MFC after:	3 weeks
2011-04-29 23:00:23 +00:00
Dag-Erling Smørgrav
6c49c6cff2 Somewhere around the 473rd time I mistyped "mdconfig file" instead of
"mdconfig -f file", I decided that it would be easier to make mdconfig
DWIM than to teach my fingers to type the correct command line.

MFC after:	3 weeks
2011-04-29 22:40:11 +00:00
Rick Macklem
859aaa883e Another man page update related to the switchover of the
NFS clients done by r221124.
This is a content change.

Submitted by:	jh
2011-04-29 01:14:12 +00:00
Rick Macklem
2513585926 Update man pages related to the change in default NFS client
applied by r221124. I also deleted references to idmapd, since that
daemon no longer exists.
This is a content change.
2011-04-28 00:20:35 +00:00
Dag-Erling Smørgrav
3b39802214 whitespace nit - sorry for the churn 2011-04-27 21:40:49 +00:00
Dag-Erling Smørgrav
e81d0f5a74 whitespace nit 2011-04-27 21:39:59 +00:00
Rick Macklem
4309e17add This patch changes head so that the default NFS client is now the new
NFS client (which I guess is no longer experimental). The fstype "newnfs"
is now "nfs" and the regular/old NFS client is now fstype "oldnfs".
Although mounts via fstype "nfs" will usually work without userland
changes, an updated mount_nfs(8) binary is needed for kernels built with
"options NFSCL" but not "options NFSCLIENT". Updated mount_nfs(8) and
mount(8) binaries are needed to do mounts for fstype "oldnfs".
The GENERIC kernel configs have been changed to use options
NFSCL and NFSD (the new client and server) instead of NFSCLIENT and NFSSERVER.
For kernels being used on diskless NFS root systems, "options NFSCL"
must be in the kernel config.
Discussed on freebsd-fs@.
2011-04-27 17:51:51 +00:00
Dag-Erling Smørgrav
d40c066473 Mechanical whitespace cleanup.
MFC after:	3 weeks
2011-04-27 02:55:03 +00:00
Dag-Erling Smørgrav
dc069d64fb Fix boo-boo in previous commit.
MFC after:	3 weeks
2011-04-27 02:35:57 +00:00
Dag-Erling Smørgrav
af18c83560 Alphabetize the options. No date bump since no actual change to the text.
MFC after:	3 weeks
2011-04-27 02:32:41 +00:00
Mikolaj Golub
cfd2b3fb51 Add missing ifdef. This fixes build with NO_OPENSSL.
Reported by:	Pawel Tyll <ptyll@nitronet.pl>
Approved by:	pjd (mentor)
MFC after:	1 week
2011-04-26 19:52:21 +00:00
Mikolaj Golub
7a2b83683d Rename HASTCTL_ defines, which are used for conversion between main
hastd process and workers, remove unused one and set different range
of numbers. This is done in order not to confuse them with HASTCTL_CMD
defines, used for conversation between hastctl and hastd, and to avoid
bugs like the one fixed in in r221075.

Approved by:	pjd (mentor)
MFC after:	1 week
2011-04-26 19:38:30 +00:00
Mikolaj Golub
1768fba5c0 For conversation between hastctl and hastd we should use HASTCTL_CMD
defines.

Approved by:	pjd (mentor)
MFC after:	1 week
2011-04-26 19:22:54 +00:00
Mikolaj Golub
610bc6ae4a Fix assert messages.
Approved by:	pjd (mentor)
2011-04-26 19:11:15 +00:00
Colin Percival
c2805605f7 Stop trying to zero UFS1 superblocks if we fall off the end of the disk.
This avoids a potentially many-hours-long loop of failed writes if newfs
finds a partially-overwritten superblock (or, for that matter, random
garbage which happens to have superblock magic bytes); on one occasion I
found newfs trying to zero 800 million superblocks on a 50 MB disk.

Reviewed by:	mckusick
MFC after:	1 week
2011-04-26 02:06:31 +00:00
Adrian Chadd
88e428c6bc Revert r220907 and r220915.
Changing the size of struct ieee80211_mimo_info changes
the STA info data, breaking ifconfig in general.
2011-04-22 00:44:27 +00:00
Adrian Chadd
bc4e0fe6d0 Change the MIMO userland export ABI to include flags, number of radio chains,
extended EVM statistics and EXT channel data.

ifconfig still displays 3 chains worth of ctl noise/rssi.
2011-04-21 03:47:40 +00:00
Pawel Jakub Dawidek
8e15d1e490 Correct comment.
MFC after:	1 week
2011-04-20 18:49:12 +00:00
Pawel Jakub Dawidek
ac0401e321 When we become primary, we connect to the remote and expect it to be in
secondary role. It is possible that the remote node is primary, but only
because there was a role change and it didn't finish cleaning up (unmounting
file systems, etc.). If we detect such situation, wait for the remote node
to switch the role to secondary before accepting I/Os. If we don't wait for
it in that case, we will most likely cause split-brain.

MFC after:	1 week
2011-04-20 18:43:28 +00:00
Pawel Jakub Dawidek
0eb02c031b If we act in different role than requested by the remote node, log it
as a warning and not an error.

MFC after:	1 week
2011-04-20 16:38:05 +00:00
Pawel Jakub Dawidek
20f32a33d2 Timeout must be positive.
MFC after:	1 week
2011-04-20 16:36:59 +00:00
Alexander Motin
d17d64c4bf When calling XPT_REL_SIMQ to ajust number of openings, do not try to really
release device. We haven't frozen the device before and attempt to release
it will at least cause warning message from kernel.
2011-04-20 14:16:22 +00:00
Pawel Jakub Dawidek
06cbf54941 Scenario:
- We have two nodes connected and synchronized (local counters on both sides
  are 0).
- We take secondary down and recreate it.
- Primary connects to it and starts synchronization (but local counters are
  still 0).
- We switch the roles.
- Synchronization restarts but data is synchronized now from new primary
  (because local counters are 0) that doesn't have new data yet.

This fix this issue we bump local counter on primary when we discover that
connected secondary was recreated and has no data yet.

Reported by:	trociny
Discussed with:	trociny
Tested by:	trociny
MFC after:	1 week
2011-04-19 19:26:27 +00:00
Gleb Smirnoff
d5a805491e Rewrite NAT configuration parser, so that memory allocation size is
calculated dynamically.

PR:		kern/143653
2011-04-19 15:03:12 +00:00
Maxim Sobolev
dde269c93b Furthermore condition IP waiting behaviour also on -dynamic flag.
This should preserve POLA in all other cases (foreground || non-dynamic).

MFC after:	2 weeks
2011-04-18 23:45:50 +00:00
Maxim Sobolev
74def44d38 Only wait for the IP to appear on the interface if natd is running in the
background.

Suggested by:   Garrett Cooper <yanegomi@gmail.com>

Use EAGAIN instead of magic value of -2 to report this condition from the
SetAliasAddressFromIfName routine.

MFC after:	2 weeks
2011-04-18 23:15:29 +00:00
Gleb Smirnoff
ffbeadc45a More whitespace fixes.
Checked with:	md5, diff -x -w
2011-04-18 22:09:03 +00:00
Gleb Smirnoff
5221106c04 Whitespace fixes.
Checked with:	md5, diff -w
2011-04-18 21:18:22 +00:00
Ruslan Ermilov
576f40089b Changed "conscontrol unset" to accept an existing virtual
console device as an argument.  Unsetting virtual console
using /dev/console seems to have never worked.

MFC after:	3 days
2011-04-18 20:28:07 +00:00
Mikolaj Golub
64acad05cd Remove hast_proto_recv(). It was used only in one place, where
hast_proto_recv_hdr() may be used. This also fixes the issue
(introduced by r220523) with hastctl, which crashed on assert in
hast_proto_recv_data().

Suggested and approved by:	pjd (mentor)
2011-04-17 16:18:45 +00:00
Maxim Sobolev
0afb958b91 If we can retrieve interface address sleep for one second and try again.
This can happen during start-up, when natd starts before dhclient has a
chance to receive IP address from the upstream provider.

MFC after:	2 weeks
2011-04-17 06:05:37 +00:00
Sergey Kandaurov
603c2b9b9b Remove vestiges of disklabel(5).
Reviewed by:	uqs
MFC after:	5 days
2011-04-14 08:53:04 +00:00
Pawel Jakub Dawidek
ac6518673e The replication mode that is currently support is fullsync, not memsync.
Correct this and print a warning if different replication mode is
configured.

MFC after:	1 week
2011-04-12 19:13:10 +00:00
Mikolaj Golub
a827fe1fdf In hast_proto_recv() remove unnecessary check. The size is checked
later in hast_proto_recv_data().

Approved by:	pjd (mentor)
MFC after:	1 week
2011-04-10 15:28:37 +00:00
Mikolaj Golub
1d521b1cbd In hast_proto_recv_data() check that the size of the data to be
received does not exceed the buffer size.

Approved by:	pjd (mentor)
MFC after:	1 week
2011-04-10 15:21:46 +00:00
Mikolaj Golub
47f1eb5c4b Fix a typo in comments.
Approved by:	pjd (mentor)
MFC after:	3 days
2011-04-10 15:11:19 +00:00
Mikolaj Golub
d4aac54c51 hastd(8) maintains a map of dirty extents, not hastctl(8). Fix this.
Approved by:	pjd (mentor)
MFC after:	3 days
2011-04-10 15:07:54 +00:00
Glen Barber
66e0e139ee Correct 'list scan' description in the examples. The previous description
was incorrect - 'list scan' does not actually do a scan, but instead lists
the results of the background 'scan' cache.

Submitted by:	Fabian Keil (freebsd-listen of fabiankeil de) (via email)
Discussed with:	bschmidt
MFC after:	3 days
2011-04-06 11:20:54 +00:00
David E. O'Brien
1e3f14466b * Add the readline(3) API to libedit. The libedit versions of
{readline,history}.h are in /usr/include/edit so as to not conflict with
  the GNU libreadline versions.  To use the libedit readline(3) one should
  add "-I/usr/include/edit" to their Makefile
  (spelled "-I${DESTDIR}/${INCLUDEDIR}/edit" within the FreeBSD source tree).

* Enable its use in the BSD licensed utilities that support readline(3).

* To make it easier to sync libedit development with NetBSD, histedit.h
  is moved into libedit's directory as history shows shown we keep merging
  it into that location.

Obtained from:	NetBSD
Sponsored by:	Juniper Networks
2011-04-05 18:41:01 +00:00
Pawel Jakub Dawidek
39526f7fb6 Increase default timeout from 5 seconds to 20 seconds. 5 seconds is definitely
to short under heavy load and I was experiencing those timeouts in my recent
tests.

MFC after:	1 week
2011-04-02 09:34:33 +00:00
Pawel Jakub Dawidek
41bb85146b Handle ENOBUFS on send(2) by retrying for a while and logging the problem.
MFC after:	1 week
2011-04-02 09:31:02 +00:00
Pawel Jakub Dawidek
a7ebb3eb8b When we are operating on blocking socket and get EAGAIN on send(2) or recv(2)
this means that request timed out. Translate the meaningless EAGAIN to
ETIMEDOUT to give administrator a hint that he might need to increase timeout
in configuration file.

MFC after:	1 month
2011-04-02 09:29:53 +00:00
Pawel Jakub Dawidek
02dfe9724c Declare directions for sockets between primary and secondary.
In HAST we use two sockets - one for only sending the data and one for only
receiving the data.

MFC after:	1 month
2011-04-02 09:25:13 +00:00
Pawel Jakub Dawidek
3a0b818f59 Allow to disable sends or receives on a socket using shutdown(2) by
interpreting NULL 'data' argument passed to proto_common_send() or
proto_common_recv() as a will to do so.

MFC after:	1 month
2011-04-02 09:22:06 +00:00
Pawel Jakub Dawidek
2a49afacd1 Handle the problem described in r220264 by using GEOM GATE queue of unlimited
length. This should fix deadlocks reported by HAST users.

MFC after:	1 week
2011-04-02 07:01:09 +00:00
Pawel Jakub Dawidek
ab9092093c Because ggatel(8) operates on local GEOM providers, use unlimited queue size in
GEOM GATE to fix the issue described in r220264. This also means that we no
longer need -q option, remove it. Don't bother to leaving it as a no-op, as
ggatel(8) is just an example utility.
2011-04-02 06:59:05 +00:00