dragonfly.git
2 years agotuning.7: Fix .Fx/.Dx confusion a bit better.
Sascha Wildner [Thu, 27 Apr 2017 06:53:02 +0000 (08:53 +0200)]
tuning.7: Fix .Fx/.Dx confusion a bit better.

* Remove a rather meaningless sentence about the VM.

* In HISTORY, it is indeed FreeBSD that we are referring to. Add some
  info about DragonFly.

* Add an AUTHORS section.

2 years agodocs - Fix name type-o
Matthew Dillon [Wed, 26 Apr 2017 19:51:12 +0000 (12:51 -0700)]
docs - Fix name type-o

* Fix .Fx use that was supposed to be .Dx.

Reported-by: kerma
2 years ago<fcntl.h>: Add some missing defines (required by POSIX).
Sascha Wildner [Mon, 24 Apr 2017 17:22:39 +0000 (19:22 +0200)]
<fcntl.h>: Add some missing defines (required by POSIX).

   SEEK_SET   S_ISUID   S_IRWXU   S_IRWXG   S_IRWXO
   SEEK_CUR   S_ISGID   S_IRUSR   S_IRGRP   S_IROTH
   SEEK_END             S_IWUSR   S_IWGRP   S_IWOTH
                        S_IXUSR   S_IXGRP   S_IXOTH

Adjust <stat.h>, <stdio.h> and <unistd.h> accordingly.

See http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/fcntl.h.html

2 years agokernel - Fix double-free in if_ath, fix lost rcvif.
Matthew Dillon [Mon, 24 Apr 2017 17:06:32 +0000 (10:06 -0700)]
kernel - Fix double-free in if_ath, fix lost rcvif.

* Reassign rcvif in ieee80211_vap_pkt_send_dest() prior to calling
  ic_transmit().  The rcvif assignment can get lost from packet
  manipulation above that section of code.

* Fix a double-free in if_ath in the error path for ath_transmit().
  Callers of ic_transmit (aka ath_transmit in this case) expect the
  mbuf to remain intact on a non-zero error return.

* Document confusing code in WPI.

Reported-by: marino
Reviewed-by: sephe
2 years agokernel - Fix i915 deadlock
Matthew Dillon [Sun, 23 Apr 2017 00:30:54 +0000 (17:30 -0700)]
kernel - Fix i915 deadlock

* (Attempt to) fix a deadlock in the i915 code.  The device lock retry
  code does not release the PG_BUSY on the passed-in placeholder page,
  so the fact that the lock is obtained non-blocking is irrelevant.

  Try to fix this by immediately releasing the placeholder page.  The
  code already checks for an insertion race later on.

2 years agox86_64: Identify HWP in "Thermal and PM features"
François Tigeot [Sat, 22 Apr 2017 08:29:45 +0000 (10:29 +0200)]
x86_64: Identify HWP in "Thermal and PM features"

Also known as Hardware-managed P-states.

2 years agoix: Fixup TX/RX ring settings for X550, which supports 64/64 TX/RX rings.
Sepherosa Ziehau [Tue, 18 Apr 2017 04:22:26 +0000 (12:22 +0800)]
ix: Fixup TX/RX ring settings for X550, which supports 64/64 TX/RX rings.

2 years agosys/vfs/hammer: Drop typedefs for struct hammer_ioc_{hist_entry,mrecord_head}
Tomohiro Kusumi [Mon, 17 Apr 2017 18:48:22 +0000 (21:48 +0300)]
sys/vfs/hammer: Drop typedefs for struct hammer_ioc_{hist_entry,mrecord_head}

These are the only two ioctl structs with pointer typedefs. All the
rest of ioctl structs aren't typedef'd, and there isn't really any
reason that these two need to be typedef'd.

Note that almost all non ioctl HAMMER structs have pointer typedef,
and majority of variables have been typedef'd ones from the beginning
(since they were mostly pointers). Rest were changed to use typedef'd
at some point in 2016, to avoid mix of these for no reason, though
typedef'd pointers have ugliness when used as const.

