Add error log if set route or addr on TUN fails

Signed-off-by: Lee Smet <lee.smet@hotmail.com>
This commit is contained in:
Lee Smet
2023-11-03 11:40:07 +01:00
parent 0d65c433f8
commit 0cecc5d528
+8 -2
View File
@@ -37,8 +37,14 @@ pub async fn new(
let tun_index = link_index_by_name(handle.clone(), name.to_string()).await?;
add_address(handle.clone(), tun_index, node_subnet).await?;
add_route(handle.clone(), tun_index, route_subnet).await?;
if let Err(e) = add_address(handle.clone(), tun_index, node_subnet).await {
error!("Failed to add address {node_subnet} to TUN interface: {e}");
return Err(e);
}
if let Err(e) = add_route(handle.clone(), tun_index, route_subnet).await {
error!("Failed to add route for {route_subnet} to TUN interface: {e}");
return Err(e);
}
// We are done with our netlink connection, abort the task so we can properly clean up.
netlink_task_handle.abort();