+errno_t
+ether_attach_inet(struct ifnet *ifp, protocol_family_t proto_family)
+{
+#pragma unused(proto_family)
+ struct ifnet_attach_proto_param_v2 proto;
+ struct ifnet_demux_desc demux[2];
+ u_short en_native = htons(ETHERTYPE_IP);
+ u_short arp_native = htons(ETHERTYPE_ARP);
+ errno_t error;
+
+ bzero(&demux[0], sizeof (demux));
+ demux[0].type = DLIL_DESC_ETYPE2;
+ demux[0].data = &en_native;
+ demux[0].datalen = sizeof (en_native);
+ demux[1].type = DLIL_DESC_ETYPE2;
+ demux[1].data = &arp_native;
+ demux[1].datalen = sizeof (arp_native);
+
+ bzero(&proto, sizeof (proto));
+ proto.demux_list = demux;
+ proto.demux_count = sizeof (demux) / sizeof (demux[0]);
+ proto.input = ether_inet_input;
+ proto.pre_output = ether_inet_pre_output;
+ proto.ioctl = ether_inet_prmod_ioctl;
+ proto.event = ether_inet_event;
+ proto.resolve = ether_inet_resolve_multi;
+ proto.send_arp = ether_inet_arp;
+
+ error = ifnet_attach_protocol_v2(ifp, proto_family, &proto);
+ if (error && error != EEXIST) {
+ printf("WARNING: %s can't attach ip to %s%d\n", __func__,
+ ifp->if_name, ifp->if_unit);
+ }
+ return (error);
+}