2 years agosbin/*hammer: Add missing braces to conform to code style
Tomohiro Kusumi [Mon, 17 Apr 2017 11:18:10 +0000 (14:18 +0300)]
sbin/*hammer: Add missing braces to conform to code style

These were the missing ones due to
1. the code were written by several devs
2. they were missing ever since originally written by dillon@

2 years agosbin/mount_hammer: Use calloc(3) and cleanups
Tomohiro Kusumi [Mon, 17 Apr 2017 11:17:48 +0000 (14:17 +0300)]
sbin/mount_hammer: Use calloc(3) and cleanups

2 years agokernel: Remove TCPDEBUG checks in tcp_debug.c.
Sascha Wildner [Sun, 16 Apr 2017 23:04:20 +0000 (01:04 +0200)]
kernel: Remove TCPDEBUG checks in tcp_debug.c.

This file is only compiled in when TCPDEBUG is specified, so the check
is always true.

2 years agokernel: Fix building with options TCPDEBUG.
Sascha Wildner [Sun, 16 Apr 2017 23:00:53 +0000 (01:00 +0200)]
kernel: Fix building with options TCPDEBUG.

2 years agosys/vfs/autofs: Value returned by taskqueue_enqueue_timeout(9) is not an error; ...
Tomohiro Kusumi [Sun, 16 Apr 2017 22:01:29 +0000 (01:01 +0300)]
sys/vfs/autofs: Value returned by taskqueue_enqueue_timeout(9) is not an error; (FreeBSD@GitHub e61af21d)

2 years agosys/vfs/autofs: Sync with FreeBSD's .vop_print format (FreeBSD@GitHub d8ce902a)
Tomohiro Kusumi [Sun, 16 Apr 2017 21:56:47 +0000 (00:56 +0300)]
sys/vfs/autofs: Sync with FreeBSD's .vop_print format (FreeBSD@GitHub d8ce902a)

FreeBSD@GitHub d8ce902a4769ab96ae8e86a730221d92a5978e4a
Implement autofs_print(), for improved debugging experience.

added .vop_print after autofs had been ported to DragonFlyBSD,
and it had anp->an_wildcards which we didn't, so just add it.

2 years agousr.sbin/fstyp: Use NULL instead of 0 for pointers. (FreeBSD@GitHub 27f4c84a)
Tomohiro Kusumi [Sun, 16 Apr 2017 11:06:47 +0000 (14:06 +0300)]
usr.sbin/fstyp: Use NULL instead of 0 for pointers. (FreeBSD@GitHub 27f4c84a)

2 years agousr.sbin/fstyp: Improve formatting. (FreeBSD@GitHub dc9b2340)
Tomohiro Kusumi [Sun, 16 Apr 2017 11:03:53 +0000 (14:03 +0300)]
usr.sbin/fstyp: Improve formatting. (FreeBSD@GitHub dc9b2340)

2 years agousr.sbin/autofs: Make autounmountd(8) not die when traced with "truss -p". (FreeBSD...
Tomohiro Kusumi [Sun, 16 Apr 2017 00:17:50 +0000 (03:17 +0300)]
usr.sbin/autofs: Make autounmountd(8) not die when traced with "truss -p". (FreeBSD@GitHub 8381908c)

2 years agousr.sbin/autofs: Use proper argument order for calloc(3). (FreeBSD@GitHub 6add75fe)
Tomohiro Kusumi [Sun, 16 Apr 2017 00:15:31 +0000 (03:15 +0300)]
usr.sbin/autofs: Use proper argument order for calloc(3). (FreeBSD@GitHub 6add75fe)

2 years ago<time.h>: For clarity, add prototypes (in #if 0) for missing functions.
Sascha Wildner [Sun, 16 Apr 2017 11:07:51 +0000 (13:07 +0200)]
<time.h>: For clarity, add prototypes (in #if 0) for missing functions.

2 years agosound/hda: Fix name for the Wildcat Point-LP (Broadwell PCH audio) model.
Imre Vadász [Sun, 16 Apr 2017 10:46:52 +0000 (12:46 +0200)]
sound/hda: Fix name for the Wildcat Point-LP (Broadwell PCH audio) model.

2 years agodrm/i915: Implement dev_to_i915(), instead of pancing with BUG().
Imre Vadász [Sun, 16 Apr 2017 08:28:17 +0000 (10:28 +0200)]
drm/i915: Implement dev_to_i915(), instead of pancing with BUG().

2 years agotcp: Don't assume power of 2 netisrs.
Sepherosa Ziehau [Sun, 16 Apr 2017 00:10:42 +0000 (08:10 +0800)]
tcp: Don't assume power of 2 netisrs.

2 years agosbin/hammer: Fix hammer(8)
Tomohiro Kusumi [Sat, 15 Apr 2017 21:18:38 +0000 (00:18 +0300)]
sbin/hammer: Fix hammer(8)

It's no longer HAMMER volume once stripped, so drop "HAMMER".

2 years agosys/vfs/hammer: Use hammer_crc_t
Tomohiro Kusumi [Sat, 15 Apr 2017 21:04:40 +0000 (00:04 +0300)]
sys/vfs/hammer: Use hammer_crc_t

Use hammer_crc_t rather than uint32_t which is the same thing.
This commit doesn't (and shouldn't) replace CRC variables that are
not HAMMER's ondisk CRC field or ioctl, but for general purpose.

2 years agosbin/hammer: Drop unused buffer_info variable
Tomohiro Kusumi [Sat, 15 Apr 2017 20:50:53 +0000 (23:50 +0300)]
sbin/hammer: Drop unused buffer_info variable

2 years agosbin/hammer: Fix HammerVersion initialization added by 4c09d9c4
Tomohiro Kusumi [Sat, 15 Apr 2017 19:29:02 +0000 (22:29 +0300)]
sbin/hammer: Fix HammerVersion initialization added by 4c09d9c4

4c09d9c4 added HammerVersion initialization code to load_volume(),
but this must be done only if volume is a root volume.

hammer version-upgrade only overwrites vol_version field of root
volume header, thus load_volume() updating HammerVersion using
non root volume(s) after once initialized using the root volume
breaks everything that volume version involves.

If HammerVersion isn't initialized by reading the volume header
(i.e. initialzied via ioctl when fs is mounted), it doesn't break
anything at least in the same way as this.

2 years agosbin/hammer: Cleanup get_buf_crc() after 965831f0
Tomohiro Kusumi [Sat, 15 Apr 2017 14:25:21 +0000 (17:25 +0300)]
sbin/hammer: Cleanup get_buf_crc() after 965831f0

Make get_buf_crc() look the same as get_inode_crc().
This is much more readable with slightly more overhead to go through
a while loop twice (at most where each loop may continue max 4 times).

2 years agosbin/hammer: Cleanup/rename get_leaf_crc() after 965831f0
Tomohiro Kusumi [Sat, 15 Apr 2017 13:43:00 +0000 (16:43 +0300)]
sbin/hammer: Cleanup/rename get_leaf_crc() after 965831f0

get_leaf_crc() is no longer a generic fucntion after 965831f0 dropped
non inode part, so rename it to get_inode_crc() with refactoring.
No functional change.

2 years agosbin/hammer: Fix newly added crc prefix character by 4c09d9c4
Tomohiro Kusumi [Sat, 15 Apr 2017 13:10:33 +0000 (16:10 +0300)]
sbin/hammer: Fix newly added crc prefix character by 4c09d9c4

4c09d9c4 made hammer show command function get_leaf_crc() use
1. "ocrc=" for old CRC
2. "icrc=" for version 7 CRC
3. "crc=" for others (i.e. bad CRC)

for inodes, but this isn't the same with get_buf_crc() for other records.

4c09d9c4 made get_buf_crc() use
1. "ocrc=" for old CRC
2. "icrc=" for others (i.e. version 7 CRC and bad CRC)

These two functions need to use the same CRC prefix character.
Add "crc=" case to get_buf_crc().

2 years agobsd-family-tree: Sync with FreeBSD (OpenBSD 6.1).
Sascha Wildner [Sat, 15 Apr 2017 12:15:04 +0000 (14:15 +0200)]
bsd-family-tree: Sync with FreeBSD (OpenBSD 6.1).

2 years agoUpdate the pciconf(8) database.
Sascha Wildner [Sat, 15 Apr 2017 12:14:28 +0000 (14:14 +0200)]
Update the pciconf(8) database.

April 3, 2017 snapshot from http://pciids.sourceforge.net/

2 years agodrm/linux: add component.h
François Tigeot [Sat, 15 Apr 2017 08:48:33 +0000 (10:48 +0200)]
drm/linux: add component.h

2 years agosbin/hammer: Drop non inode case from get_leaf_crc()
Tomohiro Kusumi [Fri, 14 Apr 2017 17:12:54 +0000 (20:12 +0300)]
sbin/hammer: Drop non inode case from get_leaf_crc()

The default case in get_leaf_crc() added by 4c09d9c4 is unused
(it's repeating the same switch/cases done by its caller), but this
is also wrong for userspace where a malloc'd buffer can only be upto
16KiB regardless of what leaf elm says.

It can be guaranteed for inode since we know inode is smaller than
16KiB. It can also be guaranteed for other types of metadata too,
but those can simply use get_buf_crc() and in fact they do.

Also see 7d0dab48.

2 years agosbin/hammer: Fix indentation made by 4c09d9c4
Tomohiro Kusumi [Fri, 14 Apr 2017 16:25:48 +0000 (19:25 +0300)]
sbin/hammer: Fix indentation made by 4c09d9c4

2 years agosbin/*hammer: Use consistent static/inline/returntype format for functions
Tomohiro Kusumi [Fri, 14 Apr 2017 13:30:08 +0000 (16:30 +0300)]
sbin/*hammer: Use consistent static/inline/returntype format for functions

Change them to HAMMER2 style which has much more stable code style
than HAMMER1. HAMMER1 is basically a mix of every possible pattern
(even in the code originally written only by dillon@).

2 years agosbin/hammer: Test volume version in __verify_volume()
Tomohiro Kusumi [Fri, 14 Apr 2017 12:46:56 +0000 (15:46 +0300)]
sbin/hammer: Test volume version in __verify_volume()

Since now that HammerVersion is always used by CRC operations, and
blkdevs based hammer commands are likely to either test/set CRC,
the volume version should be checked after volume parameters are
loaded from ondisk volume header.

The reason for using >=WIP instead of >MAX is because that's how
newfs_hammer checks volume version, though it's currently the same
thing.

2 years ago<ndbm.h>: Fix dptr type and add comment about wrong type of dsize.
Sascha Wildner [Fri, 14 Apr 2017 17:26:42 +0000 (19:26 +0200)]
<ndbm.h>: Fix dptr type and add comment about wrong type of dsize.

2 years ago<stdio.h>: ftello() and fseeko() were in SUSv2, so extend visibility.
Sascha Wildner [Fri, 14 Apr 2017 17:25:48 +0000 (19:25 +0200)]
<stdio.h>: ftello() and fseeko() were in SUSv2, so extend visibility.

See:

http://pubs.opengroup.org/onlinepubs/007908799/xsh/fseek.html
http://pubs.opengroup.org/onlinepubs/007908799/xsh/ftell.html

2 years ago<sys/signal.h>: Change sigev_notify_attributes to pthread_attr_t *.
Sascha Wildner [Fri, 14 Apr 2017 17:24:14 +0000 (19:24 +0200)]
<sys/signal.h>: Change sigev_notify_attributes to pthread_attr_t *.

See:

http://pubs.opengroup.org/onlinepubs/9699919799/functions/V2_chap02.html

2 years agodrm/linux: Harmonize pr_debug() with the rest of the pr_* functions.
Peeter Must [Thu, 13 Apr 2017 12:57:48 +0000 (15:57 +0300)]
drm/linux: Harmonize pr_debug() with the rest of the pr_* functions.

2 years agoudp: Don't assume power of 2 netisrs.
Sepherosa Ziehau [Fri, 14 Apr 2017 06:09:29 +0000 (14:09 +0800)]
udp: Don't assume power of 2 netisrs.

2 years agoinpcb: Add function to set inpcbinfo's portinfo.
Sepherosa Ziehau [Fri, 14 Apr 2017 05:34:16 +0000 (13:34 +0800)]
inpcb: Add function to set inpcbinfo's portinfo.

This unbreaks inpcbinfo.portinfo_mask -> inpcbinfo.portinfo_cnt
conversion for divert inpcbs (unused by rip inpcbs).

2 years agosbin/hammer: Add missing fflush(stdout) in 8b6688a4
Tomohiro Kusumi [Thu, 13 Apr 2017 21:44:55 +0000 (00:44 +0300)]
sbin/hammer: Add missing fflush(stdout) in 8b6688a4

2 years agosbin/hammer: Rename hammer_parsedevs() to hammer_parse_blkdevs()
Tomohiro Kusumi [Thu, 13 Apr 2017 19:35:27 +0000 (22:35 +0300)]
sbin/hammer: Rename hammer_parsedevs() to hammer_parse_blkdevs()

Parsing HAMMER's blkdevs format devices is what this function does.

2 years agosbin/hammer: Allow any volume to be stripped by strip command
Tomohiro Kusumi [Thu, 13 Apr 2017 18:56:00 +0000 (21:56 +0300)]
sbin/hammer: Allow any volume to be stripped by strip command

hammer strip should be able to strip each volume independently whether
all volumes that consist filesystem are available or not. It makes no
sense to require all volumes when the purpose of command is to destroy
them, even though that's necessary to go through the whole process.

If root volume is missing or root volume has incomplete offset format,
layer1/2 won't be erased, but just header part.

2 years agosbin/hammer: Make volume count test optional for blkdevs based commands
Tomohiro Kusumi [Thu, 13 Apr 2017 18:48:16 +0000 (21:48 +0300)]
sbin/hammer: Make volume count test optional for blkdevs based commands

This is basically for feature enhancement of hammer strip command
in the next commit. No functional change by this commit.

Some blkdevs based commands need to be able to handle broken volume
headers by omitting volume verification (to certain extent). It has
been that way for the volume header contents, but not for volume
count as well as checking existence of root volume.

2 years agozoneinfo: Create a /usr/share/zoneinfo/UTC link.
Sascha Wildner [Thu, 13 Apr 2017 20:37:51 +0000 (22:37 +0200)]
zoneinfo: Create a /usr/share/zoneinfo/UTC link.

We renamed GMT to UTC in 949d11f282cb90e67a6d24e8017b0ceb83746d29.
This commit is a followup to that commit and fixes tzload() when
called with gmt[] from gmtload().

Because upstream still uses GMT, stuff the link into a separate
file to not pollute the "etcetera" file.

Also, keep the /usr/share/zoneinfo/GMT link for now.

Reported-by: ftigeot
2 years agoinpcb/localgroup: Use LSB of the hash to find inpcb.
Sepherosa Ziehau [Thu, 13 Apr 2017 08:15:01 +0000 (16:15 +0800)]
inpcb/localgroup: Use LSB of the hash to find inpcb.

This matches hash usage of the network stack.

2 years agoinpcb: Don't rely on ncpus2 for local port allocation.
Sepherosa Ziehau [Wed, 12 Apr 2017 16:46:17 +0000 (00:46 +0800)]
inpcb: Don't rely on ncpus2 for local port allocation.

2 years agosbin/hammer: Make some readonly pointer args const
Tomohiro Kusumi [Wed, 12 Apr 2017 20:24:04 +0000 (23:24 +0300)]
sbin/hammer: Make some readonly pointer args const

2 years agosbin/*hammer: Use typedef'd for struct zone_stat*
Tomohiro Kusumi [Wed, 12 Apr 2017 18:55:45 +0000 (21:55 +0300)]
sbin/*hammer: Use typedef'd for struct zone_stat*

This is a part of series of commits started from 21e9e7d5ff in 2016.
This is for userspace.

Some ugliness in const pointer in hammer_print_zone_stat()
(but note that HAMMER originally had bunch of pointer typedefs).

2 years agosbin/*hammer: Use typedef'd for struct cache_info*
Tomohiro Kusumi [Wed, 12 Apr 2017 18:39:58 +0000 (21:39 +0300)]
sbin/*hammer: Use typedef'd for struct cache_info*

This is a part of series of commits started from 21e9e7d5ff in 2016.
This is for userspace.

2 years agosbin/*hammer: Use typedef'd for struct buffer_info*
Tomohiro Kusumi [Wed, 12 Apr 2017 18:35:14 +0000 (21:35 +0300)]
sbin/*hammer: Use typedef'd for struct buffer_info*

This is a part of series of commits started from 21e9e7d5ff in 2016.
This is for userspace.

2 years agosbin/*hammer: Use typedef'd for struct volume_info*
Tomohiro Kusumi [Wed, 12 Apr 2017 18:25:51 +0000 (21:25 +0300)]
sbin/*hammer: Use typedef'd for struct volume_info*

This is a part of series of commits started from 21e9e7d5ff in 2016.
This is for userspace.

2 years agosbin/hammer: Cleanup prototypes
Tomohiro Kusumi [Wed, 12 Apr 2017 16:14:26 +0000 (19:14 +0300)]
sbin/hammer: Cleanup prototypes

2 years agosbin/hammer: Add /* not reached */ (missing ones in 052fd72b)
Tomohiro Kusumi [Wed, 12 Apr 2017 15:58:52 +0000 (18:58 +0300)]
sbin/hammer: Add /* not reached */ (missing ones in 052fd72b)

