Problem with --route-method exe and --redirect-gateway
Just because someone reported about problems with route additions via IPAPI when using PPP or PPPoE adapters the other day, one of my users reported the same problem to me today. I'll try to reproduce it on my computer later to night, so we can get to the bottom with that problem.
While thoubleshouting that problem, I switched to --route-method exe, but found another problem!
I would call it bug in Windows route.exe rather than in OpenVPN. The problem is that when using --redirect-gateway def1, and disconnecting, OpenVPN executes the command:
ROUTE DELETE 0.0.0.0 MASK 128.0.0.0
The problem is that route.exe deletes both the 0.0.0.0/1, AND the real 0.0.0.0/0 route, regardless if the MASK option is used or not.
I double MS will fix this, so I think we need to work around this.
I can see two solutions:
1) Re-add the old default gw, like we do when not using the def1 parameter.
2) Also specify the gateway parameter on the route delete cmd. This causes route.exe only to delete the correct route.
--
_____________________________________________________________
Mathias Sundman (^) ASCII Ribbon Campaign OpenVPN GUI for Windows X NO HTML/RTF in e-mail http://www.nilings.se/openvpn / \ NO Word docs in e-mail
Quoted 10 lines · Mathias Sundman
Just because someone reported about problems with route additions via IPAPI when using PPP or PPPoE adapters the other day, one of my users reported the same problem to me today. I'll try to reproduce it on my computer later to night, so we can get to the bottom with that problem.
While thoubleshouting that problem, I switched to --route-method exe, but found another problem!
I would call it bug in Windows route.exe rather than in OpenVPN. The problem is that when using --redirect-gateway def1, and disconnecting, OpenVPN executes the command:
ROUTE DELETE 0.0.0.0 MASK 128.0.0.0
The problem is that route.exe deletes both the 0.0.0.0/1, AND the real 0.0.0.0/0 route, regardless if the MASK option is used or not.
Quoted 7 lines
I double MS will fix this, so I think we need to work around this.
I can see two solutions:
1) Re-add the old default gw, like we do when not using the def1 parameter.
2) Also specify the gateway parameter on the route delete cmd. This causes route.exe only to delete the correct route.
Here's a small patch that does the trick for me:
$ diff -u route.c.orig route.c --- route.c.orig Sun Jan 9 18:46:28 2005 +++ route.c Fri Jan 21 21:12:22 2005 @@ -820,8 +820,10 @@
#elif defined (WIN32)
- buf_printf (&buf, ROUTE_PATH " DELETE %s",
- network);
+ buf_printf (&buf, ROUTE_PATH " DELETE %s MASK %s %s",
+ network,
+ netmask,
+ gateway);
msg (D_ROUTE, "%s", BSTR (&buf));
/Mathias
Quoted 35 lines · Mathias Sundman
Quoted 17 lines · Mathias Sundman
Just because someone reported about problems with route additions via IPAPI when using PPP or PPPoE adapters the other day, one of my users reported the same problem to me today. I'll try to reproduce it on my computer later to night, so we can get to the bottom with that problem.
While thoubleshouting that problem, I switched to --route-method exe, but found another problem!
I would call it bug in Windows route.exe rather than in OpenVPN. The problem is that when using --redirect-gateway def1, and disconnecting, OpenVPN executes the command:
ROUTE DELETE 0.0.0.0 MASK 128.0.0.0
The problem is that route.exe deletes both the 0.0.0.0/1, AND the real 0.0.0.0/0 route, regardless if the MASK option is used or not.
Quoted 8 lines
I double MS will fix this, so I think we need to work around this.
I can see two solutions:
1) Re-add the old default gw, like we do when not using the def1 parameter.
2) Also specify the gateway parameter on the route delete cmd. This causes route.exe only to delete the correct route.
Here's a small patch that does the trick for me:
$ diff -u route.c.orig route.croute.c Fri Jan 21 21:12:22 2005 renamed from route.c.orig Sun Jan 9 18:46:28 2005 +0
-0@@ -820,8 +820,10 @@
route.c Fri Jan 21 21:12:22 2005 line 828
Quoted 10 lines
route.c Fri Jan 21 21:12:22 2005 renamed from route.c.orig Sun Jan 9 18:46:28 2005 +4
-2#elif defined (WIN32) - buf_printf (&buf, ROUTE_PATH " DELETE %s", - network); + buf_printf (&buf, ROUTE_PATH " DELETE %s MASK %s %s", + network, + netmask, + gateway); msg (D_ROUTE, "%s", BSTR (&buf));
This is good, though we need to be sure that this will consistently work for different kinds of routes.
The dwForwardType fix for the IP helper API + RRAS problem shows that there's a certain amount of hidden complexity in the Windows routing engine that can potentially break things if it's not fully understood.
James
Quoted 46 lines · James Yonan
Quoted 44 lines · Mathias Sundman
Quoted 17 lines · Mathias Sundman
Just because someone reported about problems with route additions via IPAPI when using PPP or PPPoE adapters the other day, one of my users reported the same problem to me today. I'll try to reproduce it on my computer later to night, so we can get to the bottom with that problem.
While thoubleshouting that problem, I switched to --route-method exe, but found another problem!
I would call it bug in Windows route.exe rather than in OpenVPN. The problem is that when using --redirect-gateway def1, and disconnecting, OpenVPN executes the command:
ROUTE DELETE 0.0.0.0 MASK 128.0.0.0
The problem is that route.exe deletes both the 0.0.0.0/1, AND the real 0.0.0.0/0 route, regardless if the MASK option is used or not.
Quoted 8 lines
I double MS will fix this, so I think we need to work around this.
I can see two solutions:
1) Re-add the old default gw, like we do when not using the def1 parameter.
2) Also specify the gateway parameter on the route delete cmd. This causes route.exe only to delete the correct route.
Here's a small patch that does the trick for me:
$ diff -u route.c.orig route.croute.c Fri Jan 21 21:12:22 2005 renamed from route.c.orig Sun Jan 9 18:46:28 2005 +4
-2@@ -820,8 +820,10 @@ #elif defined (WIN32) - buf_printf (&buf, ROUTE_PATH " DELETE %s", - network); + buf_printf (&buf, ROUTE_PATH " DELETE %s MASK %s %s", + network, + netmask, + gateway);
Quoted 8 lines
route.c Fri Jan 21 21:12:22 2005 line 828
Quoted 1 line
route.c Fri Jan 21 21:12:22 2005 renamed from route.c.orig Sun Jan 9 18:46:28 2005 +0
-0msg (D_ROUTE, "%s", BSTR (&buf));This is good, though we need to be sure that this will consistently work for different kinds of routes.
The dwForwardType fix for the IP helper API + RRAS problem shows that there's a certain amount of hidden complexity in the Windows routing engine that can potentially break things if it's not fully understood.
Yes, you're right.
I've done the following tests now on WinXP SP2 without any problems:
HOST routes (255.255.255.255)
NETWORK routes (about 10 diffrent subnet masks)
--redirect-gateway
--redirect-gateway def1
routes to the old default gateway
I've done all tests on both ethernet and PPP adapters.
/Mathias