svn commit: r216091 - head/sys/dev/usb

Weongyo Jeong weongyo at FreeBSD.org
Wed Dec 1 03:51:07 UTC 2010


Author: weongyo
Date: Wed Dec  1 03:51:06 2010
New Revision: 216091
URL: http://svn.freebsd.org/changeset/base/216091

Log:
  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).

Modified:
  head/sys/dev/usb/usb_pf.c

Modified: head/sys/dev/usb/usb_pf.c
==============================================================================
--- head/sys/dev/usb/usb_pf.c	Wed Dec  1 03:35:19 2010	(r216090)
+++ head/sys/dev/usb/usb_pf.c	Wed Dec  1 03:51:06 2010	(r216091)
@@ -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);
 	}


More information about the svn-src-all mailing list