Commit Graph

165011 Commits

Author SHA1 Message Date
Adrian Chadd
fa3324c985 This patch fixes beacon frame sequence number generation. The code
didn't set a sequence number; it didn't show up earlier because the
hardware most people use for hostap (ie, AR5212 series stuff) sets the
sequence numbers up in hardware. Later hardware (AR5416, etc) which
can do 11n and aggregation require sequence numbers to be generated in
software.

Submitted by:	paradyse@gmail.com
Approved by:	re (kib)
2011-08-24 08:53:33 +00:00
Adrian Chadd
607756e9de TIM/Timer fixes for AR5416 and later:
* Fix SLEEP1/SLEEP2 register definitions; the CAB/Beacon timeout
  fields have changed in AR5416 and later
* The TIM_PERIOD and DTIM_PERIOD registers are now microsecond fields,
  not TU.

Obtained from:	Linux ath9k, Atheros reference
Approved by:	re (kib, blanket)
2011-08-24 00:45:53 +00:00
Dmitry Morozovsky
796fc1b22f Add kern.cam.boot_delay description (with reasonable default) to
default/loader.conf

This should help people installing ${OS} to USB devices, where there are
frequently cases where kernel tries to mount root before actual umass sensing
is finished.

Reviewed by:	mav
Approved by:	re (kib)
MFC after:	1 week
2011-08-23 20:25:11 +00:00
Martin Matuska
b958f4853c Fix buffer overflow and possible ISO image corruption in wrong
handling of "." character case in makefs ISO level 1 and 2 filename
conversion.

Filed as NetBSD PR #45285
http://gnats.netbsd.org/cgi-bin/query-pr-single.pl?number=45285

Reviewed by:	Christos Zoulas <christos@netbsd.org>
Approved by:	re (kib)
MFC after:	3 days
2011-08-23 19:49:06 +00:00
Xin LI
aefb9fe04f Honor WITHOUT_IPX when installing etc/rc.d/ipxrouted.
MFC after:	1 week
Approved by:	re (kib)
2011-08-23 19:29:11 +00:00
Rick Macklem
002c2778b1 Fix nfsstat(1) so that it prints out correct stats for the
new NFS server when the "-e" option is not used. The bug was
that srvrpccnt[] was being indexed by NFSPROC_XXX when it needs
to be indexed by NFSV4OP_XXX.

Tested by:	hrs
Approved by:	re (bz)
2011-08-23 13:44:56 +00:00
Adrian Chadd
34ff1d08f6 These timer registers are all 1uS in resolution in AR5416
or later. Previous hardware had some as TU, some as 1/8th
TU.

* Modify AR_NEXT_DBA and AR_NEXT_SWBA to use a new macro,
  ONE_EIGHTH_TU_TO_USEC(), which converts the 1/8th TU
  fields to USEC. This is just cosmetic and matches the
  Atheros reference driver.

* Fix AR_NEXT_TBTT, which is USEC, not TU.

Submitted by:	paradyse@gmail.com
Approved by:	re (kib, blanket)
2011-08-23 13:36:09 +00:00
Rick Macklem
806f9b4262 Fix nfsstat(1) so that it prints out correct stats for the
new NFS server when the "-w" option is used. The problem was
spotted by hrs@ during testing where srvrpcnt[] must be indexed
by NFSV4OP_XXX and not NFSPROC_XXX.

Submitted by:	hrs
Approved by:	re (bz)
MFC after:	2 weeks
2011-08-23 13:17:09 +00:00
Andrey V. Elsukov
5373cf4e34 Fix lock leak.
Reported by:	Alex Lyashkov
Approved by:	re (kib)
MFC after:	1 week
2011-08-23 08:47:27 +00:00
Sergey Kandaurov
0ad2addc9d Fix if_addr_mtx recursion in mld6.
mld_set_version() is called only from mld_v1_input_query() and
mld_v2_input_query() both holding the if_addr_mtx lock, and then calling
into mld_v2_cancel_link_timers() acquires it the second time, which results
in mtx recursion. To avoid that, delay if_addr_mtx acquisition until after
mld_set_version() is called; while here, further reduce locking scope
to protect only the needed pieces: if_multiaddrs, in6m_lookup_locked().

