nanovms / nanos

A kernel designed to run one and only one application in a virtualized environment
https://nanos.org
Apache License 2.0
2.66k stars 137 forks source link

tun_close(): properly update `next_tx` file descriptor reference #2063

Closed francescolavra closed 2 months ago

francescolavra commented 2 months ago

When a tun file descriptor is closed, and there are no other file descriptors associated to the tun device, the next_tx field of the tun struct should be cleared; in addition, the network interface output function should check if the next_tx field points to a valid file descriptor. This change fixes an unhandled fault that occurs when closing a file descriptor on a tun device that has open TCP connections. Closes #2061.