mirror of
https://github.com/jmcorgan/fips.git
synced 2026-08-09 08:14:42 +00:00
Session 33: TUN interface lifecycle management
- Add TUN interface detection on startup, delete existing before create - Add proper interface deletion on shutdown via netlink - Add TUN packet reader in separate thread with DEBUG logging - Add graceful shutdown handling for expected "Bad address" error - Add take_tun_device() to Node for reader ownership transfer - Add shutdown_tun_interface() public function for cleanup by name - Add tokio signal feature for Ctrl+C handling
This commit is contained in:
@@ -329,6 +329,14 @@ impl Node {
|
||||
self.tun_device.as_mut()
|
||||
}
|
||||
|
||||
/// Take ownership of the TUN device.
|
||||
///
|
||||
/// This removes the TUN device from the node, transferring ownership
|
||||
/// to the caller. Useful for moving the device into a reader task.
|
||||
pub fn take_tun_device(&mut self) -> Option<TunDevice> {
|
||||
self.tun_device.take()
|
||||
}
|
||||
|
||||
/// Initialize the TUN interface.
|
||||
///
|
||||
/// Creates and configures the TUN device based on the node's configuration.
|
||||
|
||||
Reference in New Issue
Block a user