Commit Graph

7728 Commits

Author SHA1 Message Date
Andrey V. Elsukov
ffc610b221 After r270929 RAW IP code assumes that all IP fields are in network
byte order. Fix ping(8) to pass an IP header with converted ip_off
and ip_len fields, when IP_HDRINCL socket option used.
2015-01-23 13:26:35 +00:00
Alexander V. Chernikov
69c4b56a74 Eliminate incorrect IPv6 mask guessing:
RFC 2374 concept of 'IPv6 Aggregatable Global Unicast Address Format' was
deprecated by RFC 3587 12 years ago.

Before:

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

MFC after:	2 weeks
Sponsored by:	The FreeBSD Foundation
2014-12-05 12:38:01 +00:00
Xin LI
689c8e8b46 Fix inverted logic introduced in r272154.
Noticed by:	trasz
MFC after:	2 weeks
2014-12-01 20:51:01 +00:00
Dag-Erling Smørgrav
5d083d287b Disable the vxlan code until the people reponsible for it can come up with
new command names that don't conflict with existing commands.

Pointy hat to:	bryanv
2014-12-01 12:59:16 +00:00
Enji Cooper
66ca0717df Convert sbin/mdconfig/tests from prove format tests to ATF format tests
As a side effect...
1. The tests now checks for the root user before continuing with kyua, which is
   more visible than the test being skipped with the TAP protocol
2. The tests work with devices that aren't /dev/md0 by caching the device
   attached during the test to a file, and later use the cached information to
   detach the device in the cleanup routine
3. The tests no longer require perl to run

MFC after: 1 week
PR: 191191
Sponsored by: EMC / Isilon Storage Division
2014-11-27 06:04:00 +00:00
Baptiste Daroussin
13eb765f2d Convert sbin/ to LIBADD
Reduce overlinking
2014-11-25 11:23:12 +00:00
Joel Dahl
d4d112e34a Misc mdoc fixes:
- Remove superfluous paragraph macros.
- Remove/fix empty or incorrect macros.
- Sort sections into conventional order.
- Terminate quoted strings properly.
- Remove EOL whitespace.
2014-11-23 21:00:00 +00:00
Edward Tomasz Napierala
a0252a0a82 Cross-reference autounmountd(8) from umount(8).
MFC after:	1 month
Sponsored by:	The FreeBSD Foundation
2014-11-22 16:46:00 +00:00
Edward Tomasz Napierala
9df66c85e3 Cross-reference automount(8) from mount(8).
MFC after:	1 month
Sponsored by:	The FreeBSD Foundation
2014-11-22 16:43:36 +00:00
Warner Losh
009ad003a2 Recommit r274750. 2014-11-21 01:43:55 +00:00
Warner Losh
adafc9d6e7 Back our r274750 until discussions on proper fix are over. 2014-11-20 21:18:19 +00:00
Andrey V. Elsukov
681a5b28a4 Use geom attribute "PART::type" to determine partition type and choose
relevant fsck_xxx utility.

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

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

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

PR:		194925
Differential Revision:	https://reviews.freebsd.org/D1185
Approved by:	des
Obtained from:	OpenBSD
2014-11-19 13:57:39 +00:00
Mark Felder
e2d52f146f Fix geom's "usage" generation to not fabricate usage/help output for any
imaginary class we give it.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Reviewed by:	rmacklem@
MFC after:	1 month
Sponsored by:	The FreeBSD Foundation
2014-10-30 08:50:01 +00:00
Edward Tomasz Napierala
2795d7de01 Get rid of obsolete code in mount_nfs(8).
Reviewed by:	rmacklem@
Sponsored by:	The FreeBSD Foundation
2014-10-30 08:05:51 +00:00
Alexander V. Chernikov
ca807c8a88 Fix documentation issue.
PR:		194581
Submitted by:	madpilot
2014-10-24 17:06:56 +00:00
Alexander V. Chernikov
382a5cbf42 Fix displaying non-contiguous netmasks.
Found by:	ae
Sponsored by:	Yandex LLC
2014-10-24 13:29:12 +00:00
Alexander V. Chernikov
34bad16f60 Show SFP+/QSFP memory map dump on higher verbose levels.
Sponsored by:	Yandex LLC
MFC after:	1 week
2014-10-23 11:01:49 +00:00