Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 1 Dec 2010 03:51:06 +0000 (UTC)
From:      Weongyo Jeong <weongyo@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r216091 - head/sys/dev/usb
Message-ID:  <201012010351.oB13p6du062509@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
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);
 	}



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201012010351.oB13p6du062509>