libtorrent icon indicating copy to clipboard operation
libtorrent copied to clipboard

listen_interfaces and tracker_errors.

Open i96751414 opened this issue 1 year ago • 3 comments

libtorrent version (or branch): 1.2.19

platform/architecture: Linux arm64

Hi @arvidn,

I have one question that is puzzling me a bit. I have been using libtorrent for years and never had to configure listen_interfaces for it to work - the default value has been working so far.

Recently I started doing some tests with libtorrent on a RPi 5 and it simply doesn't work with the default values. I see a lot of 'tracker_errors' with "Host not found (non-authoritative)" although I have 'listen_succeeded' alert. At first glance I thought it would be a DNS problem, but it is not. If I set my local IP address (192.168.1.x) in listen_interfaces it starts working; If i set the device name (wlan0) it doesn't work (in this case I don't even receive a 'listen_succeeded/failed' alert). What could be the reason for this? Might it be related with my local network configuration?

Thanks in advance!

i96751414 avatar Jul 08 '24 16:07 i96751414

After some testing I realised libtorrent is not able to see my interfaces. The bellow code produces the following output:

    libtorrent::io_service ioContext;
    libtorrent::error_code errorCode;
    auto ifaces = libtorrent::enum_net_interfaces(ioContext, errorCode);
    for (auto &iface : ifaces)
        std::cout << iface.name << " : " << iface.interface_address << std::endl;

output:

lo : 127.0.0.1
lo : ::1

wlan0 is not listed here... Not sure if this is intended? I can workaround this by adding code to find interfaces and their IPs at my end, but it would be nice to have libtorrent doing it.

i96751414 avatar Jul 13 '24 13:07 i96751414

could you try building and running the enum_if test program? e.g.

cd tests
b2 link=static stage_enum_if
./enum_if

It prints something like this:

=========== Routes ===========
destination                                  network                                      gateway                            mtu    source-hint       interface
0.0.0.0                                      0.0.0.0                                      192.168.12.1                       0      -                 en0
127.0.0.0                                    255.0.0.0                                    127.0.0.1                          0      127.0.0.1         lo0
========= Interfaces =========
address                           netmask                                      name                gateway             state          flags               description
127.0.0.1                         255.0.0.0                                    lo0                 -                   unknown        UP LOOP RUN MULTICAST
::1                               ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff      lo0                 -                   unknown        UP LOOP RUN MULTICAST
fe80::1%lo0                       ffff:ffff:ffff:ffff::                        lo0                 -                   unknown        UP LOOP RUN MULTICAST
fe80::a078:17ff:fe8a:d838%ap1     ffff:ffff:ffff:ffff::                        ap1                 -                   unknown        UP BROADCAST RUN MULTICAST
fe80::14d1:8a1:79c3:4d62%en0      ffff:ffff:ffff:ffff::                        en0                 -                   unknown        UP BROADCAST RUN MULTICAST
192.168.12.27                     255.255.255.0                                en0                 192.168.12.1        unknown        UP BROADCAST RUN MULTICAST
fe80::488:7fff:fe44:9732%awdl0    ffff:ffff:ffff:ffff::                        awdl0               -                   unknown        UP BROADCAST RUN MULTICAST
fe80::488:7fff:fe44:9732%llw0     ffff:ffff:ffff:ffff::                        llw0                -                   unknown        UP BROADCAST RUN MULTICAST

arvidn avatar Jul 23 '24 17:07 arvidn

This is the result I have on 2.0.10 and 1.2.19:

=========== Routes ===========
destination                                  network                                      gateway                            mtu    source-hint       interface
0.0.0.0                                      0.0.0.0                                      192.168.1.254                      1500   -                 wlan0
192.168.1.0                                  255.255.255.0                                -                                  1500   192.168.1.139     wlan0
127.0.0.0                                    255.0.0.0                                    -                                  65536  127.0.0.1         lo
127.0.0.1                                    255.255.255.255                              -                                  65536  127.0.0.1         lo
127.255.255.255                              255.255.255.255                              -                                  65536  127.0.0.1         lo
192.168.1.139                                255.255.255.255                              -                                  1500   192.168.1.139     wlan0
192.168.1.255                                255.255.255.255                              -                                  1500   192.168.1.139     wlan0
2001:8a0:e4ba:4901::                         ffff:ffff:ffff:ffff::                        -                                  1500   -                 wlan0
2001:8a0:e4ba:4900::                         ffff:ffff:ffff:ff00::                        fe80::a691:b1ff:fef0:dd9c%wlan0    1500   -                 wlan0
fe80::                                       ffff:ffff:ffff:ffff::                        -                                  1500   -                 wlan0
::                                           ::                                           fe80::a691:b1ff:fef0:dd9c%wlan0    1500   -                 wlan0
::1                                          ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff      -                                  65536  -                 lo
2001:8a0:e4ba:4901:53f0:408d:1c7e:5063       ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff      -                                  1500   -                 wlan0
fe80::3b56:58fa:517a:8387                    ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff      -                                  1500   -                 wlan0
ff00::                                       ff00::                                       -                                  1500   -                 wlan0
========= Interfaces =========
address                           netmask                                      name                gateway             state          flags               description
127.0.0.1                         255.0.0.0                                    lo                  -                   unknown        UP LOOP RUN          
::1                               ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff      lo                  -                   unknown        UP LOOP RUN

i96751414 avatar Jul 27 '24 03:07 i96751414

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Apr 26 '25 14:04 stale[bot]