Error write to TUN device errno=22

Hello All!

i developing a toy application to get experience with the building of VPN ...
So , at the time my prog got a problem during call write () , follows a part of diagnostic message:

I/O error on TUN device, write(90 octets), **errno=22**

What I'm need to check additionally ?

22: tun30002: <POINTOPOINT,MULTICAST,NOARP,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UNKNOWN qlen 500
    inet scope global tun30002
       valid_lft forever preferred_lft forever
    inet6 fe80::35ba:275c:977d:d3bf/64 scope link 
       valid_lft forever preferred_lft forever

PS: a piece of code successfully checked on x86 and ARM.

Without knowing what you're trying to write and the status of the device when you get an EINVAL, it's hard to diagnose further.

1 Like

I resolved the problem. I have tried to write IP packet instead of ethernet frame + IP packet.
So the question is closed.

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.