PR:		kern/158426
Reported by:	Thomas <tps vr-web.de>,
		Tom Vijlbrief <tom.vijlbrief xs4all.nl>
Tested by:	Tom Vijlbrief
Reviewed by:	bz
Approved by:	re (kib)
2011-08-22 23:39:40 +00:00
Hans Petter Selasky
11867070c6 Spelling corrections for LibUSB manual page (2/2).
MFC after:	1 week
Approved by:	re (kib)
PR:		docs/159898
2011-08-22 21:10:50 +00:00
Hans Petter Selasky
c8c1f2ec4d Whitespace corrections for LibUSB manual page (1/2).
MFC after:	1 week
Approved by:	re (kib)
PR:		docs/159898
2011-08-22 21:05:39 +00:00
Konstantin Belousov
15523cf799 Update some comments in swap_pager.c.
Reviewed and most wording by:	alc
MFC after:	1 week
Approved by:	re (bz)
2011-08-22 20:44:18 +00:00
Pyun YongHyeon
462d5251d7 Disable PHY hibernation until I get more detailed hibernation
programming secret.  The PHY would go into sleep state when it
detects no established link and it will re-establish link when the
cable is plugged in.  Previously it failed to re-establish link
when the cable is plugged in such that it required to manually down
and up the interface again to make it work.  This came from
incorrectly programmed hibernation parameters.  According to
Atheros, each PHY chip requires different configuration for
hibernation and different vendor has different settings for the
same chip.
Disabling hibernation may consume more power but establishing link
looks more important than saving power.
Special thanks to Atheros for giving me instructions that disable
hibernation.

MFC after:	1 week
Approved by:	re (kib)
2011-08-22 20:33:05 +00:00
John Baldwin
5a7ca5ee05 Add two new macros DRIVER_MODULE_ORDERED() and EARLY_DRIVER_MODULE_ORDERED()
that allow a module to use an order other than the default of
SI_ORDER_MIDDLE when registering a driver.  This can be useful for drivers
in a kld that contain multiple new-bus drivers as part of one logical device
driver.  A typical case would be to use SI_ORDER_LAST for the "main" driver
to ensure that any other "helper" drivers are registered and available
before the "main" driver attempts to attach.

Tested by:	kib, Jason Harmening  jason harmening / gmail
Approved by:	re (kib)
MFC after:	1 week
2011-08-22 18:36:58 +00:00
Konstantin Belousov
6e903bd0d6 Apply the limit to avoid the overflows in the radix tree subr_blist.c
after the conversion of the swap device size to the page size units,
not before. That lifts the limit on the usable swap partition size
from 32GB to 256GB, that is less depressing for the modern systems.

Submitted by:   Alexander V. Chernikov <melifaro ipfw ru>
Reviewed by:    alc
Approved by:	re (bz)
MFC after:      2 weeks
2011-08-22 11:18:47 +00:00
Mike Silbersack
5cf8ac1bc2 Disable TSC usage inside SMP VM environments. On my VMware ESXi 4.1
environment with a core i5-2500K, operation in this mode causes timeouts
from the mpt driver.  Switching to the ACPI-fast timer resolves this issue.
Switching the VM back to single CPU mode also works, which is why I have
not disabled the TSC in that mode.

I did not test with KVM or other VM environments, but I am being cautious
and assuming that the TSC is not reliable in SMP mode there as well.

Reviewed by:	kib
Approved by:	re (kib)
MFC after:	Not applicable, the timecounter code is new for 9.x
2011-08-22 03:10:29 +00:00
Nathan Whitehorn
bcc25b7ea2 Implement support for GRAID volumes in the installer partition editor,
rename a few options, clarify some help text, and add help text for the
buttons on the main partition editor screen.

