diff options
author | HimbeerserverDE <himbeerserverde@gmail.com> | 2023-03-13 19:10:35 +0100 |
---|---|---|
committer | HimbeerserverDE <himbeerserverde@gmail.com> | 2023-03-13 19:10:35 +0100 |
commit | 6dfbd88368e5ce809c36d55ec3fd00ec71c280a0 (patch) | |
tree | 7b57c42c847abe200b42ac68e19bc4e70a93c620 /src | |
parent | cd1d83ad9c0a95149b9f7319159a9460bb7e90f7 (diff) |
negotiate ip configuration
Diffstat (limited to 'src')
-rw-r--r-- | src/client.rs | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/src/client.rs b/src/client.rs index 2b389ff..b8b9a16 100644 --- a/src/client.rs +++ b/src/client.rs @@ -530,6 +530,48 @@ impl Client { "ackknowledged IPCP configuration request, options: {:?}", opts ); + + Ok(()) + } + ipcp::CONFIGURE_ACK => { + let opts: Vec<ipcp::ConfigOption> = + ipcp::ConfigOptionIterator::new(ipcp.payload()).collect(); + + println!("ip configuration acknowledged by peer, options: {:?}", opts); + Ok(()) + } + ipcp::CONFIGURE_NAK => { + let opts: Vec<ipcp::ConfigOption> = + ipcp::ConfigOptionIterator::new(ipcp.payload()).collect(); + + println!("obtained configuration via IPCP NAK: {:?}", opts); + + let limit = ipcp.payload().len(); + + let mut request = Vec::new(); + request.resize(14 + 6 + 2 + 4 + limit, 0); + + let request = request.as_mut_slice(); + request[26..26 + limit].copy_from_slice(ipcp.payload()); + + ipcp::HeaderBuilder::create_configure_request(&mut request[22..26 + limit])?; + + self.new_ipcp_packet(request)?; + self.send(request)?; + + println!("verifying configuration via IPCP request"); + Ok(()) + } + ipcp::CONFIGURE_REJECT => { + let opts: Vec<ipcp::ConfigOption> = + ipcp::ConfigOptionIterator::new(ipcp.payload()).collect(); + + println!( + "the following IPCP configuration options were rejected: {:?}", + opts + ); + + self.terminate(Err(Error::ConfigReject)); Ok(()) } _ => Err(Error::InvalidIpcpCode(ipcp_code)), |