Commit Graph

7758 Commits

Author SHA1 Message Date
Andriy Voskoboinyk
a658d1b889 MFC r343980:
ifconfig(8): display 802.11n rates correctly for 'roam:rate' parameter
2019-02-16 01:05:22 +00:00
Andriy Voskoboinyk
19b7e9b2eb MFC r343871:
recoverdisk(1): fclose() file supplied via '-r readlist' parameter when
it's no longer needed

PR:		204952
Reported by:	David Binderman <dcb314@hotmail.com>
2019-02-13 09:28:48 +00:00
Andriy Voskoboinyk
251ef7900d MFC r343698, r343700:
ifconfig(8): display management / multicast wlan(4) rates properly

For 11n / 11ac we are still using non-11n rates for management and
multicast traffic by default; check 'MCS rate' bit to determine how
to print them correctly.

PR:		161035
2019-02-10 20:42:06 +00:00
Andriy Voskoboinyk
3b390ad105 MFC r343341:
ifconfig: drop unused macros from ifieee80211.c
2019-01-28 00:51:26 +00:00
Eugene Grosbein
97dfb0e552 MFC r342367: ifconfig.8, lagg.4: fix documentation bug: -use_flowid
needs to be used to force local hash computation and disable usage
of RSS hash provided by driver.

PR:		234242
2018-12-29 00:44:11 +00:00
Eugene Grosbein
6dc2319ebe MFC r339818: rcorder(8):
Add support for /etc/rc.resume, so it calls
  "rcorder -k resume" and runs scripts containing "KEYWORD: resume"
  with single "resume" argument.

  Working example is the port sysutils/cpupdate that defines
  extra_commands="resume" to reload CPU microcode cleared
  by suspend/resume sequence.

  This change does nothing for a system having no scripts with
  KEYWORD: resume.

PR:			227866
Differential Revision:	https://reviews.freebsd.org/D15247
2018-11-26 13:36:30 +00:00
Eugene Grosbein
a84cc28ddd MFC r339816: mount_msdosfs
mount_msdosfs: do not fail mounts requiring locale name conversion table
  that is already present in a kernel statically.

  For example, the command "mount_msdosfs -L ru_RU.KOI8-R" fails with error
  "mount_msdosfs: msdosfs_iconv: File exists" for a kernel having
  options LIBICONV and MSDOSFS_ICONV. After this change, it mounts
  successfully.

MFC after:		1 month
Differential Revision:	https://reviews.freebsd.org/D16951
2018-11-26 11:23:01 +00:00
Mark Johnston
4cf3aa1f8a MFC r337426:
ifconfig: Fix use of _Noreturn.
2018-08-14 14:19:57 +00:00
Jamie Gritton
0f975aaa9b MFC r335921:
Allow jail names (not just IDs) to be specified for: cpuset(1), ipfw(8),
   sockstat(1), ugidfw(8)
  These are the last of the jail-aware userland utilities that didn't work
   with names.

PR:		229266
Differential Revision:	D16047
2018-07-06 19:10:07 +00:00
Xin LI
1bbfdedf4a MFC r333098:
Don't bail out from the check if readboot() returns !FSFATAL.

This can happen when the fsinfo signature is invalid, and the
user have choose to fix it, in which case the code would return
FSBOOTMOD (not FSOK but not FSFATAL either).

All other (fatal) cases would return FSFATAL.

Obtained from:	Android Open Source Project
Obtained from:	d8775a29ea
2018-06-04 05:47:15 +00:00
Kristof Provost
a897e81456 MFC r333084:
pfctl: Don't break connections on skipped interfaces on reload

On reload we used to first flush everything, including the list of skipped
interfaces.  This can lead to termination of these connections if they send
packets before the new configuration is applied.

Note that this doesn't currently happen on 12 or 11, because of special EACCES
handling introduced in r315514. This special behaviour in tcp_output() may
change, hence the fix in pfctl.

