-
- first_empty = MAX_EN_COUNT;
- for (i=0; i < MAX_EN_COUNT; i++) {
- if (en_at_array[i].ifp == 0)
- first_empty = i;
-
- if (en_at_array[i].ifp == ifp) {
- en_at_array[i].ref_count++;
- return 0;
- }
- }
-
- if (first_empty == MAX_EN_COUNT)
- return ENOMEM;
-
- bzero(®, sizeof(reg));
- bzero(&desc, sizeof(desc));
- bzero(&desc2, sizeof(desc2));
-
- TAILQ_INIT(®.demux_desc_head);
- reg.interface_family = ifp->if_family;
- reg.unit_number = ifp->if_unit;
- reg.input = at_ether_input;
- reg.pre_output = ether_pre_output;
- reg.ioctl = ether_prmod_ioctl;
- reg.protocol_family = PF_APPLETALK;
-
- desc.type = DLIL_DESC_SNAP;
- desc.native_type = atalk_snap;
- desc.variants.native_type_length = sizeof(atalk_snap);
- TAILQ_INSERT_TAIL(®.demux_desc_head, &desc, next);
-
- desc2.type = DLIL_DESC_SNAP;
- desc2.native_type = aarp_snap;
- desc2.variants.native_type_length = sizeof(aarp_snap);
- TAILQ_INSERT_TAIL(®.demux_desc_head, &desc2, next);
+ int error;
+
+ bzero(demux, sizeof(demux));
+ demux[0].type = DLIL_DESC_SNAP;
+ demux[0].data = atalk_snap;
+ demux[0].datalen = sizeof(atalk_snap);
+ demux[1].type = DLIL_DESC_SNAP;
+ demux[1].data = aarp_snap;
+ demux[1].datalen = sizeof(aarp_snap);
+
+ bzero(&proto, sizeof(proto));
+ proto.demux_list = demux;
+ proto.demux_count = sizeof(demux) / sizeof(demux[0]);
+ proto.input = ether_at_input;
+ proto.pre_output = ether_at_pre_output;
+ proto.ioctl = ether_at_prmod_ioctl;