]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
9 years agoDo not strip outer header when operating in transport mode.
ae [Thu, 2 Oct 2014 02:00:21 +0000 (02:00 +0000)]
Do not strip outer header when operating in transport mode.
Instead requeue mbuf back to IPv4 protocol handler. If there is one extra IP-IP
encapsulation, it will be handled with tunneling interface. And thus proper
interface will be exposed into mbuf's rcvif. Also, tcpdump that listens on tunneling
interface will see packets in both directions.

Sponsored by: Yandex LLC

9 years agoResurrect set_rcvar() as a function to define a rc.conf variable.
hrs [Thu, 2 Oct 2014 01:16:30 +0000 (01:16 +0000)]
Resurrect set_rcvar() as a function to define a rc.conf variable.
It defines a variable and its default value in load_rc_config() just after
rc.conf is loaded.  "rcvar" command shows the current and the default values.

This is an attempt to solve a problem that rc.d scripts from third-party
software do not have entries in /etc/defaults/rc.conf.  The fact that
load_rc_config() reads rc.conf only once and /etc/rc invokes the function
before running rc.d scripts made developers confused for a long time because
load_rc_config() just before run_rc_command() in each rc.d script overrides
variables only when the script is directly invoked, not from /etc/rc.

Variables defined in set_rcvar are always set in load_rc_config() after
loading rc.conf.  An rc.d script can now be written in a self-contained
manner regarding the related variables as follows:

---
name=foo
rcvar=foo_enable

set_rcvar foo_enable YES "Enable $name"
set_rcvar foo_flags "-s" "Flags to $name"

...

load_rc_config $name
run_rc_command "$@"
---

9 years agoAdd an additional routing table lookup when m->m_pkthdr.fibnum is changed
hrs [Thu, 2 Oct 2014 00:25:57 +0000 (00:25 +0000)]
Add an additional routing table lookup when m->m_pkthdr.fibnum is changed
at a PFIL hook in ip{,6}_output().  IPFW setfib rule did not perform
a routing table lookup when the destination address was not changed.

CR: D805

9 years agoAdd IFCAP_HWSTATS.
hrs [Thu, 2 Oct 2014 00:19:24 +0000 (00:19 +0000)]
Add IFCAP_HWSTATS.

9 years agoDiff reduction with kernel code: instruct the compiler that the data of
delphij [Thu, 2 Oct 2014 00:13:08 +0000 (00:13 +0000)]
Diff reduction with kernel code: instruct the compiler that the data of
these types may be unaligned to their "normal" alignment and exercise
caution when accessing them.

PR: 194071
MFC after: 3 days

9 years agostrptime: fix bug introduced in r272273.
pfg [Wed, 1 Oct 2014 22:18:07 +0000 (22:18 +0000)]
strptime: fix bug introduced in r272273.

Reported by: portmgr (antoine)
Fix by: Andrey Chernov, David Carlier
PR: 137307 (follow up)

9 years agoVirtualize lagg(4) cloner. This change fixes a panic when tearing down
hrs [Wed, 1 Oct 2014 21:37:32 +0000 (21:37 +0000)]
Virtualize lagg(4) cloner.  This change fixes a panic when tearing down
if_lagg(4) interfaces which were cloned in a vnet jail.

Sysctl nodes which are dynamically generated for each cloned interface
(net.link.lagg.N.*) have been removed, and use_flowid and flowid_shift
ifconfig(8) parameters have been added instead.  Flags and per-interface
statistics counters are displayed in "ifconfig -v".

CR: D842

9 years agoFree radix mask entries on main radix destroy.
melifaro [Wed, 1 Oct 2014 21:24:58 +0000 (21:24 +0000)]
Free radix mask entries on main radix destroy.
This is temporary commit to be merged to 10.
Other approach (like hash table) should be used
to store different masks.

PR: 194078
Submitted by: Rumen Telbizov
MFC after: 3 days

9 years agoImprove performance of mking(1) by keeping a list of "chunks" in memory,
marcel [Wed, 1 Oct 2014 21:03:17 +0000 (21:03 +0000)]
Improve performance of mking(1) by keeping a list of "chunks" in memory,
that keeps track of a particular region of the image. In particular the
image_data() function needs to return to the caller whether a region
contains data or is all zeroes. This required reading the region from
the temporary file and comparing the bytes. When image_data() is used
multiple times for the same region, this will get painful fast.

With a chunk describing a region of the image, we now also have a way
to refer to the image provided on the command line. This means we don't
need to copy the image into a temporary file. We just keep track of the
file descriptor and offset within the source file on a per-chunk basis.

For streams (pipes, sockets, fifos, etc) we now use the temporary file
as a swap file. We read from the input file and create a chunk of type
"zeroes" for each sequence of zeroes that's a multiple of the sector
size. Otherwise, we allocte from the swap file, mmap(2) it, read into
the mmap(2)'d memory and create a chunk representing data.

For regular files, we use SEEK_HOLE and SEEK_DATA to handle sparse files
eficiently and create a chunk of type zeroes for holes and a chunk of
type data for data regions. For data regions, we still compare the bytes
we read to handle differences between a file system's block size and our
sector size.

After reading all files, image_write() is used by schemes to scribble in
the reserved sectors. Since this never amounts to much, keep this data
in memory in chunks of exactly 1 sector.

The output image is created by looking using the chunk list to find the
data and write it out to the output file. For chunks of type "zeroes"
we prefer to seek, but fall back to writing zeroes to handle pipes.
For chunks of type "file" and "memoty" we simply write.

The net effect of this is that for reasonably large images the execution
time drops from 1-2 minutes to 10-20 seconds. A typical speedup is about
5 to 8 times, depending on partition sizes, output format whether in
input files are sparse or not.

Bump version to 20141001.

9 years agoRevise r272363 by collapsing the tests into a for loop.
will [Wed, 1 Oct 2014 20:52:08 +0000 (20:52 +0000)]
Revise r272363 by collapsing the tests into a for loop.

This has the side effect of ensuring that realpath is also run for the
nominal case of PORTSDIR=/usr/ports (assuming .CURDIR is a ports directory
that relies on /usr/ports but is not rooted in it).  This ensures that any
generated PORTSDIR used is always the actual location.