Some comments for errx(3) were missing in 052fd72b which was intended
to do this for all err(3)/errx(3) in sbin/hammer/*.c.

2 years agosound - Delete devfs clone handler for /dev/dsp and /dev/mixer on unload.
Imre Vadász [Wed, 12 Apr 2017 20:52:23 +0000 (22:52 +0200)]
sound - Delete devfs clone handler for /dev/dsp and /dev/mixer on unload.

* This makes sound work again after unloading and then reloading the
  sound(4) module.

* Only add the devfs clone handler, when the preceeding make_dev() was
  successful.

2 years agoRevert "kernel - Spread IPIs out to more priority levels"
Matthew Dillon [Fri, 7 Apr 2017 15:57:04 +0000 (08:57 -0700)]
Revert "kernel - Spread IPIs out to more priority levels"

This commit seems to be causing a performance regression on VMs.
Since it didn't fix a particular bug (was just supposed to make
things more robust), revert it for now.

Reported-by: tkusumi
This reverts commit f240042b9f9bcfdacd70499659fcc5f55d5e49ab.

2 years agodrm/linux: Add reinit_completion()
Peeter Must [Wed, 12 Apr 2017 11:42:04 +0000 (14:42 +0300)]
drm/linux: Add reinit_completion()

2 years agokernel - Temporarily set the default machdep.pmap_nx_enable to 0
Matthew Dillon [Wed, 12 Apr 2017 18:55:09 +0000 (11:55 -0700)]
kernel - Temporarily set the default machdep.pmap_nx_enable to 0

* Until we work out some issues, temporarily set the default
  machdep.pmap_nx_enable to 0.

* NOTE: This is a loader tunable only.

2 years agoRevert "libc: Add temporary (get|set)affinity DF404.0 symbols"
John Marino [Wed, 12 Apr 2017 13:19:24 +0000 (08:19 -0500)]
Revert "libc: Add temporary (get|set)affinity DF404.0 symbols"

This reverts commit 3c2537818c14aaba122a276020143cd4b92d2cbc.

As indicated in the original commit, the (get|set)affinity DF404.0
symbols were temporary and limited to the 4.7 development branch.
Now that 4.8 has been officially released, remove them as they
have served their purpose.  By now, all software built on 4.7
should have been rebuilt and thus nothing depends on the mistake
symbols.

2 years agosbin/hammer: Add /* not reached */ for usage() variants
Tomohiro Kusumi [Tue, 11 Apr 2017 20:51:35 +0000 (23:51 +0300)]
sbin/hammer: Add /* not reached */ for usage() variants

