+ /*
+ * We use the attachcheck parameter to skip the
+ * interface attachment check.
+ * Some callers might hold the ifnet_head lock in
+ * exclusive mode. This means that:
+ * 1) the interface can't go away -- hence we don't
+ * need to perform this check
+ * 2) we can't perform this check because the lock is
+ * in exclusive mode and trying to lock it in shared
+ * mode would cause a deadlock.
+ */
+ if (attachcheck) {
+ ifnet_head_lock_shared();
+ if (ifindex2ifnet[zoneid] == NULL) {
+ ifnet_head_done();
+ return (ENXIO);
+ }