aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHimbeerserverDE <himbeerserverde@gmail.com>2023-03-24 15:38:02 +0100
committerHimbeerserverDE <himbeerserverde@gmail.com>2023-03-24 15:38:02 +0100
commitd08baaff6f1c332033d04a3d884169d5a349f3f8 (patch)
tree762aaa1572c13e619e50e0641d5832c375db98a9
parent5d88461d4305cdbd356c65e2cb1154fcbdb25942 (diff)
set buffer sizes to exactly what is needed
-rw-r--r--src/client.rs6
-rw-r--r--src/main.rs2
2 files changed, 4 insertions, 4 deletions
diff --git a/src/client.rs b/src/client.rs
index 58f70fb..5010fd7 100644
--- a/src/client.rs
+++ b/src/client.rs
@@ -25,7 +25,7 @@ use pppoe::Tag;
use rsdsl_ip_config::IpConfig;
const BROADCAST: [u8; 6] = [0xff, 0xff, 0xff, 0xff, 0xff, 0xff];
-const BUFSIZE: usize = 1522;
+const BUFSIZE: usize = 1500;
#[derive(Clone, Copy, Debug, PartialEq)]
enum State {
@@ -349,7 +349,7 @@ impl Client {
let mut opts = lcp::ConfigOptions::default();
- opts.add_option(lcp::ConfigOption::Mru(1452));
+ opts.add_option(lcp::ConfigOption::Mru(1492));
opts.add_option(lcp::ConfigOption::MagicNumber(self.magic_number()));
let limit = opts.len();
@@ -456,7 +456,7 @@ impl Client {
lcp::ConfigOptionIterator::new(lcp.payload()).collect();
if opts.len() != 2
- || opts[0] != lcp::ConfigOption::Mru(1452)
+ || opts[0] != lcp::ConfigOption::Mru(1492)
|| opts[1] != lcp::ConfigOption::MagicNumber(self.magic_number())
{
return Err(Error::AckedWrongOptions);
diff --git a/src/main.rs b/src/main.rs
index d357050..b13cf5f 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -25,7 +25,7 @@ where
fn tun2ppp(clt: Client, tun: Arc<Iface>) -> Result<()> {
loop {
- let mut buf = [0; 1504];
+ let mut buf = [0; 4 + 1492];
let n = tun.recv(&mut buf)?;
let buf = &buf[..n];