diff options
author | Himbeer <himbeer@disroot.org> | 2025-04-05 21:08:20 +0200 |
---|---|---|
committer | Himbeer <himbeer@disroot.org> | 2025-04-05 22:16:05 +0200 |
commit | 0815b09aafc392806c634205e0fe655f36b467e1 (patch) | |
tree | 5cdb96736007e39f3dd032aa113df3f5002bcb98 /src/supervisor.rs | |
parent | be07f0089801adf20bec7b98b0dedc00085d095c (diff) |
This fixes a bug where the client crashes/hangs instead of handling the
condition gracefully and reporting it to the peer.
Diffstat (limited to 'src/supervisor.rs')
-rw-r--r-- | src/supervisor.rs | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/src/supervisor.rs b/src/supervisor.rs index 140e981..ec18774 100644 --- a/src/supervisor.rs +++ b/src/supervisor.rs @@ -603,9 +603,11 @@ impl Client { let mut link_buf = &link_buf[..n]; let mut pkt = PppPkt::default(); - pkt.deserialize(&mut link_buf)?; - - self.handle_ppp(pkt)?; + match pkt.deserialize(&mut link_buf){ + Ok(_) => self.handle_ppp(pkt)?, + Err(ppproperly::Error::InvalidPppProtocol(id)) => self.lcp.reject(id), + Err(e) => return Err(e.into()), + } } else { // Session closed. session_fds = None; } @@ -616,9 +618,11 @@ impl Client { let mut net_buf = &net_buf[..n]; let mut pkt = PppPkt::default(); - pkt.deserialize(&mut net_buf)?; - - self.handle_ppp(pkt)?; + match pkt.deserialize(&mut net_buf) { + Ok(_) => self.handle_ppp(pkt)?, + Err(ppproperly::Error::InvalidPppProtocol(id)) => self.lcp.reject(id), + Err(e) => return Err(e.into()), + } } else { // Session closed. session_fds = None; } |