Hi,

On Mon, Jan 16, 2023 at 02:48:09PM -0500, selva.n...@gmail.com wrote:
> From: Selva Nair <selva.n...@gmail.com>
> 
> - Set RL_DID_LOCAL only if the corresponding route addition
>   succeeds. This is needed to preserve when the direct route to
>   the vpn server preexists.

While I think this is a good thing, the existing implementation does
not look good - changing add_route() to return RTA_* sounds logical,
and makes "return something meaningful from add_route3()" very easy,
but the "check windows route installation success?" code paths relies
on code like this...

            ret = add_route(r, tt, flags, &rl->rgi, es, ctx) && ret;

this still *works* with an "int" return, because RTA_ERROR is 0, and
the "not flagged as error" codes are 1 and 2 - but I'm not sure if that
was intentional or luck, and it makes reading the code harder.

So maybe postpone *this* part of the patch to 2.7 to give us a bit
more time to think about how the return code/logic should look like?


> - Ensure net_route_v4/v6_add/del() functions using iproute2 return
>   error when route addition fails. Return value follows the same logic
>   as corresponding functions using netlink though all failure reasons
>   get the same error code of -1.

This one is very straightforward, easily testable in itself, and could
go in right away.

I tested this as part of "testing this whole patch" on a linux/iproute2
build, triggering errors with invalid and double routes.

Without patch (2 duplicates, 1 invalid):

2023-01-21 16:50:05 /bin/ip route del 10.194.0.0/16
2023-01-21 16:50:05 /bin/ip route del 10.195.0.0/24
RTNETLINK answers: No such process
2023-01-21 16:50:05 ERROR: Linux route delete command failed: external program 
exited with error status: 2
2023-01-21 16:50:05 /bin/ip route del 10.194.0.0/16
RTNETLINK answers: No such process
2023-01-21 16:50:05 ERROR: Linux route delete command failed: external program 
exited with error status: 2
2023-01-21 16:50:05 /bin/ip route del 10.194.2.1/32
2023-01-21 16:50:05 delete_route_ipv6(fd00:abcd:194::/48)
2023-01-21 16:50:05 /bin/ip -6 route del fd00:abcd:194::/48 dev tun2
2023-01-21 16:50:05 delete_route_ipv6(fd00:abcd:194::/48)
2023-01-21 16:50:05 /bin/ip -6 route del fd00:abcd:194::/48 dev tun2
RTNETLINK answers: No such process
2023-01-21 16:50:05 ERROR: Linux route -6 del command failed: external program 
exited with error status: 2

With patch, same call == same set of "input routes"

^C2023-01-21 16:51:24 event_wait : Interrupted system call (fd=-1,code=4)
2023-01-21 16:51:24 /bin/ip route del 10.194.0.0/16
2023-01-21 16:51:24 /bin/ip route del 10.194.2.1/32
2023-01-21 16:51:24 delete_route_ipv6(fd00:abcd:194::/48)
2023-01-21 16:51:24 /bin/ip -6 route del fd00:abcd:194::/48 dev tun2
2023-01-21 16:51:24 Closing TUN/TAP interface

-> confirmed!

gert
-- 
"If was one thing all people took for granted, was conviction that if you 
 feed honest figures into a computer, honest figures come out. Never doubted 
 it myself till I met a computer with a sense of humor."
                             Robert A. Heinlein, The Moon is a Harsh Mistress

Gert Doering - Munich, Germany                             g...@greenie.muc.de

Attachment: signature.asc
Description: PGP signature

_______________________________________________
Openvpn-devel mailing list
Openvpn-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openvpn-devel

Reply via email to