summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorweongyo <weongyo@FreeBSD.org>2010-12-01 03:51:06 +0000
committerweongyo <weongyo@FreeBSD.org>2010-12-01 03:51:06 +0000
commit6f9dc08a946e1d7c0f3368edb3aec945ff1e09d7 (patch)
tree3651dfd8aaf74cdac08cb9f8eded7125da4ac3d6
parent9ebc09a72f97f4d9120b8386a7ecb5cc107be5e5 (diff)
downloadFreeBSD-src-6f9dc08a946e1d7c0f3368edb3aec945ff1e09d7.zip
FreeBSD-src-6f9dc08a946e1d7c0f3368edb3aec945ff1e09d7.tar.gz
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).
-rw-r--r--sys/dev/usb/usb_pf.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/sys/dev/usb/usb_pf.c b/sys/dev/usb/usb_pf.c
index c2925c2..4ac0eeb 100644
--- a/sys/dev/usb/usb_pf.c
+++ b/sys/dev/usb/usb_pf.c
@@ -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);
}
OpenPOWER on IntegriCloud