I have successfully created and attached to a tap interface. I can also read from the interface with no problem. But trying to write to it fails reporting "invalid argument". The code follows :
int TapInterface::write(char *buf, int n)
{
int nwrite;
if((nwrite=::write(this->my_tap_fd, buf, n))<0)
{
qDebug("Writing data") ;
perror("Error:");
exit(1);
}
return nwrite;
}
....
....
QByteArray txData("hello");
write(txData.data(), txData.length());
Any help?