that were originally missing.
Recommended by dillon@.
No diff in sbin/hammer binary when assert(3) is disabled.

2 years agosbin/hammer: Add /* not reached */
Tomohiro Kusumi [Tue, 11 Apr 2017 20:33:47 +0000 (23:33 +0300)]
sbin/hammer: Add /* not reached */

that were originally missing.
Recommended by dillon@.
No diff in sbin/hammer binary when assert(3) is disabled.

2 years agosbin/hammer: Check S_ISREG() if not block device
Tomohiro Kusumi [Tue, 11 Apr 2017 19:23:07 +0000 (22:23 +0300)]
sbin/hammer: Check S_ISREG() if not block device

ioctl(DIOCGPART) failure doesn't mean path is a regfile.

2 years agosbin/hammer: Add is_regfile() (avoid directly using a string literal)
Tomohiro Kusumi [Tue, 11 Apr 2017 19:22:41 +0000 (22:22 +0300)]
sbin/hammer: Add is_regfile() (avoid directly using a string literal)

2 years agoppp - Fix minor overflow in protocol search
Matthew Dillon [Tue, 11 Apr 2017 05:28:36 +0000 (22:28 -0700)]
ppp - Fix minor overflow in protocol search

* Fix a minor redundant expression in sys/net/libalias/alias_irc.c

