]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
7 years agoMFV 314276
Josh Paetzel [Sat, 25 Feb 2017 20:01:17 +0000 (20:01 +0000)]
MFV 314276

7570 tunable to allow zvol SCSI unmap to return on commit of txn to ZIL

illumos/illumos-gate@1c9272b861cd640a8342f4407da026ed98615517
https://github.com/illumos/illumos-gate/commit/1c9272b861cd640a8342f4407da026ed98615517

https://www.illumos.org/issues/7570

  Based on the discovery that every unmap waits for the commit of the txn to the ZIL,
  introducing a very high latency to unmap commands, this behavior was made into a
  tunable zvol_unmap_sync_enabled and set to false. The net impact of this change is
  that by default SCSI unmap commands will result in space being freed within the zvol
  (today they are ignored and returned with good status). However, unlike the code
  today, instead of 18+ms per unmap, they take about 30us.

  With the testing done on NTFS against a Win2k12 target, the new behavior should work
  seamlessly. Files on the zvol that have already been set with the zfree application
  will continue to write 0's when deleted, and any new files created since zvol
  creation will send unmap commands when deleted. This behavior exists today, but with
  this change the unmap commands will be processed and result in reclaim of space.

Author: Stephen Blinick <stephen.blinick@delphix.com>
Reviewed by: Dan Kimmel <dan.kimmel@delphix.com>
Reviewed by: Matt Ahrens <mahrens@delphix.com>
Reviewed by: Steve Gonczi <steve.gonczi@delphix.com>
Reviewed by: Pavel Zakharov <pavel.zakharov@delphix.com>
Reviewed by: Saso Kiselkov <saso.kiselkov@nexenta.com>
Reviewed by: Yuri Pankov <yuri.pankov@nexenta.com>
Approved by: Robert Mustacchi <rm@joyent.com>

7 years ago7570 tunable to allow zvol SCSI unmap to return on commit of txn to ZIL
Josh Paetzel [Sat, 25 Feb 2017 19:16:20 +0000 (19:16 +0000)]
7570 tunable to allow zvol SCSI unmap to return on commit of txn to ZIL

illumos/illumos-gate@1c9272b861cd640a8342f4407da026ed98615517
https://github.com/illumos/illumos-gate/commit/1c9272b861cd640a8342f4407da026ed98615517

https://www.illumos.org/issues/7570

  Based on the discovery that every unmap waits for the commit of the txn to the ZIL,
  introducing a very high latency to unmap commands, this behavior was made into a
  tunable zvol_unmap_sync_enabled and set to false. The net impact of this change is
  that by default SCSI unmap commands will result in space being freed within the zvol
  (today they are ignored and returned with good status). However, unlike the code
  today, instead of 18+ms per unmap, they take about 30us.

  With the testing done on NTFS against a Win2k12 target, the new behavior should work
  seamlessly. Files on the zvol that have already been set with the zfree application
  will continue to write 0's when deleted, and any new files created since zvol
  creation will send unmap commands when deleted. This behavior exists today, but with
  this change the unmap commands will be processed and result in reclaim of space.

Author: Stephen Blinick <stephen.blinick@delphix.com>
Reviewed by: Dan Kimmel <dan.kimmel@delphix.com>
Reviewed by: Matt Ahrens <mahrens@delphix.com>
Reviewed by: Steve Gonczi <steve.gonczi@delphix.com>
Reviewed by: Pavel Zakharov <pavel.zakharov@delphix.com>
Reviewed by: Saso Kiselkov <saso.kiselkov@nexenta.com>
Reviewed by: Yuri Pankov <yuri.pankov@nexenta.com>
Approved by: Robert Mustacchi <rm@joyent.com>

7 years agoRemove unused macro from common/drv.c.
Mariusz Zaborski [Sat, 25 Feb 2017 18:14:32 +0000 (18:14 +0000)]
Remove unused macro from common/drv.c.

When we was compering it to code from boot2 it also looks like
this code is buggy and boot2 was never updated to use this code.
USE_XREAD flag is unused in boot2, and common/drv.c was never
build with that flag.

Reviewed by: jhb
Differential Revision: https://reviews.freebsd.org/D9780

7 years agol2arc: try to fix write size calculation broken by Compressed ARC commit
Andriy Gapon [Sat, 25 Feb 2017 17:03:48 +0000 (17:03 +0000)]
l2arc: try to fix write size calculation broken by Compressed ARC commit

While there, make a change to not evict a first buffer outside the
requested eviciton range.

To do:
- give more consistent names to the size variables
- upstream to OpenZFS

PR: 216178
Reported by: lev
Tested by: lev
MFC after: 2 weeks

7 years agozfs: call spa_deadman on a taskqueue thread
Andriy Gapon [Sat, 25 Feb 2017 16:45:53 +0000 (16:45 +0000)]
zfs: call spa_deadman on a taskqueue thread

callout(9) prohibits callout functions from sleeping.
illumos mutexes are emulated using sx(9).
spa_deadman() calls vdev_deadman() and the latter acquires vq_lock.

As a result we can get a more confusing panic instead of a specific
panic or no panic:
sleepq_add: td 0xfffff80019669960 to sleep on wchan 0xfffff8001cff4d88 with sleeping prohibited

This change adds another level of indirection where the deadman
callout schedules spa_deadman() to be executed on taskqueue_thread.