Approved by:	re (kib)
2011-08-21 18:50:30 +00:00
Nathan Whitehorn
af6004651e Make messages about typos appear on the screen instead of in the log file.
Reported by:	lev
Approved by:	re (kib)
2011-08-21 18:49:28 +00:00
Attilio Rao
e75baa2802 callout_cpu_switch() allows preemption when dropping the outcoming
callout cpu lock (and after having dropped it).
If the newly scheduled thread wants to acquire the old queue it will
just spin forever.

Fix this by disabling preemption and interrupts entirely (because fast
interrupt handlers may incur in the same problem too) while switching
locks.

Reported by:	hrs, Mike Tancsa <mike AT sentex DOT net>,
		Chip Camden <sterling AT camdensoftware DOT com>
Tested by:	hrs, Mike Tancsa <mike AT sentex DOT net>,
		Chip Camden <sterling AT camdensoftware DOT com>,
		Nicholas Esborn <nick AT desert DOT net>
Approved by:	re (kib)
MFC after:	10 days
2011-08-21 10:52:50 +00:00
Rick Macklem
de67b4966c Fix the NFSv4 server so that it returns NFSERR_SYMLINK when
an attempt to do an Open operation on any type of file other
than VREG is done. A recent discussion on the IETF working group's
mailing list (nfsv4@ietf.org) decided that NFSERR_SYMLINK
should be returned for all non-regular files and not just symlinks,
so that the Linux client would work correctly.
This change does not affect the FreeBSD NFSv4 client and is not
believed to have a negative effect on other NFSv4 clients.

Reviewed by:	zkirsch
Approved by:	re (kib)
MFC after:	2 weeks
2011-08-20 21:26:35 +00:00
Bjoern A. Zeeb
61bc18a327 In HEAD when doing no further checkes there is no reason use the
temporary variable and check with if as TUNABLE_*_FETCH do not
alter values unless successfully found the tunable.

Reported by:	jhb, bde
MFC after:	3 days
X-MFC with:	r224516
Approved by:	re (kib)
2011-08-20 19:21:46 +00:00
Bjoern A. Zeeb
6f69742441 Fix compilation in case of defined(INET) && defined(IPFIREWALL_FORWARD)
but no INET6.

Reported by:	avg
Tested by:	avg
MFC after:	4 weeks
X-MFC with:	r225044
Approved by:	re (kib)
2011-08-20 18:45:38 +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
Bjoern A. Zeeb
90bc35de38 Add an in6_localip() helper function as in6_localaddr() is not doing what
people think: returning true for an address in any connected subnet, not
necessarily on the local machine.

Sponsored by:	Sandvine Incorporated
MFC after:	2 weeks
Approved by:	re (kib)
2011-08-20 16:43:47 +00:00
Hans Petter Selasky
d840e1d248 Add new USB ID to u3g driver.
Approved by:    re (kib)
MFC after:      1 week
PR:		usb/159919
2011-08-20 16:21:40 +00:00
Konstantin Belousov
aab4f50170 Prevent the hiwatermark for the unix domain socket from becoming
effectively negative. Often seen as upstream fastcgi connection timeouts
in nginx when using sendfile over unix domain sockets for communication.

Sendfile(2) may send more bytes then currently allowed by the
hiwatermark of the socket, e.g. because the so_snd sockbuf lock is
dropped after sbspace() call in the kern_sendfile() loop. In this case,
recalculated hiwatermark will overflow. Since lowatermark is renewed
as half of the hiwatermark by sendfile code, and both are unsigned,
the send buffer never reaches the free space requested by lowatermark,
causing indefinite wait in sendfile.

Reviewed by:	rwatson
Approved by:	re (bz)
MFC after:	2 weeks
2011-08-20 16:12:29 +00:00
Hans Petter Selasky
fbaee0f1f5 Fix for recursive locking in usb_close() after change 224777.
Approved by:    re (kib)
MFC after:      3 days
Reported by:	kwm @
2011-08-20 15:12:53 +00:00
Hans Petter Selasky
0f92e529e1 Add new USB ID.
Approved by:    re (kib)
MFC after:      1 week
PR:		usb/159836
2011-08-20 14:21:32 +00:00
Bjoern A. Zeeb
f76fdd221b Hide IPv6 next header parsing warnings under the verbose sysctl
so people can possibly disable it when their consoles are flooded,
or enabled it for debugging.

