TUN/TAP Development Update 2 | Haiku Project

More updates on the TUN Driver development!

Thankfully I’ve been able to get a lot more done on the driver this week with finishing the write/sending functionality of the driver and I am currently on the reading/receiving functionality which is getting close to being done. At first I tried to implement a solution in the networking interface (tun.cpp) that didn’t use iovecs but that just caught up to me in the end and it was just significantly easier to copy and paste the code from ethernet.cpp’s send/receive functions as that is something that works a lot better than what I was implementing. Me and my mentors also decided on using the already made BufferQueue data structure for holding the data in the driver itself since it would just be plain easier to make the data parameter, when using read from a interface, a straight up net_buffer packet that it can immediately be read back and just use the net_buffer_module_info structs read function member to get the byte stream information that any application needs. The main roadblock I have with the read functionality is using semaphores correctly to stop the networking stack from continuously reading data that isn’t there. As of writing this update, I am able to make read blocking but I am testing different ways I can release the semaphore for it to read data properly. Big shoutout to PulkoMandy and Korli for helping me with this issue!


This is a companion discussion topic for the original entry at https://www.haiku-os.org/blog/pairisto/2023-06-29_tuntap_development_update_2
24 Likes

Congrats on the progress! :100:

1 Like

Nice progress!

1 Like

Thats amazing! You are a mighty pirate!

1 Like

It was goot to hear about your progress and you could leap forward using codes elsewhere used already in Haiku. This way others who review your code later may find easier to understand as it may be more familiar for them – seeing as work as just in network stuff implementation.

Have fun with contribution ! 8D