benba
(benba)
September 30, 2021, 11:52am
1
What is the problem you are having with rclone?
I expect that rclone listen only on an IPv4 Socket.
What is your rclone version (output from rclone version
)
rclone v1.56.0-DEV
os/version: unknown
os/kernel: 3.10.108 (x86_64)
os/type: linux
os/arch: amd64
go/version: go1.17
go/linking: static
go/tags: none
Which OS you are using and how many bits (eg Windows 7, 64 bit)
DSM 7, Linux, Kernel 3.10.108, 64-bit
Which cloud storage system are you using? (eg Google Drive)
Google Drive, but doesn't matter
The command you were trying to run (eg rclone copy /tmp remote:tmp
)
rclone copy GoogleDrive: /local --rc --rc-addr 0.0.0.0:5572
sudo netstat -nl | grep :5572
Password:
tcp6 0 0 :::5572 :::* LISTEN
Yes, it listens on both IPv4 and IPv6. This one is related, I think its the same library (httplib) that handles rc:
So it's possible to listen on a port (e.g. 8081) on all IPv6 addresses, but it's not possible to listen on a port on all IPv4 addresses.
I think that is correct.
It could be made configurable - if there are enough good reasons to warrant it, a feature request is made, and someone picks it up...
The network must be "tcp", "tcp4", "tcp6", "unix" or "unixpacket".
For TCP networks, if the host in the address parameter is empty or a literal unspecified IP address, Listen liste…
It's really a non issue as new kernels have IPV6 enabled. It listens on both and if you have only IPV4 traffic, it will communicate via that.
Are you seeing any issues?
sweh
(Stephen Harris)
September 30, 2021, 1:28pm
4
It could potentially be an issue 'cos IPv4 and IPv6 have different firewalls, routing rules, etc. Someone who is dual stacked may find it's exposing a port to the internet on IPv6 that shouldn't be.
Also it breaks the principle of least surprise; if the user says 0.0.0.0
then they specifically are asking for IP4. :::12345
would be both stacks.
Sure but if I really didn't want IPV6, I would disable on the server (which is what I do since Verizon FIOS doesn't support IPV6).
Do you think someone mixes IPV4 and IPV6 on the same server with separate rules/routing (not being sarcastic as I don't have any IPV6) and am curious if folks do that or not?
sweh
(Stephen Harris)
September 30, 2021, 1:49pm
6
My home network (also FIOS) is dual stacked with a HEnet tunnel to provide the IPv6 connectivity. This means my home servers are reachable directly from the internet over IPv6 but not on IPv4 ('cos of NAT requirements). iptables and ip6tables are managed independently on Linux. Building a home router · Ramblings of a Unix Geek
My colo VMs also are dual stacked ('cos the providers support that) so those different iptable rules are important.
I also have IPv4 tunnels between various servers.
(I know; I'm not normal :-))
When I ask for an IPv4 address I expect an IPv4 address, not an IPv6 address.
(This bug doesn't impact me 'cos I don't use rclone as a server, but I do consider it a bug).
I would never accuse you of being normal
Yep, it definitely is a bug.
ncw
(Nick Craig-Wood)
October 1, 2021, 2:28pm
8
This behaviour comes from the Go standard library which rclone uses...
I made an issue here
opened 02:28PM - 01 Oct 21 UTC
closed 04:54PM - 04 Oct 21 UTC
NeedsInvestigation
FrozenDueToAge
### What version of Go are you using (`go version`)?
<pre>
go version go1.17… .1 linux/amd64
</pre>
### Does this issue reproduce with the latest release?
Yes
### What operating system and processor architecture are you using (`go env`)?
<details><summary><code>go env</code> Output</summary><br><pre>
GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/ncw/.cache/go-build"
GOENV="/home/ncw/.config/go/env"
GOEXE=""
GOEXPERIMENT=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOINSECURE=""
GOMODCACHE="/home/ncw/go/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="linux"
GOPATH="/home/ncw/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/opt/go/go1.17"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/opt/go/go1.17/pkg/tool/linux_amd64"
GOVCS=""
GOVERSION="go1.17.1"
GCCGO="/usr/bin/gccgo"
AR="ar"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD="/dev/null"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build3014442064=/tmp/go-build -gno-record-gcc-switches"
</pre></details>
### What did you do?
Run this program
```go
package main
import (
"fmt"
"log"
"net"
"os"
"os/exec"
"strings"
)
func main() {
if len(os.Args) != 2 {
log.Fatalf("Syntax: %s bind_address", os.Args[0])
}
bindAddr := os.Args[1]
go func() {
_, err := net.Listen("tcp", bindAddr)
if err != nil {
log.Fatalf("net.Listen failed: %v", err)
}
}()
// Read netstat
cmd := exec.Command("netstat", "-tuanp")
out, err := cmd.Output()
if err != nil {
log.Fatal(err)
}
// Print netstat lines with our PID in
pid := fmt.Sprint(os.Getpid())
for _, line := range strings.Split(string(out), "\n") {
if strings.Contains(line, pid) {
fmt.Println(line)
}
}
}
```
I get this
```
$ ./listen-bug 127.0.0.1:1234
tcp 0 0 127.0.0.1:1234 0.0.0.0:* LISTEN 3179765/./listen-bu
$ ./listen-bug 0.0.0.0:1234
tcp6 0 0 :::1234 :::* LISTEN 3179773/./listen-bu
```
Note the second of these is listening on IPv6 even though we explictly gave it an IPv4 bind address.
### What did you expect to see?
I expected to see it not binding to IPv6 addresses, something like this
```
$ ./listen-bug 0.0.0.0:1234
tcp 0 0 0.0.0.0:1234 0.0.0.0:* LISTEN 3179765/./listen-bu
```
### What did you see instead?
I see it binding to IPv4 and IPv6 addresses
```
$ ./listen-bug 0.0.0.0:1234
tcp6 0 0 :::1234 :::* LISTEN 3179773/./listen-bu
```
This was originally discussed in the [rclone forum](https://forum.rclone.org/t/rc-listening-on-ipv4-v6-socket-instead-only-ipv4/26768)
1 Like
system
(system)
Closed
October 4, 2021, 2:28pm
9
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.