Issue with configuring redirection of all traffic over VPN tunnel
Hi there! I am trying to use Network Manager to configure VPN with whole traffic redirection and find it is not possible to done in ordinary manner for me. Ordinary manner for me is to setup two routes (0.0.0.0/1 and 128.0.0.0/1) to create a new default route (with a higher priority) without need to deal with old default route or with routes metrics.
But NetworkManager prevents me from doing so:
/usr/bin/nmcli connection modify 'VPN Tunnel' +ipv4.routes 0.0.0.0/1 172.16.0.1
Error: failed to modify ipv4.routes: default route cannot be added (NetworkManager handles it by itself).
I know it is possible to configure default route for 'VPN Tunnel' with something like:
/usr/bin/nmcli connection modify 'VPN Tunnel' ipv4.route-metric 50 ipv4.gateway 172.16.0.1
, but it doesn't look quite right.
But in the end the problem for me is error about "default route" addition which is not correct. Route 0.0.0.0/1 is not a default route because its mask is 128.0.0.0 not 0.0.0.0. So the problem is next part of code from nm-meta-setting-desc.c:
if (!strcmp (canon_dest, "0.0.0.0") || !strcmp (canon_dest, "::")) {
g_set_error_literal (error, NM_UTILS_ERROR, NM_UTILS_ERROR_INVALID_ARGUMENT,
_("default route cannot be added (NetworkManager handles it by itself)"));
g_clear_pointer (&route, nm_ip_route_unref);
return NULL;
}
There is no mask checking at all. And that is probably wrong.