chiark / gitweb /
New option to allow changing interface flags.
[unet] / unet.c
diff --git a/unet.c b/unet.c
index 7fdc317818f2b511c6f3c0afd31882032d1f9968..3761138f9110c4a2c7f540ab13f53d354a3492f0 100644 (file)
--- a/unet.c
+++ b/unet.c
@@ -1,6 +1,6 @@
 /* -*-c-*-
  *
- * $Id: unet.c,v 1.2 2001/02/03 18:39:59 mdw Exp $
+ * $Id: unet.c,v 1.3 2001/02/19 19:10:28 mdw Exp $
  *
  * User-space network device support.
  *
@@ -29,6 +29,9 @@
 /*----- Revision history --------------------------------------------------*
  *
  * $Log: unet.c,v $
+ * Revision 1.3  2001/02/19 19:10:28  mdw
+ * New option to allow changing interface flags.
+ *
  * Revision 1.2  2001/02/03 18:39:59  mdw
  * Setting the maximum interface count now does the right thing.
  *
@@ -377,7 +380,7 @@ static int unet_ifinit(struct device *nif)
   u->nif.rebuild_header = 0;
   u->nif.set_mac_address = 0;
 
-  u->nif.type = ARPHRD_LOOPBACK;       /* Got a better idea? */
+  u->nif.type = ARPHRD_TUNNEL;         /* Got a better idea? */
   u->nif.hard_header_len = 0;
   u->nif.mtu = 1500 - MAX_HEADER;
   u->nif.addr_len = 0;
@@ -963,6 +966,19 @@ static int unet_devioctl(struct inode *ino,
                unet_maxif); )
       break;
 
+    /* --- @UNIOCFIFFLAGS@ and @UNIOCSIFFLAGS@ --- */
+
+    case UNIOCGIFFLAGS:
+      D( printk(KERN_DEBUG "unet: UNIOCGIFFFLAGS\n"); )
+      e = u->nif.flags;
+      break;
+    case UNIOCSIFFLAGS:
+      D( printk(KERN_DEBUG "unet: UNIOCSIFFFLAGS: arg = %ld\n", arg); )
+      if ((u->nif.flags ^ arg) & ~IFF_VOLATILE)
+       return (-EINVAL);
+      u->nif.flags = arg;
+      break;
+
     /* --- Everything else --- *
      *
      * You lose.