Explicitly UP and DOWN the usbus interfaces (IFT_USB) when it's attached
or detached. Normally it should be changed through user land ioctl(2) system calls but it looks there's no apps for USB and no need. With this patch, libpcap would detect the usbus interfaces correctly and tcpdump(1) could dump the USB packets into PCAP format with -w option. However it couldn't print the output to console because there's no printer-routine at tcpdump(1).
This commit is contained in:
parent
05cb58f669
commit
b172e30376
@ -65,6 +65,7 @@ usbpf_attach(struct usb_bus *ubus)
|
||||
ifp = ubus->ifp = if_alloc(IFT_USB);
|
||||
if_initname(ifp, "usbus", device_get_unit(ubus->bdev));
|
||||
if_attach(ifp);
|
||||
if_up(ifp);
|
||||
|
||||
KASSERT(sizeof(struct usbpf_pkthdr) == USBPF_HDR_LEN,
|
||||
("wrong USB pf header length (%zd)", sizeof(struct usbpf_pkthdr)));
|
||||
@ -86,6 +87,7 @@ usbpf_detach(struct usb_bus *ubus)
|
||||
|
||||
if (ifp != NULL) {
|
||||
bpfdetach(ifp);
|
||||
if_down(ifp);
|
||||
if_detach(ifp);
|
||||
if_free(ifp);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user