diff options
Diffstat (limited to 'src/client.rs')
-rw-r--r-- | src/client.rs | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/client.rs b/src/client.rs index f43ac30..f557c78 100644 --- a/src/client.rs +++ b/src/client.rs @@ -157,6 +157,15 @@ impl Client { Ok(()) } + fn configure(&self) -> Result<()> { + match self.state() { + State::Session(_) => {} + _ => return Err(Error::AlreadyActive), + } + + Ok(()) + } + fn handle_ppp(&self, src_mac: [u8; 6], header: &Header) -> Result<()> { let ppp = pppoe::ppp::Header::with_buffer(header.payload())?; let protocol = ppp.protocol(); @@ -278,6 +287,8 @@ impl Client { self.set_state(State::Session(session_id)); println!("session established, ID {}", session_id); + self.configure()?; + Ok(()) } else { Err(Error::UnexpectedPads(remote_mac_str.clone())) |