diff -ur linux-2.6.11.8-pure/drivers/net/tun.c linux-2.6.11.8/drivers/net/tun.c
--- linux-2.6.11.8-pure/drivers/net/tun.c	2005-04-29 21:27:08.000000000 -0400
+++ linux-2.6.11.8/drivers/net/tun.c	2005-08-14 15:57:58.000000000 -0400
@@ -18,6 +18,9 @@
 /*
  *  Changes:
  *
+ *  Mike Kershaw <dragorn@kismetwireless.net> 2005/08/14
+ *    Add TUNSETLINK ioctl to set the link encapsulation
+ *
  *  Mark Smith <markzzzsmith@yahoo.com.au>
  *   Use random_ether_addr() for tap MAC address.
  *
@@ -608,6 +611,11 @@
 		DBG(KERN_INFO "%s: owner set to %d\n", tun->dev->name, tun->owner);
 		break;
 
+	case TUNSETLINK:
+		tun->dev->type = (int) arg;
+		DBG(KERN_INFO "%s: linktype set to %d\n", tun->dev->name, tun->dev->type);
+		break;
+
 #ifdef TUN_DEBUG
 	case TUNSETDEBUG:
 		tun->debug = arg;
diff -ur linux-2.6.11.8-pure/include/linux/if_tun.h linux-2.6.11.8/include/linux/if_tun.h
--- linux-2.6.11.8-pure/include/linux/if_tun.h	2005-04-29 21:25:42.000000000 -0400
+++ linux-2.6.11.8/include/linux/if_tun.h	2005-08-14 15:56:18.000000000 -0400
@@ -77,6 +77,7 @@
 #define TUNSETIFF     _IOW('T', 202, int) 
 #define TUNSETPERSIST _IOW('T', 203, int) 
 #define TUNSETOWNER   _IOW('T', 204, int)
+#define TUNSETLINK    _IOW('T', 205, int)
 
 /* TUNSETIFF ifr flags */
 #define IFF_TUN		0x0001
