diff --git a/dot_bin/executable_skip-vpn.sh b/dot_bin/executable_skip-vpn.sh index 8c29426..1762632 100644 --- a/dot_bin/executable_skip-vpn.sh +++ b/dot_bin/executable_skip-vpn.sh @@ -14,11 +14,15 @@ TABLE="${TABLE:-100}" CGROUP="${CGROUP:-/user.slice/user-1000.slice/user@1000.service/app.slice/no-proxy.service}" if [[ -z "$(ip rule list fwmark "$FWMARK" table "$TABLE")" ]]; then - ip rule add fwmark "$FWMARK" table "$TABLE" + ip rule add fwmark "$FWMARK" table "$TABLE" fi default_route_table="$(ip route show default)" default_link="$(ip -j route show default | grep -E -o '"dev":\s*"([^"]*)"' | awk -F\" '{print $4}')" ip route replace $default_route_table table "$TABLE" +# I don't know why this route exists by default. +if ! ip route delete local default dev lo scope host table "$TABLE"; then + : +fi iptables -t mangle -I OUTPUT -m cgroup --path "$CGROUP" -j MARK --set-mark "$FWMARK" iptables -t nat -A POSTROUTING -o "$default_link" -j MASQUERADE