You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When I tried to set up transparent proxy in macos, go-shadowsocks could not get the real ip address and port with Packet Filter TCP redirection in MacOS 12.3.1(Intel).
The error returned is invalid argument, which is reported by the following code.
And I noticed that when run as transparent proxy, mitmproxy takes a different way, which is to parse real ip address and port from output of sudo -n /sbin/pfctl -s state, instead of using DIOCNATLOOK on the pf device /dev/pf.
The text was updated successfully, but these errors were encountered:
BigSully
changed the title
Cannot get the real ip address and port with Packet Filter TCP redirection in MacOS 12.3.1(Intel)
Can not get the real ip address and port with Packet Filter TCP redirection in MacOS 12.3.1(Intel)
May 24, 2022
In my case, the saddr.IP is a byte array [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 192, 168, 1, 4], which is actually an IPv4-mapped IPv6 address.The same goes for daddr.IP. While ioctl seems to want an ip address of 4 bytes.
After I change the above 2 lines to the following, the go-shadowsocks2 works just fine with pfctl redirection.
When I tried to set up transparent proxy in macos, go-shadowsocks could not get the real ip address and port with Packet Filter TCP redirection in MacOS 12.3.1(Intel).
The error returned is
invalid argument
, which is reported by the following code.https://github.com/shadowsocks/go-shadowsocks2/blob/v0.1.5/pfutil/pf_darwin.go#L44
And I noticed that when run as transparent proxy, mitmproxy takes a different way, which is to parse real ip address and port from output of
sudo -n /sbin/pfctl -s state
, instead of using DIOCNATLOOK on the pf device/dev/pf
.https://github.com/mitmproxy/mitmproxy/blob/v8.1.0/mitmproxy/platform/osx.py#L6
The text was updated successfully, but these errors were encountered: