title: ioctl (TUNSETIFF) : device or resource busy
body: <p>I am unable to set TUN interface. Everywhere i searched and it says the device should be rooted.
  I am setting up proxyserver on my ubuntu 14.04 system </p>
  
  <pre><code>static int get_interface(char *name) {
  int interface = open("/dev/net/tun", O_RDWR | O_NONBLOCK);
  struct ifreq ifr;
  memset(&amp;ifr, 0, sizeof(ifr));
  ifr.ifr_flags = IFF_TUN | IFF_NO_PI;   
  strncpy(ifr.ifr_name, name, sizeof(ifr.ifr_name));
  
  if (ioctl(interface, TUNSETIFF, (void *)&amp;ifr) &lt; 0) {
      perror("Cannot get TUN interface");
      exit(1);
  }
  
  return interface;
  </code></pre>
  
  <p>}</p>