PR:		214613
Submitted by:	Andreas Longwitz <longwitz at incore.de>
2018-05-02 22:36:10 +00:00
Andriy Gapon
3ea3666fcb MFC r331616: vfs_donmount: in certain cases try r/o mount if r/w mount fails
If the operation is not an update, if neither r/w nor r/o mode is
explicitly requested, if the error code hints at the possibility of the
media being read-only, and if the fallback is allowed, then we can try
to automatically downgrade to the readonly mode.

This is especially useful for auto-mounting of removable media that
sometimes can happen to be write-protected.

The fallback to r/o is not enabled by default.  It can be requested on a
per-mount basis with a new mount option, 'autoro'.  Or it can be
globally allowed by setting vfs.default_autoro.

stable/10 note: this branch does not have SYSCTL_BOOL, so SYSCTL_INT is
used instead.

Relnotes:	yes
2018-04-19 05:52:47 +00:00
Rodney W. Grimes
44e54b2a0c MFC: r332075
Exit with usage when extra arguments are on command line
preventing mistakes such as "halt 0p" for "halt -p".
Approved by:	bde (mentor, implicit), phk (mentor,implicit)
MFC after:	1 week
2018-04-13 03:47:41 +00:00
Sevan Janiyan
5d4943f8dc MFC r316464
Whilst mount_pcfs originated as a patch in 386BSD, NetBSD 0.8 actually
was the first release of an OS to ship with it.
Heads up by Ingo Schwarze.
2018-03-25 01:31:16 +00:00
Andrey V. Elsukov
f9492aa77d MFC r330792:
Do not try to reassemble IPv6 fragments in "reass" rule.

  ip_reass() expects IPv4 packet and will just corrupt any IPv6 packets
  that it gets. Until proper IPv6 fragments handling function will be
  implemented, pass IPv6 packets to next rule.

  PR:		170604
2018-03-19 09:54:16 +00:00
Alan Somers
69be211061 MFC r323314, r323338, r328849
r323314:
Audit userspace geom code for leaking memory to disk

Any geom class using g_metadata_store, as well as geom_virstor which
duplicated g_metadata_store internally, would dump sectorsize - mdsize bytes
of userspace memory following the metadata block stored. This is most or all
geom classes (gcache, gconcat, geli, gjournal, glabel, gmirror, gmultipath,
graid3, gshsec, gstripe, and geom_virstor).

PR:		222077 (comment #3)
Reported by:	Maxim Khitrov <max AT mxcrypt.com>
Reviewed by:	des
Security:	yes
Sponsored by:	Dell EMC Isilon
Differential Revision:	https://reviews.freebsd.org/D12269

r323338:
Fix information leak in geli(8) integrity mode

In integrity mode, a larger logical sector (e.g., 4096 bytes) spans several
physical sectors (e.g., 512 bytes) on the backing device.  Due to hash
overhead, a 4096 byte logical sector takes 8.5625 512-byte physical sectors.
This means that only 288 bytes (256 data + 32 hash) of the last 512 byte
sector are used.

The memory allocation used to store the encrypted data to be written to the
physical sectors comes from malloc(9) and does not use M_ZERO.

Previously, nothing initialized the final physical sector backing each
logical sector, aside from the hash + encrypted data portion.  So 224 bytes
of kernel heap memory was leaked to every block :-(.

This patch addresses the issue by initializing the trailing portion of the
physical sector in every logical sector to zeros before use.  A much simpler
but higher overhead fix would be to tag the entire allocation M_ZERO.

PR:		222077
Reported by:	Maxim Khitrov <max AT mxcrypt.com>
Reviewed by:	emaste
Security:	yes
Sponsored by:	Dell EMC Isilon
Differential Revision:	https://reviews.freebsd.org/D12272

r328849:
geom: don't write stack garbage in disk labels

Most consumers of g_metadata_store were passing in partially unallocated
memory, resulting in stack garbage being written to disk labels. Fix them by
zeroing the memory first.

gvirstor repeated the same mistake, but in the kernel.

Also, glabel's label contained a fixed-size string that wasn't
initialized to zero.

PR:		222077
Reported by:	Maxim Khitrov <max@mxcrypt.com>
Reviewed by:	cem
X-MFC-With:	323314
X-MFC-With:	323338
Differential Revision:	https://reviews.freebsd.org/D14164
2018-03-10 04:17:01 +00:00
David Bright
3f63e58efb MFC r330085:
dhclient violates RFC2131 when sending early DHCPREQUEST message to re-obtain old IP

When dhclient first starts, if an old IP address exists in the
dhclient.leases file, dhclient(8) sends early DHCPREQUEST message(s)
in an attempt to re-obtain the old IP address again. These messages
contain the old IP as a requested-IP-address option in the message
body (correct) but also use the old IP address as the packet's source
IP (incorrect).

RFC2131 sec 4.1 states:

  DHCP messages broadcast by a client prior to that client obtaining
  its IP address must have the source address field in the IP header
  set to 0.

The use of the old IP as the packet's source address is incorrect if
(a) the computer is now on a different network or (b) it is on the
same network, but the old IP has been reallocated to another host.

Fix dhclient to use 0.0.0.0 as the source IP in this circumstance
without removing any existing functionality. Any previously-used old
IP is still requested in the body of an early DHCPREQUEST message.

PR:             199378
Submitted by:   J.R. Oldroyd <fbsd@opal.com>
Reported by:    J.R. Oldroyd <fbsd@opal.com>
Sponsored by:   Dell EMC
2018-03-09 14:39:28 +00:00
Eugene Grosbein
b5e2ba045d MFC r329930: route(8): make it possible to manually delete pinned route
Reported by:	Andreas Longwitz <longwitz@incore.de>
Approved by:	avg (mentor)
2018-03-05 12:06:41 +00:00
Kirk McKusick
2f5d320887 MFC of 329749.
Fix a read past the end of a buffer in fsck.
2018-02-23 23:07:41 +00:00
Pedro F. Giffuni
c31768c1d2 MFC r328497:
pfctl(8): Fix two wrong conditions.

Caught by gcc80's -Wtautological-compare option.

MFC after:	5 days
Reviewed by:	kp
Obtained from:	DragonFlyBSD (git e3cdbf6c)
2018-02-01 02:00:36 +00:00
Xin LI
56580f3f6d MFC r326391: Prevent OOB access on corrupted msdos directories.
Submitted by:	Veo Zhang <veo live com>
2017-12-14 07:55:11 +00:00
Kristof Provost
ceba78f981 MFC r325850: pfctl: teach route-to to deal with interfaces with multiple addresses
The route_host parsing code set the interface name, but only for the first
node_host in the list. If that one happened to be the inet6 address and the
rule wanted an inet address it'd get removed by remove_invalid_hosts() later
on, and we'd have no interface name.

We must set the interface name for all node_host entries in the list, not just
the first one.

PR:		223208
2017-11-30 21:32:28 +00:00
Enji Cooper
81a349bad3 MFC r324478:
Check the exit code from fsck_ffs instead of relying on MODIFIED being in the output

^/head@r323923 changed when MODIFIED is printed at exit. It's better to follow the
documented way of determining whether or not a filesystem is clean per fsck_ffs, i.e.,
ensure that the exit code is either 0 or 7.

The pass/fail determination is brittle prior to this commit, and ^/head@r323923 made
the issue apparent -- thus this needs to be fixed independent of ^/head@r323923.

PR:		222780
MFC with:	r323923
2017-10-17 15:49:36 +00:00
Kirk McKusick
15baaff7b1 MFC of 324456.
Do not report filesystem as modified if only timestamp updated in superblock.
2017-10-16 21:55:31 +00:00
Enji Cooper
c0eb492e98 MFC r322951:
Respect MK_TCSH with build-tools and native-xtools

This helps reduce the WORLDTMP footprint slightly.

Based on a patch I submitted 5 years ago to GNATS.

PR:		174051
Relnotes:	yes (anyone who cross-builds with MK_TCSH=yes will run into
		     build failures if the host doesn't have tcsh(1))
Reminded by:	Fabian Keil <fk@fabiankeil.de>
2017-09-30 20:44:25 +00:00
Kirk McKusick
2ef8c9b479 MFC of 276737, 322200, 322201, 322271, and 322297
276737: Remove old ioctl use and support
322200: Remove (broken) search for alternate superblocks
322201: Show differences when alternate superblock fails to match
322271: Cleanup for 322200.
322297: Restore fsck_ffs ability to find alternate superblocks

Discussed with: kib, imp
Differential Revision: https://reviews.freebsd.org/D11589
Approved by: re (kib)
2017-08-24 21:44:23 +00:00
Konstantin Belousov
7f939aaebe MFC r322550:
Typo, the '-6' option selects inet6.

Approved by:	re (delphij)
2017-08-18 11:22:49 +00:00
Xin LI
ed9e407bcd MFC r320761:
- Use strlcat() instead of strncat().
 - Use asprintf() and handle allocation errors.
2017-08-02 05:47:26 +00:00
Alan Somers
6e9c0a8c31 MFC r320165-r320166
r320165:
devd(8): Remove pidfile on shutdown

Sponsored by:	Spectra Logic Corp

r320166:
Require devd to be running for its ATF tests to run

The ATF tests communicate with the system's running devd

PR:		220169
Reported by:	gjb
Sponsored by:	Spectra Logic Corp
2017-07-31 22:28:33 +00:00
Enji Cooper
3b44d03524 Relnotes: yes (subtle output/behavior change)
MFC r316938,r316953:

r316938:

savecore: fix space calculation with respect to `minfree` in check_space(..)

- Use strtoll(3) instead of atoi(3), because atoi(3) limits the
  representable data to INT_MAX. Check the values received from
  strtoll(3), trimming trailing whitespace off the end to maintain
  POLA.
- Use `KiB` instead of `kB` when describing free space, total space,
  etc. I am now fully aware of `KiB` being the IEC standard for 1024
  bytes and `kB` being the IEC standard for 1000 bytes.
- Store available number of KiB in `available` so it can be more
  easily queried and compared to ensure that there are enough KiB to
  store the dump image on disk.
- Print out the reserved space on disk, per `minfree`, so end-users
  can troubleshoot why check_space(..) is reporting that there isn't
  enough free space.

Tested with:	positive/negative cases (see review); make tinderbox

r316953:

Switch back to non-IEC units for 1024 bytes

I was swayed a little too quickly when I saw the wiki page discussing
kB vs KiB. Switch back as none of the code in base openly uses
IEC units via humanize_number(3) (which was my next step), and there's
a large degree of dislike with IEC vs more SI-like units.
2017-07-19 16:38:55 +00:00
Alan Somers
52680b453d MFC r319900:
sbin/ipfw: strcpy, strncpy => strlcpy

Reported by:	Coverity
CID:		1356162, 1356166
Sponsored by:	Spectra Logic Corp
Differential Revision:	https://reviews.freebsd.org/D10662
2017-07-07 15:35:42 +00:00
Alan Somers
067cbec26a MFC r319337:
Fix integer overflow in "camcontrol format"

Reported by:	Coverity
CID:		1011426
Sponsored by:	Spectra Logic Corp
2017-07-07 15:22:29 +00:00
Kirk McKusick
8ef57fa6f3 MFC of 320176:
Allow '_' in labels when specifying -L to newfs.

PR: 220163
Reported by: Keve Nagy
Reviewed by: kib
2017-06-26 17:33:33 +00:00
Enji Cooper
d4b943f26c MFC r316742:
Clarify units for mediasize and sectorsize in DoFile(..)

They're byte quantities.
2017-05-31 08:43:45 +00:00
Enji Cooper
9a83895417 MFC r316740:
Clarify `minfree` warning message in check_space(..)

- State that the units are kB.
- Be more complete/concise in terms of what is required (in this case
  `minfree` must be at least `X`kB)
2017-05-31 08:42:44 +00:00
Alan Somers
c698752873 MFC r317759:
Fix memory leaks in camcontrol

Reported by:	Coverity
CID:		1331674, 1331675
Reviewed by:	ken
Sponsored by:	Spectra Logic Corp
Differential Revision:	https://reviews.freebsd.org/D10588
2017-05-30 22:46:00 +00:00
Alan Somers
126bfd62c4 MFC r317755, r317758
r317755:
Various Coverity fixes in ifconfig(8)

* Exit early if kldload(2) fails (1011259). This is the only change that
  affects ifconfig's behavior.
* Close memory and resource leaks (1305624, 1305205, 1007100)
* Mark usage() as _Noreturn (1305806, 1305750)
* Fix some dereference after null checks (1011474, 270774)

Reported by:	Coverity
CID:		1305624, 1305205, 1007100, 1305806, 1305750, 1011474,
CID:		270774, 1011259
Reviewed by:	cem
Sponsored by:	Spectra Logic Corp
Differential Revision:	https://reviews.freebsd.org/D10587

r317758:
Unbreak ifconfig for mlx4en(4) after r317755

ifconfig doesn't correctly infer mlx interfaces' module names, so it will
attempt to load the mlx(4) module even when not necessary.

Reported by:	rstone
X-MFC-With:	317755
Sponsored by:	Spectra Logic Corp
2017-05-30 22:45:01 +00:00
Alan Somers
c326251498 MFC r317715:
ifconfig displays ND6_IFF_NO_DAD as "IGNORELOOP"

PR:		218958
Reviewed by:	kristof
Differential Revision:	https://reviews.freebsd.org/D10543
2017-05-30 22:44:05 +00:00
Alan Somers
20e7868288 MFC r316611:
sbin/mount: strcpy -> strlcpy

Reported by:	Coverity
CID:		1011173, 1011174
Sponsored by:	Spectra Logic Corp
2017-05-30 22:36:24 +00:00
Alan Somers
ef766a053c MFC r316535:
Fix memory leak in "gpart bootcode"

Also, annotate that gpart_issue never returns

Reported by:	Coverity
CID:		1007105
Sponsored by:	Spectra Logic Corp
2017-05-30 22:33:24 +00:00
Rick Macklem
264c423638 MFC: r317931
Fix mount_nfs so that it doesn't create mounttab entries for NFSv4 mounts.

The NFSv4 protocol doesn't use the Mount protocol, so it doesn't make sense
to add an entry for an NFSv4 mount to /var/db/mounttab. Also, r308871
modified umount so that it doesn't remove any entry created by mount_nfs.
2017-05-22 21:52:06 +00:00
Enji Cooper
58c82f22fa MFC r315775:
Add a post-humous manpage for cd9660(5), the ISO-9660 file system

Describe (briefly) how to compile the filesystem into the kernel and
load as a module.

Reference cd9660(5) in mount(8) and mount_cd9660(8).
2017-05-22 06:20:58 +00:00
Ravi Pokala
c7f17f47e7 MFC r318160, 318176: Persistently store NIC's hardware MAC address, and add
a way to retrive it

NOTE: Due to restructuring, the merges didn't apply cleanly; the resulting
change is almost identical to what went into stable/11, but in some cases in
different locations.

The MAC address reported by `ifconfig ${nic} ether' does not always match
the address in the hardware, as reported by the driver during attach. In
particular, NICs which are components of a lagg(4) interface all report the
same MAC.

When attaching, the NIC driver passes the MAC address it read from the
hardware as an argument to ether_ifattach(). Keep a second copy of it, and
create ioctl(SIOCGHWADDR) to return it. Teach `ifconfig' to report it along
with the active MAC address.

PR:		194386
2017-05-17 22:29:25 +00:00
Marius Strobl
67224c3ad3 MFC: r317343
In fill_ip6(), the value of the pointer av changes before it is
free(3)ed. Thus, introduce a new variable to track the original
value.
2017-05-14 13:59:40 +00:00
Kenneth D. Merry
3e87990d41 MFC r317854:
When editing a mode page on a tape drive, do not clear the device
  specific parameter.

  Tape drives include write protect (WP), Buffered Mode and Speed
  settings in the device-specific parameter.  Clearing this
  parameter on a mode select can have the effect of turning off
  write protect or buffered mode, or changing the speed setting of
  the tape drive.

  Disks report DPO/FUA support via the device specific parameter
  for MODE SENSE, but the bit is reserved for MODE SELECT.  So we
  clear this for disks (and other non-tape devices) to avoid
  potential errors from the target device.

  sbin/camcontrol/modeedit.c:
  	Clear the device-specific parameter in the mode page
  	header if we're not operating on a tape drive.

Sponsored by:	Spectra Logic
2017-05-08 18:30:56 +00:00
Kenneth D. Merry
8fa82ed325 MFC r317774, r317776
r317774:
  Add the ability to rescan or reset devices specified by peripheral
  name and unit number in camcontrol(8).

  Previously camcontrol(8) only supported rescanning or resetting
  devices specified by bus:target:lun.  This is because for
  rescanning at least, you don't have a peripheral name and unit
  number (e.g. da4) for devices that don't exist yet.

  That is still the case after this change, but in other cases, when
  the device does exist in the CAM EDT (Existing Device Table), we
  do a careful lookup of the bus/target/lun if the user supplies a
  peripheral name and unit number to find the bus:target:lun and then
  issue the requested reset or rescan.

  The lookup is done without actually opening the device in question,
  since a rescan is often done to make a device go away after it has
  been pulled.  (This is especially true for busses/controllers, like
  parallel SCSI controllers, that don't automatically detect changes
  in topology.)  Opening a device that is no longer there to
  determine the bus/target/lun might result in error recovery actions
  when the user really just wanted to make the device go away.

  sbin/camcontrol/camcontrol.c:
  	In dorescan_or_reset(), if the use hasn't specified a
  	numeric argument, assume he has specified a device.  Lookup
  	the pass(4) instance for that device using the transport
  	layer CAMGETPASSTHRU ioctl.  If that is successful, we can
  	use the returned bus:target:lun to rescan or reset the
  	device.

  	Under the hood, resetting a device using XPT_RESET_DEV is
  	actually sent via the pass(4) device anyway.  But this
  	provides a way for the user to specify devices in a more
  	convenient way, and can work on device rescans when the
  	device is going away, assuming it still exists in the EDT.

  sbin/camcontrol/camcontrol.8:
  	Update the man page for the rescan and reset subcommands
  	to reflect that you can now use a device name and unit
  	number with them.

Sponsored by:	Spectra Logic

r317776:
  Bump the camcontrol(8) man page date.

Sponsored by:	Spectra Logic
2017-05-08 17:02:03 +00:00
Rick Macklem
cc8f75415d MFC: r316793
Document the "oneopenown" option added by r316792.

This is a content change.
2017-04-27 21:45:50 +00:00
Konstantin Belousov
cfacd61cad MFC r316852:
In fsck_ffs pass1, prevent the inosused variable from wrapping.

PR:	218592
2017-04-21 10:16:34 +00:00
Dimitry Andric
5223ae8683 MFC r314671 (by cem):
newfs_nandfs: Fix unaligned pointer warning

PR:		217532
Submitted by:	Trond Endrestol <Trond.Endrestol at ximalas.info>
2017-04-13 17:11:50 +00:00
Enji Cooper
6f0670eaa4 MFC r315774:
mount.conf(8): fix a .Xr call

Add the missing section number for devfs(5)
2017-03-30 05:17:23 +00:00