Lines Matching refs:pcb
96 __private_extern__ errno_t utun_pkt_input (struct utun_pcb *pcb, mbuf_t m);
190 struct utun_pcb *pcb;
195 pcb = utun_alloc(sizeof(*pcb));
196 if (pcb == NULL)
200 bzero(pcb, sizeof(*pcb));
201 *unitinfo = pcb;
202 pcb->utun_ctlref = kctlref;
203 pcb->utun_unit = sac->sc_unit;
205 printf("utun_ctl_connect: creating interface utun%d\n", pcb->utun_unit - 1);
210 utun_init.unit = pcb->utun_unit - 1;
218 utun_init.softc = pcb;
222 result = ifnet_allocate(&utun_init, &pcb->utun_ifp);
225 utun_free(pcb);
231 ifnet_set_mtu(pcb->utun_ifp, 1500);
232 ifnet_set_flags(pcb->utun_ifp, IFF_UP | IFF_MULTICAST | IFF_POINTOPOINT, 0xffff);
237 ifnet_set_eflags(pcb->utun_ifp, IFEF_NOAUTOIPV6LL, IFEF_NOAUTOIPV6LL);
241 ifnet_set_stat(pcb->utun_ifp, &stats);
244 result = ifnet_attach(pcb->utun_ifp, NULL);
247 ifnet_release(pcb->utun_ifp);
248 utun_free(pcb);
253 bpfattach(pcb->utun_ifp, DLT_NULL, 4);
257 ifnet_set_flags(pcb->utun_ifp, IFF_RUNNING, IFF_RUNNING);
420 struct utun_pcb *pcb = unitinfo;
421 ifnet_t ifp = pcb->utun_ifp;
424 utun_cleanup_crypto(pcb);
426 pcb->utun_ctlref = NULL;
427 pcb->utun_unit = 0;
469 struct utun_pcb *pcb = unitinfo;
487 pcb->utun_flags = *(u_int32_t *)data;
519 pcb->utun_ext_ifdata_stats = (*(int *)data) ? 1 : 0;
530 if (!pcb->utun_ext_ifdata_stats) {
535 ifnet_stat_increment_in(pcb->utun_ifp, utsp->utsp_packets,
538 ifnet_stat_increment_out(pcb->utun_ifp, utsp->utsp_packets,
560 struct utun_pcb *pcb = unitinfo;
568 *(u_int32_t *)data = pcb->utun_flags;
575 *(int *)data = (pcb->utun_ext_ifdata_stats) ? 1 : 0;
579 *len = snprintf(data, *len, "%s%d", ifnet_name(pcb->utun_ifp), ifnet_unit(pcb->utun_ifp)) + 1;
600 struct utun_pcb *pcb = ifnet_softc(interface);
603 bpf_tap_out(pcb->utun_ifp, DLT_NULL, data, 0, 0);
605 if (pcb->utun_flags & UTUN_FLAGS_NO_OUTPUT) {
612 if (pcb->utun_ctlref) {
616 if ((pcb->utun_flags & (UTUN_FLAGS_CRYPTO | UTUN_FLAGS_CRYPTO_STOP_DATA_TRAFFIC)) == UTUN_FLAGS_CRYPTO) {
617 if (utun_pkt_crypto_output(pcb, &data) == 0) {
623 result = ctl_enqueuembuf(pcb->utun_ctlref, pcb->utun_unit, data, CTL_DATA_EOR);
631 if (!pcb->utun_ext_ifdata_stats)
749 struct utun_pcb *pcb = ifnet_softc(interface);
751 utun_free(pcb);
812 utun_pkt_input (struct utun_pcb *pcb, mbuf_t m)
817 mbuf_pkthdr_setrcvif(m, pcb->utun_ifp);
819 bpf_tap_in(pcb->utun_ifp, DLT_NULL, m, 0, 0);
821 if (pcb->utun_flags & UTUN_FLAGS_NO_INPUT) {
829 if (protocol == AF_UTUN && pcb->utun_flags & UTUN_FLAGS_CRYPTO) {
830 if (utun_pkt_crypto_output(pcb, &m) == 0) {
833 printf("%s: utun_pkt_crypto_output failed, flags %x\n", __FUNCTION__, pcb->utun_flags);
837 if (!pcb->utun_ext_ifdata_stats) {
843 result = ifnet_input(pcb->utun_ifp, m, &incs);
845 result = ifnet_input(pcb->utun_ifp, m, NULL);
848 ifnet_stat_increment_in(pcb->utun_ifp, 0, 0, 1);