Opened 7 years ago
Last modified 7 years ago
#951 new Bug / Defect
learn-address script should have dev env variable defined for delete too
Reported by: | sthibault | Owned by: | |
---|---|---|---|
Priority: | major | Milestone: | |
Component: | Generic / unclassified | Version: | OpenVPN 2.4.0 (Community Ed) |
Severity: | Not set (select this one, unless your'e a OpenVPN developer) | Keywords: | |
Cc: |
Description
Hello,
The learn-address script has the dev environment variable defined when called for add or update, which is useful for adding routes. It however does not have it when called for delete, that's really a problem because one then doesn't know which route to remove, notably when several instances of openvpn run on the system system (e.g. to listen both on udp and tcp).
Samuel
Change History (3)
comment:1 Changed 7 years ago by
comment:2 Changed 7 years ago by
what ordex says... my learn-address script just removes the route with no interface specified ("ip route delete $prefix"). But then, a given prefix is only ever installed once, so there is no ambiguity.
comment:3 Changed 7 years ago by
Hello,
As I said, we have several instances of openvpn running on the system (e.g. to listen both on udp and tcp). If for whatever reason the client disconnects from one and reconnects to the other quickly (e.g. he has a configuration that tries both because he is sometimes on networks where udp doesn't work, but prefers to use udp when it works of course), the new route is added by learn-address through the latter tun dev before learn-address is called to remove the route through the former. At that point the script can't know which route it should remove.
Hello Samuel,
after quickly checking the code I believe that the OpenVPN provided environment is basically empty for the learn-address script invoked upon 'delete'
This happens because there is no more client object in OpenVPN at that point. Still, it should be possible to set some generic variables like dev (as it is not client dependent).
Speaking about your specific case: shouldn't you be able to delete a route even without specifying the interface? Or do you havemultiple routes to the same IP going over different interfaces at the same time? (this is the only case where I think you'd need to specify the interface too)