i already knew about fpioctl, but the ioctl example uses some macros to get the correct code, but i dont understand how
theres a python equivalent code that works, but i cant decypher this : (Python code) TUNSETIFF = 0x400454ca IFF_TUN = 0x0001 IFF_TAP = 0x0002 TUNMODE = IFF_TUN f = os.open("/dev/net/tun", os.O_RDWR) ifs = ioctl(f, TUNSETIFF, struct.pack("16sH", "toto%d", TUNMODE)) ifname = ifs[:16].strip("\x00") becomes (Pascal Code); TUNSETIFF := $400454ca; IFF_TUN := $0001; // TUN is a pseudo-ip device IFF_TAP := $0002; // TAP is a pseudo-ethernet device F := TFileStream.Create('/dev/net/tun', fmOpenReadWrite); IFS := fpioctl(F.Handle, TUNSETIFF, ???); IFNAME := ???? This makes the handle behave as a virtual network interface (allowing packet injection/reception from userland) and returns the correct interface name so as to allow passing it to scripts, ifconfig etc...
_______________________________________________ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal