pub struct TapLink {
pub tap_fd: OwnedFd,
pub ifname: String,
pub gateway_v4: Ipv4Addr,
pub guest_v4: Ipv4Addr,
pub prefix_v4: u8,
pub gateway_v6: Ipv6Addr,
pub guest_v6: Ipv6Addr,
pub prefix_v6: u8,
pub mtu: u16,
pub mac: [u8; 6],
pub subnet_v4: String,
pub subnet_v6: String,
}Expand description
TAP-based network backend for Linux.
Holds the TAP file descriptor and the resolved network parameters. On drop, cleans up nftables set elements and removes the TAP device.
Fields§
§tap_fd: OwnedFdTAP device file descriptor.
ifname: StringTAP interface name (e.g. msbtap42).
gateway_v4: Ipv4AddrGateway IPv4 address (assigned to the TAP interface).
guest_v4: Ipv4AddrGuest IPv4 address.
prefix_v4: u8IPv4 prefix length.
gateway_v6: Ipv6AddrGateway IPv6 address (assigned to the TAP interface).
guest_v6: Ipv6AddrGuest IPv6 address.
prefix_v6: u8IPv6 prefix length.
mtu: u16MTU.
mac: [u8; 6]Guest MAC address.
subnet_v4: StringSandbox IPv4 subnet registered in nftables.
subnet_v6: StringSandbox IPv6 subnet registered in nftables.
Implementations§
Source§impl TapLink
impl TapLink
Sourcepub fn create(slot: u32, interface: &InterfaceConfig) -> Result<Self>
pub fn create(slot: u32, interface: &InterfaceConfig) -> Result<Self>
Creates a new TAP device and configures host networking for the given sandbox slot.
Privileged operations (must run as root):
- Create TAP device
- Assign gateway IPv4/IPv6 addresses to the TAP interface
- Set MTU
- Bring interface up
- Enable IP forwarding (sysctl)
- Ensure shared nftables table/chains/sets exist
- Register this sandbox in the nftables sets
Sourcepub fn ready_info(&self) -> MsbnetReady
pub fn ready_info(&self) -> MsbnetReady
Builds the MsbnetReady payload from the resolved parameters.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for TapLink
impl RefUnwindSafe for TapLink
impl Send for TapLink
impl Sync for TapLink
impl Unpin for TapLink
impl UnsafeUnpin for TapLink
impl UnwindSafe for TapLink
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more