Skip to main content

dev_change_net_namespace

Function dev_change_net_namespace 

Source
pub fn dev_change_net_namespace(
    name: &str,
    netns_fd: RawFd,
    device: &LinuxNetDevice,
) -> Result<Vec<CidrAddress>, NetworkError>
Expand description

dev_change_netns allows to move a device given by name to a network namespace given by netns_fd and optionally change the device name. The device name will be kept the same if device.Name is None or an empty string. This function ensures that the move and rename operations occur atomically. It preserves existing interface attributes, including IP addresses.