* Fix a one-byte overflow in cdcontrol.  Not a security issue.

* Fix an overflow in the protocol search.  This can only overflow a
  static array by one element and is not likely able to cause a security
  issue.

Dragonfly-bugs: 3012 (dcb)

2 years agolibtelnet - Fix improper statement construction (not a bug in the binary)
Matthew Dillon [Tue, 11 Apr 2017 05:19:30 +0000 (22:19 -0700)]
libtelnet - Fix improper statement construction (not a bug in the binary)

* libstand hammer1.c - remove extra format element in debugging printf.
  This code is not compiled by the build anyway.

* Fix statement construction in rsaencpwd.c.  The prior code generated
  the desired result (incrementing the ptr), but there was an extra
  ineffective indirection.  Removed the ineffective indirection.

Dragonfly-bugs: 3010 (dcb)

2 years agolibdevstat - Limit sscanf field, fix redundant condition
Matthew Dillon [Tue, 11 Apr 2017 05:13:55 +0000 (22:13 -0700)]
libdevstat - Limit sscanf field, fix redundant condition

* Limit a sscanf field to MAXHOSTNAMELEN - 1.

* Remove a redundant condition already tested by the first part of a
  conditional.

Dragonfly-bugs: 3009 (dcb)

2 years agolibalias - Cleanup unused variable
Matthew Dillon [Tue, 11 Apr 2017 05:06:54 +0000 (22:06 -0700)]
libalias - Cleanup unused variable