Submitted by: jkim (different implementation)

9 years agoSuffix the cookie constants with ULL to silence warnings from compilers
marcel [Wed, 1 Oct 2014 20:37:15 +0000 (20:37 +0000)]
Suffix the cookie constants with ULL to silence warnings from compilers
that try to treat them as 32-bit values.

9 years agoOptimize program flow for execution speed. Also fix some more style(9) nits
dteske [Wed, 1 Oct 2014 18:59:57 +0000 (18:59 +0000)]
Optimize program flow for execution speed. Also fix some more style(9) nits
while here:
+ Fix an issue when extracting small archives where dialog_mixedgauge was
  not rendering; leaving the user wondering if anything happened.
+ Add #ifdef's to assuage compilation against older libarchive
  NB: Minimize diff between branches; make merging easier.
+ Add missing calls to end_dialog(3)
+ Change string processing from strtok(3) to strcspn(3) (O(1) optimization)
+ Use EXIT_SUCCESS and EXIT_FAILURE instead of 0/1
+ Optimize getenv(3) use, using stored results instead of calling repeatedly
  NB: Fixes copy/paste error wherein we display getenv(BSDINSTALL_DISTDIR) in
      an error msgbox when chdir(2) to getenv(BSDINSTALL_CHROOT) fails
      (wrong variable displayed in msgbox).
+ Use strtol(3) instead of [deprecated] atoi(3)
+ Add additional error checking (e.g., check return of archive_read_new(3))
+ Assign DECONST strings to static variables
+ Fix typo in distextract.c error message (s/Could could/Could not/)
+ Add comments and make a minor whitespace adjustment

Reviewed by: nwhitehorn, julian

9 years agoAdd a sysctl, net.inet.icmp.tstamprepl, which can be used to disable replies
markj [Wed, 1 Oct 2014 18:07:34 +0000 (18:07 +0000)]
Add a sysctl, net.inet.icmp.tstamprepl, which can be used to disable replies
to ICMP Timestamp packets.

PR: 193689
Submitted by: Anthony Cornehl <accornehl@gmail.com>
MFC after: 3 weeks
Sponsored by: EMC / Isilon Storage Division

9 years agoSome cleanup for sfxge.4
bjk [Wed, 1 Oct 2014 17:16:18 +0000 (17:16 +0000)]
Some cleanup for sfxge.4

Use standard mdoc macros instead of pure roff, fix some other mdoc usage,
make the style consistent, and fix some grammar issues.

Approved by: hrs (mentor)

9 years agoSeparate release/scripts/mk-vmimage.sh to machine-specific
gjb [Wed, 1 Oct 2014 17:05:40 +0000 (17:05 +0000)]
Separate release/scripts/mk-vmimage.sh to machine-specific
scripts, making it possible to mimic the functionality for
non-x86 targets.

Move echo output if MAKEFLAGS is empty outside of usage().

Remove TARGET/TARGET_ARCH evaluation.

Sponsored by: The FreeBSD Foundation

9 years agoEmbellish a comment regarding the reliability of DEBUG_VFS_LOCKS.
will [Wed, 1 Oct 2014 16:16:01 +0000 (16:16 +0000)]
Embellish a comment regarding the reliability of DEBUG_VFS_LOCKS.

Submitted by: kib

9 years agoClean up detection of hard-float ABIs. As with big-endian in r272368 we
andrew [Wed, 1 Oct 2014 16:08:19 +0000 (16:08 +0000)]
Clean up detection of hard-float ABIs. As with big-endian in r272368 we
can check against arm*hf*.

9 years agoClean up detection of big-endian ARM. In all cases we follow the pattern
andrew [Wed, 1 Oct 2014 16:00:21 +0000 (16:00 +0000)]
Clean up detection of big-endian ARM. In all cases we follow the pattern
arm*eb*. Check we are building for arm and if MACHINE_ARCH follows this
pattern.

9 years agoInstead of requiring an edit to turn on ZFS debugging, define ZFS_DEBUG.
will [Wed, 1 Oct 2014 15:34:48 +0000 (15:34 +0000)]
Instead of requiring an edit to turn on ZFS debugging, define ZFS_DEBUG.

MFC after: 1 month

9 years agoIn the syncer, drop the sync mutex while patting the watchdog.
will [Wed, 1 Oct 2014 15:32:28 +0000 (15:32 +0000)]
In the syncer, drop the sync mutex while patting the watchdog.

Some watchdog drivers (like ipmi) need to sleep while patting the watchdog.
See sys/dev/ipmi/ipmi.c:ipmi_wd_event(), which calls malloc(M_WAITOK).

Submitted by: asomers
MFC after: 1 month
Sponsored by: Spectra Logic
MFSpectraBSD: 637548 on 2012/10/04

9 years agoAlways resolve PORTSDIR to absolute paths using realpath(1).
will [Wed, 1 Oct 2014 15:02:37 +0000 (15:02 +0000)]
Always resolve PORTSDIR to absolute paths using realpath(1).

Reported by: madpilot
Reviewed by: bapt
X-MFC-With: 272282

9 years agoEnsure that every ENTRY(foo) has a matching END(foo).
bapt [Wed, 1 Oct 2014 15:00:21 +0000 (15:00 +0000)]
Ensure that every ENTRY(foo) has a matching END(foo).
It allows to build with newer binutils

Differential Revision: https://reviews.freebsd.org/D877
Reviewed by: jhibbits

9 years agoRemove lock init from radix.c.
melifaro [Wed, 1 Oct 2014 14:39:06 +0000 (14:39 +0000)]
Remove lock init from radix.c.
Radix has never managed its locking itself.
The only consumer using radix with embeded rwlock
is system routing table. Move per-AF lock inits there.

9 years agoAdd sysctl to track the resource consumption of ACPI interrupts.
will [Wed, 1 Oct 2014 14:35:52 +0000 (14:35 +0000)]
Add sysctl to track the resource consumption of ACPI interrupts.

Submitted by: gibbs
MFC after: 1 month
Sponsored by: Spectra Logic
MFSpectraBSD: 636827 on 2012/09/28

