Hide IPv6 next header parsing warnings under the verbose sysctl
so people can possibly disable it when their consoles are flooded,
or enabled it for debugging.
If we detect an IPv6 fragment header and it is not the first fragment,
then terminate the loop as we will not find any further headers and
for short fragments this could otherwise lead to a pullup error
discarding the fragment.
Submitted by: Matthew Luckie (mjl luckie.org.nz)
PR: kern/145733
ipfw internally checks for offset == 0 to determine whether the
packet is a/the first fragment or not. For IPv6 we have added the
"more fragments" flag as well to be able to determine on whether
there will be more as we do not have the fragment header avaialble
for logging, while for IPv4 this information can be derived directly
from the IPv4 header. This allowed fragmented packets to bypass
normal rules as proper masking was not done when checking offset.
Split variables to not need masking for IPv6 to avoid further errors.
After r225032 fix logging in a similar way masking the the IPv6
more fragments flag off so that offset == 0 checks work properly.
Submitted by: Matthew Luckie (mjl luckie.org.nz)
PR: kern/145733
While not explicitly allowed by RFC 2460, in case there is no
translation technology involved (and that section is suggested to
be removed by Errata 2843), single packet fragments do not harm.
There is another errata and further drafts under discussion to clarify
on these kinds of packets.
Meanwhile add a sysctl to allow disabling this behaviour again.
We will treat single packet fragment (a fragment header added
when not needed) as if there was no fragment header.
Submitted by: Matthew Luckie (mjl luckie.org.nz) (original version)
PR: kern/145733
kib [Wed, 8 Feb 2012 15:19:49 +0000 (15:19 +0000)]
MFC r230553:
When doing vflush(WRITECLOSE), clean vnode pages.
Unmounts do vfs_msync() before calling VFS_UNMOUNT(), but there is
still a race allowing a process to dirty pages after msync
finished. Remounts rw->ro just left dirty pages in system.
mav [Wed, 8 Feb 2012 07:31:55 +0000 (07:31 +0000)]
MFC 230877:
Fix NULL dereference panic on attempt to turn off (on system shutdown)
disconnected swap device.
This is quick and imperfect solution, as swap device will still be opened
and GEOM will not be able to destroy it. Proper solution would be to
automatically turn off and close disconnected swap device, but with existing
code it will cause panic if there is at least one page on device, even if
it is unimportant page of the user-level process. It needs some work.
delphij [Tue, 7 Feb 2012 21:56:58 +0000 (21:56 +0000)]
MFC r227454:
Use __packed to prevent alignment from taking place, which otherwise may
change the on-disk format in an incompatible way. Without this change,
msdosfs created on FreeBSD/arm would not be mountable.
PR: bin/162486
Submitted by: Ian Lepore <freebsd damnhippie dyndns org>
Reported by: Mattia Rossi <mrossi at swin.edu.au>
jhb [Tue, 7 Feb 2012 19:56:22 +0000 (19:56 +0000)]
MFC 229614:
Add new variants of the IF_ADDR_*LOCK*() macros used for protecting
interface address lists that distinguish read locks from write locks.
To preserve the KPI, the previous operations are mapped to the write
lock macros. The lock is still kept as a mutex for now.
Rev. 13572:
disk sync write perf regression when slog is used post oi_148 [1]
Rev. 13573:
crash during reguid causes stale config [2]
allow and unallow missing from zpool history since removal of pyzfs [5]
Rev. 13574:
leaking a vdev when removing an l2cache device [3]
memory leak when adding a file-based l2arc device [4]
leak in ZFS from metaslab_group_create and zfs_ereport_checksum [6]
MFC r230495:
Try resolving jail path with realpath(3).
jail(8) does a chdir(2) to the given path argument. Kernel evaluates the
jail path from the new cwd and not from the original cwd, which leads to
undesired behavior if given a relative path.
cognet [Tue, 7 Feb 2012 15:50:14 +0000 (15:50 +0000)]
MFC r226441 and r226443
r226441:
Explicitely set ARM_RAS_START and ARM_RAS_END once the cacheline or the
page has been allocated, or we could end up using random values, and bad things
could happen.
PR: arm/161492
Submitted by: Ian Lepore <freebsd AT damnhippie dot dyndns DOT org>
r226443:
Fix 2 bugs :
- A race condition could happen if two threads were using RAS at the same time
as the code didn't reset RAS_END, the RAS code could believe we were not in
a RAS, when we were in fact.
- Using signed value logic to compare addresses wasn't such a good idea.
Many thanks to Ian to investigate on these issues.
Pointy hat to: cognet
PR: arm/161498
Submitted by: Ian Lepore <freebsd At damnhippie DOT dyndns dot org
emaste [Tue, 7 Feb 2012 04:06:21 +0000 (04:06 +0000)]
MFC r227893 and r228119:
Avoid double free creating a new RAID with invalid command line
arguments.
In build_volume(), check if arrays is allocated before traversing its
items. While parsing the arrays input, it's possible that we reach the
error path before initializing the 'arrays' pointer, which in turn leads
to a NULL deference.
emaste [Tue, 7 Feb 2012 03:37:29 +0000 (03:37 +0000)]
MFC r226697 and r226708:
Avoid printing // for packages that install to /
I have some packages that install to / (for whatever reason). Right now we
print entries of the form //path/to/file when listing files (pkg_info -L,
pkg_info -g etc.) This change avoids printing the redundant / .
emaste [Tue, 7 Feb 2012 03:15:12 +0000 (03:15 +0000)]
MFC r219708:
Reemove uptime validity check that hasn't been necessary since r151417
switched to clock_gettime. vmstat will now not exit with an error
if run on a system with 10 years of uptime.
r228491:
Do not clobber the ingress queue's congestion setting.
r228561:
Many updates to cxgbe(4)
- Device configuration via plain text config file. Also able to operate
when not attached to the chip as the master driver.
- Generic "work request" queue that serves as the base for both ctrl and
ofld tx queues.
- Generic interrupt handler routine that can process any event on any
kind of ingress queue (via a dispatch table).
- A couple of new driver ioctls. cxgbetool can now install a firmware
to the card ("loadfw" command) and can read the card's memory
("memdump" and "tcb" commands).
- Lots of assorted information within dev.t4nex.X.misc.* This is
primarily for debugging and won't show up in sysctl -a.
- Code to manage the L2 tables on the chip.
- Updates to cxgbe(4) man page to go with the tunables that have changed.
- Updates to the shared code in common/
- Updates to the driver-firmware interface (now at fw 1.4.16.0)
r228594:
Catch up with new driver ioctls in cxgbe.
dumbbell [Mon, 6 Feb 2012 13:36:49 +0000 (13:36 +0000)]
MFC r230212:
sh: Fix execution of multiple statements in a trap when evalskip is set
Before this fix, only the first statement of the trap was executed if
evalskip was set. This is for example the case when:
o "-e" is set for this shell
o a trap is set on EXIT
o a function returns 1 and causes the script to abort
kib [Mon, 6 Feb 2012 10:35:21 +0000 (10:35 +0000)]
MFC r230785:
A debugger which requested PT_FOLLOW_FORK should get the notification
about new child not only when doing PT_TO_SCX, but also for PT_CONTINUE.
If TDB_FORK flag is set, always issue a stop, the same as is done for
TDB_EXEC.
pfg [Sun, 5 Feb 2012 20:18:53 +0000 (20:18 +0000)]
MFC: r230897
Use new OSS-based BSD-licensed header for cs sound driver.
The cs driver requires a table with firmware values. An
alternative firmware is available in a similar Open Sound
System driver. This is actually a partial revert of
Revision 77504.
fork(2) returns -1 on failure, not some random negative number.
r229778 (uqs):
Spelling fixes for sbin/
r229944 (pjd):
Don't touch pidfiles when running in foreground. Before that change we
would create an empty pidfile on start and check if it changed on SIGHUP.
r229945 (pjd):
For functions that return -1 on failure check exactly for -1 and not for
any negative number.
r229946 (pjd):
- Fix a bug where pidfile was removed in SIGHUP when it hasn't changed in
configuration file.
- Log the fact that pidfile has changed.
r230092 (pjd):
Style cleanups.
r230395 (pjd):
Remove unused token 'port'.
r230396 (pjd):
Remove another unused token.
r230436 (pjd):
Fix minor memory leak.
r230457 (pjd):
Free memory that won't be used in child.
r230515 (pjd):
- Fix documentation to note that /etc/hast.conf is the default configuration
file for hastd(8) and hastctl(8) and not hast.conf.
- In copyright statement correct that this file is documentation, not software.
- Bump date.
dim [Fri, 3 Feb 2012 23:08:58 +0000 (23:08 +0000)]
MFC r229753:
In sys/contrib/rdma/ib_addr.h, bump MAX_ADDR_LEN to 20 bytes (the same
value used in sys/ofed/include/linux/netdevice.h), so there will be no
buffer overruns in the rest of the inline functions in this file.
pfg [Fri, 3 Feb 2012 23:00:28 +0000 (23:00 +0000)]
MFC: r229981, r230898
Replace a GPL'd header in the emu10kx snd driver code.
This uses the emuxkireg.h already used in the emu10k1
snd driver. Special thanks go to Alexander Motin as
he was able to find some errors and reverse engineer
some wrong values in the emuxkireg header.
While here also merge some cleanups to the module Makefile.
pfg [Fri, 3 Feb 2012 21:30:31 +0000 (21:30 +0000)]
MFC: r228780
Update libstdc++ with small changes up to the latest rev. (135556)
from the gcc 4.2 branch.
The libraries in the gcc-4_2-branch remained under the LGPLv2.
pfg [Fri, 3 Feb 2012 21:26:25 +0000 (21:26 +0000)]
MFC: r228756
Clean an inconsistency with -ffinite-math-only.
Backported from the gcc-4_3-branch, revision (118001)
under the GPLv2.
This issue was also fixed in Apple's gcc.
PR: 157025
Reviewed by: mm
Approved by: jhb (mentor)
rmacklem [Fri, 3 Feb 2012 03:41:43 +0000 (03:41 +0000)]
MFC: r230345
Martin Cracauer reported a problem to freebsd-current@ under the
subject "Data corruption over NFS in -current". During investigation
of this, I came across an ugly bogusity in the new NFS client where
it replaced the cr_uid with the one used for the mount. This was
done so that "system operations" like the NFSv4 Renew would be
performed as the user that did the mount. However, if any other
thread shares the credential with the one doing this operation,
it could do an RPC (or just about anything else) as the wrong cr_uid.
This patch fixes the above, by using the mount credentials instead of
the one provided as an argument for this case. It appears
to have fixed Martin's problem.
This patch is needed for NFSv4 mounts and NFSv3 mounts against
some non-FreeBSD servers that do not put post operation attributes
in the NFSv3 Statfs RPC reply.
ken [Thu, 2 Feb 2012 19:03:29 +0000 (19:03 +0000)]
MFC 230592:
Bring in the LSI-supported version of the mps(4) driver.
This involves significant changes to the mps(4) driver, but is not a
complete rewrite.
Some of the changes in this version of the driver:
- Integrated RAID (IR) support.
- Support for WarpDrive controllers.
- Support for SCSI protection information (EEDP).
- Support for TLR (Transport Level Retries), needed for tape drives.
- Improved error recovery code.
- ioctl interface compatible with LSI utilities.
mps.4: Update the mps(4) driver man page somewhat for the driver
changes. The list of supported hardware still needs to be
updated to reflect the full list of supported cards.
conf/files: Add the new driver files.
mps/mpi/*: Updated version of the MPI header files, with a BSD style
copyright.
mps/*: See above for a description of the new driver features.
modules/mps/Makefile:
Add the new mps(4) driver files.
marius [Wed, 1 Feb 2012 21:28:16 +0000 (21:28 +0000)]
MFC: r230664
As it turns out r227960 (MFC'ed to stable/8 in r228145) may still be
insufficient with PREEMPTION so try harder to get the CDMA sync
interrupt delivered and also in a more efficient way:
- wrap the whole process of sending and receiving the CDMA sync
interrupt in a critical section so we don't get preempted,
- send the CDMA sync interrupt to the CPU that is actually waiting
for it to happen so we don't take a detour via another CPU,
- instead of waiting for up to 15 seconds for the interrupt to
trigger try the whole process for up to 15 times using a one
second timeout (the code was also changed to just ignore belated
interrupts of a previous tries should they appear).
According to testing done by Peter Jeremy with the debugging also
added as part of this commit the first two changes apparently are
sufficient to now properly get the CDMA sync interrupts delivered
at the first try though.
marius [Wed, 1 Feb 2012 21:24:06 +0000 (21:24 +0000)]
MFC: r230662
Fully disable interrupts while we fiddle with the FP context in the
VIS-based block copy/zero implementations. While with 4BSD it's
sufficient to just disable the tick interrupts, with ULE+PREEMPTION
it's otherwise also possible that these are preempted via IPIs.
marius [Wed, 1 Feb 2012 21:19:54 +0000 (21:19 +0000)]
MFC: r230633, r230634
Now that we have a working OF_printf() since r230631 and a OF_panic()
helper since r230632 (MFC'ed to stable/8 in r230885 and r230887
respectively), use these for output and panicing during the early
cycles and move cninit() until after the static per-CPU data has
been set up. This solves a couple of issue regarding the non-
availability of the static per-CPU data:
- panic() not working and only making things worse when called,
- having to supply a special DELAY() implementation to the low-level
console drivers,
- curthread accesses of mutex(9) usage in low-level console drivers
that aren't conditional due to compiler optimizations (basically,
this is the problem described in r227537 but in this case for
keyboards attached via uart(4)). [1]
marius [Wed, 1 Feb 2012 21:14:07 +0000 (21:14 +0000)]
MFC: r230632
- Now that we have a working OF_printf() since r230631 (MFC'ed to stable/8
in r230885), use it for implementing a simple OF_panic() that may be used
during the early cycles when panic() isn't available, yet.
- Mark cpu_{exit,shutdown}() as __dead2 as appropriate.
marius [Wed, 1 Feb 2012 21:10:00 +0000 (21:10 +0000)]
MFC: r230630
For machines where the kernel address space is unrestricted increase
VM_KMEM_SIZE_SCALE to 2, awaiting more insight from alc@. As it turns
out, the VM apparently has problems with machines that have large holes
in the physical address space, causing the kmem_suballoc() call in
kmeminit() to fail with a VM_KMEM_SIZE_SCALE of 1. Using a value of 2
allows these, namely Blade 1500 with 2GB of RAM, to boot.
mav [Wed, 1 Feb 2012 18:05:54 +0000 (18:05 +0000)]
MFC r228820, r228851:
Merge to da driver quirks hinting 4K physical sector sizes for SATA disks
connected via SAS or USB. Unluckily I've found that SAS (mps) and USB-SATA
I have translate models in different ways, requiring twice more quirks.
Unluckily for Hitachi, their model names are trimmed on SAS, making
impossible to identify 4K sector drives that way.
ken [Tue, 31 Jan 2012 23:09:27 +0000 (23:09 +0000)]
MFC: 230000, 230544
Fix a race condition in CAM peripheral free handling, locking
in the CAM XPT bus traversal code, and a number of other periph level
issues.
r230544 | ken | 2012-01-25 10:58:47 -0700 (Wed, 25 Jan 2012) | 9 lines
Fix a bug introduced in r230000. We were eliminating all LUNs on a target
in response to CAM_DEV_NOT_THERE, instead of just the LUN in question.
This will now just eliminate the specified LUN in response to
CAM_DEV_NOT_THERE.
Reported by: Richard Todd <rmtodd@servalan.servalan.com>
r230000 | ken | 2012-01-11 17:41:48 -0700 (Wed, 11 Jan 2012) | 72 lines
Fix a race condition in CAM peripheral free handling, locking
in the CAM XPT bus traversal code, and a number of other periph level
issues.
cam_periph.h,
cam_periph.c: Modify cam_periph_acquire() to test the CAM_PERIPH_INVALID
flag prior to allowing a reference count to be gained
on a peripheral. Callers of this function will receive
CAM_REQ_CMP_ERR status in the situation of attempting to
reference an invalidated periph. This guarantees that
a peripheral scheduled for a deferred free will not
be accessed during its wait for destruction.
Panic during attempts to drop a reference count on
a peripheral that already has a zero reference count.
In cam_periph_list(), use a local sbuf with SBUF_FIXEDLEN
set so that mallocs do not occur while the xpt topology
lock is held, regardless of the allocation policy of the
passed in sbuf.
Add a new routine, cam_periph_release_locked_buses(),
that can be called when the caller already holds
the CAM topology lock.
Add some extra debugging for duplicate peripheral
allocations in cam_periph_alloc().
Treat CAM_DEV_NOT_THERE much the same as a selection
timeout (AC_LOST_DEVICE is emitted), but forgo retries.
cam_xpt.c: Revamp the way the EDT traversal code does locking
and reference counting. This was broken, since it
assumed that the EDT would not change during
traversal, but that assumption is no longer valid.
So, to prevent devices from going away while we
traverse the EDT, make sure we properly lock
everything and hold references on devices that
we are using.
The two peripheral driver traversal routines should
be examined. xptpdperiphtraverse() holds the
topology lock for the entire time it runs.
xptperiphtraverse() is now locked properly, but
only holds the topology lock while it is traversing
the list, and not while the traversal function is
running.
The bus locking code in xptbustraverse() should
also be revisited at a later time, since it is
complex and should probably be simplified.
scsi_da.c: Pay attention to the return value from cam_periph_acquire().
Return 0 always from daclose() even if the disk is now gone.
Add some rudimentary error injection support.
scsi_sg.c: Fix reference counting in the sg(4) driver.
The sg driver was calling cam_periph_release() on close,
but never called cam_periph_acquire() (which increments
the reference count) on open.
The periph code correctly complained that the sg(4)
driver was trying to decrement the refcount when it
was already 0.
jfv [Tue, 31 Jan 2012 22:47:10 +0000 (22:47 +0000)]
MFC of e1000 drivers
The following revs are merged:
212303,212304,213234,214363,214441,217556,219902,221505,
223676,226436,227309,228386,228387,228405,228415,228788,
228803,229606,229767,230023,230024,230742
gibbs [Tue, 31 Jan 2012 18:13:49 +0000 (18:13 +0000)]
MFC r225708 into stable/8:
Modify the netfront driver so it can successfully attach to
PV devices with the ioemu attribute set.
sys/dev/xen/netfront/netfront.c:
o If a mac address for the interface cannot be found
in the front-side XenStore tree, look for an entry
in the back-side tree. With ioemu devices, the
emulator does not populate the front side tree and
neither does Xend.
o Return an error rather than panic when an attach
attempt fails.
Reported by: Janne Snabb (fix inspired by patch provided)
PR: kern/154302
MFC r222778 (gavin):
Rework parts of this man page to improve grammar.
MFC r225003 (ae):
Add new section "BOOTSTRAPPING" to the gpart(8), that describes
bootstrap code images used to boot from MBR, GPT, BSD and VTOC8
schemes.
MFC r227774:
Add a section that explicitly describes partitioning schemes. Modify
existing sections to refer to the new one. Rearrange partitioning scheme
list so MBR and EBR types are together. Also add several corrections for
grammar, clarity, and consistency.
MFC r227777:
Fix date.
MFC r227800:
Correct and expand BSD partitioning scheme description.
Correct GUID to GPT in RECOVERING section.
dougb [Tue, 31 Jan 2012 00:49:04 +0000 (00:49 +0000)]
MFC r217071 and r217213:
Make the setting of the BIND CFLAG -DWORDS_BIGENDIAN conditional on the
TARGET_ENDIANNESS knob from bsd.endian.mk so that we can avoid having to
special-case each arch.
MFC r224093 (in part):
Stop claiming that we support atomic ops except on arches where we know
that they work. Many users have reported problems on the other arches,
so until they can get fixed we'll take the safe route.
truckman [Mon, 30 Jan 2012 07:23:53 +0000 (07:23 +0000)]
MFC r230064:
Allow an MBR primary or extended Linux swap partition to be specified
as the system dump device. This was already allowed for GPT. The Linux
swap metadata at the beginning of the partition should not be disturbed
because the crash dump is written at the end.
If an RCS file is truncated, rcsfile_getdelta() will return NULL. Instead
of faulting, check for NULL. However, returning an error would cause csup
to just abort the entire update. Instead, break out of the loop and
return ok. The attempts to update the file will trigger a MD5 failure which
will cause csup to download the entire file as a fixup.
o MFC: r213573 (partial)
mdoc: drop redundant .Pp and .LP calls
They have no effect when coming in pairs, or before .Bl/.Bd
o MFC: r216370 (partial)
Remove the advertising clause from UCB copyrighted files in usr.bin. This
is in accordance with the information provided at
ftp://ftp.cs.berkeley.edu/pub/4bsd/README.Impt.License.Change
Also add $FreeBSD$ to a few files to keep svn happy.
o MFC: r216542
Signal that data should not be modified.
o MFC: r217858
Remove dead code.
o MFC: r225535
Fix csup to allow case insensitive server names in the auth file,
just as advertised in the manpage.
PR: 158652
o MFC: r225536
Fix typos in error messages.
o MFC: r225979
Update the comment to reflect what is actually going on.
o MFC: r225980
Handle the situation where fixups_close() has been called but more fixups
are still available on the queue.
o MFC: r228625
In usr.bin/csup/auth.c, use the correct number of bytes for zeroing the
shared secret, and use long long format to snprintf a time_t.
o MFC: r228626
In usr.bin/csup/proto.c, use the correct printf length modifier to print
an off_t.
o MFC: r228667
In usr.bin/csup/auth.c, cast time_t to intmax_t instead, and use the
corresponding printf length modifier.
o MFC: r228857
On FreeBSD just use the MD5 implementation of libmd rather than that of
libcrypto so we don't need to relinquish csup when world is built without
OpenSSL.
marius [Sun, 29 Jan 2012 12:58:07 +0000 (12:58 +0000)]
MFC: r228211
It doesn't make much sense to check whether child is NULL after already
having dereferenced it. We either should generally check the device_t's
supplied to bus functions before using them (which we seem to virtually
never do) or just assume that they are not NULL.
While at it make this code fit 78 columns.
marius [Sun, 29 Jan 2012 12:56:21 +0000 (12:56 +0000)]
MFC: r228209
- In device_probe_child(9) check the return value of device_set_driver(9)
when actually setting a driver as especially ENOMEM is fatal in these
cases.
- Annotate other calls to device_set_devclass(9) and device_set_driver(9)
without the return value being checked and that are okay to fail.
marius [Sun, 29 Jan 2012 12:54:36 +0000 (12:54 +0000)]
MFC: r228027
Move the scsi_da_bios_params() prototype from pc98_machdep.h to md_var.h
where the prototype for pc98_ata_disk_firmware_geom_adjust() also lives
in order to avoid an #ifdef'ed include in cam(4).
marius [Sun, 29 Jan 2012 01:22:48 +0000 (01:22 +0000)]
MFC: r227843 (partial)
- There's no need to overwrite the default device method with the default
one. Interestingly, these are actually the default for quite some time
(bus_generic_driver_added(9) since r52045 and bus_generic_print_child(9)
since r52045) but even recently added device drivers do this unnecessarily.
Discussed with: jhb, marcel
- While at it, use DEVMETHOD_END.
Discussed with: jhb
- Also while at it, use __FBSDID.
marius [Sun, 29 Jan 2012 01:00:16 +0000 (01:00 +0000)]
MFC: r227687, r228290 (partial)
- Add a hint.miibus.X.phymask hint, allowing do individually exclude PHY
addresses from being probed and attaching something including ukphy(4)
to it. This is mainly necessarily for PHY switches that create duplicate
or fake PHYs on the bus that can corrupt the PHY state when accessed or
simply cause problems when ukphy(4) isolates the additional instances.
- Change miibus(4) to be a hinted bus, allowing to add child devices via
hints and to set their attach arguments (including for automatically
probed PHYs). This is mainly needed for PHY switches that violate IEEE
802.3 and don't even implement the basic register set so we can't probe
them automatically. However, the ability to alter the attach arguments
for automatically probed PHYs is also useful as for example it allows
to test (or tell a user to test) new variant of a PHY with a specific
driver by letting an existing driver attach to it via manipulating the
IDs without the need to touch the source code or to limit a Gigabit
Ethernet PHY to only announce up to Fast Ethernet in order to save
energy by limiting the capability mask. Generally, a driver has to
be hinted via hint.phydrv.X.at="miibusY" and hint.phydrv.X.phyno="Z"
(which already is sufficient to add phydrvX at miibusY at PHY address
Z). Then optionally the following attach arguments additionally can
be configured:
hint.phydrv.X.id1
hint.phydrv.X.id2
hint.phydrv.X.capmask
- Some minor cleanup.
marius [Sun, 29 Jan 2012 00:50:50 +0000 (00:50 +0000)]
MFC: r227685
- There's no need to ignore the return value of mii_attach(9) when attaching
dcphy(4) (CID 9283).
- In dc_detach(), check whether ifp is NULL as dc_attach() may call the
former without ifp being allocated (CID 4288).