From owner-freebsd-current@FreeBSD.ORG Fri Nov 26 00:15:18 2010 Return-Path: Delivered-To: current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0A6691065674 for ; Fri, 26 Nov 2010 00:15:18 +0000 (UTC) (envelope-from weongyo.jeong@gmail.com) Received: from mail-gw0-f54.google.com (mail-gw0-f54.google.com [74.125.83.54]) by mx1.freebsd.org (Postfix) with ESMTP id B216D8FC14 for ; Fri, 26 Nov 2010 00:15:17 +0000 (UTC) Received: by gwj21 with SMTP id 21so721118gwj.13 for ; Thu, 25 Nov 2010 16:15:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:received:from:date:to:subject :message-id:reply-to:mail-followup-to:mime-version:content-type :content-disposition:user-agent:organization:x-operation-sytem; bh=E60EJF5PQHDvlnZB3/RIllMGlw9a7tdGAKN2z39EjSg=; b=O7oSoaIVO6ReEz8nBiah6Hn8a9jDjQRs9CBgOHKN2fXMQyWUIUBmxxHEexLHwx82lG G7c2MXPfEI545s4HK/V0ir2Mj1v7O2jrT+4f17th17ROxTg9MOMEhEzXCzubxDpxDEHy NyYnJnQG4FXXjy20XQ0gS9/66dkNPumNE8qKc= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:date:to:subject:message-id:reply-to:mail-followup-to :mime-version:content-type:content-disposition:user-agent :organization:x-operation-sytem; b=CwTkhG/JT6/urSq1lNLUQzLVu65lzt6WZ4ps61Zvyc+YnhYNv+chfQS6AEnGygvG0p i8f6uG7s00Exq2QylRqey8Dk5P/ln1d5wprdJhNHGXZ+l/sPW+dUSik15BucMgColC/7 4BfVUaDnCRObZk+7vhYjmU1mgJMEAAm5B58bM= Received: by 10.151.111.17 with SMTP id o17mr4005757ybm.151.1290728697821; Thu, 25 Nov 2010 15:44:57 -0800 (PST) Received: from weongyo ([174.35.1.224]) by mx.google.com with ESMTPS id k16sm920923ybe.12.2010.11.25.15.44.54 (version=SSLv3 cipher=RC4-MD5); Thu, 25 Nov 2010 15:44:56 -0800 (PST) Received: by weongyo (sSMTP sendmail emulation); Thu, 25 Nov 2010 15:45:27 -0800 From: Weongyo Jeong Date: Thu, 25 Nov 2010 15:45:27 -0800 To: current@freebsd.org Message-ID: <20101125234527.GO92881@weongyo> Mail-Followup-To: current@freebsd.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="vni90+aGYgRvsTuO" Content-Disposition: inline User-Agent: Mutt/1.4.2.3i Organization: CDNetworks. X-Operation-Sytem: FreeBSD Cc: Subject: [CFR] a small change of ifconfig(8) X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: Weongyo Jeong List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 26 Nov 2010 00:15:18 -0000 --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--