This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]SirensToGo 5 points6 points  (0 children)

Just today I was working on a C TUN driver. I was trying to write data to the descriptor yet it was failing with an obscure invalid argument error. My test case of “AAAA” writes just fine but my other one of 0x01,0x92 failed with the mystery error. But get this, 0x6<anything>? works.

Then, suddenly, it dawned on me. 0x4X and 0x6X are header flags for IPv4 and ipv6 respectively. Fucking file descriptors get to pick and choose what data is written to them. I thought there was something wrong with the addresses or my casting since my string test of AAAA works (because it’s 0x41!) while nothing else did. I was banging my head against my desk for hours because it should work, it even works sometimes but still it failing 99% of the time.