* Cleanup an unused variable.

Dragonfly-bugs: 3008 (dcb)

2 years agoopenssh - Fix a broken assignment
Matthew Dillon [Tue, 11 Apr 2017 05:01:03 +0000 (22:01 -0700)]
openssh - Fix a broken assignment

* Fix a broken assignment.  NOTE: OpenSSH master already has this fix.

* Document dangerous sscanf()s, but note that it is not possible for a
  buffer overflow to occur in these cases.

Dragonfly-bugs: 3007 (dcb)

2 years agowindow - Fix Graphics capability enable test
Matthew Dillon [Tue, 11 Apr 2017 04:50:14 +0000 (21:50 -0700)]
window - Fix Graphics capability enable test

* Fix Graphics capability enable test, code type-o, logical OR has to be AND.

Dragonfly-bugs: 3005 (dcb)

2 years agokernel - Fix event preset
Matthew Dillon [Tue, 11 Apr 2017 04:47:51 +0000 (21:47 -0700)]
kernel - Fix event preset

* Enable all events was not enabling all events.  Fix the memset().

Dragonfly-bugs: 3004 (dcb)

2 years agomfiutil - Fix static buffer overflow
Matthew Dillon [Tue, 11 Apr 2017 04:41:43 +0000 (21:41 -0700)]
mfiutil - Fix static buffer overflow

