-
- bzero(&gif_init, sizeof(gif_init));
- gif_init.name = GIFNAME;
- gif_init.unit = ngif;
- gif_init.type = IFT_GIF;
- gif_init.family = IFNET_FAMILY_GIF;
- gif_init.output = gif_output;
- gif_init.demux = gif_demux;
- gif_init.add_proto = gif_add_proto;
- gif_init.del_proto = gif_del_proto;
- gif_init.softc = sc;
- gif_init.ioctl = gif_ioctl;
- gif_init.set_bpf_tap = gif_set_bpf_tap;
-
- bzero(sc, sizeof(struct gif_softc));
- result = ifnet_allocate(&gif_init, &sc->gif_if);
- if (result != 0) {
- printf("gif_create_dev, ifnet_allocate failed - %d\n", result);
+
+ /* 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.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(&gif_init_params, &sc->gif_if);
+ if (error != 0) {
+ printf("gif_clone_create, ifnet_allocate failed - %d\n", error);