libtorrent icon indicating copy to clipboard operation
libtorrent copied to clipboard

TOS isn't being applied

Open tiagogaspar8 opened this issue 3 years ago • 17 comments

libtorrent version (or branch): 2.0.5 (in qbittorrent)

platform/architecture: Windows 11

compiler and compiler version: N/A

please describe what symptoms you see, what you would expect to see instead and how to reproduce it.

The TOS doesn't seem to be applying correctly, it is configured to 4 by default but in wireshark the DSCP isn't changed and stays at CS0 (0). I'd also like to suggest the change from the name TOS to DSCP since TOS is deprecated.

Thanks!

tiagogaspar8 avatar Apr 16 '22 12:04 tiagogaspar8

did you look at all traffic or just some connections? I believe DSCP is only meant to apply to peer connections, not DHT or tracker connections for instance.

arvidn avatar Apr 17 '22 11:04 arvidn

are you looking at both TCP and UDP peer connections? The DSCP is set via slightly different code paths for those.

arvidn avatar Apr 18 '22 09:04 arvidn

do you see the SET_TOS messages in the log?

arvidn avatar Apr 18 '22 09:04 arvidn

https://github.com/arvidn/libtorrent/pull/6822

arvidn avatar Apr 18 '22 09:04 arvidn

Hi,

My setup only has μtp enabled, and that doesn't have any dscp, I can't say about TCP, but I believe I can try if you'd like!

tiagogaspar8 avatar Apr 18 '22 11:04 tiagogaspar8

@arvidn This rename has broken compatibility and generating errors in Deluge with latest lt 1.2 code, was this applied to the wrong branch (for 2.0 not 1.2) and missing setting deprecated in settings_pack.cpp?

self.session.apply_settings(settings)
builtins.KeyError: 'unknown name in settings_pack: peer_tos'

cas-- avatar May 17 '22 20:05 cas--

good point. I need to fix the binding to support the old name as well.

arvidn avatar May 17 '22 21:05 arvidn

https://github.com/arvidn/libtorrent/pull/6874

arvidn avatar May 21 '22 23:05 arvidn

Hi @arvidn , I'd just like to let you know that TCP also suffers from the same issue, dscp isn't marked

tiagogaspar8 avatar Jun 21 '22 12:06 tiagogaspar8

is it possible the process need a special privilege to set it? Do you have any error messages in the log for setting DSCP?

arvidn avatar Jun 21 '22 12:06 arvidn

I have tried to run it as an admin but it didn't help

tiagogaspar8 avatar Jul 01 '22 16:07 tiagogaspar8

@tiagogaspar8 can you get the log? Do you see entries saying SET_TOS or SET_DSCP? If so, they will contain error codes.

arvidn avatar Jul 01 '22 17:07 arvidn

I'm using qbittorrent and I have no idea how to enable extra debug logging 😞 Do you have any idea?

tiagogaspar8 avatar Jul 01 '22 18:07 tiagogaspar8

In the implementation of libtorrent, dscp/tos is always set after the application handshake instead of the TCP handshake. This behavior breaks possibility of traffic split via tos by proxy, because the traffic split in proxy application always happens at the moment TCP syn=1.

We have to solve the problem with some inelegant methods, see https://github.com/daeuniverse/dae/discussions/295.

The tos setting is wonderful, but the current timing of the option setting is preventing it from being used, hope you can fix it, thanks!

mzz2017 avatar Aug 20 '23 12:08 mzz2017