9 years agozfsvfs_create(): Refuse to mount datasets whose names are too long.
will [Wed, 1 Oct 2014 14:12:02 +0000 (14:12 +0000)]
zfsvfs_create(): Refuse to mount datasets whose names are too long.

This is checked for in the zfs_snapshot_004_neg STF/ATF test (currently
still in projects/zfsd rather than head).

sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c:
- zfsvfs_create(): Check whether the objset name fits into
  statfs.f_mntfromname, and return ENAMETOOLONG if not.  Although
  the filesystem can be unmounted via the umount(8) command, any
  interface that relies on iterating on statfs (e.g. libzfs) will
  fail to find the filesystem by its objset name, and thus assume
  it's not mounted.  This causes "zfs unmount", "zfs destroy",
  etc. to fail on these filesystems, whether or not -f is passed.

MFC after: 1 month
Sponsored by: Spectra Logic
MFSpectraBSD: 974872 on 2013/08/09

9 years agoUse rn_detachhead() instead of direct free(9) for radix tables.
glebius [Wed, 1 Oct 2014 13:35:41 +0000 (13:35 +0000)]
Use rn_detachhead() instead of direct free(9) for radix tables.

Sponsored by: Nginx, Inc.

9 years agoFix the TARGET_ABI value clang uses. It shpuld be gnueabi on all ARM
andrew [Wed, 1 Oct 2014 12:47:25 +0000 (12:47 +0000)]
Fix the TARGET_ABI value clang uses. It shpuld be gnueabi on all ARM
soft-float architectures, and gnueabihf for hard-float.

9 years agoSplit you the syscall handling to a separate file.
andrew [Wed, 1 Oct 2014 12:44:16 +0000 (12:44 +0000)]
Split you the syscall handling to a separate file.

9 years agoFix couple issues with ROD tokens content.
mav [Wed, 1 Oct 2014 11:30:20 +0000 (11:30 +0000)]
Fix couple issues with ROD tokens content.

MFC after: 3 days

9 years agoFix off by one in lagg_port_destroy().
glebius [Wed, 1 Oct 2014 11:23:54 +0000 (11:23 +0000)]
Fix off by one in lagg_port_destroy().

Reported by: "Max N. Boyarov" <zotrix bsd.by>

9 years agoRemove MK_ARM_EABI, the armeb issues have been fixed. The code to support
andrew [Wed, 1 Oct 2014 08:26:51 +0000 (08:26 +0000)]
Remove MK_ARM_EABI, the armeb issues have been fixed. The code to support
the oabi is still in the tree, but it is expected this will be removed
as developers work on surrounding code.

With this commit the ARM EABI is the only supported supported ABI by
FreeBSD on ARMa 32-bit processors.

X-MFC after: never
Relnotes: yes
Differential Revision: https://reviews.freebsd.org/D876

9 years agoSet default cycle state in case of early interrupts.
hselasky [Wed, 1 Oct 2014 07:34:49 +0000 (07:34 +0000)]
Set default cycle state in case of early interrupts.

MFC after: 3 days

9 years agoConsistently cast tty and user to const char * in printf()-like contexts.
des [Wed, 1 Oct 2014 07:15:02 +0000 (07:15 +0000)]
Consistently cast tty and user to const char * in printf()-like contexts.

9 years agoThe default for UDPLITE_RECV_CSCOV is zero. RFC 3828 recommend
tuexen [Wed, 1 Oct 2014 05:43:29 +0000 (05:43 +0000)]
The default for UDPLITE_RECV_CSCOV is zero. RFC 3828 recommend
that this means full checksum coverage for received packets.
If an application is willing to accept packets with partial
coverage, it is expected to use the socekt option and provice
the minimum coverage it accepts.

Reviewed by: kevlo
MFC after: 3 days

9 years agoCorrect the way that libelf is linked when USDT is used.
markj [Wed, 1 Oct 2014 04:28:39 +0000 (04:28 +0000)]
Correct the way that libelf is linked when USDT is used.

9 years agoTag ^/base/vendor/NetBSD/tests/09.30.2014_20.45 from
ngie [Wed, 1 Oct 2014 04:12:38 +0000 (04:12 +0000)]
Tag ^/base/vendor/NetBSD/tests/09.30.2014_20.45 from
^/base/vendor/NetBSD/tests/dist

Sponsored by: EMC / Isilon Storage Division

9 years agoCheck in first src/tests snapshot from NetBSD anoncvs
ngie [Wed, 1 Oct 2014 04:07:17 +0000 (04:07 +0000)]
Check in first src/tests snapshot from NetBSD anoncvs

Sources were obtained like so:

