Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Possibility to change MTU (max_frag_len) fragmentation size. #82

Closed
1 of 2 tasks
ratelwork opened this issue May 1, 2023 · 8 comments
Closed
1 of 2 tasks

Possibility to change MTU (max_frag_len) fragmentation size. #82

ratelwork opened this issue May 1, 2023 · 8 comments

Comments

@ratelwork
Copy link

ratelwork commented May 1, 2023

I am submitting a …

  • bug report
  • feature request

Description

It will be very nice to have possibility to change maximum DTLS fragment size. In the ssl_server2 dtls=1 this parameter can be changed via max_frag_len=512, but it supports only the constant values 512, 1024, 2048, 4096. In my usecase I need max_frag_len=380. Is there are some possibility to change it now? (at least I did not found something related to that in the source code.

  1. programs/server.py --dtls --max_frag_len 380
  2. programs/client.py --dtls --max_frag_len 380

Minimal demo of the problem

>>> import mbedtls
...
        conf = DTLSConfiguration(
            pre_shared_key_store=args.psk_store, 
            validate_certificates=False,
            max_frag_len=380,
        )
@Synss
Copy link
Owner

Synss commented May 4, 2023

Currently, it isn't possible but wrapping mbedtls_ssl_set_mtu or mbedtls_ssl_conf_max_frag_len, or both should be simple enough.

These are the relevant options, right?

@Synss
Copy link
Owner

Synss commented May 14, 2023

If I'm not mistaken, upstream only allows the values you already noted: 512, 1024, 2048, and 4096. So it can't be set to 380.
See, https://github.com/Mbed-TLS/mbedtls/blob/development/include/mbedtls/ssl.h#L4230C1-L4232

@Synss Synss closed this as completed May 14, 2023
@ratelwork
Copy link
Author

ratelwork commented May 16, 2023

If I got that right ony mbedtls_ssl_conf_max_frag_len allow to use constant values. mbedtls_ssl_set_mtu allows to use any integer value.

@Synss
Copy link
Owner

Synss commented May 20, 2023

Yes, I think you're right. Reopening.

@Synss Synss reopened this May 20, 2023
Synss added a commit that referenced this issue May 20, 2023
Synss added a commit that referenced this issue May 24, 2023
Synss added a commit that referenced this issue May 24, 2023
Synss added a commit that referenced this issue May 24, 2023
Synss added a commit that referenced this issue May 24, 2023
Synss added a commit that referenced this issue May 25, 2023
@Synss Synss closed this as completed in aadd590 May 25, 2023
@Synss
Copy link
Owner

Synss commented May 25, 2023

Both functions are wrapped now in the library and they will be available in the next release. If you need the functionality faster, you should compile the library yourself, have a look under scripts/ for examples. I do not really plan to modify the example programs but that should be simple enough.

@ratelwork
Copy link
Author

Thanks a lot! Approximately, when do you plan to make a new release?

@Synss
Copy link
Owner

Synss commented May 26, 2023

It should come in the next few days.

Synss added a commit that referenced this issue May 27, 2023
@Synss
Copy link
Owner

Synss commented May 27, 2023

2.7.0 is out on https://pypi.org/project/python-mbedtls/

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

No branches or pull requests

2 participants