- sc->gif_if.if_softc = sc;
- sc->gif_if.if_name = GIFNAME;
- sc->gif_if.if_unit = ngif;
-
+
+ /* 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);
+
+ bzero(&gif_init, sizeof(gif_init));
+ gif_init.uniqueid = sc->gif_ifname;
+ gif_init.uniqueid_len = strlen(sc->gif_ifname);
+ gif_init.name = GIFNAME;
+ gif_init.unit = unit;
+ 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;
+
+ result = ifnet_allocate(&gif_init, &sc->gif_if);
+ if (result != 0) {
+ printf("gif_clone_create, ifnet_allocate failed - %d\n", result);
+ _FREE(sc, M_DEVBUF);
+ return ENOBUFS;
+ }
+