MFC after:	2 weeks
Approved by:	re (kib)
2011-08-20 14:20:36 +00:00
Hans Petter Selasky
33ec9f0cb0 Use correct enum instead of constant value.
MFC after:	1 week
Spotted by:	scf @
Approved by:	re (kib)
2011-08-20 14:04:16 +00:00
Bjoern A. Zeeb
0c4dbd5af7 After r225032 fix logging in a similar way masking the the IPv6
more fragments flag off so that offset == 0 checks work properly.

PR:		kern/145733
Submitted by:	Matthew Luckie (mjl luckie.org.nz)
MFC after:	2 weeks
X-MFC with:	r225032
Approved by:	re (kib)
2011-08-20 13:47:08 +00:00
Bjoern A. Zeeb
49239b28da If we detect an IPv6 fragment header and it is not the first fragment,
then terminate the loop as we will not find any further headers and
for short fragments this could otherwise lead to a pullup error
discarding the fragment.

PR:		kern/145733
Submitted by:	Matthew Luckie (mjl luckie.org.nz)
MFC after:	2 weeks
Approved by:	re (kib)
2011-08-20 13:46:19 +00:00
Bjoern A. Zeeb
720fee0674 ipfw internally checks for offset == 0 to determine whether the
packet is a/the first fragment or not.  For IPv6 we have added the
"more fragments" flag as well to be able to determine on whether
there will be more as we do not have the fragment header avaialble
for logging, while for IPv4 this information can be derived directly
from the IPv4 header.  This allowed fragmented packets to bypass
normal rules as proper masking was not done when checking offset.
Split variables to not need masking for IPv6 to avoid further errors.

PR:		kern/145733
Submitted by:	Matthew Luckie (mjl luckie.org.nz)
MFC after:	2 weeks
Approved by:	re (kib)
2011-08-20 13:17:47 +00:00
Bjoern A. Zeeb
391255b8a4 While not explicitly allowed by RFC 2460, in case there is no
translation technology involved (and that section is suggested to
be removed by Errata 2843), single packet fragments do not harm.

There is another errata under discussion to clarify and allow this.
Meanwhile add a sysctl to allow disabling this behaviour again.
We will treat single packet fragment (a fragment header added
when not needed) as if there was no fragment header.

PR:		kern/145733
Submitted by:	Matthew Luckie (mjl luckie.org.nz) (original version)
Tested by:	Matthew Luckie (mjl luckie.org.nz)
MFC after:	2 weeks
Approved by:	re (kib)
2011-08-20 12:40:17 +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
John Baldwin
6dfd657c01 Walk the zombproc list as well as the allproc list when enumerating threads
and processes in a kernel image.  This allows examination of threads that
have exited or are in the late stages of exiting.

Tested by:	avg
Approved by:	re (kib)
MFC after:	1 week
2011-08-19 21:28:40 +00:00
Marius Strobl
5ca7dfffdf Revert r224157, re-enabling r222135. The underlying problem keeping the
latter from working as expected was fixed in r225014.

MFC after:	3 days
Approved by:	re (kib)
2011-08-19 19:13:31 +00:00
Marius Strobl
6e3f307486 r221812 reveals that at least some Broadcom PHYs default to being not only
isolated but also powered down after a reset and while they just work fine
[sic] when both is the case they don't if they are only deisolate but still
powered down. So in order to put PHYs in an overall normal operation mode
for the common case, ensure in mii_phy_reset() that they are not powered
down after a reset. Unfortunately, this only helps in case of BCM5421,
while BCM5709S apparently only work when they remain isolated and powered
down after a reset. So don't call mii_phy_reset() in brgphy_reset() and
implement the reset locally leaving the problematic bits alone. Effectively
this bypasses r221812 for brgphy(4).
Thanks to Justin Hibbits for doing a binary search in order to identify
the problematic commit.