% export CVSROOT="anoncvs@anoncvs.NetBSD.org:/cvsroot"
% cvs -z9 co -D "09/30/2014 20:45" -P src/tests
% mv src/tests/* tests/dist/.

'*CVS*' has been added to svn:ignore to ease updating periodically from
upstream

Some line ending issues had to be resolved with test outputs and scripts
via dos2unix and by deleting the eol-style property set in usr.bin/sort

Discussed with: rpaulo
Sponsored by: EMC / Isilon Storage Division

9 years agoAdd ObsoleteFiles.inc OLD_FILES entries for libnv
ngie [Wed, 1 Oct 2014 01:56:51 +0000 (01:56 +0000)]
Add ObsoleteFiles.inc OLD_FILES entries for libnv

X-MFC with: r271241
Submitted by: pjd
Pointyhat to: ngie
Sponsored by: EMC / Isilon Storage Division

9 years agoTest for absence of M_NOFREE before attempting to purge the mbuf's tags.
np [Tue, 30 Sep 2014 23:16:26 +0000 (23:16 +0000)]
Test for absence of M_NOFREE before attempting to purge the mbuf's tags.
This will leave more state intact should the assertion go off.

MFC after: 1 month

9 years agoReturn the actual baud rate programmed in the hardware rather than 115200.
ian [Tue, 30 Sep 2014 23:01:11 +0000 (23:01 +0000)]
Return the actual baud rate programmed in the hardware rather than 115200.
This allows the "3wire" entry in /etc/ttys (with no speed specified) to work.

9 years agoWhen building the lists of available memory, actually honor the exclusion
ian [Tue, 30 Sep 2014 21:28:05 +0000 (21:28 +0000)]
When building the lists of available memory, actually honor the exclusion
flags, like the comment says it does.

Pointy hat: ian
Submitted by: Svatopluk Kraus <onwahe@gmail.com>

9 years agoSupport tunable to control Tx deferred packet list limits
gnn [Tue, 30 Sep 2014 20:57:25 +0000 (20:57 +0000)]
Support tunable to control Tx deferred packet list limits

Also increase default for Tx queue get-list limit.
Too small limit results in TCP packets drops especiall when many
streams are running simultaneously.
Put list may be kept small enough since it is just a temporary
location if transmit function can't get Tx queue lock.

Submitted by:   Andrew Rybchenko <arybchenko at solarflare.com>
Sponsored by:   Solarflare Communications, Inc.

9 years agoThe patch allows to check state of the software Tx queues at run time.
gnn [Tue, 30 Sep 2014 20:43:21 +0000 (20:43 +0000)]
The patch allows to check state of the software Tx queues at run time.

Submitted by:   Andrew Rybchenko <arybchenko at solarflare.com>
Sponsored by:   Solarflare Communications, Inc.

9 years agoUpdate SolarFlare driver manual page with new tunables.
gnn [Tue, 30 Sep 2014 20:38:36 +0000 (20:38 +0000)]
Update SolarFlare driver manual page with new tunables.

Submitted by:   Andrew Rybchenko <arybchenko at solarflare.com>
Sponsored by:   Solarflare Communications, Inc.

9 years agoMake size of Tx and Rx rings configurable
gnn [Tue, 30 Sep 2014 20:36:07 +0000 (20:36 +0000)]
Make size of Tx and Rx rings configurable

Required size of event queue is calculated now.

Submitted by:   Andrew Rybchenko <arybchenko at solarflare.com>
Sponsored by:   Solarflare Communications, Inc.

9 years agoUDPLite requires a checksum. Therefore, discard a received packet if
tuexen [Tue, 30 Sep 2014 20:29:58 +0000 (20:29 +0000)]
UDPLite requires a checksum. Therefore, discard a received packet if
the checksum is 0.

MFC after: 3 days

9 years agocleanup: code style fixes
gnn [Tue, 30 Sep 2014 20:18:10 +0000 (20:18 +0000)]
cleanup: code style fixes

Remove trailing whitespaces and tabs.
Enclose value in return statements in parentheses.
Use tabs after #define.
Do not skip comparison with 0/NULL in boolean expressions.

Submitted by:   Andrew Rybchenko <arybchenko at solarflare.com>
Sponsored by:   Solarflare Communications, Inc.

9 years agoFix a mismerge in r260183 which prevents snapshot zvol devices being
delphij [Tue, 30 Sep 2014 18:50:45 +0000 (18:50 +0000)]
Fix a mismerge in r260183 which prevents snapshot zvol devices being
removed and re-instate the fix in r242862.

Reported by: Leon Dang <ldang nahannisys com>, smh
MFC after: 3 days

9 years agoIf the checksum coverage field in the UDPLITE header is the length
tuexen [Tue, 30 Sep 2014 18:17:28 +0000 (18:17 +0000)]
If the checksum coverage field in the UDPLITE header is the length
of the complete UDPLITE packet, the packet has full checksum coverage.
SO fix the condition.

Reviewed by: kevlo
MFC after: 3 days

9 years agoxen: fix blkback pushing responses before releasing internal resources
royger [Tue, 30 Sep 2014 17:41:16 +0000 (17:41 +0000)]
xen: fix blkback pushing responses before releasing internal resources

Fix a problem where the blockback driver could run out of requests,
despite the fact that we allocate enough request and reqlist
structures to satisfy the maximum possible number of requests.

The problem was that we were sending responses back to the other
end (blockfront) before freeing resources. The Citrix Windows
driver is pretty agressive about queueing, and would queue more I/O
to us immediately after we sent responses to it. We would run into
a resource shortage and stall out I/O until we freed resources.

It isn't clear whether the request shortage condition was an
indirect cause of the I/O hangs we've been seeing between Windows
with the Citrix PV drivers and FreeBSD's blockback, but the above
problem is certainly a bug.

Sponsored by: Spectra Logic
Submitted by: ken
Reviewed by: royger

dev/xen/blkback/blkback.c:
 - Break xbb_send_response() into two sub-functions,
   xbb_queue_response() and xbb_push_responses().
   Remove xbb_send_response(), because it is no longer
   used.

 - Adjust xbb_complete_reqlist() so that it calls the
   two new functions, and holds the mutex around both
   calls.  The mutex insures that another context
   can't come along and push responses before we've
   freed our resources.

 - Change xbb_release_reqlist() so that it requires
   the mutex to be held instead of acquiring the mutex
   itself.  Both callers could easily hold the mutex
   while calling it, and one really needs to hold the
   mutex during the call.

 - Add two new counters, accessible via sysctl
   variables.  The first one counts the number of
   I/Os that are queued and waiting to be pushed
   (reqs_queued_for_completion).  The second one
   (reqs_completed_with_error) counts the number of
   requests we've completed with an error status.

9 years agoxen/balloon: fix accounting of current memory pages on PVH
royger [Tue, 30 Sep 2014 17:38:21 +0000 (17:38 +0000)]
xen/balloon: fix accounting of current memory pages on PVH

Using realmem on PVH is not realiable, since in this case the realmem value
is computed from Maxmem, which contains the higher memory address found. Use
HYPERVISOR_start_info->nr_pages instead, which is set by the hypervisor and
contains the exact number of memory pages assigned to the domain.

Sponsored by: Citrix Systems R&D

9 years agoxen: add xenstored user-space device
royger [Tue, 30 Sep 2014 17:37:26 +0000 (17:37 +0000)]
xen: add xenstored user-space device

This device is used by the user-space daemon that runs xenstore
(xenstored). It allows xenstored to map the xenstore memory page, and
reports the event channel xenstore is using.

Sponsored by: Citrix Systems R&D

dev/xen/xenstore/xenstored_dev.c:
 - Add the xenstored character device that's used to map the xenstore
   memory into user-space, and to report the event channel used by
   xenstore.

conf/files:
 - Add the device to the build process.

9 years agoxen: convert the xenstore user-space char device to a newbus device
royger [Tue, 30 Sep 2014 17:31:04 +0000 (17:31 +0000)]
xen: convert the xenstore user-space char device to a newbus device

Convert the xenstore user-space device (/dev/xen/xenstore) to a device
using the newbus interface. This allows us to make the device
initialization dependant on the initialization of xenstore itself in
the kernel.

Sponsored by: Citrix Systems R&D

dev/xen/xenstore/xenstore.c:
 - Convert to a newbus device, this removes the xs_dev_init function.

xen/xenstore/xenstore_internal.h:
 - Remove xs_dev_init prototype.

dev/xen/xenstore/xenstore.c:
 - Don't call xs_dev_init anymore, the device will attach itself when
   xenstore is started.

9 years agoxen: defer xenstore initialization until xenstored is started
royger [Tue, 30 Sep 2014 17:27:56 +0000 (17:27 +0000)]
xen: defer xenstore initialization until xenstored is started

The xenstore related devices in the kernel cannot be started until
xenstored is running, which will happen later in the Dom0 case. If
start_info_t doesn't contain a valid xenstore event channel, defer all
xenstore related devices attachment to later.

Sponsored by: Citrix Systems R&D

dev/xen/xenstore/xenstore.c:
 - Prevent xenstore from trying to attach it's descendant devices if
   xenstore is not initialized.
 - Add a callback in the xenstore interrupt filter that will trigger
   the plug of xenstore descendant devices on the first received
   interrupt. This interrupt is generated when xenstored attaches to
   the event channel, and serves as a notification that xenstored is
   running.

9 years agoOnly define the full inm_print() if KTR_IGMPV3 is enabled at compile time.
jhb [Tue, 30 Sep 2014 17:26:34 +0000 (17:26 +0000)]
Only define the full inm_print() if KTR_IGMPV3 is enabled at compile time.

9 years agoExplicitly return None for negative event indices. Prior to this,
jhb [Tue, 30 Sep 2014 17:19:07 +0000 (17:19 +0000)]
Explicitly return None for negative event indices.  Prior to this,
eventat(-1) would return the next-to-last event causing the back button
to cycle back to the end of an event source instead of stopping at the
start.

9 years agoxen: move xenstore devices
royger [Tue, 30 Sep 2014 17:14:11 +0000 (17:14 +0000)]
xen: move xenstore devices

Move xenstore related devices (xenstore.c and xenstore_dev.c) from
xen/xenstore to dev/xen/xenstore. This is just code motion, no
functional changes.

Sponsored by: Citrix Systems R&D

9 years agoxen: make xen balloon a driver that depends on xenstore
royger [Tue, 30 Sep 2014 16:53:08 +0000 (16:53 +0000)]
xen: make xen balloon a driver that depends on xenstore

This is done so we can prevent the Xen Balloon driver from attaching
before xenstore is setup.

Sponsored by: Citrix Systems R&D

dev/xen/balloon/balloon.c:
 - Make xen balloon a driver that depends on xenstore.

9 years agoxen: add the Xen implementation of pci_child_added method
royger [Tue, 30 Sep 2014 16:49:17 +0000 (16:49 +0000)]
xen: add the Xen implementation of pci_child_added method

Add the Xen specific implementation of pci_child_added to the Xen PCI
bus. This is needed so FreeBSD can register the devices it finds with
the hypervisor.

Sponsored by: Citrix Systems R&D

x86/xen/xen_pci.c:
 - Add the Xen pci_child_added method.

9 years agomsi: add Xen MSI implementation
royger [Tue, 30 Sep 2014 16:46:45 +0000 (16:46 +0000)]
msi: add Xen MSI implementation

This patch adds support for MSI interrupts when running on Xen. Apart
from adding the Xen related code needed in order to register MSI
interrupts this patch also makes the msi_init function a hook in
init_ops, so different MSI implementations can have different
initialization functions.

Sponsored by: Citrix Systems R&D

xen/interface/physdev.h:
 - Add the MAP_PIRQ_TYPE_MULTI_MSI to map multi-vector MSI to the Xen
   public interface.

x86/include/init.h:
 - Add a hook for setting custom msi_init methods.

amd64/amd64/machdep.c:
i386/i386/machdep.c:
 - Set the default msi_init hook to point to the native MSI
   initialization method.

x86/xen/pv.c:
 - Set the Xen MSI init hook when running as a Xen guest.

x86/x86/local_apic.c:
 - Call the msi_init hook instead of directly calling msi_init.

xen/xen_intr.h:
x86/xen/xen_intr.c:
 - Introduce support for registering/releasing MSI interrupts with
   Xen.
 - The MSI interrupts will use the same PIC as the IO APIC interrupts.

xen/xen_msi.h:
x86/xen/xen_msi.c:
 - Introduce a Xen MSI implementation.

x86/xen/xen_nexus.c:
 - Overwrite the default MSI hooks in the Xen Nexus to use the Xen MSI
   implementation.

x86/xen/xen_pci.c:
 - Introduce a Xen specific PCI bus that inherits from the ACPI PCI
   bus and overwrites the native MSI methods.
 - This is needed because when running under Xen the MSI messages used
   to configure MSI interrupts on PCI devices are written by Xen
   itself.

dev/acpica/acpi_pci.c:
 - Lower the quality of the ACPI PCI bus so the newly introduced Xen
   PCI bus can take over when needed.

conf/files.i386:
conf/files.amd64:
 - Add the newly created files to the build process.

9 years agoFix old iSCSI initiator to work with new CAM locking.
mav [Tue, 30 Sep 2014 16:17:12 +0000 (16:17 +0000)]
Fix old iSCSI initiator to work with new CAM locking.

This switches code to using xpt_scan() routine, irrelevant to locking.
Using xpt_action() directly requires knowledge about higher level locks,
that SIM does not need to have.

This code is obsoleted, but that is not a reason to crash.

MFC after: 3 days

9 years agoFix pkill unit tests.
rodrigc [Tue, 30 Sep 2014 15:27:49 +0000 (15:27 +0000)]
Fix pkill unit tests.

- use daemon(8) to write out a pid file for processes,
  and check for for the existence of that file after
  killing processes
- use explict named parameters to jail(8)

9 years agoMake sure __ARM_ARCH is defined in sysreg.h by including acle-compat.h
andrew [Tue, 30 Sep 2014 13:32:45 +0000 (13:32 +0000)]
Make sure __ARM_ARCH is defined in sysreg.h by including acle-compat.h

9 years agoRemove redundant call to ipsec_getpolicybyaddr().
ae [Tue, 30 Sep 2014 13:15:19 +0000 (13:15 +0000)]
Remove redundant call to ipsec_getpolicybyaddr().
ipsec_hdrsiz() will call it internally.

Sponsored by: Yandex LLC

9 years agoBe prepared that set_dumper() might fail even when resetting it or prefix
pjd [Tue, 30 Sep 2014 12:00:50 +0000 (12:00 +0000)]
Be prepared that set_dumper() might fail even when resetting it or prefix
the call with (void) to document that we intentionally ignore the return
value - no way to handle an error in case of device disappearing.

9 years agoStyle fixes.
pjd [Tue, 30 Sep 2014 11:51:32 +0000 (11:51 +0000)]
Style fixes.

9 years agoWhen plen != ulen, it should only be checked when this is UDP.
kevlo [Tue, 30 Sep 2014 07:28:31 +0000 (07:28 +0000)]
When plen != ulen, it should only be checked when this is UDP.

Spotted by: bryanv

9 years agoAdd a missing file from the last commit.
adrian [Tue, 30 Sep 2014 05:50:34 +0000 (05:50 +0000)]
Add a missing file from the last commit.

Noticed by: jhibbits

9 years agoMake clear in the ipheth(4) hardware notes that this driver is for the
gavin [Tue, 30 Sep 2014 05:36:16 +0000 (05:36 +0000)]
Make clear in the ipheth(4) hardware notes that this driver is for the
tethering functionality only.  Add a "bugs" section to give a pointer
to usbconfig set_config if the device isn't automatically detected.

MFC after: 3 days

9 years agoRemove this stuff - it's no longer needed here.
adrian [Tue, 30 Sep 2014 03:29:46 +0000 (03:29 +0000)]
Remove this stuff - it's no longer needed here.

9 years agoAdd initial support for the AR9485 CUS198 / CUS230 variants.
adrian [Tue, 30 Sep 2014 03:19:29 +0000 (03:19 +0000)]
Add initial support for the AR9485 CUS198 / CUS230 variants.

These variants have a few differences from the default AR9485 NIC,
namely:

* a non-default antenna switch config;
* slightly different RX gain table setup;
* an external XLNA hooked up to a GPIO pin;
* (and not yet done) RSSI threshold differences when
  doing slow diversity.

To make this possible:

* Add the PCI device list from Linux ath9k, complete with vendor and
  sub-vendor IDs for various things to be enabled;
* .. and until FreeBSD learns about a PCI device list like this,
  write a search function inspired by the USB device enumeration code;
* add HAL_OPS_CONFIG to the HAL attach methods; the HAL can use this
  to initialise its local driver parameters upon attach;
* copy these parameters over in the AR9300 HAL;
* don't default to override the antenna switch - only do it for
  the chips that require it;
* I brought over ar9300_attenuation_apply() from ath9k which is cleaner
  and easier to read for this particular NIC.

This is a work in progress.  I'm worried that there's some post-AR9380
NIC out there which doesn't work without the antenna override set as
I currently haven't implemented bluetooth coexistence for the AR9380
and later HAL.  But I'd rather have this code in the tree and fix it
up before 11.0-RELEASE happens versus having a set of newer NICs
in laptops be effectively RX deaf.

Tested:

* AR9380 (STA)
* AR9485 CUS198 (STA)

Obtained from: Qualcomm Atheros, Linux ath9k

9 years agoDocument [EPERM] for UNIX sockets.
bdrewery [Tue, 30 Sep 2014 00:06:53 +0000 (00:06 +0000)]
Document [EPERM] for UNIX sockets.

MFC after: 2 weeks

9 years agoUse bzero instead of explicitly zeroing stuff in do_execve.
mjg [Mon, 29 Sep 2014 23:59:19 +0000 (23:59 +0000)]
Use bzero instead of explicitly zeroing stuff in do_execve.

While strictly speaking this is not correct since some fields are pointers,
it makes no difference on all supported archs and we already rely on it doing
the right thing in other places.

No functional changes.

9 years agoSigh, remove a line that needs to be removed along with previous commit.
delphij [Mon, 29 Sep 2014 21:54:46 +0000 (21:54 +0000)]
Sigh, remove a line that needs to be removed along with previous commit.

Submitted by: mjg
MFC after: 3 days
X-MFC-with: 272288

9 years agoWhen setting environment variables in the atrun script, use the
delphij [Mon, 29 Sep 2014 21:45:57 +0000 (21:45 +0000)]
When setting environment variables in the atrun script, use the
"export foo=bar" form instead of "foo=bar; export foo" since the
former allows the shell to catch variable names that are not valid
shell identifiers.  This will cause /bin/sh to exit with an error
(which gets mailed to the at user) and it will not run the script.

Obtained from: OpenBSD (r1.63 millert)
MFC after: 3 days

9 years agoImport ACPICA 20140926.
jkim [Mon, 29 Sep 2014 19:53:38 +0000 (19:53 +0000)]
Import ACPICA 20140926.

9 years agoEnsure that ixl_flush() uses a defined register on VFs
rstone [Mon, 29 Sep 2014 17:51:39 +0000 (17:51 +0000)]
Ensure that ixl_flush() uses a defined register on VFs

In some code that is shared between the ixl(4) and ixlv(4) drivers,
a macro hard-coded a register offset that was not valid on ixlv devices.
Fix this by having each driver define a variable that contains the correct
offset.

Reviewed by: Eric Joyner <ricera10 AT gmail.com>
MFC after: 3 days
Sponsored by: Sandvine Inc

9 years agoFix integer truncation in affecting systat -ifstat
rstone [Mon, 29 Sep 2014 17:38:50 +0000 (17:38 +0000)]
Fix integer truncation in affecting systat -ifstat

The "systat -ifstat" command was using a u_int to store byte counters.
With a 10Gbps or faster interface, this overflows within the default
5 second refresh period.  Switch to using a uint64_t across the board,
which matches the size used for all counters as of r263102.

PR: 182448
MFC after: 1 week
Sponsored by: Sandvine Inc

9 years agoSearch for the nearest PORTSDIR where Mk/bsd.ports.mk exists, from .CURDIR.
will [Mon, 29 Sep 2014 15:05:23 +0000 (15:05 +0000)]
Search for the nearest PORTSDIR where Mk/bsd.ports.mk exists, from .CURDIR.
This will only take effect if PORTSDIR is not set, as previously supported.

Use .if exists(), for four specific possibilities relative to .CURDIR:
., .., ../.., and ../../..  The fourth possibility is primarily in case
ports ever grows a third level.  If none of these paths exist, fall back to
the old default of /usr/ports.

This removes the need to set PORTSDIR explicitly (or via wrapper script) if
one is running out of a ports tree that is not in /usr/ports, but in a
home directory.

Reviewed by: bapt, bdrewery (older version)
CR: D799
MFC after: 1 week
Sponsored by: Spectra Logic

9 years agoHopefully fix build breakage with gcc passing void * instead of char *
bz [Mon, 29 Sep 2014 10:36:14 +0000 (10:36 +0000)]
Hopefully fix build breakage with gcc passing void * instead of char *
to "%s" format string after r272280.

PR: 83099 193927
MFC after: 3 days
X-MFC with: r272280

9 years agoInstead of failing when neither PAM_TTY nor PAM_RHOST are available, call
des [Mon, 29 Sep 2014 08:57:36 +0000 (08:57 +0000)]
Instead of failing when neither PAM_TTY nor PAM_RHOST are available, call
login_access() with "**unknown**" as the second argument.  This will allow
"ALL" rules to match.

Reported by: Tim Daneliuk <tundra@tundraware.com>
Tested by: dim@
PR: 83099 193927
MFC after: 3 days

9 years agoComment cleanup in panic() message when mkimg(1) does not support
gjb [Mon, 29 Sep 2014 01:17:42 +0000 (01:17 +0000)]
Comment cleanup in panic() message when mkimg(1) does not support
the requested disk image format.

Sponsored by: The FreeBSD Foundation

9 years agoUse snprintf(3) in place of unbounded sprintf(3) (prevent buffer overflow).
dteske [Mon, 29 Sep 2014 00:35:12 +0000 (00:35 +0000)]
Use snprintf(3) in place of unbounded sprintf(3) (prevent buffer overflow).
Use adequately sized buffer for error(s) (512 -> PATH_MAX + 512).
Fix the following style(9) nits while here:
- distfetch.c uses PATH_MAX while distextract.c uses MAXPATHLEN;
  standardize on one (PATH_MAX)
- Move $FreeBSD$ from comment to __FBSDID()
- Sort included headers (alphabetically, sys/* at top)
- Add missing header includes (e.g., <stdlib.h> for getenv(3),
  calloc(3)/malloc(3)/free(3), and atoi(3); <string.h> for strdup(3),
  strrchr(3), strsep(3), and strcmp(3); <ctype.h> for isspace(3); and
  <unistd.h> for chdir(2), etc.)
- Remove rogue newline at end of distfetch.c
- Don't declare variables in if-, while-, or other statement
NB: To prevent masking of prior declarations atop function
- Perform stack alignment for variable declarations
- Add missing function prototype for count_files() in distextract.c
- Break out single-line multivariable-declarations
NB: Aligning similarly-named variables with one-char difference(s)
NB: Minimizes diffs and makes future diffs more clear
- Use err(3) family of functions (requires s/int err;/int retval;/g)

Reviewed by: nwhitehorn, julian

9 years agoRemove the UFS label from the root filesystem since it is added
gjb [Sun, 28 Sep 2014 23:22:55 +0000 (23:22 +0000)]
Remove the UFS label from the root filesystem since it is added
by mkimg(1) as a gpt label, consistent with the fstab(5) entry.

Sponsored by: The FreeBSD Foundation

9 years agoChange the /var dataset in the default ZFS layout to have the
allanjude [Sun, 28 Sep 2014 21:44:23 +0000 (21:44 +0000)]
Change the /var dataset in the default ZFS layout to have the
ZFS property canmount=off so that /var/db/pkg and other such directories
are part of the / dataset, and only /var/mail, /var/log, and /var/crash
are excluded from the ZFS boot environment (beadm).

PR: 193971
Approved by: jmg
MFC after: ASAP
Relnotes: yes
Sponsored by: ScaleEngine Inc.

9 years agoAdd strptime(3) support for %U and %W (take 2)
pfg [Sun, 28 Sep 2014 21:20:20 +0000 (21:20 +0000)]
Add strptime(3) support for %U and %W (take 2)

Add support for the missing POSIX-2001 %U and %W features: the
existing FreeBSD strptime code recognizes both directives and
validates that the week number lies in the permitted range,
but then simply discards the value.

Initial support for the feature was written by Paul Green.
David Carlier added the initial handling of tm_wday/tm_yday.
Major credit goes to Andrey Chernov for detecting much of the
brokenness, and rewriting/cleaning most of the code, making it
much more robust.

Tested independently with the strptime test from the GNU C
library.

PR: 137307
MFC after: 1 month
Relnotes: yes

9 years agoRemove comments left in accidentally while testing, so the
gjb [Sun, 28 Sep 2014 21:15:30 +0000 (21:15 +0000)]
Remove comments left in accidentally while testing, so the
VM /etc/fstab is actually created.

Sponsored by: The FreeBSD Foundation

9 years agoFix UFS label for the root filesystem.
gjb [Sun, 28 Sep 2014 21:13:30 +0000 (21:13 +0000)]
Fix UFS label for the root filesystem.

Sponsored by: The FreeBSD Foundation

9 years agotty_rel_free() can be called more than once for the same tty so make sure
neel [Sun, 28 Sep 2014 21:12:23 +0000 (21:12 +0000)]
tty_rel_free() can be called more than once for the same tty so make sure
that the tty is dequeued from 'tty_list' only the first time.

The panic below was seen when a revoke(2) was issued on an nmdm device.
In this case there was also a thread that was blocked on a read(2) on the
device. The revoke(2) woke up the blocked thread which would typically
return an error to userspace. In this case the reader also held the last
reference on the file descriptor so fdrop() ended up calling tty_rel_free()
via ttydev_close().

tty_rel_free() then tried to dequeue 'tp' again which led to the panic.

panic: Bad link elm 0xfffff80042602400 prev->next != elm
cpuid = 1
KDB: stack backtrace:
db_trace_self_wrapper() at db_trace_self_wrapper+0x2b/frame 0xfffffe00f9c90460
kdb_backtrace() at kdb_backtrace+0x39/frame 0xfffffe00f9c90510
vpanic() at vpanic+0x189/frame 0xfffffe00f9c90590
panic() at panic+0x43/frame 0xfffffe00f9c905f0
tty_rel_free() at tty_rel_free+0x29b/frame 0xfffffe00f9c90640
ttydev_close() at ttydev_close+0x1f9/frame 0xfffffe00f9c90690
devfs_close() at devfs_close+0x298/frame 0xfffffe00f9c90720
VOP_CLOSE_APV() at VOP_CLOSE_APV+0x13c/frame 0xfffffe00f9c90770
vn_close() at vn_close+0x194/frame 0xfffffe00f9c90810
vn_closefile() at vn_closefile+0x48/frame 0xfffffe00f9c90890
devfs_close_f() at devfs_close_f+0x2c/frame 0xfffffe00f9c908c0
_fdrop() at _fdrop+0x29/frame 0xfffffe00f9c908e0
sys_read() at sys_read+0x63/frame 0xfffffe00f9c90980
amd64_syscall() at amd64_syscall+0x2b3/frame 0xfffffe00f9c90ab0
Xfast_syscall() at Xfast_syscall+0xfb/frame 0xfffffe00f9c90ab0
--- syscall (3, FreeBSD ELF64, sys_read), rip = 0x800b78d8a, rsp = 0x7fffffbfdaf8, rbp = 0x7fffffbfdb30 ---

CR: https://reviews.freebsd.org/D851
Reviewed by: glebius, ed
Reported by: Leon Dang
Sponsored by: Nahanni Systems
MFC after: 1 week

9 years agorelease/Makefile:
gjb [Sun, 28 Sep 2014 20:06:02 +0000 (20:06 +0000)]
release/Makefile:
  Include .OBJDIR in DESTDIR in the vm-base target.

release/release.sh:
  Provide the full path to mddev.

Sponsored by: The FreeBSD Foundation

9 years agoConvert most BPF_TAP users to BPF_MTAP.
melifaro [Sun, 28 Sep 2014 19:05:22 +0000 (19:05 +0000)]
Convert most BPF_TAP users to BPF_MTAP.

MFC after: 2 weeks

9 years agorelease/Makefile:
gjb [Sun, 28 Sep 2014 17:53:10 +0000 (17:53 +0000)]
release/Makefile:
  Connect the virtual machine image build to the release
  target if WITH_VMIMAGES is set to a non-empty value.

release/release.sh:
  Add WITH_VMIMAGES to RELEASE_RMAKEFLAGS.

release/release.conf.sample:
  Add commented entries for tuning the release build if the
  WITH_VMIMAGES make(1) environment variable is set to
  a non-empty value.

Sponsored by: The FreeBSD Foundation

9 years agoChecksum coverage values larger than 65535 for UDPLite are invalid.
tuexen [Sun, 28 Sep 2014 17:22:45 +0000 (17:22 +0000)]
Checksum coverage values larger than 65535 for UDPLite are invalid.
Check for this when the user calls setsockopt using UDPLITE_{SEND,RECV}CSCOV.

Reviewed by: kevlo
MFC after: 3 days

9 years agoRemove a 'set -x' that snuck in during testing.
gjb [Sun, 28 Sep 2014 17:16:45 +0000 (17:16 +0000)]
Remove a 'set -x' that snuck in during testing.

Sponsored by: The FreeBSD Foundation

9 years agoMove the unconditional #include of net/ifq.h to the very end of file.
bz [Sun, 28 Sep 2014 17:09:40 +0000 (17:09 +0000)]
Move the unconditional #include of net/ifq.h to the very end of file.
This seems to allow us to pass a universe with either clang or gcc
after r272244 (and r272260) and probably makes it easier to untabgle
these chained #includes in the future.

9 years agoRemove duplicate declaraton of the if_inc_counter() function after r272244.
bz [Sun, 28 Sep 2014 15:38:21 +0000 (15:38 +0000)]
Remove duplicate declaraton of the if_inc_counter() function after r272244.
if_var.h has the expected on and if_var.h include ifq.h and thus we get
duplicates.  It seems only one cavium ethernet file actually includes ifq.h
directly which might be another cleanup to be done but need to test first.

9 years agoMFi386: Enable QUOTA, PRINTF_BUFR_SIZE and puc.
nyan [Sun, 28 Sep 2014 14:39:11 +0000 (14:39 +0000)]
MFi386: Enable QUOTA, PRINTF_BUFR_SIZE and puc.

9 years ago- Cosmetic changes.
nyan [Sun, 28 Sep 2014 14:25:46 +0000 (14:25 +0000)]
- Cosmetic changes.
- Reduce diffs against i386.

9 years ago- Remove empty wrappers ether_poll_[de]register_drv(). [1]
glebius [Sun, 28 Sep 2014 14:05:18 +0000 (14:05 +0000)]
- Remove empty wrappers ether_poll_[de]register_drv(). [1]
- Move polling(9) declarations out of ifq.h back to if_var.h
  they are absolutely unrelated to queues.

Submitted by: Mikhail <mp lenta.ru> [1]

9 years agoMFi386: r261567
nyan [Sun, 28 Sep 2014 13:34:43 +0000 (13:34 +0000)]
MFi386: r261567

  Switch from lib/libstand to sys/boot/libstand32.