Tunnel.py and PS3

Hello all,

tunnel.py (examples/python/digital) hardcodes a value

 TUNSETIFF = 0x400454ca

This does not seem to be compatible with the PS3.

running tunnel.py returns

ifs = ioctl(tun, TUNSETIFF, struct.pack("16sH", "gr%d", mode))

IOError: [Errno 22] Invalid argument

Changing the hardcoded value to

 TUNSETIFF = 0x800454ca   (changed 4004 to 8004)

allows tunnel.py to function properly on PS3.

Question: Anyone have a good way to set these values other than hard
coding
them?

i.e. how can we get the values directly out of linux/if_tun.h?

Tim

On Mon, Feb 04, 2008 at 02:41:16PM -0500, Tim M. wrote:

ifs = ioctl(tun, TUNSETIFF, struct.pack("16sH", "gr%d", mode))

i.e. how can we get the values directly out of linux/if_tun.h?

Tim

We should probably swig the constants in linux/if_tun.h

The relevant line in if_tun.h is

#define TUNSETIFF _IOW(‘T’, 202, int)

I was not sure how to swig the _IOW stuff. If anyone can provide a hint
I
will try.

On Mon, Feb 04, 2008 at 03:36:26PM -0500, Tim M. wrote:

The relevant line in if_tun.h is

#define TUNSETIFF _IOW(‘T’, 202, int)

I was not sure how to swig the _IOW stuff. If anyone can provide a hint I
will try.

It may be easiest to write a small stand-alone function that just
returns the value of TUNSETIFF and then swig that. E.g.,

int
get_TUNSETIFF()
{
#ifdef TUNSETIFF
return TUNSETIFF;
#else
return -1;
#endif
}

Feel free to drop it into gnuradio-core/src/lib/general and send a
patch.

Thanks,
Eric