* Fix static buffer that is too small.  Use a dynamic asprintf()
  instead.

Dragonfly-bugs: 3002 (dcb)

2 years agopf: Don't assume # of network procecssing CPUs is power-of-2
Sepherosa Ziehau [Mon, 10 Apr 2017 10:05:04 +0000 (18:05 +0800)]
pf: Don't assume # of network procecssing CPUs is power-of-2

Reviewed-by: dillon@
2 years agotoeplitz: Add comment.
Sepherosa Ziehau [Mon, 10 Apr 2017 10:04:52 +0000 (18:04 +0800)]
toeplitz: Add comment.

2 years agosbin/newfs_hammer: Add /* not reached */ for usage()
Tomohiro Kusumi [Mon, 10 Apr 2017 22:16:24 +0000 (01:16 +0300)]
sbin/newfs_hammer: Add /* not reached */ for usage()

2 years agosbin/mount_hammer: Add /* not reached */
Tomohiro Kusumi [Mon, 10 Apr 2017 22:00:41 +0000 (01:00 +0300)]
sbin/mount_hammer: Add /* not reached */

2 years agosbin/newfs_hammer: Add /* not reached */
Tomohiro Kusumi [Mon, 10 Apr 2017 21:57:35 +0000 (00:57 +0300)]
sbin/newfs_hammer: Add /* not reached */

2 years agosbin/hammer: Partly bring back removed braces from 52e2f1b5
Tomohiro Kusumi [Mon, 10 Apr 2017 17:20:40 +0000 (20:20 +0300)]
sbin/hammer: Partly bring back removed braces from 52e2f1b5

based on comments from dillon@.

(dillon) three types, yah.  (1) multi-line condition in if(), (2) if TRUE or FALSE body spans more than one line, put braces around both
(dillon) (including if a comment is part of the body)

2 years agosbin/newfs_hammer: Partly bring back removed braces from 46689eca
Tomohiro Kusumi [Mon, 10 Apr 2017 16:53:20 +0000 (19:53 +0300)]
sbin/newfs_hammer: Partly bring back removed braces from 46689eca

based on comments from dillon@.

(dillon) three types, yah.  (1) multi-line condition in if(), (2) if TRUE or FALSE body spans more than one line, put braces around both
(dillon) (including if a comment is part of the body)

2 years agosbin/mount_hammer: Partly bring back removed braces from a90e74c5
Tomohiro Kusumi [Mon, 10 Apr 2017 16:46:21 +0000 (19:46 +0300)]
sbin/mount_hammer: Partly bring back removed braces from a90e74c5

based on comments from dillon@.

(dillon) three types, yah.  (1) multi-line condition in if(), (2) if TRUE or FALSE body spans more than one line, put braces around both
(dillon) (including if a comment is part of the body)

2 years agonetisr: Use netisr_ncpus to convert hash to cpuid.
Sepherosa Ziehau [Mon, 10 Apr 2017 05:37:27 +0000 (13:37 +0800)]
netisr: Use netisr_ncpus to convert hash to cpuid.

And factor out netisr_hashlsb() for future use.

2 years agonet: Reorder sysinit a bit.
Sepherosa Ziehau [Mon, 10 Apr 2017 09:06:29 +0000 (17:06 +0800)]
net: Reorder sysinit a bit.

2 years agosbin/hammer: Make info command print a proper error message
Tomohiro Kusumi [Sun, 9 Apr 2017 17:10:25 +0000 (20:10 +0300)]
sbin/hammer: Make info command print a proper error message

Printing a function name of some library makes no sense.

2 years agosbin/hammer: Make info command properly handle non HAMMER path
Tomohiro Kusumi [Sun, 9 Apr 2017 16:46:20 +0000 (19:46 +0300)]
sbin/hammer: Make info command properly handle non HAMMER path

This shouldn't be needed if i/f of libhammer were carefully designed,
but this seems to be the only guaranteed way to detect non HAMMER path,
and print a proper error message that makes sense for UFS, etc.

-- before this commit
 # hammer info /boot
 hammer: libhammer_get_fsinfo     <--- ???

-- with this commit
 # hammer info /boot
 hammer: /boot is probably not a HAMMER filesystem: Inappropriate ioctl for device

2 years agosbin/mount_hammer: Cleanup blocks with a single statement
Tomohiro Kusumi [Sun, 9 Apr 2017 00:05:54 +0000 (03:05 +0300)]
sbin/mount_hammer: Cleanup blocks with a single statement

This commit basically does the same as what Linux kernel's coding
style mentions for braces, which is basically the same with BSDs.
https://github.com/torvalds/linux/blob/master/Documentation/process/coding-style.rst#3-placing-braces-and-spaces

