> ioctl(d_tap, TUNSETIFF, &ifr): Operation not permitted
I'm not familiar with this particular error - what command are you entering when you receive this?
In general (may or may not apply here, don't know) this error message just means you need to run it with root privs (i.e., precede the command with 'sudo').