Very small patch to allow setting of the link type of the virtual tapX interfaces in tun/tap. Needed for writing packets of other arp link types to tap, ie 80211 wireless frames.
Implemented as a simple IOCTL to set the arptype. -m -- Mike Kershaw/Dragorn <[EMAIL PROTECTED]> GPG Fingerprint: 3546 89DF 3C9D ED80 3381 A661 D7B2 8822 738B BDB1 As part of Mr. Lee's good neighbor policy, all Rat Things are programmed never to break the sound barrier in a populated area. But Fido's in too much of a hurry to worry about the good neighbor policy. Jack the sound barrier. Bring the noise. - Snowcrash
[TUNTAP]: Allow setting the linktype of the tap device from userspace Currently tun/tap only supports the EN10MB ARP type. For use with wireless and other networking types it should be possible to set the ARP type via an ioctl. Signed-off-by: Mike Kershaw <[EMAIL PROTECTED]> --- diff --git a/drivers/net/tun.c b/drivers/net/tun.c --- a/drivers/net/tun.c +++ b/drivers/net/tun.c @@ -18,6 +18,9 @@ /* * Changes: * + * Mike Kershaw <[EMAIL PROTECTED]> 2005/08/14 + * Add TUNSETLINK ioctl to set the link encapsulation + * * Mark Smith <[EMAIL PROTECTED]> * Use random_ether_addr() for tap MAC address. * @@ -612,6 +615,11 @@ static int tun_chr_ioctl(struct inode *i 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 --git a/include/linux/if_tun.h b/include/linux/if_tun.h --- a/include/linux/if_tun.h +++ b/include/linux/if_tun.h @@ -77,6 +77,7 @@ struct tun_struct { #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
pgpx2l0jTWf3U.pgp
Description: PGP signature