Author: weongyo
Date: Tue Dec  7 20:23:47 2010
New Revision: 216267
URL: http://svn.freebsd.org/changeset/base/216267

Log:
  Introduces IFF_CANTCONFIG interface flag to point that the interface
  isn't configurable in a meaningful way.  This is for ifconfig(8) or
  other tools not to change code whenever IFT_USB-like interfaces are
  registered at the interface list.
  
  Reviewed by:  brooks
  No objections:        gavin, jkim

Modified:
  head/sbin/ifconfig/ifconfig.c
  head/sys/dev/usb/usb_pf.c
  head/sys/net/if.h

Modified: head/sbin/ifconfig/ifconfig.c
==============================================================================
--- head/sbin/ifconfig/ifconfig.c       Tue Dec  7 19:18:00 2010        
(r216266)
+++ head/sbin/ifconfig/ifconfig.c       Tue Dec  7 20:23:47 2010        
(r216267)
@@ -295,8 +295,6 @@ main(int argc, char *argv[])
                        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));
@@ -307,6 +305,8 @@ main(int argc, char *argv[])
                }
                cp = ifa->ifa_name;
 
+               if ((ifa->ifa_flags & IFF_CANTCONFIG) != 0)
+                       continue;
                if (downonly && (ifa->ifa_flags & IFF_UP) != 0)
                        continue;
                if (uponly && (ifa->ifa_flags & IFF_UP) == 0)

Modified: head/sys/dev/usb/usb_pf.c
==============================================================================
--- head/sys/dev/usb/usb_pf.c   Tue Dec  7 19:18:00 2010        (r216266)
+++ head/sys/dev/usb/usb_pf.c   Tue Dec  7 20:23:47 2010        (r216267)
@@ -64,6 +64,7 @@ usbpf_attach(struct usb_bus *ubus)
 
        ifp = ubus->ifp = if_alloc(IFT_USB);
        if_initname(ifp, "usbus", device_get_unit(ubus->bdev));
+       ifp->if_flags = IFF_CANTCONFIG;
        if_attach(ifp);
        if_up(ifp);
 

Modified: head/sys/net/if.h
==============================================================================
--- head/sys/net/if.h   Tue Dec  7 19:18:00 2010        (r216266)
+++ head/sys/net/if.h   Tue Dec  7 20:23:47 2010        (r216267)
@@ -145,7 +145,7 @@ struct if_data {
 #define        IFF_LINK2       0x4000          /* per link layer defined bit */
 #define        IFF_ALTPHYS     IFF_LINK2       /* use alternate physical 
connection */
 #define        IFF_MULTICAST   0x8000          /* (i) supports multicast */
-/*                     0x10000         */
+#define        IFF_CANTCONFIG  0x10000         /* (i) unconfigurable using 
ioctl(2) */
 #define        IFF_PPROMISC    0x20000         /* (n) user-requested promisc 
mode */
 #define        IFF_MONITOR     0x40000         /* (n) user-requested monitor 
mode */
 #define        IFF_STATICARP   0x80000         /* (n) static ARP */
_______________________________________________
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"

Reply via email to