Hi
On Mon, Jan 9, 2023 at 7:17 AM Gert Doering <[email protected]> wrote:
>
> I also notice that there is quite a bit of imbalance between IPv4 and
> IPv6 route addition on Windows - for IPv6, add_route_ipv6() will not
> print any messages (so, no diff here), while IPv4 has all that...
> maybe something to clean up in 2.7.
>
> We *also* might want to get rid of that obscure
>
> /* failed, try increasing the metric to work around Vista issue */
>
> code bit, which looks extremely scary ("increasing metric with +1 in
> a tight loop until we reach 2048") and Vista is out of support anyway...
>
In fact the issue worked around is not a Vista thing but Vista+ including
Win10 and results from wrong use of the API. The old API used here requires
the metric parameter to be the route metric + interface metric starting
Vista+. So metric = 0 or any value < interface-metric fails. If we want a
metric of 5 on an interface that has a metric of 20, we have to pass in 25.
Looks like someone (I won't say who) added that obnoxious loop trying
metric from 0 to 2048 to work around this. Probably the idea was to support
pre-vista and vista without needing a run-time check.
That said, in Vista+ one should use CreateIpForwardEntry2() which is much
easier. As we do for IPv6 and for both v4 and v6 in the service.
Let's rewrite this function in 2.7.
Selva
_______________________________________________
Openvpn-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openvpn-devel