[Bug] VLC http web server doesn't work with WSL interfaces
Set static IP to WSL distro (run on Windows CMD as Administrator):
wsl -d Debian -u root ip addr add 192.168.50.11/24 broadcast 192.168.50.255 dev eth0 label eth0:1
Set static IP on Windows to talk to WSL (run on Windows CMD as Administrator):
netsh interface ip add address "vEthernet (WSL)" 192.168.50.21 255.255.255.0
So now, 192.168.50.21 (Windows) and 192.168.50.11 (WSL Debian) can talk to each other. You can test this using a python simple http server:
Run on Windows CMD (Python 3.x)
python -m http.server 8003 --bind 192.168.50.21
Serving HTTP on 192.168.50.21 port 8003 (http://192.168.50.21:8003/) ...
Run on WSL:
curl --interface 192.168.50.11 -vv http://192.168.50.21:8003/
* Expire in 0 ms for 6 (transfer 0x55d906d8f0f0)
* Trying 192.168.50.21...
* TCP_NODELAY set
* Name '192.168.50.11' family 2 resolved to '192.168.50.11' family 2
* Local port: 0
* Expire in 200 ms for 4 (transfer 0x55d906d8f0f0)
* Connected to 192.168.50.21 (192.168.50.21) port 8003 (#0)
> GET / HTTP/1.1
> Host: 192.168.50.21:8003
> User-Agent: curl/7.64.0
> Accept: */*
>
* HTTP 1.0, assume close after body
< HTTP/1.0 200 OK
< Server: SimpleHTTP/0.6 Python/3.7.7
< Date: Sat, 10 Sep 2022 02:41:43 GMT
< Content-type: text/html; charset=utf-8
< Content-Length: 338
<
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Directory listing for /</title>
</head>
<body>
<h1>Directory listing for /</h1>
<hr>
<ul>
<li><a href="file.txt">file.txt</a></li>
</ul>
<hr>
</body>
</html>
* Closing connection 0
The connection works perfectly. But when using VLC:
- http-host=192.168.50.21
- http-port=8002
Run on WSL
curl --interface 192.168.50.11 -vv http://192.168.50.21:8002/
* Expire in 0 ms for 6 (transfer 0x55bc5ec1d0f0)
* Trying 192.168.50.21...
* TCP_NODELAY set
* Name '192.168.50.11' family 2 resolved to '192.168.50.11' family 2
* Local port: 0
* Expire in 200 ms for 4 (transfer 0x55bc5ec1d0f0)
It never loads. VLC works fine on "real" network interfaces. So, how come python works fine with WSL interfaces, but VLC does not?
It's not a timeout problem, because requests on local interfaces are extremely fast: See: how to time requests using curl
time_namelookup: 0.000070s
time_connect: 0.024010s
time_appconnect: 0.000000s
time_pretransfer: 0.024279s
time_redirect: 0.000000s
time_starttransfer: 0.045116s
----------
time_total: 0.045249s
So I decided to dig deeper. I've gathered these short WireShark captures:
I started wireshark from Windows to monitor 192.168.50.21. I took two captures of the http.server traffic, and three captures of the VLC traffic. What I've noticed consistently between the VLC captures, is that the ARP broadcasts seem to be "turned around":
http.server always does this:
but VLC always does this:
So there's a high chance that this is an issue with an ARP (Address Resolution Protocol)-related dependency in VLC. No idea which dependency though, so I need some developers to look into this