Skip to content

Glider can't forward UDP between proxies in Unix Socket format #291

@phantomcraft

Description

@phantomcraft

I tried to forward a SOCKS5 proxy to a container with UDP support and I perceived that Glider doesn't send the UDP packets through upstream servers if they are in Unix Socket format.

Maybe Glider doesn't "see" the unix socket with the name ending in "u" ("socketu")?

It's easy to reproduce with a network namespace and Glider using Unix Sockets:

ip netns add nsx
ip li add vethx type veth peer name peerx netns nsx
ip li set vethx up
ip addr add 10.0.0.1/24 dev vethx
ip netns exec nsx ip li set lo up
ip netns exec nsx ip li set peerx up
ip netns exec nsx ip addr add 10.0.0.2/24 dev peerx
ip netns exec nsx ip route add default via 10.0.0.1 dev peerx

ip rule add fwmark 1088 table 100
ip route add local default dev vethx table 100

iptables -t mangle -A PREROUTING -i vethx -p udp -j TPROXY -s 10.0.0.2 --on-ip 10.0.0.1 --on-port 10000 --tproxy-mark 1088

========================================================================

root@localhost:/home/user# glider -verbose -listen unix:///dev/shm/socket,socks5:// -forward direct://
2021/10/12 04:42:15 group.go:186: [group] only 1 forwarder found, disable health checking
2021/10/12 04:42:15 server.go:55: [unix] listening on /dev/shm/socket
2021/10/12 04:42:15 server.go:106: [unix] ListenPacket on /dev/shm/socketu

========================================================================

root@localhost:/home/user# glider -verbose -listen tproxy://10.0.0.1:10000 -forward unix:///dev/shm/socket,socks5://
2021/10/12 04:42:25 group.go:186: [group] only 1 forwarder found, disable health checking
2021/10/12 04:42:25 server.go:78: [tproxyu] listening UDP on 10.0.0.1:10000

========================================================================

root@localhost:/home/user# ip netns exec nsx dig @1.1.1.1 g.co
; <<>> DiG 9.16.15-Debian <<>> @1.1.1.1 g.co
; (1 server found)
;; global options: +cmd
;; connection timed out; no servers could be reached

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions