pub struct PppUnit { /* private fields */ }Expand description
A PPP network interface (pppN) created through /dev/ppp.
The interface exists while this value is alive. Connect a PPP channel to
it with connect_channel; PPP control frames are
then read from and written to the unit descriptor, while configured
network protocols flow through the interface.
Implementations§
Source§impl PppUnit
impl PppUnit
Sourcepub fn with_index(index: i32) -> Result<Self>
pub fn with_index(index: i32) -> Result<Self>
Creates the PPP unit with the given index, failing with EEXIST when
it is taken.
Sourcepub fn ifname(&self) -> &L2tpIfName
pub fn ifname(&self) -> &L2tpIfName
Returns the interface name, pppN.
Sourcepub fn connect_channel(&self, socket: &PppSocket) -> Result<PppChannel>
pub fn connect_channel(&self, socket: &PppSocket) -> Result<PppChannel>
Connects a PPP channel to this unit (PPPIOCATTCHAN followed by
PPPIOCCONNECT).
The returned PppChannel must stay alive for as long as the channel
should remain connected to the unit.
The unit and socket must belong to the same network namespace;
otherwise this returns
Error::NamespaceMismatch.
Attachment runs in that namespace. Calling this from another
namespace requires CAP_SYS_ADMIN to enter the owning namespace on
a temporary thread; the calling thread is never moved.