Skip to content

LLT-7068: Adapter MTU API - #1978

Open
stalowyjez wants to merge 13 commits into
mainfrom
LLT-7068_adapter_mtu_api
Open

LLT-7068: Adapter MTU API#1978
stalowyjez wants to merge 13 commits into
mainfrom
LLT-7068_adapter_mtu_api

Conversation

@stalowyjez

@stalowyjez stalowyjez commented Sep 7, 2026

Copy link
Copy Markdown
Contributor

Problem

Currently there is no way to set MTU for any adapter while it can be added and it would be useful for some telio users

Solution

Two ways of configuring MTU are added: adding in during adapter startup and set_mtu usable on running device. Because there are already many adapter starting functions I think instead of adding to each of them another version with mtu argument I think it makes more sense to add a config with optional fields and MTU among them. The solution works currently only with WindowsNT adapter, returns an error when used with other one.

☑️ Definition of Done checklist

  • Commit history is clean (requirements)
  • README.md is updated
  • Functionality is covered by unit or integration tests

Comment thread crates/telio-traversal/src/endpoint_providers/upnp.rs Outdated
Comment thread nat-lab/tests/test_adapter.py Outdated
Comment thread nat-lab/tests/test_adapter.py
Comment thread nat-lab/tests/test_adapter.py
Comment thread src/ffi.rs Outdated
Comment thread nat-lab/tests/test_adapter.py Outdated
Comment thread nat-lab/tests/test_adapter.py Outdated
Comment thread nat-lab/tests/test_adapter.py
Comment thread src/libtelio.udl
Comment thread nat-lab/tests/test_adapter.py

@tomaszklak tomaszklak left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please cleanup the commit history (move review fixes to appropriate commits, so that they already appear in the final correct form).

Comment thread src/ffi.rs
Comment on lines +175 to +182
#[cfg(not(target_os = "windows"))]
let tun = self.tun.map(|fd| {
use std::os::fd::{FromRawFd, OwnedFd};
// SAFETY: the caller hands over an open descriptor it no longer uses
unsafe { OwnedFd::from_raw_fd(fd) }
});
#[cfg(target_os = "windows")]
let tun = None;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it would be best to move this right before the return. Otherwise the failed mtu check will close the fd passed by the caller.

family,
err
);
if failed {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we undo the effects of set_forced_mtu(Some(...)) here?

// * start - telio does everything
// * start_with_tun - use existing tun (android, apple)
// * start_with_name - create tun with name (windows, linux)
// * start_with_config - like start, with optional settings (name, ext_if_filter, mtu)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here (and in other places) not all settings are listed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants