Date: Thu, 25 Nov 2010 15:45:27 -0800 From: Weongyo Jeong <weongyo.jeong@gmail.com> To: current@freebsd.org Subject: [CFR] a small change of ifconfig(8) Message-ID: <20101125234527.GO92881@weongyo>
next in thread | raw e-mail | index | archive | help
--vni90+aGYgRvsTuO Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Hello all, I'm sending this email to check whether my approach is reasonable that I added 2 line into ifconfig(8) to skip IFT_USB interfaces as follows: + if (sdl != NULL && sdl->sdl_type == IFT_USB) + continue; And as additionally I added two changes of USB pf to call if_up(ifp) / if_down(ifp) explicitly to UP usbus interfaces though normally it always should be called through user ioctl calls. The reason why I make this patch is that I encountered a side-effect output from ifconfig(8) after USB packet filter is committed. Yes usbus interfaces are printed. Please give me some hints whether the patch is reasonable. If it's reasonable, is there other tools which I should make patches? regards, Weongyo Jeong --vni90+aGYgRvsTuO Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="patch_usb_20101125.diff" Index: sbin/ifconfig/ifconfig.c =================================================================== --- sbin/ifconfig/ifconfig.c (revision 215648) +++ sbin/ifconfig/ifconfig.c (working copy) @@ -295,6 +295,8 @@ sdl = (const struct sockaddr_dl *) ifa->ifa_addr; else sdl = NULL; + if (sdl != NULL && sdl->sdl_type == IFT_USB) + continue; if (cp != NULL && strcmp(cp, ifa->ifa_name) == 0 && !namesonly) continue; iflen = strlcpy(name, ifa->ifa_name, sizeof(name)); Index: sys/dev/usb/usb_pf.c =================================================================== --- sys/dev/usb/usb_pf.c (revision 215812) +++ sys/dev/usb/usb_pf.c (working copy) @@ -65,6 +65,7 @@ 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 @@ if (ifp != NULL) { bpfdetach(ifp); + if_down(ifp); if_detach(ifp); if_free(ifp); } --vni90+aGYgRvsTuO--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20101125234527.GO92881>