Commit Graph

7807 Commits

Author SHA1 Message Date
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
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
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