No diff in sbin/mount_hammer/mount_hammer binary when assert(3)
is disabled.

2 years agosbin/newfs_hammer: Cleanup blocks with a single statement
Tomohiro Kusumi [Sun, 9 Apr 2017 00:05:29 +0000 (03:05 +0300)]
sbin/newfs_hammer: Cleanup blocks with a single statement

This commit basically does the same as what Linux kernel's coding
style mentions for braces, which is basically the same with BSDs.
https://github.com/torvalds/linux/blob/master/Documentation/process/coding-style.rst#3-placing-braces-and-spaces

No diff in sbin/newfs_hammer/newfs_hammer binary when assert(3)
is disabled.

2 years agosbin/hammer: Cleanup blocks with a single statement
Tomohiro Kusumi [Sun, 9 Apr 2017 00:04:16 +0000 (03:04 +0300)]
sbin/hammer: Cleanup blocks with a single statement

This commit basically does the same as what Linux kernel's coding
style mentions for braces, which is basically the same with BSDs.
https://github.com/torvalds/linux/blob/master/Documentation/process/coding-style.rst#3-placing-braces-and-spaces

No diff in sbin/hammer/hammer binary when assert(3) is disabled.

2 years agoifpoll: Use netisr_ncpus.
Sepherosa Ziehau [Sun, 9 Apr 2017 05:23:13 +0000 (13:23 +0800)]
ifpoll: Use netisr_ncpus.

2 years agoifpoll: Use SYSINIT to initialize per-cpu ifpoll context.
Sepherosa Ziehau [Sun, 9 Apr 2017 05:20:47 +0000 (13:20 +0800)]
ifpoll: Use SYSINIT to initialize per-cpu ifpoll context.

2 years agosys/vfs/hammer: Add __hammer_crc_get_xxx() for CRC test retry
Tomohiro Kusumi [Sat, 8 Apr 2017 16:53:12 +0000 (19:53 +0300)]
sys/vfs/hammer: Add __hammer_crc_get_xxx() for CRC test retry

On retry, we don't need extra conditionals inlined (once or twice)
from calling hammer_datacrc(), since we know retry uses old crc.

Newly added inline functions are renamed versions of original ones
before 4c09d9c4.

2 years agosys/vfs/hammer: Cleanups on CRC functions
Tomohiro Kusumi [Sat, 8 Apr 2017 16:39:47 +0000 (19:39 +0300)]
sys/vfs/hammer: Cleanups on CRC functions

Just sync style with other part of the same file.

2 years agosys/vfs/hammer: Add comments on volume version 7 CRC (4c09d9c4)
Tomohiro Kusumi [Thu, 6 Apr 2017 23:18:01 +0000 (02:18 +0300)]
sys/vfs/hammer: Add comments on volume version 7 CRC (4c09d9c4)

There's no official documentation on this, but shouldn't be necessary
as CRC change does nothing directly to users.

2 years agoinpcb: Use netisr_ncpus for listing inpcbs.
Sepherosa Ziehau [Sat, 8 Apr 2017 06:38:06 +0000 (14:38 +0800)]
inpcb: Use netisr_ncpus for listing inpcbs.

2 years agosyncache: Use netisr_ncpus instead of ncpus2
Sepherosa Ziehau [Sat, 8 Apr 2017 05:52:02 +0000 (13:52 +0800)]
syncache: Use netisr_ncpus instead of ncpus2

2 years agosyncache: Cache align per-cpu data.
Sepherosa Ziehau [Sat, 8 Apr 2017 05:51:15 +0000 (13:51 +0800)]
syncache: Cache align per-cpu data.

2 years agoipdemux: Use netisr_ncpus instead of ncpus2.
Sepherosa Ziehau [Sat, 8 Apr 2017 05:36:23 +0000 (13:36 +0800)]
ipdemux: Use netisr_ncpus instead of ncpus2.

2 years agoinet6: Restore mbuf hash after defragmentation.
Sepherosa Ziehau [Sat, 8 Apr 2017 13:26:40 +0000 (21:26 +0800)]
inet6: Restore mbuf hash after defragmentation.

Reported-by: zach
2 years agoipfrag: Max # of frags per-cpu should use ncpus instead of ncpus2.
Sepherosa Ziehau [Sat, 8 Apr 2017 02:10:15 +0000 (10:10 +0800)]
ipfrag: Max # of frags per-cpu should use ncpus instead of ncpus2.

2 years agoinet: Use netisr_ncpus for ifdetach inet processing.
Sepherosa Ziehau [Sat, 8 Apr 2017 02:01:24 +0000 (10:01 +0800)]
inet: Use netisr_ncpus for ifdetach inet processing.