Re: svn commit: r216091 - head/sys/dev/usb
On Wed, Dec 01, 2010 at 06:58:18PM -0500, Jung-uk Kim wrote: On Tuesday 30 November 2010 10:51 pm, Weongyo Jeong wrote: 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). I have written a very hackish USB packet printer for tcpdump based on Linux version. http://people.freebsd.org/~jkim/tcpdump-usb.diff Looks good to me. Note we can only print headers as Linux version does. Are you planning on adopting DLT_USB_LINUX or DLT_USB_LINUX_MMAPPED or applying for our own DLT, BTW? Frankly speaking, not sure yet. As you know, DLT_USB_LINUX and DLT_USB_LINUX_MMAPPED types are very specific only for Linux and each types has different structure size (48 bytes and 64 bytes). IMHO linux thought their own format only instead of thinking/defining a generic format. I think we have some cases we could select as follows: 1) Define a generic USB packet header form and make a consensus with linux guys then uses DLT_USB type. 2) Define DLT_USB_BSD and write our own code. 3) Changes `struct usbpf_pkthdr' to be compatible with linux format though it's expected to have some wasted variables (e.g. time stamp). regards, Weongyo Jeong ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org
Re: svn commit: r216091 - head/sys/dev/usb
On Tuesday 30 November 2010 10:51 pm, Weongyo Jeong wrote: 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). I have written a very hackish USB packet printer for tcpdump based on Linux version. http://people.freebsd.org/~jkim/tcpdump-usb.diff Note we can only print headers as Linux version does. Are you planning on adopting DLT_USB_LINUX or DLT_USB_LINUX_MMAPPED or applying for our own DLT, BTW? Jung-uk Kim ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org
svn commit: r216091 - head/sys/dev/usb
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); } ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org