PR:		157405, 158156
Reviewed by:	yongari (mii_phy_reset() part)
Approved by:	re (kib)
MFC after:	3 days
2011-08-19 19:12:58 +00:00
Adrian Chadd
198af96ed7 Correctly handle BAR TX failures.
On a TX failure, ic_raw_xmit will still call ieee80211_node_free().
There's no need to call it here.

Submitted by:	moonlightakkiy@yahoo.ca
Approved by:	re (kib)
2011-08-19 15:21:13 +00:00
Attilio Rao
72dc07eb44 Bump the maximum coretemp limit (for CPU temperature) to 110. Several
cores with temp in the range 101-105 have been found in the past.

Sponsored by:	Sandvine Incorporated
Reviewed by:	delphij, emaste
Approved by:	re (kib)
MFC after:	3 days
2011-08-19 13:31:48 +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
Hans Petter Selasky
9465dbeb5c Add sysctl to not reset the device on clear stall failures, to
temporarily mitigate problems with VMs.

Approved by:    re (kib)
MFC after:      1 week
2011-08-19 09:01:34 +00:00
Robert Watson
311fa10b52 r222015 introduced a new assertion that the size of a fixed-length sbuf
buffer is greater than 1.  This triggered panics in at least one spot in
the kernel (the MAC Framework) which passes non-negative, rather than >1
buffer sizes based on the size of a user buffer passed into a system
call.  While 0-size buffers aren't particularly useful, they also aren't
strictly incorrect, so loosen the assertion.

Discussed with:	phk (fears I might be EDOOFUS but willing to go along)
Spotted by:	pho + stress2
Approved by:	re (kib)
2011-08-19 08:29:10 +00:00
Jonathan Anderson
b465884f42 Test process descriptors.
Ensure that process descriptors work as expected. We should be able to:
 - pdfork(), like regular fork(), but producing a process descriptor
 - pdgetpid() to convert a PD into a PID
 - pdkill() to send signals to a process identified by a PD

Approved by:  re (kib), mentor (rwatson)
Sponsored by: Google Inc
2011-08-18 23:15:04 +00:00
Jonathan Anderson
f8ca0a757a Auto-generated system call code based on r224987.
Approved by:	re (implicit)
2011-08-18 23:08:52 +00:00
Jonathan Anderson
cfb5f76865 Add experimental support for process descriptors
A "process descriptor" file descriptor is used to manage processes
without using the PID namespace. This is required for Capsicum's
Capability Mode, where the PID namespace is unavailable.

New system calls pdfork(2) and pdkill(2) offer the functional equivalents
of fork(2) and kill(2). pdgetpid(2) allows querying the PID of the remote
process for debugging purposes. The currently-unimplemented pdwait(2) will,
in the future, allow querying rusage/exit status. In the interim, poll(2)
may be used to check (and wait for) process termination.

When a process is referenced by a process descriptor, it does not issue
SIGCHLD to the parent, making it suitable for use in libraries---a common
scenario when using library compartmentalisation from within large
applications (such as web browsers). Some observers may note a similarity
to Mach task ports; process descriptors provide a subset of this behaviour,
but in a UNIX style.

This feature is enabled by "options PROCDESC", but as with several other
Capsicum kernel features, is not enabled by default in GENERIC 9.0.

Reviewed by: jhb, kib
Approved by: re (kib), mentor (rwatson)
Sponsored by: Google Inc
2011-08-18 22:51:30 +00:00
John Baldwin
f55d3fbe84 One of the general principles of the sysctl(3) API is that a user can
query the needed size for a sysctl result by passing in a NULL old
pointer and a valid oldsize.  The kern.proc.args sysctl handler broke
this assumption by not calling SYSCTL_OUT() if the old pointer was
NULL.

Approved by:	re (kib)
MFC after:	3 days
2011-08-18 22:20:45 +00:00