- struct dlil_proto_reg_str reg;
- struct dlil_demux_desc desc;
- short native=0;
- int stat =0 ;
- int i;
-
- for (i=0; i < lo_count; i++) {
- if ((lo_array[i]) && (lo_array[i]->ifp == ifp)) {
- if (lo_array[i]->protocol_family == PF_INET) {
- *dl_tag = lo_array[i]->dl_tag;
- return (0);
- }
- }
- }
-
- TAILQ_INIT(®.demux_desc_head);
- desc.type = DLIL_DESC_RAW;
- desc.variants.bitmask.proto_id_length = 0;
- desc.variants.bitmask.proto_id = 0;
- desc.variants.bitmask.proto_id_mask = 0;
- desc.native_type = (char *) &native;
- TAILQ_INSERT_TAIL(®.demux_desc_head, &desc, next);
- reg.interface_family = ifp->if_family;
- reg.unit_number = ifp->if_unit;
- reg.input = lo_input;
- reg.pre_output = lo_pre_output;
- reg.event = 0;
- reg.offer = 0;
- reg.ioctl = loioctl;
- reg.default_proto = 0;
- reg.protocol_family = PF_INET;
-
- stat = dlil_attach_protocol(®, dl_tag);
-
- if (stat)
- printf("lo_attach_inet: dlil_attach_protocol returned=%d\n", stat);
-
- return stat;
-}
+ struct dlil_proto_reg_str reg;
+ int stat =0 ;
+
+ bzero(®, sizeof(reg));
+ TAILQ_INIT(®.demux_desc_head);
+ reg.interface_family = ifp->if_family;
+ reg.unit_number = ifp->if_unit;
+ reg.input = lo_input;
+ reg.pre_output = lo_pre_output;
+ reg.protocol_family = protocol_family;
+
+ stat = dlil_attach_protocol(®);