diff options
author | HimbeerserverDE <himbeerserverde@gmail.com> | 2023-07-29 14:50:46 +0200 |
---|---|---|
committer | HimbeerserverDE <himbeerserverde@gmail.com> | 2023-07-29 14:50:46 +0200 |
commit | 45781b03bba45f6a2f2d495366e3eec88dfaee89 (patch) | |
tree | 9fc616b02f6108d87685555391b94ce63befc360 | |
parent | 6178e15abe1d13899baaefa7c5252792dc2b01b8 (diff) |
call new termination code from previous padt sites
-rw-r--r-- | src/main.rs | 54 |
1 files changed, 12 insertions, 42 deletions
diff --git a/src/main.rs b/src/main.rs index acc788e..4d42e4e 100644 --- a/src/main.rs +++ b/src/main.rs @@ -269,20 +269,10 @@ fn session( match *ppp_state { Ppp::Synchronize(identifier, mru, magic_number, attempt) => { if attempt >= MAX_ATTEMPTS { - PppoePkt::new_padt( - remote_mac, - local_mac, - session_id, - vec![PppoeVal::GenericError("Peer not responding".into()).into()], - ) - .serialize(&mut sock_disc_w)?; - sock_disc_w.flush()?; - - println!(" -> [{}] padt, session id: {}", remote_mac, session_id); - - *ppp_state = Ppp::Terminated; - *pppoe_state.lock().expect("pppoe state mutex is poisoned") = Pppoe::Init; - break; + *ppp_state = Ppp::Terminate2( + "Maximum number of Configure-Request attempts exceeded".into(), + ); + continue; } PppPkt::new_lcp(LcpPkt::new_configure_request( @@ -304,20 +294,10 @@ fn session( } Ppp::SyncAck(identifier, mru, magic_number, attempt) => { if attempt >= MAX_ATTEMPTS { - PppoePkt::new_padt( - remote_mac, - local_mac, - session_id, - vec![PppoeVal::GenericError("Peer not responding".into()).into()], - ) - .serialize(&mut sock_disc_w)?; - sock_disc_w.flush()?; - - println!(" -> [{}] padt, session id: {}", remote_mac, session_id); - - *ppp_state = Ppp::Terminated; - *pppoe_state.lock().expect("pppoe state mutex is poisoned") = Pppoe::Init; - break; + *ppp_state = Ppp::Terminate2( + "Maximum number of Configure-Request attempts exceeded".into(), + ); + continue; } PppPkt::new_lcp(LcpPkt::new_configure_request( @@ -340,20 +320,10 @@ fn session( Ppp::SyncAcked(attempt) => { // Packet handler takes care of the rest. if attempt >= MAX_ATTEMPTS { - PppoePkt::new_padt( - remote_mac, - local_mac, - session_id, - vec![PppoeVal::GenericError("Peer not initiating".into()).into()], - ) - .serialize(&mut sock_disc_w)?; - sock_disc_w.flush()?; - - println!(" -> [{}] padt, session id: {}", remote_mac, session_id); - - *ppp_state = Ppp::Terminated; - *pppoe_state.lock().expect("pppoe state mutex is poisoned") = Pppoe::Init; - break; + *ppp_state = Ppp::Terminate2( + "Maximum number of Configure-Ack attempts exceeded".into(), + ); + continue; } *ppp_state = Ppp::SyncAcked(attempt + 1); |