+ log(LOG_ERR, "gif_clone_create: failed to allocate gif%d\n",
+ unit);
+ error = ENOBUFS;
+ goto done;
+ }
+
+ /* use the interface name as the unique id for ifp recycle */
+ snprintf(sc->gif_ifname, sizeof(sc->gif_ifname), "%s%d",
+ ifc->ifc_name, unit);
+
+ lck_mtx_init(&sc->gif_lock, gif_mtx_grp, gif_mtx_attr);
+
+ bzero(&gif_init_params, sizeof(gif_init_params));
+ gif_init_params.ver = IFNET_INIT_CURRENT_VERSION;
+ gif_init_params.len = sizeof(gif_init_params);
+ gif_init_params.flags = IFNET_INIT_LEGACY;
+ gif_init_params.uniqueid = sc->gif_ifname;
+ gif_init_params.uniqueid_len = strlen(sc->gif_ifname);
+ gif_init_params.name = GIFNAME;
+ gif_init_params.unit = unit;
+ gif_init_params.type = IFT_GIF;
+ gif_init_params.family = IFNET_FAMILY_GIF;
+ gif_init_params.output = gif_output;
+ gif_init_params.demux = gif_demux;
+ gif_init_params.add_proto = gif_add_proto;
+ gif_init_params.del_proto = gif_del_proto;
+ gif_init_params.softc = sc;
+ gif_init_params.ioctl = gif_ioctl;
+ gif_init_params.set_bpf_tap = gif_set_bpf_tap;
+ gif_init_params.detach = gif_detach;
+
+ error = ifnet_allocate_extended(&gif_init_params, &sc->gif_if);
+ if (error != 0) {
+ printf("gif_clone_create, ifnet_allocate failed - %d\n", error);
+ if_clone_softc_deallocate(&gif_cloner, sc);
+ error = ENOBUFS;
+ goto done;