While there, use callout_schedule(0 instead of callout_reset()
in spa_sync().

Discussed with: mav
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D9762

7 years agocall vm_lowmem hook in uma_reclaim_worker
Andriy Gapon [Sat, 25 Feb 2017 16:39:21 +0000 (16:39 +0000)]
call vm_lowmem hook in uma_reclaim_worker

A comment near kmem_reclaim() implies that we already did that.
Calling the hook is useful, because some handlers, e.g. ARC,
might be able to release significant amounts of KVA.

Now that we have more than one place where vm_lowmem hook is called,
use this change as an opportunity to introduce flags that describe
a reason for calling the hook.  No handler makes use of the flags yet.

Reviewed by: markj, kib
MFC after: 1 week
Sponsored by: Panzura
Differential Revision: https://reviews.freebsd.org/D9764

7 years agochromebook_platform: catch up with ig4iic -> ig4iic_pci in r310621
Andriy Gapon [Sat, 25 Feb 2017 15:55:46 +0000 (15:55 +0000)]
chromebook_platform: catch up with ig4iic -> ig4iic_pci in r310621

Reported by: Wolfgang Zenker <wolfgang@lyxys.ka.sub.org>
Tested by: Wolfgang Zenker <wolfgang@lyxys.ka.sub.org>
MFC after: 5 days

7 years agoadd chromebook_platform.4 to the list of manual pages
Andriy Gapon [Sat, 25 Feb 2017 14:50:53 +0000 (14:50 +0000)]
add chromebook_platform.4 to the list of manual pages

Reported by: Wolfgang Zenker <wolfgang@lyxys.ka.sub.org>
Pointyhat to: avg
MFC after: 5 days

7 years agoMFV 314243
Josh Paetzel [Sat, 25 Feb 2017 14:45:54 +0000 (14:45 +0000)]
MFV 314243

6676 Race between unique_insert() and unique_remove() causes ZFS fsid change

illumos/illumos-gate@40510e8eba18690b9a9843b26393725eeb0f1dac
https://github.com/illumos/illumos-gate/commit/40510e8eba18690b9a9843b26393725eeb0f1dac

https://www.illumos.org/issues/6676

  The fsid of zfs filesystems might change after reboot or remount. The problem seems to
  be caused by a race between unique_insert() and unique_remove(). The unique_remove()
  is called from dsl_dataset_evict() which is now an asynchronous thread. In a case the
  dsl_dataset_evict() thread is very slow and calls unique_remove() too late we will end
  up with changed fsid on zfs mount.

  This problem is very likely caused by #5056.

  Steps to Reproduce
  Note: I'm able to reproduce this always on a single core (virtual) machine. On multicore
  machines it is not so easy to reproduce.

# uname -a
SunOS openindiana 5.11 illumos-633aa80 i86pc i386 i86pc Solaris
# zfs create rpool/TEST
# FS=$(echo ::fsinfo | mdb -k | grep TEST | awk '{print $1}')
# echo $FS::print vfs_t vfs_fsid | mdb -k
vfs_fsid = {
    vfs_fsid.val = [ 0x54d7028a, 0x70311508 ]
}
# zfs umount rpool/TEST
# zfs mount rpool/TEST
# FS=$(echo ::fsinfo | mdb -k | grep TEST | awk '{print $1}')
# echo $FS::print vfs_t vfs_fsid | mdb -k
vfs_fsid = {
    vfs_fsid.val = [ 0xd9454e49, 0x6b36d08 ]
}
#

  Impact
  The persistent fsid (filesystem id) is essential for proper NFS functionality.
  If the fsid of a filesystem changes on remount (or after reboot) the NFS
  clients might not be able to automatically recover from such event and the
  manual remount of the NFS filesystems on every NFS client might be needed.

Author: Josef 'Jeff' Sipek <josef.sipek@nexenta.com>
Reviewed by: Saso Kiselkov <saso.kiselkov@nexenta.com>
Reviewed by: Sanjay Nadkarni <sanjay.nadkarni@nexenta.com>
Reviewed by: Dan Vatca <dan.vatca@gmail.com>
Reviewed by: Matthew Ahrens <mahrens@delphix.com>
Reviewed by: George Wilson <george.wilson@delphix.com>
Reviewed by: Sebastien Roy <sebastien.roy@delphix.com>
Approved by: Robert Mustacchi <rm@joyent.com>

7 years agoAdd reporting SAS protocol, in case we ever have one.
Alexander Motin [Sat, 25 Feb 2017 14:36:24 +0000 (14:36 +0000)]
Add reporting SAS protocol, in case we ever have one.

MFC after: 2 weeks

7 years agoUse ctl_queue_sense() to implement sense data reporting.
Alexander Motin [Sat, 25 Feb 2017 14:24:29 +0000 (14:24 +0000)]
Use ctl_queue_sense() to implement sense data reporting.

USB MS BBB transport does not support autosense, so we have to queue any
sense data back to CTL for later fetching via REQUEST SENSE.

7 years agoReenable CTL_WITH_CA, optimizing it for lower memory usage.
Alexander Motin [Sat, 25 Feb 2017 14:20:30 +0000 (14:20 +0000)]
Reenable CTL_WITH_CA, optimizing it for lower memory usage.

This code was disabled due to its high memory usage.  But now we need this
functionality for cfumass(4) frontend, since USB MS BBB transport does not
support autosense.

MFC after: 2 weeks

7 years agoUpdate kern_data_resid according to r312291.
Alexander Motin [Sat, 25 Feb 2017 12:11:07 +0000 (12:11 +0000)]
Update kern_data_resid according to r312291.

This now mandatory for correct operation.

7 years agoDo not leak mount references for dying threads.
Konstantin Belousov [Sat, 25 Feb 2017 10:38:18 +0000 (10:38 +0000)]
Do not leak mount references for dying threads.

Thread might create a condition for delayed SU cleanup, which creates
a reference to the mount point in td_su, but exit without returning
through userret(), e.g. when terminating due to single-threading or
process exit.  In this case, td_su reference is not dropped and mount
point cannot be freed.

Handle the situation by clearing td_su also in the thread destructor
and in exit1().  softdep_ast_cleanup() has to receive the thread as
argument, since e.g. thread destructor is executed in different
context.

Reported and tested by: pho
Sponsored by: The FreeBSD Foundation
MFC after: 2 weeks

7 years agoDo not use ULL suffix. Cast to uint64_t where the suffix is needed,
Konstantin Belousov [Sat, 25 Feb 2017 10:32:49 +0000 (10:32 +0000)]
Do not use ULL suffix.  Cast to uint64_t where the suffix is needed,
and just remove it in another place.

Requested by: bde
Sponsored by: The FreeBSD Foundation
MFC after: 1 week

7 years agoConvert PCIe Hot Plug to using pci_request_feature
Warner Losh [Sat, 25 Feb 2017 06:11:59 +0000 (06:11 +0000)]
Convert PCIe Hot Plug to using pci_request_feature

Convert PCIe hot plug support over to asking the firmware, if any, for
permission to use the HotPlug hardware. Implement pci_request_feature
for ACPI. All other host pci connections to allowing all valid feature
requests.

Sponsored by: Netflix

7 years agoRename pci_pcie_intr to pci_pcie_intr_hotplug.
Warner Losh [Sat, 25 Feb 2017 06:11:50 +0000 (06:11 +0000)]
Rename pci_pcie_intr to pci_pcie_intr_hotplug.

Sponsored by: Netflix

7 years agoCreate pcib_request_feature.
Warner Losh [Sat, 25 Feb 2017 06:11:36 +0000 (06:11 +0000)]
Create pcib_request_feature.

pcib_request_feature allows drivers to request the firmware (ACPI)
release certain features it may be using. ACPI normally manages things
like hot plug, advanced error reporting and other features until the
OS requests ACPI to relenquish control since it is taking over.

Sponsored by: Netflix

7 years agoAxe out some forever disabled questionable functionality.
Alexander Motin [Sat, 25 Feb 2017 04:24:51 +0000 (04:24 +0000)]
Axe out some forever disabled questionable functionality.

This code is complicated enough even in its base shape.

MFC after: 2 weeks

7 years agoImprove CAM target frontend reference counting.
Alexander Motin [Sat, 25 Feb 2017 04:04:11 +0000 (04:04 +0000)]
Improve CAM target frontend reference counting.

Before this change it was possible to trigger some use-after-free panics
by disabling LUNs/ports under heavy load.

MFC after: 2 weeks

7 years agoFill MK_LIBTHR as far as lib/libthr is concerned
Enji Cooper [Sat, 25 Feb 2017 03:44:51 +0000 (03:44 +0000)]
Fill MK_LIBTHR as far as lib/libthr is concerned

There are other areas of the tree that will need to be evaluated for sanity
if they're supposed to be conditionally compiled out of the build/install,
like libzpool

MFC after: 1 month
Relnotes: yes (this might break someone's system if have the knob set)
Sponsored by: Dell EMC Isilon

7 years agoRemove MK_OBJC block
Enji Cooper [Sat, 25 Feb 2017 03:35:26 +0000 (03:35 +0000)]
Remove MK_OBJC block

It is no longer represented via src.conf(5)

MFC after: 3 days
Sponsored by: Dell EMC Isilon

7 years ago6676 Race between unique_insert() and unique_remove() causes ZFS fsid change
Josh Paetzel [Sat, 25 Feb 2017 03:34:22 +0000 (03:34 +0000)]
6676 Race between unique_insert() and unique_remove() causes ZFS fsid change

illumos/illumos-gate@40510e8eba18690b9a9843b26393725eeb0f1dac
https://github.com/illumos/illumos-gate/commit/40510e8eba18690b9a9843b26393725eeb0f1dac

https://www.illumos.org/issues/6676

  The fsid of zfs filesystems might change after reboot or remount. The problem seems to
  be caused by a race between unique_insert() and unique_remove(). The unique_remove()
  is called from dsl_dataset_evict() which is now an asynchronous thread. In a case the
  dsl_dataset_evict() thread is very slow and calls unique_remove() too late we will end
  up with changed fsid on zfs mount.

  This problem is very likely caused by #5056.

  Steps to Reproduce
  Note: I'm able to reproduce this always on a single core (virtual) machine. On multicore
  machines it is not so easy to reproduce.

# uname -a
SunOS openindiana 5.11 illumos-633aa80 i86pc i386 i86pc Solaris
# zfs create rpool/TEST
# FS=$(echo ::fsinfo | mdb -k | grep TEST | awk '{print $1}')
# echo $FS::print vfs_t vfs_fsid | mdb -k
vfs_fsid = {
    vfs_fsid.val = [ 0x54d7028a, 0x70311508 ]
}
# zfs umount rpool/TEST
# zfs mount rpool/TEST
# FS=$(echo ::fsinfo | mdb -k | grep TEST | awk '{print $1}')
# echo $FS::print vfs_t vfs_fsid | mdb -k
vfs_fsid = {
    vfs_fsid.val = [ 0xd9454e49, 0x6b36d08 ]
}
#

  Impact
  The persistent fsid (filesystem id) is essential for proper NFS functionality.
  If the fsid of a filesystem changes on remount (or after reboot) the NFS
  clients might not be able to automatically recover from such event and the
  manual remount of the NFS filesystems on every NFS client might be needed.

Author: Josef 'Jeff' Sipek <josef.sipek@nexenta.com>
Reviewed by: Saso Kiselkov <saso.kiselkov@nexenta.com>
Reviewed by: Sanjay Nadkarni <sanjay.nadkarni@nexenta.com>
Reviewed by: Dan Vatca <dan.vatca@gmail.com>
Reviewed by: Matthew Ahrens <mahrens@delphix.com>
Reviewed by: George Wilson <george.wilson@delphix.com>
Reviewed by: Sebastien Roy <sebastien.roy@delphix.com>
Approved by: Robert Mustacchi <rm@joyent.com>

7 years agoRemove MK_CRYPT stub
Enji Cooper [Sat, 25 Feb 2017 03:33:09 +0000 (03:33 +0000)]
Remove MK_CRYPT stub

It doesn't directly control what gets installed today; it indirectly
pulls other knobs (like MK_KERBEROS, etc).

MFC after: 1 weeks
Sponsored by: Dell EMC Isilon

7 years agoFill in MK_RESCUE by finding paths in ${DESTDIR}/rescue and adding
Enji Cooper [Sat, 25 Feb 2017 03:28:49 +0000 (03:28 +0000)]
Fill in MK_RESCUE by finding paths in ${DESTDIR}/rescue and adding
them to OLD_FILES/OLD_DIRS, as necessary.

MFC after: 1 month
Sponsored by: Dell EMC Isilon

7 years agoConditionally compile certain programs into rescue(8) if requested
Enji Cooper [Sat, 25 Feb 2017 03:23:11 +0000 (03:23 +0000)]
Conditionally compile certain programs into rescue(8) if requested

MK_CCD - ccdconfig
MK_ROUTED - routed, rtquery

MFC after: 2 weeks
Sponsored by: Dell EMC Isilon

7 years agoAdd shutdown/poweroff support to rescue(8)
Enji Cooper [Sat, 25 Feb 2017 03:11:08 +0000 (03:11 +0000)]
Add shutdown/poweroff support to rescue(8)

shutdown is a safer way to power off than reboot (in general), because of
the added shutdown process that it executes via /etc/rc.shutdown . It was
odd that it was missing from rescue(8) since reboot and friends were
added in past commits.

While here, alias poweroff to shutdown for parity with sbin/shutdown/Makefile

MFC after: 2 weeks
Sponsored by: Dell EMC Isilon

7 years agoiwn: some initialization / RF switch state change fixes.
Andriy Voskoboinyk [Sat, 25 Feb 2017 00:40:50 +0000 (00:40 +0000)]
iwn: some initialization / RF switch state change fixes.

- Check return code from initialization path; otherwise, vap state
may be wrong after an error.
- Do not try to run iwn_stop() / iwn_init() multiple times.
- Merge iwn_radio_on/off() and move RFKILL bit check into the task.
- Try to handle possible RF switch state change in S3 state (PR 181694).

PR: 181694
Reviewed by: adrian
Differential Revision: https://reviews.freebsd.org/D9797

7 years agoParameterize out the length of struct filed->f_lasttime as `MAXDATELEN`
Enji Cooper [Sat, 25 Feb 2017 00:12:29 +0000 (00:12 +0000)]
Parameterize out the length of struct filed->f_lasttime as `MAXDATELEN`

This removes the hardcoded value for the field (16) and the equivalent
hardcoded lengths in logmsg(..).

This change is being done to help stage future work to add RFC5424/RFC5434
support to syslogd(8).

Obtained from: Isilon OneFS (dcd33d13da) (as part of a larger change)
Submitted by: John Bauman <john.bauman@isilon.com>
MFC after: 2 weeks
Sponsored by: Dell EMC Isilon

7 years agoExit when we can't print a variable.
Warner Losh [Sat, 25 Feb 2017 00:09:26 +0000 (00:09 +0000)]
Exit when we can't print a variable.

Exit after printing a message on stderr when we can't get a
message. This is slightly different than linux, but keeps shell
scripts from thinking the value of the variable is the error message
and so is a net win.

Sponsored by: Netflix

7 years agoDon't convert ENOENT to nothing for individual lookup, just for the
Warner Losh [Sat, 25 Feb 2017 00:09:21 +0000 (00:09 +0000)]
Don't convert ENOENT to nothing for individual lookup, just for the
iterative get_next interface. This prevents efivar(3) from printing 4k
of 0's when a variable isn't set.

Sponsored by: Netflix

7 years agoMake nvmecontrol logpage -p help list known pages.
Warner Losh [Sat, 25 Feb 2017 00:09:16 +0000 (00:09 +0000)]
Make nvmecontrol logpage -p help list known pages.

Make -p help and -v help list all the pages we know about.
Add -v to usage.
Update the man page.

Sponsored by: Netflix

7 years agoExit with usage if argv[1] is NULL in dispatch. This fixes core dumps
Warner Losh [Sat, 25 Feb 2017 00:09:12 +0000 (00:09 +0000)]
Exit with usage if argv[1] is NULL in dispatch. This fixes core dumps
when a command has subcommands, but the user doesn't give the
parameters on the command line.

Sponsored by: Netflix

7 years agoFix typos in output.
Warner Losh [Sat, 25 Feb 2017 00:09:02 +0000 (00:09 +0000)]
Fix typos in output.

Sponsored by: Netflix

7 years agoUse SRCTOP instead of .CURDIR relative paths with ".."
Enji Cooper [Fri, 24 Feb 2017 21:35:59 +0000 (21:35 +0000)]
Use SRCTOP instead of .CURDIR relative paths with ".."

This simplifies pathing in make/displayed output

MFC after: 1 week
Sponsored by: Dell EMC Isilon

7 years agoAdd linux_preadv() and linux_pwritev() syscalls to Linuxulator.
Mahdi Mokhtari [Fri, 24 Feb 2017 20:04:02 +0000 (20:04 +0000)]
Add linux_preadv() and linux_pwritev() syscalls to Linuxulator.

Reviewed by: dchagin
Approved by: dchagin, trasz (src committers)
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D9722

7 years agoRevert r314217. Commit is not match that I have approved.
Dmitry Chagin [Fri, 24 Feb 2017 19:47:27 +0000 (19:47 +0000)]
Revert r314217. Commit is not match that I have approved.

7 years agoAdd linux_preadv() and linux_pwritev() syscalls to Linuxulator.
Mahdi Mokhtari [Fri, 24 Feb 2017 19:22:17 +0000 (19:22 +0000)]
Add linux_preadv() and linux_pwritev() syscalls to Linuxulator.

Reviewed by: dchagin
Approved by: dchagin, trasz (src committers)
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D9722

7 years agoWe have seen several cases recently where we appear to get a double-fault:
Jonathan T. Looney [Fri, 24 Feb 2017 18:56:00 +0000 (18:56 +0000)]
We have seen several cases recently where we appear to get a double-fault:
We have an original panic. Then, instead of writing the core to the dump
device, the kernel has a second panic: "smp_targeted_tlb_shootdown:
interrupts disabled". This change is an attempt to fix that second panic.

When the other CPUs are stopped, we can't notify them of the TLB shootdown,
so we skip that operation. However, when the CPUs come back up, we
invalidate the TLB to ensure they correctly observe any changes to the
page mappings.

Reviewed by: kib
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D9786

7 years agoImplement more string functions in the LinuxKPI.
Hans Petter Selasky [Fri, 24 Feb 2017 17:36:55 +0000 (17:36 +0000)]
Implement more string functions in the LinuxKPI.

MFC after: 1 week
Sponsored by: Mellanox Technologies

7 years agoPrototype device structure to ensure LinuxKPI header file can be
Hans Petter Selasky [Fri, 24 Feb 2017 17:03:14 +0000 (17:03 +0000)]
Prototype device structure to ensure LinuxKPI header file can be
included standalone.

MFC after: 1 week
Sponsored by: Mellanox Technologies

7 years agoRemove control+r handling from geliboot's pwgets()
Allan Jude [Fri, 24 Feb 2017 16:52:57 +0000 (16:52 +0000)]
Remove control+r handling from geliboot's pwgets()

pwgets() is based on ngets() from libstand, which includes a feature
that is not wanted in a very of the function designed for password
handling.

Pressing control+r echos out the entered string

This commit removes that feature from pwgets()

PR: 217298
Reported by: ehaupt
Reviewed by: kristof, tsoome, ehaupt
Sponsored by: ScaleEngine Inc.
Differential Revision: https://reviews.freebsd.org/D9782

7 years agoUse correct macro for Synopsys UART driver declaration.
Ruslan Bukin [Fri, 24 Feb 2017 16:37:35 +0000 (16:37 +0000)]
Use correct macro for Synopsys UART driver declaration.

7 years agoRemove cpu_deepest_sleep variable.
Konstantin Belousov [Fri, 24 Feb 2017 16:11:55 +0000 (16:11 +0000)]
Remove cpu_deepest_sleep variable.

On Core2 and older Intel CPUs, where TSC stops in C2, system does not
allow C2 entrance if timecounter hardware is TSC.  This is done by
tc_windup() which tests for TC_FLAGS_C2STOP flag of the new
timecounter and increases cpu_disable_c2_sleep if flag is set.  Right
now init_TSC_tc() only sets the flag if cpu_deepest_sleep >= 2, but
TSC is initialized too early for this variable to be set by
acpi_cpu.c.

There is no reason to require that ACPI reported C2 and deeper states
to set TC_FLAGS_C2STOP, so remove cpu_deepest_sleep test from
init_TSC_tc() condition.  And since this is the only use of the
variable, remove it at all.

Reported and submitted by: Jia-Shiun Li <jiashiun@gmail.com>
Suggested by: jhb
MFC after: 2 weeks

7 years ago[iwm] add if_iwm_fw.c.
Adrian Chadd [Fri, 24 Feb 2017 15:17:43 +0000 (15:17 +0000)]
[iwm] add if_iwm_fw.c.

7 years agoRespecting r314204 tighten ATIO cleanup requirements.
Alexander Motin [Fri, 24 Feb 2017 14:48:17 +0000 (14:48 +0000)]
Respecting r314204 tighten ATIO cleanup requirements.

Every ATIO must complete with either successfully sent status or XPT_ABORT.

MFC after: 2 weeks

7 years agoImplement srcu_dereference() macro in the LinuxKPI.
Hans Petter Selasky [Fri, 24 Feb 2017 14:40:15 +0000 (14:40 +0000)]
Implement srcu_dereference() macro in the LinuxKPI.

MFC after: 1 week
Sponsored by: Mellanox Technologies

7 years agoGuard sem_clockwait_np() declaration with __BSD_VISIBLE
Eric van Gyzen [Fri, 24 Feb 2017 14:37:55 +0000 (14:37 +0000)]
Guard sem_clockwait_np() declaration with __BSD_VISIBLE

This is a POSIX header file, so keep the namespace clean.

Reported by: kib
MFC after: 13 days
X-MFC with: r314179
Sponsored by: Dell EMC

7 years agoImplement BIT_ULL() macro in the LinuxKPI.
Hans Petter Selasky [Fri, 24 Feb 2017 14:23:46 +0000 (14:23 +0000)]
Implement BIT_ULL() macro in the LinuxKPI.

MFC after: 1 week
Sponsored by: Mellanox Technologies

7 years agoExplicitly abort ATIO if CTIO sending status has failed.
Alexander Motin [Fri, 24 Feb 2017 12:12:30 +0000 (12:12 +0000)]
Explicitly abort ATIO if CTIO sending status has failed.

This helps SIM to free related resources in questionable cases.

MFC after: 2 weeks

7 years agoFix missing xpt_done() for ATIO/INOT on missing LUN.
Alexander Motin [Fri, 24 Feb 2017 12:11:17 +0000 (12:11 +0000)]
Fix missing xpt_done() for ATIO/INOT on missing LUN.

MFC after: 2 weeks

7 years agoWe can't access periph after ctlfe_free_ccb().
Alexander Motin [Fri, 24 Feb 2017 11:25:32 +0000 (11:25 +0000)]
We can't access periph after ctlfe_free_ccb().

MFC after: 2 weeks

7 years agoUnify ATIO/INOT CCBs requeuing.
Alexander Motin [Fri, 24 Feb 2017 09:16:21 +0000 (09:16 +0000)]
Unify ATIO/INOT CCBs requeuing.

MFC after: 2 weeks

7 years agoProperly handle possible underflow in vm_fault_prefault().
Konstantin Belousov [Fri, 24 Feb 2017 08:09:16 +0000 (08:09 +0000)]
Properly handle possible underflow in vm_fault_prefault().

In vm_fault_prefault(), if backward count causes underflow in
calculation of
starta = addra - backward * PAGE_SIZE;
then starta must be clipped to entry->start, instead of zero.
Clipping to zero allowed mapping outside of the map entries address
ranges, in particular, map at zero.

Submitted by: Yanko Yankulov <yanko.yankulov@gmail.com>
Reviewed by: alc
MFC after: 1 week

7 years agozfs: clean up unused files and definitions
Andriy Gapon [Fri, 24 Feb 2017 07:53:56 +0000 (07:53 +0000)]
zfs: clean up unused files and definitions

MFC after: 1 month
X-MFC after: r314048

7 years agoSome code cleanup.
Alexander Motin [Fri, 24 Feb 2017 07:47:50 +0000 (07:47 +0000)]
Some code cleanup.

MFC after: 2 weeks

7 years ago[iwm] Add support for Firmware paging, needed for newer 8000C firmware.
Adrian Chadd [Fri, 24 Feb 2017 07:07:58 +0000 (07:07 +0000)]
[iwm] Add support for Firmware paging, needed for newer 8000C firmware.

* Uses the IWM_FW_PAGING_BLOCK_CMD firmware command to tell the firmware
  what memory ranges to use for paging.

Obtained from: dragonflybsd.git 8a5b199964f8e7bdb00039f0b48817a01b402f18

7 years agoFix up r314189
Enji Cooper [Fri, 24 Feb 2017 06:49:31 +0000 (06:49 +0000)]
Fix up r314189

The conditional in do_buff_decode(..) after the while loop was accidentally
inverted. Only increment the pointer for fmt if it's not NUL.

MFC after: 2 weeks
X-MFC with: r314189
Reported by: pstef
Sponsored by: Dell EMC Isilon

7 years agoFix some minor style nits: put parentheses around return values
Enji Cooper [Fri, 24 Feb 2017 06:28:58 +0000 (06:28 +0000)]
Fix some minor style nits: put parentheses around return values

MFC after: 2 weeks
Sponsored by: Dell EMC Isilon

7 years agoFix up NULL/'\0' uses and fix 2 derefs after NULL
Enji Cooper [Fri, 24 Feb 2017 06:24:39 +0000 (06:24 +0000)]
Fix up NULL/'\0' uses and fix 2 derefs after NULL

MFC after: 2 weeks
Reported by: Coverity
CID: 10188981018899
Differential Revision: https://reviews.freebsd.org/D6142
Sponsored by: Dell EMC Isilon

7 years agoCast values to (int) before comparing them to the range of the
Warner Losh [Fri, 24 Feb 2017 01:39:12 +0000 (01:39 +0000)]
Cast values to (int) before comparing them to the range of the
enum. This ensures they are in range w/o the warnings.

7 years agoKDTRACE_HOOKS isn't guaranteed to be defined. Change to check to see
Warner Losh [Fri, 24 Feb 2017 01:39:08 +0000 (01:39 +0000)]
KDTRACE_HOOKS isn't guaranteed to be defined. Change to check to see
if it is defined or not rather than if it is non-zero.

Sponsored by: Netflix, Inc

7 years agoat91: double assignment.
Pedro F. Giffuni [Thu, 23 Feb 2017 23:48:44 +0000 (23:48 +0000)]
at91: double assignment.

Found with: coccinelle (da.cocci)
Suggested by: cognet

7 years agomtx: microoptimize lockstat handling in spin mutexes and thread lock
Mateusz Guzik [Thu, 23 Feb 2017 22:46:01 +0000 (22:46 +0000)]
mtx: microoptimize lockstat handling in spin mutexes and thread lock

While here make the code compilablle on kernels with LOCK_PROFILING but without
KDTRACE_HOOKS.

7 years agoadd jedec_ts.4 to the list of manual pages
Andriy Gapon [Thu, 23 Feb 2017 22:08:35 +0000 (22:08 +0000)]
add jedec_ts.4 to the list of manual pages

Reported by: rpokala
MFC after: 3 days

7 years ago[ifconfig] handle illegal WPS frames
Adrian Chadd [Thu, 23 Feb 2017 20:49:17 +0000 (20:49 +0000)]
[ifconfig] handle illegal WPS frames

Some APs broadcast WPS IE frames with totally broken data.  Ifconfig's printwpsie()
loops through WPS frames printing the attributes out; if the frame's data is bad,
printwpsie() can end up looking at out-of-bounds addresses causing ifconfig to
bus error.

Thanks to Takashi Inoue at Nihon U for his efforts in debugging this.

PR: bin/217312
Submitted by: fbsd@opal.com
MFC after: 1 week

7 years agoFix and shorten BERI kernel builds during universe.
Brooks Davis [Thu, 23 Feb 2017 20:41:55 +0000 (20:41 +0000)]
Fix and shorten BERI kernel builds during universe.

Stop building BERI_DE4_BASE and BERI_SIM_BASE, they aren't particularly
valid as they don't have a root dev.  Do build BERI_DE4_SDROOT which
does so devices get coverage.

Remove ident from BERI_DE4_BASE for the reasons above which will cause
it to fail to build.  BERI_SIM_BASE was already this way and broke
universe.[0]

Reported by: rpokala
Sponsored by: DARPA, AFRL

7 years agoAdd sem_clockwait_np()
Eric van Gyzen [Thu, 23 Feb 2017 19:36:38 +0000 (19:36 +0000)]
Add sem_clockwait_np()

This function allows the caller to specify the reference clock
and choose between absolute and relative mode.  In relative mode,
the remaining time can be returned.

The API is similar to clock_nanosleep(3).  Thanks to Ed Schouten
for that suggestion.

While I'm here, reduce the sleep time in the semaphore "child"
test to greatly reduce its runtime.  Also add a reasonable timeout.

Reviewed by: ed (userland)
MFC after: 2 weeks
Relnotes: yes
Sponsored by: Dell EMC
Differential Revision: https://reviews.freebsd.org/D9656

7 years agoAdd support for RDMA from userspace with T6 cards.
Navdeep Parhar [Thu, 23 Feb 2017 19:21:47 +0000 (19:21 +0000)]
Add support for RDMA from userspace with T6 cards.

Submitted by: Krishnamraju Eraparaju @ Chelsio
Sponsored by: Chelsio Communications

7 years agocxgbe/iw_cxgbe: Minor changes for T6.
Navdeep Parhar [Thu, 23 Feb 2017 19:02:40 +0000 (19:02 +0000)]
cxgbe/iw_cxgbe: Minor changes for T6.

Submitted by: Krishnamraju Eraparaju at Chelsio
Sponsored by: Chelsio Communications

7 years agovxge(4): Yet another (minor) mismatch.
Pedro F. Giffuni [Thu, 23 Feb 2017 18:56:31 +0000 (18:56 +0000)]
vxge(4): Yet another (minor) mismatch.

VXGE_DEFAULT_TTI_RTIMER_VAL and VXGE_DEFAULT_RTI_RTIMER_VAL have value
zero but nevertheless we should use the right value on each.

Pointed by: jhb
X-MFC with: r314145

7 years agort_attach(): double assignment.
Pedro F. Giffuni [Thu, 23 Feb 2017 18:15:04 +0000 (18:15 +0000)]
rt_attach(): double assignment.

Found with: coccinelle (da.cocci)

7 years agoTCP window updates are only sent if the window can be increased by at
Michael Tuexen [Thu, 23 Feb 2017 18:14:36 +0000 (18:14 +0000)]
TCP window updates are only sent if the window can be increased by at
least 2 * MSS. However, if the receive buffer size is small, this might
be impossible. Add back a criterion to send a TCP window update if
the window can be increased by at least half of the receive buffer size.
This condition was removed in r242252. This patch simply brings it back.
PR: 211003
Reviewed by: gnn
MFC after: 1 week
Sponsored by: Netflix, Inc.
Differential Revision: https://reviews.freebsd.org/D9475

7 years agoFix memory leaks in error cases in libdtrace.
Mark Johnston [Thu, 23 Feb 2017 17:56:24 +0000 (17:56 +0000)]
Fix memory leaks in error cases in libdtrace.

Submitted by: Tom Rix <trix@juniper.net>
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D9705

7 years agoFix a memory leak in an error case in libctf.
Mark Johnston [Thu, 23 Feb 2017 17:54:17 +0000 (17:54 +0000)]
Fix a memory leak in an error case in libctf.

Submitted by: Tom Rix <trix@juniper.net>
MFC after: 1 week

7 years agoRemove an assembler flag, which is redundant since r309124. The upstream
Jung-uk Kim [Thu, 23 Feb 2017 17:46:38 +0000 (17:46 +0000)]
Remove an assembler flag, which is redundant since r309124.  The upstream
took care of it by introducing a macro NO_EXEC_STACK_DIRECTIVE.

http://llvm.org/viewvc/llvm-project?rev=273500&view=rev

Reviewed by: dim

7 years agoUnbreak if_iwm.ko after r314076
Enji Cooper [Thu, 23 Feb 2017 17:44:06 +0000 (17:44 +0000)]
Unbreak if_iwm.ko after r314076

Add if_iwm_7000.c/if_iwm_8000.c to SRCS to match similar additions made
to sys/conf/files after refactoring done in the commit noted.

PR: 217308
Pointyhat to: adrian
Submitted by: Andreas Nilsson <andrnils@gmail.com>
Reported by: Jakob Alvermark <jakob@alvermark.net>, Juan Ramómon Molina Menor <listjm@club.fr>
Sponsored by: Dell EMC Isilon

7 years agoFix the xnb(4) unit tests
Alan Somers [Thu, 23 Feb 2017 16:54:30 +0000 (16:54 +0000)]
Fix the xnb(4) unit tests

One test was inadvertently expecting a bug in the kernel's sscanf
implementation circa 2012. I don't know when that bug got fixed.

Reported by: royger
Reviewed by: royger
MFC after: 3 weeks
Sponsored by: Spectra Logic Corp
Differential Revision: https://reviews.freebsd.org/D9766

7 years agoThe ct driver was removed by r312910.
Yoshihiro Takahashi [Thu, 23 Feb 2017 16:42:48 +0000 (16:42 +0000)]
The ct driver was removed by r312910.

7 years agoMisc Coverity fixes in xnb(4)
Alan Somers [Thu, 23 Feb 2017 16:31:04 +0000 (16:31 +0000)]
Misc Coverity fixes in xnb(4)

Most of these are null pointer dereferences or missing error checks in the
unit tests. One is a missing error check in xnb_attach_failed. None can
cause real problems in running systems.

Reported by: Coverity
CIDs: 1092469 1092468 1092467 2092466 1092465 1092512 1092511 1092510
CIDs: 1092510 1092509 1092508 1092507
Reviewed by: royger
MFC after: 3 weeks
Sponsored by: Spectra Logic Corp
Differential Revision: https://reviews.freebsd.org/D9234

7 years agobktr(4): double assignment.
Pedro F. Giffuni [Thu, 23 Feb 2017 16:18:57 +0000 (16:18 +0000)]
bktr(4): double assignment.

First assignment is obviously overwritten by the next line.
Leave newest assignment: it was introduced in r29233.

Found with: coccinelle (da.cocci)

7 years agodev/vxe: double assignments.
Pedro F. Giffuni [Thu, 23 Feb 2017 16:10:15 +0000 (16:10 +0000)]
dev/vxe: double assignments.

Fix some suspicious code, likely caused by excessive copy-pasting.

Found with: coccinelle (da.cocci)
MFC after: 2 weeks

7 years agodev/ce: double assignment.
Pedro F. Giffuni [Thu, 23 Feb 2017 15:30:21 +0000 (15:30 +0000)]
dev/ce: double assignment.

The code is not operational right now so just comment away an obviously
useless assignment. Fix some typos while here.

Found with: coccinelle (da.cocci)

7 years agortadvd(8): double assignment.
Pedro F. Giffuni [Thu, 23 Feb 2017 15:10:46 +0000 (15:10 +0000)]
rtadvd(8): double assignment.

Remove doubtful initialization since the value will be overwritten
immediately afterwards.

Found with: coccinelle (da.cocci)

7 years agocamdd(8): double assignment.
Pedro F. Giffuni [Thu, 23 Feb 2017 15:05:01 +0000 (15:05 +0000)]
camdd(8): double assignment.

Why do a calculation twice when you can do it just once.

Found with: coccinelle (da.cocci)

7 years agomake vi message catalogues build independent of locale
Ed Maste [Thu, 23 Feb 2017 14:39:51 +0000 (14:39 +0000)]
make vi message catalogues build independent of locale

r275234 addressed sort automatically converting 8-bit locales to UTF-8
by using "LANG=C sort", but LC_ALL overrides LANG if set, so the issue
may still be present depending on the user's environment. Use LC_ALL=C
instead.

Reported by: tests.reproducible-builds.org
Reviewed by: bapt
MFC after: 1 week
Sponsored by: The Linux Foundation / Core Infrastructure Initiative
Differential Revision: https://reviews.freebsd.org/D9765

7 years agoxen/gndev: use UOFF_TO_IDX instead of OFF_TO_IDX
Roger Pau Monné [Thu, 23 Feb 2017 13:14:28 +0000 (13:14 +0000)]
xen/gndev: use UOFF_TO_IDX instead of OFF_TO_IDX

The Xen grant table device treats the mmap offset parameter as an unsigned
type, and as so it must use the newly introduced UOFF_TO_IDX.

Sponsored by:   Citrix Systems R&D
MFC after:      2 weeks
X-MFC-with:     r313690

7 years agoImplement __test_and_clear_bit() and __test_and_set_bit() in the LinuxKPI.
Hans Petter Selasky [Thu, 23 Feb 2017 09:53:54 +0000 (09:53 +0000)]
Implement __test_and_clear_bit() and __test_and_set_bit() in the LinuxKPI.

The clang compiler will optimise these functions down to three AMD64
instructions if the bit argument is a constant during compilation.

MFC after: 1 week
Sponsored by: Mellanox Technologies

7 years agoRight clock defines specified in linux_timer.h.
Dmitry Chagin [Thu, 23 Feb 2017 08:17:42 +0000 (08:17 +0000)]
Right clock defines specified in linux_timer.h.
Get rid of spirious clock defines from linux_misc.h.

MFC after: 1 week

7 years agoAvoid NULL dereference in a couple of sysctl handlers in ibcore.
Navdeep Parhar [Thu, 23 Feb 2017 07:48:58 +0000 (07:48 +0000)]
Avoid NULL dereference in a couple of sysctl handlers in ibcore.
iw_cxgbe sets ib_device->dma_device to NULL (since r311880).

Reviewed by: hselasky@
Sponsored by: Chelsio Communications

7 years agoReset failed login count to zero when removing a blocked address
Kurt Lidl [Thu, 23 Feb 2017 05:40:59 +0000 (05:40 +0000)]
Reset failed login count to zero when removing a blocked address

The blacklistd daemon keeps records of failed login attempts for
each address:port that is flagged as a failed login.  When a
successful login occurs for that address:port combination,
the record's last update time is set to zero, to indicate no current
failed login attempts.

Reset the failed login count to zero, so that at the next failed
login attempt, the counting will restart properly at zero.  Without
this reset to zero, the first failed login after a successful login
will cause the address to be blocked immediately.

When debugging is turned on, output more information about database
state before and after the database updates have occured.

A similar patch has already been upstreamed to NetBSD.

MFC after: 3 days
Sponsored by: The FreeBSD Foundation

7 years agoDo not check divider length if we have a div table.
Emmanuel Vadot [Thu, 23 Feb 2017 05:33:20 +0000 (05:33 +0000)]
Do not check divider length if we have a div table.

Reviewed by: mmel

7 years agoActually fix buildworlds other than i386/amd64/sparc64 after r313992
Eric Badger [Thu, 23 Feb 2017 04:26:17 +0000 (04:26 +0000)]
Actually fix buildworlds other than i386/amd64/sparc64 after r313992

Disable offending test for platforms without a userspace visible
breakpoint().

Reported by: rpokala
Approved by: vangyzen (mentor)

7 years agomakefs: eliminate global cd9660 structure
Ed Maste [Thu, 23 Feb 2017 02:28:08 +0000 (02:28 +0000)]
makefs: eliminate global cd9660 structure

For diff reduction with NetBSD

NetBSD file versions:
cd9660.c 1.39
cd9660.h 1.19
cd9660/cd9660_debug.c 1.12
cd9660/cd9660_eltorito.c 1.20
cd9660/cd9660_write.c 1.16
cd9660/iso9660_rrip.c 1.12
cd9660/iso9660_rrip.h 1.6

Reviewed by: ngie
Obtained from: NetBSD
MFC after: 1 month
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D9627

7 years agoFix a panic during boot caused by inadequate locking of some vt(4) driver
Jonathan T. Looney [Thu, 23 Feb 2017 01:18:47 +0000 (01:18 +0000)]
Fix a panic during boot caused by inadequate locking of some vt(4) driver
data structures.

vt_change_font() calls vtbuf_grow() to change some vt driver data
structures. It uses TF_MUTE to prevent the console from trying to use those
data structures while it changes them.

During the early stage of the boot process, the vt driver's tc_done routine
uses those data structures; however, it is currently called outside the
TF_MUTE check.

Move the tc_done routine inside the locked TF_MUTE check.

PR: 217282
Reviewed by: ed, ray
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D9709

7 years agoFully handle the special encoding of GOT[1] on mips64.
John Baldwin [Thu, 23 Feb 2017 00:02:49 +0000 (00:02 +0000)]
Fully handle the special encoding of GOT[1] on mips64.

The MIPS ABI does not require the second GOT entry to be reserved for use
by the runtime linker as on other architectures.  Instead, static linkers
use a special value in the second GOT entry to indicate if the entry is
reserved.  This value is supposed to consist of an address with the MSB
set and the rest of the bits all zero which is an invalid user address.

However, the old binutils currently in the tree uses the 32-bit mask value
(2^31) on 64-bit MIPS instead of 2^63.  This was fixed in upstream
binutils in 2008 to use 2^63 on 64-bit MIPS.

The first part of this change changes the runtime check in init_pltgot()
to check for both values (2^31 and 2^63) when deciding whether to store
the current object pointer in GOT[1] which fixes dynamic N64 binaries
compiled with modern binutils.

However, the initial version of this fix exposed another related bug in
that _rtld_relocate_nonplt_self() was only checking for the new value
(2^63) in GOT[1] and incorrectly treated GOT[1] as a local GOT entry
(and did not relocate the final local GOT entry).  To handle this, fix
all of the places that check for GOT[1]'s status to use the same macro
that checks for both values on N64.

Reviewed by: kan, imp
Sponsored by: DARPA / AFRL
Differential Revision: https://reviews.freebsd.org/D9708

7 years agoUse LDFLAGS with CC instead of _LDFLAGS.
John Baldwin [Wed, 22 Feb 2017 23:58:54 +0000 (23:58 +0000)]
Use LDFLAGS with CC instead of _LDFLAGS.

This is a followup to r311458.  _LDFLAGS is for use with LD, whereas
LDFLAGS is for use with CC.

7 years agoRemove tests/sys/netinet/fibs_tests's dependency on net/socat
Alan Somers [Wed, 22 Feb 2017 23:57:22 +0000 (23:57 +0000)]
Remove tests/sys/netinet/fibs_tests's dependency on net/socat

Instead of bridging two tap interfaces with socat, just use an epair pair.

MFC after: 3 weeks
Sponsored by: Spectra Logic Corp

7 years agoloader: update symlink support in zfs reader
Toomas Soome [Wed, 22 Feb 2017 22:00:50 +0000 (22:00 +0000)]
loader: update symlink support in zfs reader

As the current zfs file system is providing symlink via system attributes, need
to update the code accordingly.

Note, as the zfsboot code does not free the memory at this time, the
object list will put some stress on the boot2 heap, eventually we should
address the issue.

Reviewed by: allanjude, smh
Approved by: allanjude (mentor)
Differential Revision: https://reviews.freebsd.org/D9706

7 years agoImprove ipfw rule creation for blacklist-helper script
Kurt Lidl [Wed, 22 Feb 2017 21:50:37 +0000 (21:50 +0000)]
Improve ipfw rule creation for blacklist-helper script

When blocking an address, the blacklist-helper script
needs to do the following things for the ipfw packet
filter:

 - create a table to hold the addresses to be blocked,
   so lookups can be done quickly, and place the address
   to be blocked in that table
 - create rule that does the lookup in the table and
   blocks the packet

The ipfw system allows multiple rules to be inserted for
a given rule number.  There only needs to be one rule
to do the lookup per port.  Modify the script to probe
for the existence of the rule before attempting to create
it, so only one rule is inserted, rather than one rule per
blocked address.

PR: 214980
Reported by: azhegalov (at) gmail.com
Reviewed by: emaste
MFC after: 3 days
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D9681